/*
-----------------------------------------------------------
Copyright (c) 2026 Ahngunism. All rights reserved.
-----------------------------------------------------------
File           : style.css
Last updated   : 20260324 134513
Version        : ver 1.08
-----------------------------------------------------------
  201_AGJC - Modern Dark Glassmorphism Design
  JS logic untouched. CSS design fully renewed.
*/

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&family=Noto+Sans+KR:wght@300;400;500;700&family=Inter:wght@400;600;700&display=swap');

/* ============================================================
   ROOT TOKENS
   ============================================================ */
:root {
    /* Brand */
    --accent:          #0ea5e9;
    --accent-glow:     rgba(14, 165, 233, 0.45);
    --accent-hover:    #0284c7;
    --accent-2:        #14b8a6;

    /* Surfaces */
    --bg-base:         #0d0e1a;
    --bg-card:         rgba(255, 255, 255, 0.05);
    --bg-card-hover:   rgba(255, 255, 255, 0.08);
    --bg-input:        rgba(255, 255, 255, 0.07);
    --glass-border:    rgba(255, 255, 255, 0.12);

    /* Text */
    --text-primary:    #f0f0ff;
    --text-secondary:  rgba(240, 240, 255, 0.55);
    --text-muted:      rgba(240, 240, 255, 0.35);

    /* Quiz states */
    --correct-bg:      rgba(52, 211, 153, 0.18);
    --correct-border:  #34d399;
    --incorrect-bg:    rgba(248, 113, 113, 0.18);
    --incorrect-border:#f87171;
    --not-asked-bg:    rgba(255, 255, 255, 0.06);
    --not-asked-border:rgba(255, 255, 255, 0.15);

    /* Effects */
    --blur:            16px;
    --radius-sm:       8px;
    --radius-md:       14px;
    --radius-lg:       20px;
    --shadow:          0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow:     0 0 30px var(--accent-glow);

    /* Legacy compat */
    --primary-color:   var(--accent);
    --card-background: var(--bg-card);
    --border-color:    var(--glass-border);
    --correct-color:   var(--correct-bg);
    --incorrect-color: var(--incorrect-bg);
    --not-asked-color: var(--not-asked-bg);
}

/* ============================================================
   GLOBAL RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Noto Sans KR', sans-serif;
    background-color: var(--bg-base);
    background-image:
        radial-gradient(ellipse 80% 60% at 20% -10%, rgba(14, 165, 233, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 110%, rgba(20, 184, 166, 0.12) 0%, transparent 60%);
    background-attachment: fixed;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 28px 16px;
}

h1 {
    font-size: clamp(1.6em, 4vw, 2.2em);
    font-weight: 700;
    background: linear-gradient(135deg, #fff 30%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 24px;
    letter-spacing: -0.5px;
}

h3 {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95em;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
    margin-bottom: 18px;
}

/* ============================================================
   GLASS CARD — 공통
   ============================================================ */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.container,
.quiz-container,
.result-container {
    background: var(--bg-card);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 32px 36px;
    width: 100%;
    margin-bottom: 24px;
    transition: box-shadow 0.3s;
}

.container {
    max-width: 580px;
    text-align: center;
}

.quiz-container {
    max-width: 500px;
    text-align: center;
    transition: background-color 0.25s, box-shadow 0.3s;
}

.result-container {
    max-width: 820px;
    text-align: center;
}

/* ============================================================
   설정 FORM — index.html
   ============================================================ */
.settings-form fieldset {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 20px 20px 16px;
    margin-bottom: 20px;
    text-align: left;
    background: rgba(255,255,255,0.025);
}

.settings-form legend {
    font-weight: 600;
    font-size: 0.88em;
    padding: 0 10px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 14px;
}

.option-group input[type='radio'] { display: none; }

.option-group label {
    flex: 1;
    min-width: 80px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    font-weight: 500;
    font-size: 0.95em;
    text-align: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.option-group label:hover {
    background: rgba(14, 165, 233, 0.15);
    border-color: var(--accent);
    color: var(--text-primary);
}

.option-group input[type='radio']:checked + label {
    background: linear-gradient(135deg, var(--accent), #38bdf8);
    border-color: transparent;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 18px var(--accent-glow);
}

/* ============================================================
   버튼 — Start / Retry / Nav
   ============================================================ */
.start-button,
.retry-button {
    display: inline-block;
    width: 100%;
    padding: 16px;
    font-size: 1.1em;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--accent) 0%, #38bdf8 100%);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
    box-shadow: 0 6px 24px var(--accent-glow);
    letter-spacing: 0.3px;
    margin-top: 8px;
}

.start-button:hover,
.retry-button:hover {
    opacity: 0.92;
    transform: translateY(-2px);
    box-shadow: 0 10px 32px var(--accent-glow);
}

.start-button:active,
.retry-button:active {
    transform: scale(0.97) translateY(0);
}

.retry-button {
    width: auto;
    padding: 14px 36px;
    margin-top: 36px;
}

.button-container {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 28px;
}

.quiz-nav-button {
    flex-grow: 1;
    padding: 12px 16px;
    font-size: 0.95em;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    background: linear-gradient(135deg, var(--accent), #38bdf8);
    border: none;
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.quiz-nav-button:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.quiz-nav-button.secondary {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    box-shadow: none;
}

.quiz-nav-button.secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

/* ============================================================
   문자표 — index.html
   ============================================================ */
.charts-container {
    margin-top: 8px;
    background: var(--bg-card);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px 32px;
    width: 100%;
    max-width: 820px;
}

.charts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.charts-header h2 {
    font-size: 1em;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.toggle-arrow {
    font-size: 1em;
    color: var(--accent);
    transition: transform 0.4s ease;
}

.charts-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
}

.charts-container.expanded .charts-content {
    max-height: 2000px;
    margin-top: 20px;
}

.charts-container.expanded .toggle-arrow {
    transform: rotate(180deg);
}

/* 탭 */
.chart-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.tab-button {
    flex: 1;
    padding: 9px 18px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 6px;
    transition: all 0.2s;
}

.tab-button.active {
    background: linear-gradient(135deg, var(--accent), #38bdf8);
    color: #fff;
    box-shadow: 0 2px 10px var(--accent-glow);
}

.chart-box { display: none; }
.chart-box.active { display: block; }

.chart-container { margin-top: 16px; }

.gojuon-chart {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    font-family: 'Noto Sans JP', sans-serif;
}

.yoon-chart {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    font-family: 'Noto Sans JP', sans-serif;
}

/* 문자 셀 */
.char-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 52px;
    border-radius: var(--radius-sm);
    font-size: 1.45em;
    font-weight: 700;
    background: var(--not-asked-bg);
    border: 1px solid var(--not-asked-border);
    transition: background 0.3s, border-color 0.3s, opacity 0.3s, transform 0.15s;
    color: var(--text-primary);
}

.char-cell.empty {
    background: transparent;
    border-color: transparent;
}

.char-cell:not(.empty) { cursor: pointer; }

.char-cell:not(.empty):hover {
    transform: scale(1.06);
    background: rgba(14, 165, 233, 0.15);
    border-color: var(--accent);
}

.char-cell.show-kr {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 1.2em;
}

.char-cell.fade-out { opacity: 0; }

/* 결과 셀 */
.char-cell.correct {
    background: var(--correct-bg);
    border-color: var(--correct-border);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.25);
}

.char-cell.incorrect {
    background: var(--incorrect-bg);
    border-color: var(--incorrect-border);
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.25);
}

.char-cell.not-asked {
    background: var(--not-asked-bg);
    border-color: var(--not-asked-border);
}

/* ============================================================
   QUIZ PAGE
   ============================================================ */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 18px;
}

.progress-bar-inner {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #38bdf8);
    border-radius: 99px;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px var(--accent-glow);
}

.progress-text {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 28px;
    letter-spacing: 0.5px;
}

.question-display {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: clamp(5em, 15vw, 8em);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.25s ease-in-out;
    text-shadow: 0 4px 24px var(--accent-glow);
}

.question-display.fade-out { opacity: 0; }

.question-display.show-answer {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: clamp(3.5em, 10vw, 5.5em);
    color: var(--text-secondary);
}

.answer-input {
    width: 82%;
    padding: 14px 18px;
    font-size: 1.4em;
    text-align: center;
    background: var(--bg-input);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Inter', 'Noto Sans KR', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.answer-input::placeholder { color: var(--text-muted); }

.answer-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* 피드백 애니메이션 */
.feedback-correct { animation: flash-correct 0.4s; }
.feedback-incorrect { animation: flash-incorrect 0.4s; }

@keyframes flash-correct {
    0%, 100% { background: var(--bg-card); }
    50% { background: rgba(52, 211, 153, 0.15); }
}
@keyframes flash-incorrect {
    0%, 100% { background: var(--bg-card); }
    50% { background: rgba(248, 113, 113, 0.15); }
}

/* ============================================================
   RESULT PAGE
   ============================================================ */
.score {
    font-size: 1.9em;
    font-weight: 700;
    margin-bottom: 28px;
    background: linear-gradient(135deg, #fff 30%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: var(--text-secondary);
    font-weight: 500;
}

.legend-color {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.15);
}

/* ============================================================
   광고 영역
   ============================================================ */
.ad-grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    justify-content: center;
    justify-items: center;
    max-width: 680px;
    margin: 20px auto;
}

.ad-item {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 320px;
    height: 50px;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(255,255,255,0.03);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    margin-top: auto;
    padding: 18px 20px;
    border-top: 1px solid var(--glass-border);
    width: 100%;
}

.footer-container {
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 2px;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88em;
    transition: color 0.2s;
    padding-bottom: 1px;
    border-bottom: 1px solid transparent;
}

.footer-link:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.separator { color: var(--text-muted); font-weight: 300; }

.footer-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8em;
    color: var(--text-muted);
}

.copyright { margin: 0; font-weight: 400; }

.version-tag {
    display: inline-block;
    font-size: 0.78em;
    background: rgba(14, 165, 233, 0.15);
    padding: 3px 10px;
    border-radius: 99px;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.5px;
    border: 1px solid rgba(14, 165, 233, 0.3);
    margin: 0 auto;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 680px) {
    .ad-grid-container {
        grid-template-columns: 1fr;
    }
    .container,
    .quiz-container,
    .result-container,
    .charts-container {
        padding: 22px 18px;
    }
    .answer-input {
        width: 94%;
    }
}
