@charset "UTF-8";
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;700&display=swap');

/* --- 1. Variables --- */
:root {
    --bg-color: #f4f5f7;
    --text-color: #333;
    --text-muted: #666;
    --text-light: #999;
    
    /* Palette */
    --c-white: #ffffff;
    --c-gray-100: #f8f9fa;
    --c-gray-200: #f0f0f0;
    --c-gray-300: #e0e0e0;
    
    /* Pastel Colors */
    --c-red-light: #fff0f0;
    --c-red-strong: #ffecec;
    --c-purple: #f3e5f5;
    --c-blue: #e3f2fd;
    --c-green: #e8f5e9;
    --c-yellow: #fffde7;
    --c-orange: #fff3e0;
}

/* --- 2. Base Styles --- */
body {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 20px 10px;
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
}

.container {
    width: 100%;
    max-width: 480px;
    text-align: center;
}

/* --- 3. Profile & Header --- */
.profile-container {
    margin-bottom: 20px;
}

.profile-img {
    width: 140px;
    height: 140px;
    border: 3px solid var(--c-white);
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.header {
    margin-bottom: 25px;
}

.header h1 {
    margin: 8px 0;
    font-size: 1.4rem;
    color: #222;
}

.header p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
    word-break: keep-all;
}

/* --- 4. 16 Commandments Section --- */
.commandments-section {
    box-sizing: border-box;
    width: 100%;
    margin-bottom: 20px;
    padding: 25px 20px;
    background-color: var(--c-white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    text-align: left;
}

.commandments-title {
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 800;
    color: #1a1a1a;
    text-align: center;
    letter-spacing: -0.5px;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 90px;
    grid-auto-flow: dense;
    gap: 8px;
    width: 100%;
}

.bento-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px;
    background: var(--c-white);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bento-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.section-num {
    font-size: 0.65rem;
    font-weight: 700;
    opacity: 0.6;
}

.card-icon {
    font-size: 2rem;
}

.card-text {
    font-size: 0.8rem;
    font-weight: 700;
    color: #333;
    line-height: 1.25;
    letter-spacing: -0.5px;
    word-break: keep-all;
}

/* 2x2, 4x1이 아닌 모든 카드 폰트 크기 축소 (1x1, 2x1 포함) */
.bento-card:not(.row-2, .col-4) .card-text {
    font-size: 0.7rem;
    line-height: 1.2;
}

.bento-card:not(.row-2, .col-4) .card-icon {
    font-size: 1.8rem;
}

/* Bento Variants */
.col-2 { grid-column: span 2; }
.row-2 { grid-row: span 2; }
.col-4 { grid-column: span 4; }

.bg-purple { background-color: var(--c-purple); color: #4a148c; }
.bg-red-strong { background-color: var(--c-red-strong); border: 1px solid #ffcdd2; }
.bg-blue { background-color: var(--c-blue); color: #0d47a1; }
.bg-orange { background-color: var(--c-orange); color: #e65100; }
.bg-green { background-color: var(--c-green); color: #1b5e20; }
.bg-yellow { background-color: var(--c-yellow); color: #f57f17; }

.col-2.row-2 .card-text, .col-4 .card-text { font-size: 1rem; }
.col-2.row-2 .card-icon { font-size: 2.5rem; margin-bottom: 5px; }

/* Badges */
.badge {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--c-white);
    border-bottom-left-radius: 10px;
    letter-spacing: -0.5px;
}

.badge-warn { background-color: #ff5252; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.badge-joker { background-color: #222; color: #ffd700; border: 1px solid rgba(255, 255, 255, 0.2); }

.card-joker {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA000 100%);
    color: var(--c-white);
    border: none;
}
.card-joker .card-text { color: var(--c-white); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }
.card-joker .section-num { color: rgba(255, 255, 255, 0.8); }

/* --- 5. Download Button --- */
.download-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 15px;
}

.download-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--c-gray-200);
    color: #555;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.download-btn:hover {
    background: var(--c-gray-300);
    color: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* --- 6. Links --- */
.links {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 40px;
}

.link-item {
    display: block;
    padding: 16px;
    background-color: var(--c-white);
    color: var(--text-color);
    text-decoration: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.link-item:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.link-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.link-title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: left;
    word-break: keep-all;
    flex-shrink: 1;
}

.contributor-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.by-text {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-light);
}

.contributor-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background-color: var(--c-gray-100);
    border: 1px solid var(--c-gray-300);
    border-radius: 20px;
    transition: background-color 0.2s ease;
}

.link-item:hover .contributor-chip {
    background-color: var(--c-gray-200);
}

.avatar-vxs {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    object-fit: cover;
}

.author-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: #555;
}

.badge-new {
    display: inline-block;
    padding: 2px 5px;
    margin-left: 5px;
    background-color: #ff4757;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 4px;
    vertical-align: middle;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(255, 71, 87, 0.2);
}

/* --- 7. ETF Section --- */
.etf-section {
    box-sizing: border-box;
    width: 100%;
    margin-bottom: 20px;
    padding: 25px 20px;
    background-color: var(--c-white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    text-align: left;
}

.etf-section-title {
    margin: 0 0 20px 0;
    font-size: 1.2rem;
    font-weight: 800;
    color: #1a1a1a;
    text-align: center;
    letter-spacing: -0.5px;
}

.etf-category {
    margin-bottom: 18px;
}

.etf-category:last-child {
    margin-bottom: 0;
}

.etf-category-label {
    display: inline-block;
    margin-bottom: 10px;
    padding: 3px 10px;
    background-color: #1a1a1a;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.etf-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.etf-chip {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.07);
    min-width: 0;
    cursor: default;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.etf-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* 브랜드별 색상 */
.etf-brand-TIME  { background-color: var(--c-blue);   color: #0d47a1; }
.etf-brand-KoAct { background-color: var(--c-green);  color: #1b5e20; }
.etf-brand-KODEX { background-color: var(--c-orange); color: #e65100; }
.etf-brand-RISE  { background-color: var(--c-purple); color: #4a148c; }
.etf-brand-TIGER { background-color: var(--c-yellow); color: #f57f17; }
.etf-brand-none  { background-color: var(--c-gray-100); color: #333; }

.etf-nickname {
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.etf-fullname {
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0.7;
    line-height: 1.2;
    word-break: keep-all;
}

.etf-pending-badge {
    display: inline-block;
    margin-left: 3px;
    padding: 1px 4px;
    background-color: rgba(0, 0, 0, 0.12);
    font-size: 0.6rem;
    font-weight: 800;
    border-radius: 4px;
    vertical-align: middle;
}

/* 링크 칩 (a 태그로 렌더링될 때) */
a.etf-chip {
    text-decoration: none;
    color: inherit;
}

/* 섹션 안내 문구 */
.section-hint {
    margin: 12px 0 0 0;
    font-size: 0.72rem;
    color: var(--text-light);
    text-align: center;
    letter-spacing: -0.2px;
}

/* --- 8. Footer --- */
.footer {
    margin-top: 40px;
    font-size: 0.75rem;
    color: #bbb;
    text-align: center;
}

/* --- 8. Modal --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box; /* [중요] 패딩을 너비에 포함시켜 틀어짐 방지 */
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 450px;
    max-height: 80vh;
    background-color: var(--c-white);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    z-index: 1001;
    animation: slideUp 0.3s ease;
    margin: 0 auto; /* [권장] Flexbox 외에도 안전하게 중앙 정렬 보장 */
}

/* 모달 배경색 (카드 색상 유지) */
.modal-content.bg-purple { background-color: var(--c-purple); }
.modal-content.bg-red-strong { background-color: var(--c-red-strong); }
.modal-content.bg-blue { background-color: var(--c-blue); }
.modal-content.bg-orange { background-color: var(--c-orange); }
.modal-content.bg-green { background-color: var(--c-green); }
.modal-content.bg-yellow { background-color: var(--c-yellow); }

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background-color: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    background-color: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 30px 25px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-icon {
    font-size: 3rem;
    flex-shrink: 0;
}

.modal-number {
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0.6;
    margin-bottom: 5px;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

/* 모달 타이틀 내의 괄호 텍스트 전용 스타일 */
.modal-title-sub {
    font-size: 0.75em;  /* 원래 크기의 75%로 축소 */
    font-weight: 400;   /* 볼드체 제거 (Normal) */
    opacity: 0.8;       /* 색상을 살짝 연하게 */
    margin-left: 4px;   /* 앞 글자와 살짝 띄우기 */
    vertical-align: middle; /* 높이 중앙 정렬 */
}

.modal-body {
    padding: 25px;
}

.modal-section {
    margin-bottom: 25px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section h4 {
    font-size: 0.85rem;
    font-weight: 800;
    color: #555;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-section p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #333;
    margin: 0;
    word-break: keep-all;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
