/* ==========================================================================
   TOEIC WORD HERO - Compact Mobile-Scaled & Arcade Cyberpunk Stylesheet
   ========================================================================== */

:root {
    --bg-dark: #0a0e17;
    --bg-surface: #111827;
    --bg-card: #151d30;
    --bg-card-hover: #1c263f;
    --border-color: #232f48;
    
    --neon-cyan: #00f2fe;
    --neon-cyan-glow: rgba(0, 242, 254, 0.35);
    --neon-purple: #9d4edd;
    --neon-purple-glow: rgba(157, 78, 221, 0.35);
    --neon-pink: #ff2a85;
    --neon-pink-glow: rgba(255, 42, 133, 0.35);
    --neon-gold: #ffbe0b;
    --neon-gold-glow: rgba(255, 190, 11, 0.35);
    --neon-green: #05ffa1;
    --neon-green-glow: rgba(5, 255, 161, 0.35);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --font-heading: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    --font-arcade: 'Black Han Sans', 'Chakra Petch', sans-serif;
}

/* ==========================================================================
   Base Reset & Mobile Screen Auto-Scale Density
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* Default Mobile Root Font: Scaled down to 13.5px for crisp, compact density */
html {
    font-size: 13.5px;
    -webkit-text-size-adjust: 100%;
}

/* Ultra-compact for small phones (<= 375px like iPhone SE) */
@media (max-width: 375px) {
    html {
        font-size: 12.5px;
    }
}

/* Desktop Root Font (>= 769px) */
@media (min-width: 769px) {
    html {
        font-size: 15px;
    }
}

body {
    width: 100%;
    min-height: 100dvh;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-heading);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    touch-action: manipulation;
    line-height: 1.45;
}

/* Subtle Cyber Grid Background */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        linear-gradient(rgba(19, 27, 46, 0.5) 1px, transparent 1px),
        linear-gradient(90deg, rgba(19, 27, 46, 0.5) 1px, transparent 1px);
    background-size: 24px 24px;
    z-index: -1;
    pointer-events: none;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   Buttons & Inputs (Compact Density)
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 800;
    font-size: 0.92rem;
    min-height: 42px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.12s ease;
    user-select: none;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.96);
    filter: brightness(0.92);
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    color: #050d1a;
    box-shadow: 0 2px 10px var(--neon-cyan-glow);
}

.btn-accent {
    background: linear-gradient(135deg, #ff2a85 0%, #ff758c 100%);
    color: #ffffff;
    box-shadow: 0 2px 10px var(--neon-pink-glow);
}

.btn-gold {
    background: linear-gradient(135deg, #ffbe0b 0%, #fb5607 100%);
    color: #050d1a;
    box-shadow: 0 2px 10px var(--neon-gold-glow);
}

.btn-outline {
    background: rgba(19, 27, 46, 0.6);
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
}
.btn-outline:active {
    border-color: var(--neon-cyan);
    background: rgba(0, 242, 254, 0.1);
}

.btn-sm {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   1. LOGIN GATE SCREEN (Compact Fitted Height)
   ========================================================================== */
#loginGateScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 14px;
    background: radial-gradient(circle at center, #172138 0%, #0a0e17 85%);
    overflow-y: auto;
}

.login-modal-box {
    width: 100%;
    max-width: 350px;
    background: rgba(17, 24, 39, 0.96);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8), 0 0 20px var(--neon-cyan-glow);
    padding: 22px 18px;
    text-align: center;
    position: relative;
    backdrop-filter: blur(12px);
    margin: auto;
}

.game-logo-badge {
    display: inline-block;
    background: rgba(0, 242, 254, 0.12);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.game-title {
    font-size: 1.7rem;
    font-family: var(--font-arcade);
    font-weight: 900;
    background: linear-gradient(135deg, #00f2fe, #ff2a85);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 12px rgba(0, 242, 254, 0.35);
    margin-bottom: 2px;
}

.game-subtitle {
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin-bottom: 16px;
}

.auth-tabs {
    display: flex;
    background: rgba(10, 14, 23, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 3px;
    margin-bottom: 16px;
}

.auth-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    font-weight: 800;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab-btn.active {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, #0284c7 100%);
    color: #050d1a;
    box-shadow: 0 2px 6px var(--neon-cyan-glow);
}

.auth-form-group {
    text-align: left;
    margin-bottom: 12px;
}

.auth-form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-wrapper span.icon {
    position: absolute;
    left: 12px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.auth-input {
    width: 100%;
    min-height: 42px;
    background: rgba(10, 14, 23, 0.85);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px 8px 36px;
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.auth-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px var(--neon-cyan-glow);
}

.auth-msg {
    margin-top: 10px;
    font-size: 0.78rem;
    font-weight: 700;
    min-height: 18px;
}
.auth-msg.error { color: #f87171; }
.auth-msg.success { color: var(--neon-green); }

/* ==========================================================================
   2. MAIN APP SHELL (Slim, Compact Header & Body)
   ========================================================================== */
#mainAppContainer {
    width: 100%;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* App Top Bar */
.app-top-bar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 800;
    background: rgba(10, 14, 23, 0.95);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(14px);
    padding: calc(6px + env(safe-area-inset-top)) 12px 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.app-player-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.avatar-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff2a85, #9d4edd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    border: 1.5px solid #ffffff;
    box-shadow: 0 0 8px var(--neon-pink-glow);
    flex-shrink: 0;
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.profile-row {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-name {
    font-size: 0.88rem;
    font-weight: 900;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-level {
    background: linear-gradient(135deg, var(--neon-gold), #fb923c);
    color: #050d1a;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: var(--radius-full);
}

.badge-streak {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #fca5a5;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: var(--radius-full);
}

.xp-progress-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
}

.xp-progress-bar {
    width: 75px;
    height: 5px;
    background: rgba(19, 27, 46, 0.9);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.xp-fill-glow {
    height: 100%;
    background: linear-gradient(90deg, #00f2fe, #05ffa1);
    box-shadow: 0 0 5px var(--neon-green-glow);
    width: 0%;
    transition: width 0.3s ease;
}

.xp-number {
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--neon-green);
}

.app-top-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.action-circle-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(19, 27, 46, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.12s;
}

.action-circle-btn:active {
    transform: scale(0.9);
    border-color: var(--neon-cyan);
}

.desktop-nav-bar {
    display: none;
}

/* Main Content Body */
.app-content-body {
    flex: 1;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 10px 10px 80px 10px; /* bottom 80px for slim bottom bar */
}

/* ==========================================================================
   TAB 1: Home Dashboard & Attendance (Compact Fit)
   ========================================================================== */
.attendance-hero-card {
    background: linear-gradient(135deg, rgba(255, 190, 11, 0.1), rgba(255, 42, 133, 0.1));
    border: 1.5px solid rgba(255, 190, 11, 0.3);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 12px;
}

.attendance-top-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

@media (min-width: 500px) {
    .attendance-top-row {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.badge-pill-cyan {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 900;
    color: var(--neon-cyan);
    letter-spacing: 0.8px;
    margin-bottom: 2px;
}

.attendance-title {
    font-size: 1.1rem;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 2px;
}

.attendance-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.btn-attendance-action {
    white-space: nowrap;
    min-height: 36px;
    font-size: 0.82rem;
    padding: 6px 12px;
}

.btn-attendance-action.checked {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
    box-shadow: none;
}

.attendance-calendar-box {
    background: rgba(10, 14, 23, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
}

.cal-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.attendance-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.cal-weekday {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    padding: 2px 0;
}

.cal-day-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(19, 27, 46, 0.5);
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.cal-day-cell.empty {
    background: transparent;
    border: none;
}

.cal-day-cell.today {
    border-color: var(--neon-gold);
    color: var(--neon-gold);
    font-weight: 900;
}

.cal-day-cell.attended {
    background: rgba(0, 242, 254, 0.15);
    border-color: var(--neon-cyan);
    color: #ffffff;
    font-weight: 900;
}

.cal-day-cell.attended::after {
    content: "🔥";
    font-size: 0.55rem;
    line-height: 1;
}

/* Achievement Metrics Grid */
.achievement-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.metric-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
}

.metric-icon {
    font-size: 1.15rem;
}

.metric-num {
    font-size: 1.15rem;
    font-weight: 900;
    color: #ffffff;
    line-height: 1.2;
}

.metric-sub {
    font-size: 0.68rem;
    color: var(--text-secondary);
    font-weight: 700;
}

.metric-bar-track {
    width: 100%;
    height: 4px;
    background: rgba(10, 14, 23, 0.8);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.metric-bar-fill {
    height: 100%;
    transition: width 0.4s ease;
}

.metric-bar-fill.fill-cyan {
    background: linear-gradient(90deg, #00f2fe, #4facfe);
}

.metric-bar-fill.fill-green {
    background: linear-gradient(90deg, #10b981, #05ffa1);
}

.metric-tag {
    font-size: 0.65rem;
    color: var(--neon-gold);
    font-weight: 800;
}

/* Charts Section */
.charts-section-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.chart-container-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.chart-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: #ffffff;
}

.chart-badge {
    font-size: 0.62rem;
    font-weight: 800;
    color: var(--neon-cyan);
    background: rgba(0, 242, 254, 0.1);
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.chart-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 160px;
}

/* Quest Cards */
.quest-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.quest-item {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    transition: all 0.12s ease;
}

.quest-item:active {
    transform: scale(0.98);
    border-color: var(--neon-cyan);
}

.quest-item-content {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.quest-emoji {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.quest-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 1px;
}

.quest-summary {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.quest-arrow-btn {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--neon-cyan);
    white-space: nowrap;
    padding: 4px 8px;
    background: rgba(0, 242, 254, 0.1);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

/* ==========================================================================
   TAB 2 & 3: Learning Flashcards (Fitted to 1 Screen, No Vertical Overflow)
   ========================================================================== */
.learn-header-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.learn-view-title {
    font-size: 1.1rem;
    font-weight: 900;
}

.scrollable-filter-chips {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.scrollable-filter-chips::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    padding: 4px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
}

.filter-chip.active {
    background: var(--neon-cyan);
    color: #050d1a;
    border-color: var(--neon-cyan);
}

.swipe-hint-text {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.mobile-card-wrapper {
    width: 100%;
    margin-bottom: 10px;
    touch-action: pan-y;
}

.flashcard-box {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    user-select: none;
}

.card-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-badges-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
}

.badge-pos {
    background: rgba(157, 78, 221, 0.25);
    border: 1px solid var(--neon-purple);
    color: #d8b4fe;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.badge-level-tag {
    background: rgba(255, 190, 11, 0.2);
    border: 1px solid var(--neon-gold);
    color: var(--neon-gold);
    font-size: 0.7rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.star-toggle-btn {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.star-toggle-btn.bookmarked {
    color: var(--neon-gold);
    text-shadow: 0 0 10px var(--neon-gold-glow);
}

.card-hero-block {
    text-align: center;
    padding: 4px 0;
}

.card-english-term {
    font-size: 1.65rem;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 2px;
}

.card-phonetic-code {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.btn-tts-listen {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 242, 254, 0.12);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    padding: 5px 14px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.card-meaning-container {
    background: rgba(10, 14, 23, 0.7);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    text-align: center;
}

.meaning-label {
    font-size: 0.6rem;
    font-weight: 900;
    color: var(--text-muted);
    letter-spacing: 0.8px;
}

.meaning-highlight {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--neon-cyan);
}

.card-example-container {
    background: rgba(15, 23, 42, 0.7);
    border-left: 2.5px solid var(--neon-purple);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 8px 10px;
}

.example-label {
    font-size: 0.6rem;
    font-weight: 900;
    color: var(--neon-purple);
    letter-spacing: 0.6px;
    margin-bottom: 2px;
}

.example-en {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.35;
    margin-bottom: 2px;
}

.example-ko {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.card-memory-container {
    background: rgba(255, 42, 133, 0.08);
    border: 1px solid rgba(255, 42, 133, 0.25);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}

.tip-header {
    font-size: 0.68rem;
    font-weight: 900;
    color: var(--neon-pink);
    margin-bottom: 2px;
}

.tip-content {
    font-size: 0.78rem;
    color: #fbcfe8;
    line-height: 1.35;
}

.card-footer-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.btn-nav-card {
    flex: 1;
    min-height: 38px;
    font-size: 0.85rem;
}

.card-nav-indicator {
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: center;
}

/* ==========================================================================
   TAB 4: Test Hub & Quiz Battle View (Compact Fitted Choices)
   ========================================================================== */
.quiz-select-hub {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-hub-header {
    margin-bottom: 4px;
}

.quiz-mode-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.quiz-mode-card.mode-choice { border-color: rgba(255, 42, 133, 0.4); }
.quiz-mode-card.mode-blank { border-color: rgba(255, 190, 11, 0.4); }

.mode-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.mode-title {
    font-size: 1rem;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 2px;
}

.mode-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Playing Screen */
.quiz-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.quiz-tag-pill {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--neon-cyan);
}

.quiz-counter-tag {
    font-family: var(--font-arcade);
    font-size: 0.95rem;
    color: var(--neon-gold);
}

.quiz-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(10, 14, 23, 0.8);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff2a85, #ffbe0b);
    width: 0%;
}

.quiz-question-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 12px;
}

.question-meta-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 6px;
}

.cat-badge {
    background: rgba(0, 242, 254, 0.15);
    color: var(--neon-cyan);
    font-size: 0.68rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.cat-level {
    font-size: 0.68rem;
    color: var(--neon-gold);
    font-weight: 800;
}

.quiz-prompt-msg {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 700;
    margin-bottom: 8px;
}

.quiz-target-term {
    font-size: 1.4rem;
    font-weight: 900;
    color: #ffffff;
    line-height: 1.25;
    margin-bottom: 2px;
}

.quiz-sub-guide {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

/* Choice Options List (Compact & Touch Friendly) */
.choice-options-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
}

.option-btn {
    width: 100%;
    min-height: 44px;
    background: rgba(10, 14, 23, 0.8);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    text-align: left;
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-btn.selected {
    border-color: var(--neon-cyan);
    background: rgba(0, 242, 254, 0.18);
    box-shadow: 0 0 10px var(--neon-cyan-glow);
}

.option-idx {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.blank-input-wrapper {
    margin-bottom: 14px;
}

.blank-native-input {
    width: 100%;
    min-height: 44px;
    background: rgba(10, 14, 23, 0.9);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--neon-gold);
    text-align: center;
    outline: none;
}

.blank-hint-pill {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.quiz-btn-row {
    display: flex;
    gap: 8px;
}

.btn-quiz-nav {
    flex: 1;
    min-height: 38px;
}

/* Quiz Result Screen */
.quiz-result-wrapper {
    background: var(--bg-card);
    border: 2px solid var(--neon-cyan);
    border-radius: var(--radius-md);
    padding: 20px 14px;
    text-align: center;
}

.result-rank-symbol {
    font-size: 2.6rem;
    font-family: var(--font-arcade);
    font-weight: 900;
    background: linear-gradient(135deg, #ffbe0b, #ff2a85);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2px;
}

.result-score-title {
    font-size: 1.35rem;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 12px;
}

.result-metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.metric-box {
    background: rgba(10, 14, 23, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
}

.metric-title {
    display: block;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.metric-value {
    font-size: 1.05rem;
    font-weight: 900;
}
.metric-value.highlight-cyan { color: var(--neon-cyan); }
.metric-value.highlight-red { color: #f87171; }

.result-action-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.review-section-title {
    text-align: left;
    font-size: 0.9rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 8px;
}

.result-review-scroll {
    text-align: left;
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.review-item {
    background: rgba(10, 14, 23, 0.7);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    border-left: 3px solid #ef4444;
}

.review-item.is-correct {
    border-left-color: var(--neon-green);
}

.review-term {
    font-weight: 800;
    font-size: 0.88rem;
    color: #ffffff;
}

.review-explanation {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.35;
    margin-top: 3px;
}

/* ==========================================================================
   TAB 5: Archive & History Hub
   ========================================================================== */
.archive-segment-tabs {
    display: flex;
    background: rgba(10, 14, 23, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 3px;
    margin-bottom: 12px;
    overflow-x: auto;
}

.archive-segment-tabs::-webkit-scrollbar {
    display: none;
}

.segment-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 7px 6px;
    font-weight: 800;
    font-size: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    text-align: center;
}

.segment-tab-btn.active {
    background: var(--bg-card);
    color: var(--neon-cyan);
    border: 1px solid var(--border-color);
}

.panel-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.panel-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.mobile-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.list-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.list-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.list-item-term {
    font-size: 1.1rem;
    font-weight: 900;
    color: #ffffff;
}

.list-item-meaning {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--neon-cyan);
}

.list-item-sentence {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.list-item-tip {
    font-size: 0.72rem;
    background: rgba(255, 42, 133, 0.08);
    border: 1px solid rgba(255, 42, 133, 0.25);
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    color: #fbcfe8;
}

.wrong-badge {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #fca5a5;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.history-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.history-term {
    font-size: 0.95rem;
    font-weight: 900;
    color: #ffffff;
}

.history-meaning {
    font-size: 0.8rem;
    color: var(--neon-cyan);
    font-weight: 700;
}

.history-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.quiz-history-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quiz-score-pill {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--neon-gold);
    font-family: var(--font-arcade);
}

/* ==========================================================================
   Mobile Bottom Navigation Bar (Slim 54px Fit)
   ========================================================================== */
.mobile-app-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(54px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(14, 20, 32, 0.97);
    border-top: 1px solid var(--border-color);
    backdrop-filter: blur(14px);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.6);
}

.bottom-tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px 0;
    cursor: pointer;
    gap: 2px;
    height: 100%;
}

.bottom-tab-btn .tab-emoji {
    font-size: 1.15rem;
    line-height: 1;
}

.bottom-tab-btn .tab-text {
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1;
}

.bottom-tab-btn.active {
    color: var(--neon-cyan);
}

.bottom-tab-btn.active .tab-emoji {
    transform: translateY(-2px) scale(1.12);
    filter: drop-shadow(0 0 6px var(--neon-cyan-glow));
}

/* ==========================================================================
   Bottom Sheet Dialog (Settings)
   ========================================================================== */
.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.bottom-sheet-dialog {
    width: 100%;
    max-width: 480px;
    max-height: 85dvh;
    background: var(--bg-card);
    border-top: 2px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
}

.sheet-drag-handle {
    width: 36px;
    height: 4px;
    background: var(--border-color);
    border-radius: var(--radius-full);
    margin: 8px auto 4px auto;
}

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
}

.sheet-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffffff;
}

.sheet-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.sheet-body-scroll {
    padding: 14px 16px 20px 16px;
    overflow-y: auto;
}

.sheet-divider {
    border-top: 1px dashed var(--border-color);
    margin: 12px 0;
}

.sheet-subhead {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--neon-gold);
    margin-bottom: 8px;
}

/* ==========================================================================
   Desktop / Tablet Media Query Enhancements (769px and above)
   ========================================================================== */
@media (min-width: 769px) {
    .mobile-app-bottom-bar {
        display: none !important;
    }

    .desktop-nav-bar {
        display: flex;
        gap: 8px;
        background: rgba(17, 24, 39, 0.85);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 4px;
        margin: 14px auto 18px auto;
        max-width: 1000px;
        width: 100%;
    }

    .d-nav-item {
        flex: 1;
        background: transparent;
        border: none;
        padding: 10px 12px;
        font-weight: 800;
        font-size: 0.9rem;
        color: var(--text-secondary);
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s;
        text-align: center;
    }

    .d-nav-item:hover {
        color: #ffffff;
        background: rgba(255, 255, 255, 0.05);
    }

    .d-nav-item.active {
        background: linear-gradient(135deg, rgba(0, 242, 254, 0.2), rgba(157, 78, 221, 0.2));
        color: var(--neon-cyan);
        border: 1px solid var(--neon-cyan);
    }

    .d-nav-item.logout {
        color: #f87171;
    }

    .app-content-body {
        padding: 0 16px 50px 16px;
    }

    .achievement-metrics-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }

    .charts-section-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .chart-container-card.chart-full-width {
        grid-column: 1 / -1;
    }

    .quest-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .flashcard-box, .card-footer-controls, .quiz-question-card, .quiz-result-wrapper {
        max-width: 640px;
        margin: 0 auto;
    }

    .mobile-items-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .bottom-sheet-overlay {
        align-items: center;
    }

    .bottom-sheet-dialog {
        border-radius: var(--radius-lg);
        border: 2px solid var(--border-color);
    }
}
