:root {
    --bg-color: #0b0c10;
    --text-color: #c5c6c7;
    --accent-color: #66fcf1;
    --panel-bg: rgba(31, 40, 51, 0.85);
    --gold: #d4af37;
    --gold-hover: #f1d570;
    --gold-soft: rgba(212, 175, 55, 0.2);
    --positive: #7CFC00;
    --danger: #ff6b6b;
    --font-heading: 'Cinzel', serif;
    --font-body: 'Lora', serif;
    --radius: 8px;
    --radius-lg: 15px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at center, #1f2833 0%, #0b0c10 100%);
    color: var(--text-color);
    font-family: var(--font-body);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

#game-container {
    width: 90%;
    max-width: 800px;
    height: 90vh;
    height: 90dvh;
    background: var(--panel-bg);
    border: 2px solid var(--gold);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 30px;
    box-sizing: border-box;
}

.screen.active { display: flex; }

/* --- Kezdőképernyő --- */
#start-screen {
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    background-image: linear-gradient(rgba(11, 12, 16, 0.55), rgba(11, 12, 16, 0.80)), url("assets/bg.svg");
    background-size: cover;
    background-position: center;
}

.start-inner {
    position: relative;
    z-index: 2;
    max-width: 560px;
}

h1 {
    font-family: var(--font-heading);
    color: var(--gold);
    font-size: clamp(2.1rem, 6vw, 3rem);
    margin: 0 0 10px;
    letter-spacing: 1px;
}

.glow-text {
    text-shadow: 0 0 16px rgba(212, 175, 55, 0.55), 0 0 34px rgba(212, 175, 55, 0.22);
}

.start-subtitle {
    font-family: var(--font-heading);
    color: #c9b66a;
    font-size: 0.95rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin: 0 0 18px;
}

.start-desc {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #c2c5cb;
    margin: 0 auto 28px;
    max-width: 520px;
}

.hl-trust { color: var(--gold); }
.hl-compass { color: var(--positive); }

.start-buttons {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.start-note {
    color: #a8aeb8;
    font-size: 0.85rem;
    margin-top: 22px;
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

label {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--gold);
    margin-bottom: 10px;
}

input[type="text"] {
    padding: 12px 20px;
    font-size: 1.2rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--gold);
    color: #fff;
    border-radius: var(--radius);
    font-family: var(--font-body);
    text-align: center;
    outline: none;
    transition: box-shadow 0.3s;
}

input[type="text"]::placeholder {
    color: rgba(197, 198, 199, 0.45);
    font-style: italic;
}

input[type="text"]:focus { box-shadow: 0 0 10px rgba(212, 175, 55, 0.5); }

/* --- Gombok --- */
.magic-btn {
    padding: 12px 25px;
    font-size: 1.15rem;
    font-family: var(--font-heading);
    background: transparent;
    color: var(--gold);
    border: 2px solid var(--gold);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.25s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.magic-btn:hover {
    background: var(--gold);
    color: var(--bg-color);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
}

.magic-btn:active { transform: translateY(1px); box-shadow: 0 0 10px rgba(212, 175, 55, 0.35); }

.magic-btn.secondary {
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold-hover);
}
.magic-btn.secondary:hover { background: var(--gold); color: var(--bg-color); }

/* --- Játékképernyő --- */
#play-screen {
    position: relative;
    background-image: linear-gradient(rgba(11, 12, 16, 0.90), rgba(11, 12, 16, 0.94)), url("assets/bg.svg");
    background-size: cover;
    background-position: center bottom;
}

#stats-bar {
    order: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 10px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    margin-bottom: 20px;
    font-family: var(--font-heading);
    color: var(--gold);
}

.stat {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--gold-soft);
    white-space: nowrap;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#stat-trust, #stat-compass { font-weight: 700; transition: color 0.3s; }

/* Kritikus mérő-érték kiemelése a pirulán (a JS togglézi a stat-high/stat-low osztályt) */
.stat.stat-high { border-color: rgba(124, 252, 0, 0.5); box-shadow: 0 0 8px rgba(124, 252, 0, 0.18); }
.stat.stat-low { border-color: rgba(255, 107, 107, 0.5); box-shadow: 0 0 8px rgba(255, 107, 107, 0.18); }

.clue-badge {
    cursor: pointer;
    color: var(--gold);
    font-family: var(--font-heading);
    min-height: 38px;
}
.clue-badge:hover { border-color: var(--gold); background: rgba(212, 175, 55, 0.1); }

#story-area {
    order: 2;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 15px;
    margin-bottom: 20px;
    font-size: 1.2rem;
    line-height: 1.65;
    scrollbar-width: thin;
    scrollbar-color: var(--gold) rgba(0, 0, 0, 0.2);
}
#story-area:focus { outline: none; }

#story-area::-webkit-scrollbar,
#clue-panel::-webkit-scrollbar { width: 8px; }
#story-area::-webkit-scrollbar-track,
#clue-panel::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); border-radius: 4px; }
#story-area::-webkit-scrollbar-thumb,
#clue-panel::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 4px; }

#choices-area {
    order: 3;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.choice-btn {
    padding: 15px;
    font-size: 1.1rem;
    font-family: var(--font-body);
    background: rgba(0, 0, 0, 0.6);
    color: var(--text-color);
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.1s, box-shadow 0.2s;
    position: relative;
}

.choice-btn:hover { background: rgba(212, 175, 55, 0.1); border-color: var(--gold); color: #fff; }
.choice-btn:active { transform: translateY(1px) scale(0.995); background: rgba(212, 175, 55, 0.16); }

.choice-btn.required-stat {
    border-left: 4px solid var(--gold);
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.10), rgba(0, 0, 0, 0.6) 62%);
}
.choice-btn.required-stat:hover { box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.3); }

.choice-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    border-color: rgba(120, 110, 80, 0.5);
    background: rgba(0, 0, 0, 0.45);
    filter: grayscale(0.4);
}
.choice-btn:disabled:hover { background: rgba(0, 0, 0, 0.45); color: var(--text-color); transform: none; }

#control-bar {
    order: 4;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(212, 175, 55, 0.18);
}
.control-btn {
    background: transparent;
    color: #c2b270;
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: var(--radius);
    min-height: 44px;
    padding: 8px 14px;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
}
.control-btn:hover:not(:disabled) { color: var(--gold); border-color: var(--gold); background: rgba(212, 175, 55, 0.08); }
.control-btn:active:not(:disabled) { transform: translateY(1px); }
.control-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* --- Egységes fókuszgyűrű (billentyűzet-akadálymentesség) --- */
.choice-btn:focus-visible,
.magic-btn:focus-visible,
.control-btn:focus-visible,
.clue-badge:focus-visible {
    outline: 2px solid var(--gold-hover);
    outline-offset: 2px;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.55);
}
input[type="text"]:focus-visible { outline: 2px solid var(--gold-hover); outline-offset: 1px; }

/* --- Nyom-tár párbeszéd --- */
#clue-panel {
    position: absolute;
    top: 70px;
    right: 20px;
    width: 280px;
    max-height: 60%;
    overflow-y: auto;
    background: var(--panel-bg);
    border: 1px solid var(--gold);
    border-radius: var(--radius);
    padding: 15px;
    z-index: 20;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
    scrollbar-width: thin;
    scrollbar-color: var(--gold) rgba(0, 0, 0, 0.2);
}
#clue-panel h3 { font-family: var(--font-heading); color: var(--gold); margin-top: 0; }
#clue-panel ul { list-style: none; padding-left: 0; margin: 0 0 4px; }
#clue-panel li { padding: 6px 0; border-bottom: 1px solid rgba(212, 175, 55, 0.15); }
#clue-panel li:last-child { border-bottom: none; }
#clue-panel .empty { color: #9aa0a6; font-style: italic; }
#clue-panel .magic-btn { margin-top: 12px; font-size: 0.9rem; padding: 6px 14px; }

.hidden { display: none !important; }

/* --- Értesítések (toast) --- */
#toast-area {
    position: absolute;
    bottom: 84px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    width: max-content;
    max-width: 90%;
}
.toast {
    background: rgba(0, 0, 0, 0.88);
    color: var(--gold);
    border: 1px solid var(--gold);
    border-radius: var(--radius);
    padding: 10px 18px;
    margin-top: 8px;
    font-family: var(--font-body);
    text-align: center;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
    animation: toastIn 0.35s ease both;
}

/* --- Animációk --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.7s forwards; }

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

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}
.shake { animation: shake 0.5s; }

/* --- Mozgáscsökkentés tisztelete --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .fade-in { opacity: 1 !important; transform: none !important; }
}

/* --- Mobil reszponzivitás --- */
@media (max-width: 600px) {
    body { overflow: auto; }
    #game-container {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .screen { padding: 18px 16px; }
    .start-desc { font-size: 0.98rem; }
    #stats-bar { gap: 6px; padding-bottom: 12px; margin-bottom: 14px; }
    .stat { font-size: 0.85rem; padding: 4px 9px; gap: 5px; }
    #story-area { font-size: 1.05rem; padding-right: 8px; margin-bottom: 14px; }
    #choices-area { gap: 12px; }
    .choice-btn { padding: 13px 14px; font-size: 1rem; }
    .magic-btn { padding: 11px 18px; font-size: 1.05rem; }
    input[type="text"] { font-size: 1rem; }
    #toast-area { bottom: 92px; }
    #clue-panel {
        top: auto;
        right: 0;
        left: 0;
        bottom: 0;
        width: auto;
        max-height: 70%;
        border-radius: 12px 12px 0 0;
        border-left: none;
        border-right: none;
    }
}
