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

:root {
    --bg-void: #07060d;
    --bg-panel: rgba(15, 13, 28, 0.94);
    --bg-card: rgba(24, 20, 44, 0.88);
    --purple-deep: #241445;
    --purple-glow: #7c3aed;
    --cyan-neon: #06b6d4;
    --cyan-bright: #22d3ee;
    --gold-rune: #eab308;
    --danger: #ef4444;
    --success: #10b981;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-glow: rgba(34, 211, 238, 0.35);
    --font-thai: 'Noto Sans Thai', sans-serif;
    --font-display: 'Cinzel', 'Noto Sans Thai', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg-void);
    background-image:
        radial-gradient(circle at 20% 20%, rgba(124, 58, 237, 0.18), transparent 45%),
        radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.15), transparent 45%);
    color: var(--text-main);
    font-family: var(--font-thai);
    line-height: 1.65;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

body.font-large { font-size: 18px; }

.rune-header {
    border-bottom: 1px solid var(--border-glow);
    background: linear-gradient(90deg, rgba(7,6,13,0.95), rgba(36,20,69,0.85), rgba(7,6,13,0.95));
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    position: sticky;
    top: 0;
    z-index: 50;
}

.brand-badge { display: flex; align-items: center; gap: 10px; }
.rune-symbol { color: var(--cyan-bright); font-size: 1.4rem; text-shadow: 0 0 10px var(--cyan-neon); }
.brand-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    background: linear-gradient(90deg, #fff, var(--cyan-bright));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.35);
    color: var(--cyan-bright);
}
.pill-gold {
    background: rgba(234, 179, 8, 0.15);
    border-color: rgba(234, 179, 8, 0.45);
    color: #fde047;
}
.pill-purple {
    background: rgba(124, 58, 237, 0.2);
    border-color: rgba(124, 58, 237, 0.5);
    color: #d8b4fe;
}

.app-container {
    flex: 1;
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.screen { display: none; animation: fadeIn 0.3s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.hero-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-glow);
    border-radius: 16px;
    padding: 36px 24px;
    text-align: center;
    box-shadow: 0 0 40px rgba(124, 58, 237, 0.2), inset 0 0 30px rgba(6, 182, 212, 0.08);
}

.hero-panel::before {
    content: "◈ ⟡ ◈ ELYSIUM PROTOCOL ◈ ⟡ ◈";
    display: block;
    font-size: 0.75rem;
    letter-spacing: 3px;
    color: var(--cyan-neon);
    margin-bottom: 12px;
}

.game-main-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: 3px;
    color: #ffffff;
    text-shadow: 0 0 25px rgba(34, 211, 238, 0.55), 0 0 50px rgba(124, 58, 237, 0.5);
    line-height: 1.2;
}

.game-subtitle { font-size: clamp(1rem, 2.5vw, 1.35rem); color: var(--cyan-bright); font-weight: 600; margin-top: 6px; }
.game-tagline {
    margin: 16px auto 28px;
    max-width: 620px;
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.98rem;
    padding: 10px 16px;
    border-left: 2px solid var(--purple-glow);
    border-right: 2px solid var(--purple-glow);
    background: rgba(124, 58, 237, 0.08);
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    max-width: 760px;
    margin: 0 auto;
}

.btn-cyber {
    background: linear-gradient(135deg, rgba(36, 20, 69, 0.9), rgba(15, 13, 28, 0.95));
    border: 1px solid rgba(34, 211, 238, 0.4);
    color: var(--text-main);
    font-family: var(--font-thai);
    font-size: 0.98rem;
    font-weight: 600;
    padding: 13px 18px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
}

.btn-cyber:hover:not(:disabled), .btn-cyber:active:not(:disabled) {
    border-color: var(--cyan-bright);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.45), rgba(6, 182, 212, 0.25));
    box-shadow: 0 0 16px rgba(34, 211, 238, 0.35);
}

.btn-cyber:disabled { opacity: 0.42; cursor: not-allowed; }
.btn-primary { border-color: var(--cyan-bright); background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(124, 58, 237, 0.45)); }
.btn-danger { border-color: rgba(239, 68, 68, 0.5); color: #fca5a5; }
.btn-sm { padding: 7px 12px; font-size: 0.88rem; min-height: 38px; }

.panel-box {
    background: var(--bg-panel);
    border: 1px solid var(--border-glow);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.panel-title { font-size: 1.25rem; font-weight: 700; color: var(--cyan-bright); }

/* Workspace Sub-Navigation Tabs */
.workspace-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(34, 211, 238, 0.2);
}

.ws-tab {
    background: rgba(24, 20, 44, 0.85);
    border: 1px solid rgba(124, 58, 237, 0.4);
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: 10px;
    font-family: var(--font-thai);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
}

.ws-tab.active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.28), rgba(124, 58, 237, 0.45));
    border-color: var(--cyan-bright);
    color: #fff;
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.3);
}

.ws-pane { display: none; }
.ws-pane.active { display: block; animation: fadeIn 0.25s ease; }

/* Grid & Cards */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }

.card-dark {
    background: var(--bg-card);
    border: 1px solid rgba(124, 58, 237, 0.38);
    border-radius: 12px;
    padding: 16px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 12px 0;
}

.stat-cell {
    background: rgba(7, 6, 13, 0.65);
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}

.stat-label { font-size: 0.78rem; color: var(--text-muted); }
.stat-val { font-size: 1.15rem; font-weight: 700; color: var(--cyan-bright); }

/* Progress Bars */
.bar-wrap { background: rgba(0, 0, 0, 0.5); border-radius: 999px; height: 10px; overflow: hidden; margin: 4px 0 10px; border: 1px solid rgba(255,255,255,0.1); }
.bar-hp { background: linear-gradient(90deg, #10b981, #34d399); height: 100%; }
.bar-mp { background: linear-gradient(90deg, #06b6d4, #38bdf8); height: 100%; }
.bar-exp { background: linear-gradient(90deg, #eab308, #facc15); height: 100%; }

/* Scene Placeholder Frame */
.scene-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 320px;
    border-radius: 12px;
    border: 1px dashed var(--cyan-neon);
    background: linear-gradient(160deg, #0d0b1a 0%, #1c1033 50%, #091926 100%);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-bottom: 16px;
}

.scene-badge {
    display: inline-block;
    background: rgba(234, 179, 8, 0.15);
    border: 1px solid var(--gold-rune);
    color: #fde047;
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 6px;
    width: fit-content;
}

.scene-desc-box {
    background: rgba(7, 6, 13, 0.8);
    border-left: 3px solid var(--cyan-bright);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.tts-bar {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.tts-controls { display: flex; gap: 6px; flex-wrap: wrap; }

.save-slot-list { display: flex; flex-direction: column; gap: 12px; }
.save-slot-card {
    background: var(--bg-card);
    border: 1px solid rgba(124, 58, 237, 0.4);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.tab-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab-btn {
    background: rgba(24, 20, 44, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-thai);
    font-size: 0.88rem;
}
.tab-btn.active { border-color: var(--cyan-bright); color: var(--cyan-bright); background: rgba(6, 182, 212, 0.15); }

.codex-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.codex-item { background: var(--bg-card); border: 1px solid rgba(124, 58, 237, 0.3); border-radius: 10px; padding: 14px; }
.codex-item h4 { color: var(--cyan-bright); margin-bottom: 6px; }

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    left: 20px;
    max-width: 480px;
    margin: 0 auto;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid var(--cyan-bright);
    color: #fff;
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7);
    z-index: 100;
    text-align: center;
    display: none;
}
.toast.show { display: block; animation: fadeIn 0.25s ease; }

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 12px;
    flex-wrap: wrap;
}

select, input[type="range"] {
    background: #1e1b38;
    color: #fff;
    border: 1px solid var(--cyan-neon);
    padding: 6px 10px;
    border-radius: 6px;
    font-family: var(--font-thai);
}
