/* style.css - Premium RPG Fantasy Theme Styling for Read Spy: The Lost Library */

:root {
    --bg-dark-green: #0a1610;
    --panel-green: rgba(13, 31, 23, 0.85);
    --panel-wood-dark: #2a180b;
    --wood-border: #4d2b12;
    --gold: #cca03a;
    --gold-light: #e6c15c;
    --gold-dark: #99731f;
    --cream: #faf7f0;
    --cream-dark: #e8dfcb;
    --charcoal: #1e1e1e;
    --danger: #ff4757;
    --danger-light: #ff6b81;
    --success: #2ed573;
    --success-light: #7bed9f;
    --shadow-gold: 0 0 15px rgba(204, 160, 58, 0.5);
    --font-heading: 'Mitr', 'Chakra Petch', sans-serif;
    --font-body: 'Sarabun', sans-serif;
    --font-english: 'Cinzel', serif;
}

/* Base resets and setup */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark-green);
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(22, 62, 45, 0.3) 0%, rgba(10, 22, 16, 0.9) 100%),
        repeating-linear-gradient(0deg, rgba(0,0,0,0.15) 0px, rgba(0,0,0,0.15) 1px, transparent 1px, transparent 4px);
    color: var(--cream);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background fog & particle effects */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.fog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 30%, rgba(0,0,0,0.4) 100%);
    z-index: 2;
    pointer-events: none;
}

.app-container {
    position: relative;
    z-index: 10;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Screen Transitions */
.screen {
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    width: 100%;
    min-height: 100vh;
}

.screen.active {
    display: block;
    opacity: 1;
}

/* Text Colors & Utils */
.text-gold { color: var(--gold-light) !important; text-shadow: 0 0 5px rgba(230, 193, 92, 0.3); }
.text-green { color: var(--success-light) !important; }
.text-blue { color: #54a0ff !important; }
.text-danger { color: var(--danger-light) !important; }
.text-cream { color: var(--cream) !important; }
.text-cream-light { color: var(--cream-dark) !important; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-glow { text-shadow: 0 0 15px var(--gold-light); }
.margin-top-10 { margin-top: 10px; }
.margin-top-20 { margin-top: 20px; }
.margin-bottom-10 { margin-bottom: 10px; }
.margin-bottom-20 { margin-bottom: 20px; }
.padding-bottom-5 { padding-bottom: 5px; }
.padding-bottom-10 { padding-bottom: 10px; }
.border-bottom { border-bottom: 1px solid rgba(204, 160, 58, 0.2); }
.max-width-600 { max-width: 600px; }
.max-width-800 { max-width: 800px; }
.font-rpg { font-family: var(--font-heading); }
.font-sm { font-size: 0.85rem; }
.padding-20 { padding: 20px !important; }

/* 🛡️ RPG Cards - Glassmorphism Wood & Gold Panel Design */
.rpg-card {
    background: var(--panel-green);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid var(--gold);
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.5), 
        inset 0 0 20px rgba(22, 62, 45, 0.6),
        0 0 15px rgba(204, 160, 58, 0.15);
    border-radius: 12px;
    position: relative;
    padding: 30px;
    margin: 20px auto;
    transition: all 0.3s ease;
}

/* Gold Corner Accents */
.gold-border-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid var(--gold-light);
    z-index: 5;
    pointer-events: none;
}
.gold-border-corner.top-left { top: -2px; left: -2px; border-right: none; border-bottom: none; border-radius: 10px 0 0 0; }
.gold-border-corner.top-right { top: -2px; right: -2px; border-left: none; border-bottom: none; border-radius: 0 10px 0 0; }
.gold-border-corner.bottom-left { bottom: -2px; left: -2px; border-right: none; border-top: none; border-radius: 0 0 0 10px; }
.gold-border-corner.bottom-right { bottom: -2px; right: -2px; border-left: none; border-top: none; border-radius: 0 0 10px 0; }

/* Wood Borders simulation */
.wood-border-top, .wood-border-bottom {
    position: absolute;
    left: 10px;
    right: 10px;
    height: 6px;
    background: linear-gradient(90deg, var(--wood-border), var(--panel-wood-dark), var(--wood-border));
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    z-index: 3;
}
.wood-border-top { top: 0; }
.wood-border-bottom { bottom: 0; }

.wood-border-left, .wood-border-right {
    position: absolute;
    top: 10px;
    bottom: 10px;
    width: 6px;
    background: linear-gradient(180deg, var(--wood-border), var(--panel-wood-dark), var(--wood-border));
    box-shadow: 2px 0 4px rgba(0,0,0,0.4);
    z-index: 3;
}
.wood-border-left { left: 0; }
.wood-border-right { right: 0; }

/* 🌟 RPG Buttons (3D, Animated, Glow) */
.rpg-btn {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-transform: uppercase;
    transition: all 0.15s ease;
    user-select: none;
}

/* Gold Button style */
.btn-gold {
    background: linear-gradient(180deg, #ffd700 0%, #e6a100 50%, #b37d00 100%);
    color: #3b2300 !important;
    border: 2px solid var(--cream);
    box-shadow: 
        0 4px 0 #805900,
        0 8px 15px rgba(0,0,0,0.3);
    text-shadow: 0 1px 1px rgba(255,255,255,0.4);
}
.btn-gold:hover {
    background: linear-gradient(180deg, #ffe033 0%, #ffb700 50%, #cc8e00 100%);
    box-shadow: 
        0 4px 0 #996a00,
        0 8px 20px rgba(230, 193, 92, 0.4);
    transform: translateY(-2px);
}
.btn-gold:active {
    transform: translateY(2px);
    box-shadow: 
        0 2px 0 #805900,
        0 4px 10px rgba(0,0,0,0.3);
}

/* Green Light Button style */
.btn-green-light {
    background: linear-gradient(180deg, #55e6c1 0%, #20bf6b 100%);
    color: #0b3d22 !important;
    border: 2px solid var(--cream);
    box-shadow: 
        0 4px 0 #158047,
        0 8px 15px rgba(0,0,0,0.3);
}
.btn-green-light:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 4px 0 #158047,
        0 8px 20px rgba(85, 230, 193, 0.3);
}
.btn-green-light:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #158047;
}

/* Gold Outline style */
.btn-gold-outline {
    background: transparent;
    color: var(--gold-light);
    border: 2px solid var(--gold);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.btn-gold-outline:hover {
    background: rgba(204, 160, 58, 0.1);
    color: var(--cream);
    border-color: var(--gold-light);
}

/* Danger Button style */
.btn-danger {
    background: linear-gradient(180deg, #ff6b81 0%, #ff4757 100%);
    color: var(--cream);
    border: 2px solid var(--cream);
    box-shadow: 0 4px 0 #cc2936;
}
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 #cc2936, 0 8px 15px rgba(255, 71, 87, 0.3);
}
.btn-danger:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #cc2936;
}

.btn-danger-outline {
    background: transparent;
    color: var(--danger-light);
    border: 1px solid var(--danger);
}
.btn-danger-outline:hover {
    background: rgba(255, 71, 87, 0.15);
}

.btn-block { width: 100%; display: flex; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; border-radius: 6px; }
.btn-large { padding: 16px 32px; font-size: 1.2rem; }

/* Text Button */
.btn-text-gold {
    background: none;
    border: none;
    color: var(--gold-light);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-text-gold:hover {
    color: var(--cream);
    text-shadow: 0 0 10px var(--gold-light);
}

/* 🖋️ RPG Forms */
.rpg-form .form-group {
    margin-bottom: 20px;
    text-align: left;
}

.rpg-form label {
    display: block;
    font-family: var(--font-heading);
    color: var(--cream-dark);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.rpg-form input[type="text"],
.rpg-form input[type="number"],
.rpg-form input[type="password"],
.rpg-form input[type="url"],
.rpg-form select,
.rpg-form textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(10, 22, 16, 0.8);
    border: 2px solid var(--gold-dark);
    border-radius: 8px;
    color: var(--cream);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.rpg-form input:focus,
.rpg-form select:focus,
.rpg-form textarea:focus {
    border-color: var(--gold-light);
    box-shadow: 0 0 10px rgba(230, 193, 92, 0.3);
    background: rgba(10, 22, 16, 0.95);
}

.form-row {
    display: flex;
    gap: 15px;
}
.form-row .half { flex: 1; }
.form-row .third { flex: 1; }

/* Special Parchment scroll-like inputs for gameplay questions */
.parchment-input {
    background-color: #faf4e6 !important;
    background-image: radial-gradient(circle at 0% 0%, rgba(200, 180, 150, 0.15) 0%, transparent 100%) !important;
    border: 2px solid #8c6239 !important;
    border-radius: 6px !important;
    color: #2b1a0a !important;
    font-weight: 600;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.05);
}
.parchment-input::placeholder {
    color: #8c7664;
}
.parchment-input:focus {
    border-color: #cca03a !important;
    box-shadow: 0 0 10px rgba(140, 98, 57, 0.4) !important;
    background-color: #fffcf5 !important;
}

/* 🏠 SCREEN 1: LOGIN CARD */
.login-card {
    max-width: 500px;
    margin: 80px auto;
    text-align: center;
}

.logo-area {
    margin-bottom: 30px;
}

.spy-emoji {
    font-size: 4rem;
    display: block;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px var(--gold-light));
}

.game-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: var(--cream);
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
    margin-bottom: 5px;
}

.game-subtitle {
    font-family: var(--font-english);
    font-size: 1.2rem;
    color: var(--gold-light);
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(230,193,92,0.4);
    margin-bottom: 20px;
}

.tagline-container {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid var(--gold);
    display: inline-block;
}

.tagline {
    font-style: italic;
    font-size: 0.9rem;
    color: var(--cream-dark);
}

.login-footer {
    margin-top: 25px;
    border-top: 1px solid rgba(204, 160, 58, 0.2);
    padding-top: 15px;
}

.back-header {
    text-align: left;
    margin-bottom: 15px;
}
.btn-back {
    background: none;
    border: none;
    color: var(--gold-light);
    font-family: var(--font-heading);
    cursor: pointer;
    font-size: 0.95rem;
}
.btn-back:hover { color: var(--cream); }

/* 🎮 SCREEN 3: STUDENT DASHBOARD & GAMEPLAY */
.rpg-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 30px;
    background: rgba(13, 31, 23, 0.9);
    border-bottom: 3px solid var(--gold);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.player-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar-ring {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
    border: 2px solid var(--cream);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.player-info {
    text-align: left;
}

.player-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--cream);
}

.badge-role {
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 6px;
    background: var(--gold-dark);
    color: var(--cream);
    border-radius: 4px;
    border: 1px solid var(--gold-light);
}

.player-meta {
    font-size: 0.85rem;
    color: var(--cream-dark);
}

.topbar-stats {
    display: flex;
    gap: 30px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--cream-dark);
    text-transform: uppercase;
}

.stat-val {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
}

.progress-container-small {
    position: relative;
    width: 120px;
    height: 18px;
    background: rgba(0,0,0,0.5);
    border-radius: 9px;
    border: 1px solid var(--gold-dark);
    overflow: hidden;
    margin-top: 4px;
}

.progress-bar-small {
    height: 100%;
    background: linear-gradient(90deg, #10ac84, #2ed573);
    border-radius: 9px;
    transition: width 0.5s ease-out;
}

.progress-text-small {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--cream);
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 🔑 Key HUD */
.key-hud-container {
    max-width: 400px;
    margin: 15px auto 5px auto;
    padding: 8px 20px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid var(--gold-dark);
}

.key-hud-title {
    font-size: 0.8rem;
    font-family: var(--font-heading);
    color: var(--gold-light);
    margin-bottom: 5px;
    text-shadow: 0 0 5px rgba(204, 160, 58, 0.4);
}

.key-slots {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.key-slot {
    position: relative;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    border: 2px solid rgba(204, 160, 58, 0.2);
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.15);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.key-slot.active {
    border-color: var(--gold-light);
    background: radial-gradient(circle, rgba(230, 193, 92, 0.3) 0%, rgba(20, 40, 30, 0.7) 100%);
    color: var(--gold-light);
    text-shadow: 0 0 8px var(--gold-light);
    box-shadow: 0 0 12px rgba(230, 193, 92, 0.5);
    transform: scale(1.1);
}

.key-slot .slot-num {
    position: absolute;
    bottom: -3px;
    right: -3px;
    font-size: 0.65rem;
    background: var(--charcoal);
    color: var(--cream);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gold);
}

/* Student Main Screen Layout */
.student-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    padding: 10px 30px 30px 30px;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

.student-aside {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.aside-card {
    margin: 0;
    padding: 20px;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(204, 160, 58, 0.2);
    padding-bottom: 8px;
}

/* Badge list styles */
.badge-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.25;
    transition: opacity 0.5s ease;
}

.badge-item.unlocked {
    opacity: 1;
}

.badge-icon-wrap {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

.badge-item.unlocked .badge-icon-wrap {
    border-color: var(--gold-light);
    background: radial-gradient(circle, rgba(230, 193, 92, 0.2) 0%, rgba(13, 31, 23, 0.8) 100%);
    box-shadow: 0 0 10px rgba(230, 193, 92, 0.4);
}

.badge-name {
    font-size: 0.7rem;
    margin-top: 5px;
    text-align: center;
    white-space: nowrap;
    color: var(--cream-dark);
}

/* Leaderboard Ranking list */
.ranking-header {
    display: grid;
    grid-template-columns: 50px 1fr 100px;
    font-size: 0.75rem;
    color: var(--cream-dark);
    font-weight: bold;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.ranking-ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    max-height: 250px;
    overflow-y: auto;
}

.ranking-li {
    display: grid;
    grid-template-columns: 50px 1fr 100px;
    align-items: center;
    padding: 6px 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.ranking-li.top-1 {
    border-color: var(--gold);
    background: linear-gradient(90deg, rgba(204, 160, 58, 0.15) 0%, rgba(0,0,0,0.2) 100%);
}

.rank-num {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--cream-dark);
}

.ranking-li.top-1 .rank-num {
    color: var(--gold-light);
    font-size: 1.1rem;
}

.rank-name {
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 5px;
}

.rank-val {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--gold-light);
    text-align: right;
}

/* Gameplay Main Area */
.mission-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.mission-tab {
    flex: 1;
    font-family: var(--font-heading);
    padding: 10px 15px;
    background: rgba(13, 31, 23, 0.6);
    border: 2px solid rgba(204, 160, 58, 0.3);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    color: var(--cream-dark);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mission-tab:hover:not(.locked) {
    background: rgba(22, 62, 45, 0.8);
    color: var(--cream);
}

.mission-tab.active {
    background: var(--panel-green);
    border-color: var(--gold);
    color: var(--gold-light);
    text-shadow: 0 0 5px rgba(230,193,92,0.3);
    font-weight: bold;
    transform: translateY(1px);
    z-index: 5;
}

.mission-tab.locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.3);
}

.gameplay-card {
    margin: 0;
    min-height: 480px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Gameplay views */
.mission-intro {
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.difficulty-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.difficulty-badge.easy { background: rgba(46, 213, 115, 0.2); color: var(--success-light); border: 1px solid var(--success); }
.difficulty-badge.medium { background: rgba(255, 165, 0, 0.2); color: #ffa500; border: 1px solid #ffa500; }
.difficulty-badge.hard { background: rgba(255, 71, 87, 0.2); color: var(--danger-light); border: 1px solid var(--danger); }

.clues-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 25px 0;
}

.clue-box {
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(204, 160, 58, 0.4);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.clue-box:hover {
    border-color: var(--gold-light);
    background: rgba(0, 0, 0, 0.5);
    transform: translateY(-2px);
}

.clue-icon {
    font-size: 1.8rem;
    color: var(--gold-light);
}

.clue-text {
    font-family: var(--font-heading);
    font-weight: bold;
    font-size: 1.1rem;
}

/* Extra Hint Banner */
.extra-hint-box {
    background: rgba(204, 160, 58, 0.1);
    border: 1px solid var(--gold);
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    text-align: left;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideDown 0.4s ease;
}

.extra-hint-box i {
    font-size: 1.3rem;
    color: var(--gold-light);
    margin-top: 2px;
}

.extra-hint-box p {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Input guess area */
.guess-area {
    max-width: 500px;
    margin: 20px auto 0 auto;
}

.guess-box-row {
    display: flex;
    gap: 10px;
}

.guess-box-row input {
    flex: 1;
    font-size: 1.1rem !important;
}

/* Q&A Stage Styles */
.qa-stage-container {
    animation: fadeIn 0.5s ease;
}

.scroll-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--gold-light);
    margin-bottom: 20px;
    text-shadow: 0 0 8px rgba(230,193,92,0.4);
}

.qa-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.qa-group {
    background: rgba(0,0,0,0.15);
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid var(--gold);
}

.qa-group label {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--gold-light);
    margin-bottom: 6px;
}

.qa-group textarea {
    min-height: 70px;
    resize: none;
}

.qa-full-width {
    grid-column: span 2;
}

/* Completed Secret Library Portals */
.secret-library-completed {
    text-align: center;
    padding: 40px;
    animation: fadeIn 0.8s ease;
}

.master-key-glowing {
    font-size: 5rem;
    color: var(--gold-light);
    animation: glow-pulse 2s infinite ease-in-out;
    margin-bottom: 20px;
}

/* 🏫 TEACHER PANEL STYLES */
.teacher-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    width: 100%;
}

.teacher-sidebar {
    background: #09120d;
    border-right: 2px solid var(--gold);
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.sidebar-brand {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(204, 160, 58, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 2.2rem;
    color: var(--gold-light);
    filter: drop-shadow(0 0 5px var(--gold-light));
}

.sidebar-brand h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--cream);
}

.sidebar-brand span {
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--gold-light);
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    flex: 1;
}

.sidebar-menu li {
    padding: 14px 25px;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--cream-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.sidebar-menu li:hover {
    background: rgba(22, 62, 45, 0.3);
    color: var(--cream);
}

.sidebar-menu li.active {
    background: rgba(204, 160, 58, 0.1);
    color: var(--gold-light);
    border-left-color: var(--gold);
    font-weight: bold;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.teacher-main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.teacher-header {
    background: rgba(9, 18, 13, 0.7);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(204, 160, 58, 0.2);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.teacher-header h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--gold-light);
}

.teacher-stats-bar {
    display: flex;
    gap: 20px;
}

.teacher-header-stat {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(204, 160, 58, 0.2);
    border-radius: 6px;
    padding: 8px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.teacher-header-stat .lbl {
    font-size: 0.75rem;
    color: var(--cream-dark);
}

.teacher-header-stat .val {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
}

.teacher-work-window {
    padding: 30px;
    flex: 1;
}

.teacher-subview {
    display: none;
    animation: fadeIn 0.4s ease;
}

.teacher-subview.active {
    display: block;
}

/* Admin Dashboard grid layout */
.teacher-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.teacher-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* Charts Containers */
.chart-container-small {
    position: relative;
    max-height: 200px;
    display: flex;
    justify-content: center;
}

.chart-container {
    position: relative;
    height: 350px;
    display: flex;
    justify-content: center;
}

/* Tables and records in Admin */
.table-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.search-box-container {
    position: relative;
    width: 300px;
}

.search-box-container i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold-dark);
}

.search-box-container input {
    padding-left: 35px;
    height: 38px;
    font-size: 0.9rem;
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--gold-dark);
    border-radius: 6px;
    color: var(--cream);
    outline: none;
}

.search-box-container input:focus {
    border-color: var(--gold-light);
}

.table-card {
    padding: 10px;
}

.table-scroll-container {
    overflow-x: auto;
    width: 100%;
}

.t-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.t-table th, .t-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.t-table th {
    font-family: var(--font-heading);
    color: var(--gold-light);
    border-bottom: 2px solid var(--gold);
    font-weight: 600;
}

.t-table tbody tr:hover {
    background: rgba(22, 62, 45, 0.2);
}

.badge-status {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}
.badge-status.online { background: rgba(46, 213, 115, 0.2); color: var(--success-light); }
.badge-status.offline { background: rgba(255, 255, 255, 0.1); color: var(--cream-dark); }

.log-timeline {
    max-height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 5px;
}

.timeline-item {
    background: rgba(0,0,0,0.2);
    border-left: 3px solid var(--gold);
    padding: 8px 12px;
    border-radius: 0 6px 6px 0;
    font-size: 0.8rem;
    text-align: left;
}

.timeline-time {
    display: block;
    font-size: 0.7rem;
    color: var(--gold-light);
}

/* Modals Overlay & Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 30px 10px;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-card {
    max-width: 500px;
    width: 90%;
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    margin: auto;
}

/* Base modal close button style */
.btn-close-modal {
    background: none;
    border: none;
    color: var(--gold-light);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-close-modal:hover { color: var(--cream); }

/* Absolute gold-bordered touch button for direct children close buttons */
.modal-card > .btn-close-modal {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6) !important;
    border: 2px solid var(--gold) !important;
    border-radius: 50% !important;
    color: var(--gold-light) !important;
    font-size: 1.3rem !important;
    z-index: 99 !important;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.modal-card > .btn-close-modal:hover {
    background: var(--gold-dark) !important;
    color: var(--cream) !important;
    transform: scale(1.1);
    border-color: var(--gold-light) !important;
    box-shadow: 0 0 15px rgba(230, 193, 92, 0.5) !important;
}

/* Responsiveness: Align to start on short/mobile viewports to prevent top cutoff */
@media (max-height: 650px), (max-width: 768px) {
    .modal-overlay {
        align-items: flex-start;
    }
    .modal-card {
        margin-top: 30px;
        margin-bottom: 30px;
    }
}

/* Portal gate open animation */
.portal-gate-container {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    border: 5px double var(--gold);
    margin: 0 auto 20px auto;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle, #053322 0%, #000 100%);
    box-shadow: 0 0 30px var(--gold);
}

.portal-door {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(135deg, var(--wood-border), var(--panel-wood-dark));
    border: 2px solid var(--gold);
    z-index: 5;
    transition: transform 1.5s cubic-bezier(0.77, 0, 0.175, 1);
}

.portal-door.left-door {
    left: 0;
    border-right: 3px double var(--gold);
    transform-origin: left;
}

.portal-door.right-door {
    right: 0;
    border-left: 3px double var(--gold);
    transform-origin: right;
}

.portal-light {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #fff 0%, var(--gold-light) 40%, transparent 80%);
    opacity: 0;
    z-index: 2;
    mix-blend-mode: screen;
}

.portal-key-animation {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: var(--gold-light);
    z-index: 10;
    animation: key-insert 2s forwards ease;
}

/* Door opening trigger styles */
.modal-overlay.open .left-door { transform: rotateY(-90deg); }
.modal-overlay.open .right-door { transform: rotateY(90deg); }
.modal-overlay.open .portal-light { animation: portalGlow 2.5s infinite alternate; }

/* Certifcate Styles */
.certificate-preview-container {
    background: #fff;
    color: #333;
    padding: 30px;
    border: 10px double var(--gold);
    border-radius: 4px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.3);
    margin: 20px 0;
    position: relative;
    text-align: center;
    background-image: 
        radial-gradient(circle at 100% 150%, #fcf7e8 24%, #fff 24%),
        radial-gradient(circle at 0% 150%, #fcf7e8 24%, #fff 24%);
}

.certificate-title {
    font-family: var(--font-english);
    font-size: 1.6rem;
    font-weight: 800;
    color: #805900;
    letter-spacing: 2px;
}

.cert-qr-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 80px;
    height: 80px;
}

/* Answers details lists */
.answers-history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.history-mission-block {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(204, 160, 58, 0.2);
    border-radius: 6px;
    padding: 15px;
}

.history-mission-title {
    font-family: var(--font-heading);
    color: var(--gold-light);
    font-size: 0.95rem;
    margin-bottom: 10px;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    padding-bottom: 5px;
}

.history-answers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    font-size: 0.8rem;
}

.history-answer-item strong {
    color: var(--cream-dark);
}

.history-answer-item p {
    color: var(--cream);
    margin-top: 2px;
    background: rgba(255,255,255,0.05);
    padding: 4px 8px;
    border-radius: 4px;
}

/* KEY ANIMATIONS DEFINITIONS */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes modalPop {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes key-insert {
    0% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    60% { transform: translate(-50%, -50%) rotate(0deg); }
    80% { transform: translate(-50%, -50%) rotate(90deg); opacity: 1; }
    100% { transform: translate(-50%, -50%) rotate(90deg) scale(0); opacity: 0; }
}

@keyframes portalGlow {
    0% { opacity: 0.3; }
    100% { opacity: 0.9; }
}

@keyframes glow-pulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 10px var(--gold-light)); }
    50% { transform: scale(1.05); filter: drop-shadow(0 0 25px var(--gold-light)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 10px var(--gold-light)); }
}

.animate-pulse {
    animation: glow-pulse 1.5s infinite ease-in-out;
}

.animate-shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
    20%, 40%, 60%, 80% { transform: translateX(6px); }
}

.animate-float {
    animation: float 2.5s infinite ease-in-out;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* RESPONSIVE LAYOUTS */
@media (max-width: 1024px) {
    .student-grid {
        grid-template-columns: 1fr;
    }
    .student-aside {
        order: 2;
    }
    .student-main {
        order: 1;
    }
    .teacher-layout {
        grid-template-columns: 80px 1fr;
    }
    .sidebar-brand h4, .sidebar-brand span, .sidebar-menu li span, .sidebar-menu li div {
        display: none;
    }
    .sidebar-menu li {
        justify-content: center;
        padding: 15px 0;
    }
    .sidebar-brand {
        justify-content: center;
        padding: 15px 0;
    }
    .teacher-sidebar h4 { display: none; }
}

@media (max-width: 768px) {
    .rpg-topbar {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
    }
    .player-profile {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .topbar-stats {
        width: 100%;
        justify-content: space-around;
        gap: 10px;
    }
    .topbar-actions {
        width: 100%;
        justify-content: center;
    }
    .qa-grid {
        grid-template-columns: 1fr;
    }
    .qa-full-width {
        grid-column: span 1;
    }
    .clues-grid {
        grid-template-columns: 1fr;
    }
    .teacher-grid-3, .teacher-grid-2 {
        grid-template-columns: 1fr;
    }
    .teacher-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .teacher-stats-bar {
        width: 100%;
        flex-wrap: wrap;
    }
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* Rounds Navigation Sidebar inside Student View */
.rounds-nav-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.round-nav-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.round-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(230, 193, 92, 0.3);
    transform: translateY(-2px);
}

.round-nav-item.active {
    background: linear-gradient(135deg, rgba(46, 76, 53, 0.6) 0%, rgba(26, 46, 32, 0.8) 100%);
    border: 1.5px solid var(--gold);
    box-shadow: 0 0 12px rgba(230, 193, 92, 0.25);
}

.round-nav-item.completed {
    border-left: 4px solid var(--success);
}

.round-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.round-nav-header strong {
    font-family: var(--font-heading);
    color: var(--gold-light);
}

.round-nav-item.completed .round-nav-header strong {
    color: var(--success-light);
}

.round-nav-title {
    margin-top: 5px;
    font-size: 0.8rem;
    color: var(--cream-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
