* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    background: #82a5cd;
}

/* 화면 전환 */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* 시작 화면 */
#home-screen {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #82a5cd;
    z-index: 0;
}



/* 섬 배치 */
.island-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.island {
    position: absolute;
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;
    z-index: 5;
}

.island:hover,
.island:active {
    transform: scale(1.1);
    filter: brightness(1.1);
}

.island img {
    width: 62vw;
    height: 62vw;
    max-width: 450px;
    max-height: 450px;
    object-fit: contain;
    display: block;
}

.island-label {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: bold;
    color: #333;
    background: rgba(255,255,255,0.9);
    padding: 5px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    white-space: nowrap;
}

.island.top-left {
    top: 20vh;
    left: -5vw;
}

.island.top-left img {
    width: 57vw;
    height: 57vw;
    max-width: 430px;
    max-height: 430px;
}

.island.top-right {
    top: 26vh;
    right: 8vw;
}

.island.top-right img {
    width: 50vw;
    height: 50vw;
    max-width: 360px;
    max-height: 360px;
}

.island.bottom-center {
    bottom: 20vh;
    left: 50%;
    transform: translateX(-50%);
}

.island.bottom-center img {
    width: 62vw;
    height: 62vw;
    max-width: 450px;
    max-height: 450px;
}

.island.bottom-center:hover,
.island.bottom-center:active {
    transform: translateX(-50%) scale(1.1);
}

/* 카테고리 화면 */
.app-header {
    position: sticky;
    top: 0;
    background: #82a5cd;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    z-index: 100;
}

.app-header h2 {
    font-size: 20px;
    color: #fff;
}

.back-btn, .add-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: #fff;
    cursor: pointer;
    padding: 5px 10px;
}

.settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    font-size: 24px;
    color: #fff;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 50%;
    backdrop-filter: blur(10px);
    z-index: 10;
    transition: all 0.3s;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

.settings-content {
    padding: 20px 0;
}

.settings-item {
    padding: 20px 0;
    border-bottom: 1px solid #eee;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item h4 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.filter-bar {
    padding: 15px 20px;
    background: #82a5cd;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

#sort-select {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* 아이템 그리드 */
.items-grid {
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.item-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.item-card:hover,
.item-card:active {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.item-thumbnail {
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, #82a5cd 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 48px;
}

.item-info {
    padding: 12px;
}

.item-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-rating {
    font-size: 16px;
    color: #FFD700;
    margin-bottom: 5px;
}

.item-date {
    font-size: 12px;
    color: #999;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 20px;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

/* 폼 */
.form-group {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="date"],
.form-group input[type="file"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

/* 이미지 미리보기 */
.image-preview {
    margin-top: 10px;
    min-height: 100px;
    max-height: 200px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

/* 별점 */
.star-rating {
    display: flex;
    gap: 8px;
    font-size: 32px;
}

.star {
    cursor: pointer;
    color: #ddd;
    transition: color 0.2s;
}

.star.active {
    color: #FFD700;
}

/* 버튼 */
.modal-actions {
    display: flex;
    gap: 10px;
    padding: 20px;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-primary {
    background: #82a5cd;
    color: #fff;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-primary:hover,
.btn-secondary:hover {
    opacity: 0.8;
}

/* 상세 모달 */
#detail-content {
    padding: 20px;
}

.detail-image {
    width: 100%;
    height: 250px;
    background: linear-gradient(135deg, #82a5cd 0%, #764ba2 100%);
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    font-size: 14px;
    color: #999;
    margin-bottom: 8px;
}

.detail-section p {
    font-size: 16px;
    color: #333;
    line-height: 1.6;
}

.detail-link {
    color: #82a5cd;
    text-decoration: none;
    word-break: break-all;
}

.detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-delete {
    background: #FF3B30;
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-refresh {
    background: #666;
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
}

.btn-link {
    background: #82a5cd;
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 30px 20px;
    margin: 20px auto;
    width: 140px;
    height: auto;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.empty-state-text {
    font-size: 14px;
    color: #333;
    font-weight: 500;
    line-height: 1.4;
}
/* 모바일 최적화 */
@media (hover: none) and (pointer: coarse) {
    /* 터치 디바이스에서 호버 효과 비활성화 */
    .island:hover {
        transform: none;
        filter: none;
    }
    
    .island:active {
        transform: scale(1.1);
        filter: brightness(1.1);
    }
    
    .item-card:hover {
        transform: none;
    }
    
    .item-card:active {
        transform: translateY(-2px);
    }
}

/* iOS 사파리 최적화 */
input,
textarea,
select,
button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 8px;
}

/* 터치 반응 개선 */
* {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-touch-callout: none;
}

/* 스크롤 개선 */
body,
.modal-content {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

/* 모바일 화면 높이 최적화 (주소창 고려) */
#home-screen {
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

html {
    height: -webkit-fill-available;
}