/* -----------------------------------------------------------
   Copyright (c) 2026 Ahngunism1105. All rights reserved.
   -----------------------------------------------------------
   File           : style.css
   Last updated:  : 20260309 003500
   Version        : ver 1.01
   ----------------------------------------------------------- */

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

/* =============================================
   CSS Variables – Dark Neon Glow Theme
   ============================================= */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --neon-blue: #00d4ff;
    --neon-purple: #a855f7;
    --neon-pink: #ec4899;
    --neon-green: #22c55e;
    --neon-red: #ef4444;
    --text-primary: #e8e8f0;
    --text-secondary: #8888aa;
    --text-muted: #555570;
    --border-glow: rgba(0, 212, 255, 0.15);
    --border-subtle: rgba(255, 255, 255, 0.08);

    --correct-color: rgba(34, 197, 94, 0.15);
    --correct-border: #22c55e;
    --incorrect-color: rgba(239, 68, 68, 0.15);
    --incorrect-border: #ef4444;
    --not-asked-color: rgba(255, 255, 255, 0.03);
    --not-asked-border: rgba(255, 255, 255, 0.08);

    --card-radius: 20px;
    --card-shadow: 0 0 40px rgba(0, 212, 255, 0.04), 0 20px 60px rgba(0, 0, 0, 0.3);
    --card-backdrop: blur(20px);
}

/* =============================================
   Base & Reset
   ============================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', 'Noto Sans KR', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    overflow-x: hidden;
}

/* Animated ambient background */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(0, 212, 255, 0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(168, 85, 247, 0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(236, 72, 153, 0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
    animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

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

/* =============================================
   Typography
   ============================================= */
h1 {
    font-size: 2em;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple), var(--neon-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textGlow 3s ease-in-out infinite alternate;
}

@keyframes textGlow {
    0% { filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.3)); }
    100% { filter: drop-shadow(0 0 16px rgba(168, 85, 247, 0.4)); }
}

h3 {
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 8px;
    margin-bottom: 15px;
    color: var(--neon-blue);
    font-size: 1em;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* =============================================
   Glass Card – Common Components
   ============================================= */
.container, .quiz-container, .result-container {
    position: relative;
    z-index: 1;
    background: var(--bg-card);
    backdrop-filter: var(--card-backdrop);
    -webkit-backdrop-filter: var(--card-backdrop);
    border: 1px solid var(--border-glow);
    border-radius: var(--card-radius);
    padding: 36px 40px;
    width: 100%;
    margin-bottom: 24px;
    box-shadow: var(--card-shadow);
    animation: cardFadeIn 0.7s ease-out;
}

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

.quiz-container {
    max-width: 520px;
    text-align: center;
    transition: background-color 0.3s;
}

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

/* =============================================
   Charts & Cells
   ============================================= */
.chart-container {
    margin-top: 20px;
}

.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: 10px;
    font-size: 1.5em;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    transition: all 0.25s ease;
}

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

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

.char-cell:not(.empty):hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.35);
    box-shadow: 0 0 18px rgba(0, 212, 255, 0.1);
    transform: scale(1.06);
}

.char-cell.show-kr {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 1.3em;
    color: var(--neon-purple);
}

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

/* Result specific cell styles */
.char-cell.correct {
    background-color: var(--correct-color);
    border-color: var(--correct-border);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.15);
}

.char-cell.incorrect {
    background-color: var(--incorrect-color);
    border-color: var(--incorrect-border);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}

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

/* =============================================
   Index Page – Charts Section
   ============================================= */
.charts-container {
    position: relative;
    z-index: 1;
    margin-top: 24px;
    background: var(--bg-card);
    backdrop-filter: var(--card-backdrop);
    -webkit-backdrop-filter: var(--card-backdrop);
    border: 1px solid var(--border-glow);
    border-radius: var(--card-radius);
    padding: 28px 40px;
    width: 100%;
    max-width: 820px;
    box-shadow: var(--card-shadow);
    animation: cardFadeIn 0.7s ease-out 0.15s both;
}

.charts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0 6px;
}

.charts-header h2 {
    font-size: 1.25em;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.toggle-arrow {
    font-size: 1.2em;
    color: var(--neon-blue);
    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: 18px;
}

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

.chart-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: 12px;
}

.tab-button {
    flex: 1;
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 1em;
    font-weight: 700;
    color: var(--text-secondary);
    border-radius: 10px;
    transition: all 0.25s;
}

.tab-button.active {
    color: var(--neon-blue);
    background: rgba(0, 212, 255, 0.1);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.08);
}

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

/* =============================================
   Index Page – Settings Form
   ============================================= */
.settings-form fieldset {
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 20px;
    text-align: left;
    background: rgba(255, 255, 255, 0.015);
    transition: border-color 0.3s;
}

.settings-form fieldset:hover {
    border-color: rgba(0, 212, 255, 0.25);
}

.settings-form legend {
    font-weight: 700;
    font-size: 0.95em;
    padding: 0 12px;
    color: var(--neon-blue);
    text-align: center;
    letter-spacing: 0.5px;
}

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

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

.option-group label {
    flex: 1;
    min-width: 80px;
    padding: 12px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95em;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.option-group label:hover {
    background: rgba(0, 212, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.3);
    color: var(--text-primary);
}

.option-group input[type='radio']:checked + label {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(168, 85, 247, 0.15));
    border-color: var(--neon-blue);
    color: white;
    font-weight: 700;
    box-shadow:
        0 0 18px rgba(0, 212, 255, 0.12),
        inset 0 0 15px rgba(0, 212, 255, 0.05);
}

.start-button {
    width: 100%;
    padding: 16px;
    font-size: 1.15em;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    margin-top: 8px;
}

.start-button::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
    transition: left 0.5s;
}

.start-button:hover::before { left: 100%; }

.start-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.3);
}

.start-button:active {
    transform: scale(0.98);
}

/* =============================================
   Quiz Page
   ============================================= */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-bar-inner {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--neon-blue), var(--neon-purple));
    border-radius: 4px;
    transition: width 0.3s;
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

.progress-text {
    font-size: 1em;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.question-display {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 8em;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.15);
}

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

.question-display.show-answer {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 6em;
    color: var(--neon-purple);
    text-shadow: 0 0 20px rgba(168, 85, 247, 0.25);
}

.answer-input {
    width: 80%;
    padding: 15px;
    font-size: 1.5em;
    text-align: center;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.answer-input:focus {
    outline: none;
    border-color: var(--neon-blue);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.15);
}

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

.feedback-correct {
    animation: flash-correct 0.6s;
}
.feedback-incorrect {
    animation: flash-incorrect 0.6s;
}
@keyframes flash-correct {
    50% { background-color: rgba(34, 197, 94, 0.1); border-color: var(--correct-border); }
}
@keyframes flash-incorrect {
    50% { background-color: rgba(239, 68, 68, 0.1); border-color: var(--incorrect-border); }
}

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

.quiz-nav-button {
    flex-grow: 1;
    padding: 12px 15px;
    font-size: 1em;
    font-weight: 700;
    border: 1px solid var(--neon-blue);
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.25s ease;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    color: white;
}

.quiz-nav-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.2);
}

.quiz-nav-button.secondary {
    background: transparent;
    color: var(--neon-blue);
    border: 1px solid var(--border-subtle);
}

.quiz-nav-button.secondary:hover {
    background: rgba(0, 212, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.3);
}

/* =============================================
   Result Page
   ============================================= */
.score {
    font-size: 1.8em;
    font-weight: 800;
    margin-bottom: 30px;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

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

.legend-color {
    width: 18px;
    height: 18px;
    border-radius: 5px;
}

.retry-button {
    margin-top: 40px;
    display: inline-block;
    padding: 15px 40px;
    font-size: 1.15em;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    border: none;
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.retry-button::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
    transition: left 0.5s;
}

.retry-button:hover::before { left: 100%; }

.retry-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.3);
}

/* =============================================
   Ads (commented out, but keep styles)
   ============================================= */
.ad-grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    justify-content: center;
    justify-items: center;
    max-width: 680px;
    margin: 30px auto;
}

.ad-item {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 320px;
    height: 50px;
    margin: 0 auto;
}

/* =============================================
   Footer
   ============================================= */
.footer {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding: 20px;
    width: 100%;
    border-top: 1px solid var(--border-subtle);
    margin-bottom: 0px !important;
}

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

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

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.25s ease;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
}

.footer-link:hover {
    color: var(--neon-blue);
    border-bottom-color: var(--neon-blue);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

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

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

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

.version-tag {
    display: inline-block;
    font-size: 0.75em;
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.15);
    padding: 3px 12px;
    border-radius: 12px;
    color: var(--neon-blue);
    font-weight: 600;
    letter-spacing: 0.5px;
    margin: 0 auto;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 680px) {
    .ad-grid-container {
        grid-template-columns: repeat(1, 1fr);
    }
}

@media (max-width: 600px) {
    .container, .quiz-container, .result-container, .charts-container {
        padding: 24px 20px;
        border-radius: 16px;
    }
    h1 { font-size: 1.6em; }
    .question-display { font-size: 6em; height: 160px; }
    .question-display.show-answer { font-size: 4em; }
}
