* { box-sizing: border-box; }

:root {
    /* A játéknak egyetlen, szándékosan sötét kinézete van. */
    color-scheme: dark;
    /* Meleg, földszínű paletta: bőr, fa, faszén és a tűz borostyánszíne. */
    --bg: #15120e;
    --panel: #211b15;
    --panel-2: #2c241b;
    --border: #4a3c2c;
    --text: #efe5d3;
    --muted: #a8977c;
    --accent: #d98c3a;
    --danger: #d9534a;
    --ok: #6cb85c;
}

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
}

.hidden { display: none !important; }

.screen {
    display: flex;
    flex-direction: column;
    height: 100%;
}

button {
    background: linear-gradient(#372c21, #261e16);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: inset 0 1px 0 rgba(255, 230, 190, 0.08);
    padding: 7px 12px;
    font: inherit;
    cursor: pointer;
}
button:hover { border-color: var(--accent); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: linear-gradient(#e8a24c, #b8702a); border-color: #e8a24c; color: #1e140a; font-weight: 700; }
button.danger { color: var(--danger); }

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    background: linear-gradient(#2a2119, #1c1611);
    border-bottom: 2px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar .hint { color: var(--muted); margin: 0; flex: 1; }

input, select {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 10px;
    font: inherit;
}

.bar { height: 4px; background: var(--panel-2); border-radius: 2px; margin: 2px 0 6px; }
.bar div { height: 100%; background: var(--accent); border-radius: 2px; }
.sel-info .bar { height: 5px; background: rgba(0, 0, 0, 0.4); }

/* Ikonok (icons.js) */
.ico { width: 20px; height: 20px; vertical-align: middle; flex-shrink: 0; }
.ico-sm { width: 15px; height: 15px; vertical-align: -3px; }

/* Csata */
.battle-top { gap: 10px; }
.battle-top button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; white-space: nowrap; }
.battle-top button .ico { width: 18px; height: 18px; }
#resources { display: flex; flex-wrap: wrap; gap: 6px; min-width: 120px; }
.res {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 10px 2px 4px; border-radius: 14px;
    background: rgba(0, 0, 0, 0.3); border: 1px solid #3f3326;
    font-size: 15px; font-variant-numeric: tabular-nums;
}
.res .ico { width: 22px; height: 22px; }
.res.warn { border-color: #a0402a; }
.res.era { font-weight: 600; color: var(--accent); white-space: nowrap; }
.res.warn b { color: #ff9a6a; }
.res.idle b { color: #9fc0ff; }
#daytime { display: inline-flex; align-items: center; gap: 5px; }
#daytime { white-space: nowrap; color: var(--muted); }
#ai-note { flex: 1; color: #f0a39e; }
.battle-area { position: relative; flex: 1; min-height: 0; }
#game, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#game { cursor: default; }
#overlay { pointer-events: none; }

.build-bar {
    background: linear-gradient(#241d16, #18130f);
    border-top: 2px solid var(--border);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.45);
    padding: 8px 16px;
}
.panel-row { display: flex; gap: 12px; align-items: stretch; height: 140px; }
.minimap {
    width: 240px; height: 135px; flex-shrink: 0; align-self: center;
    border: 2px solid #5a4a36; border-radius: 6px; cursor: pointer;
    box-shadow: 0 0 0 1px #120e0a, 0 3px 8px rgba(0, 0, 0, 0.5);
    background: #0e0c09;
}
#build-buttons { overflow-y: auto; }
#build-buttons { display: flex; gap: 8px; flex-wrap: wrap; align-content: flex-start; flex: 1; }
.sel-info {
    width: 300px; flex-shrink: 0; min-height: 56px;
    background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
    padding: 6px 10px; font-size: 13px; line-height: 1.45; overflow-y: auto;
}
.sel-info:empty { visibility: hidden; }
.sel-info b { font-size: 14px; }
.info-portrait { display: flex; gap: 10px; align-items: flex-start; }
.info-text { min-width: 0; flex: 1; }
.portrait, .tile-img, .panel-portrait {
    background: radial-gradient(circle at 50% 38%, #56664a, #1c2017 75%);
    border: 1px solid #5a4a36; border-radius: 8px;
}
.portrait { width: 76px; height: 76px; flex-shrink: 0; }
.tiles { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tile { position: relative; }
.tile-img { width: 40px; height: 40px; display: block; }
.tile b { position: absolute; right: 3px; bottom: 0; font-size: 12px; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.sel-info .muted { color: var(--muted); }
.sel-info .bar { margin: 3px 0 4px; }
.build-btn { display: flex; align-items: center; gap: 8px; text-align: left; position: relative; }
.build-btn canvas, .build-btn .panel-portrait, .build-btn .panel-svg { width: 48px; height: 48px; flex-shrink: 0; }
.build-btn .panel-svg { padding: 6px; background: rgba(0, 0, 0, 0.25); border-radius: 8px; border: 1px solid #3f3326; }
.build-btn small { color: var(--muted); display: block; }
.build-btn.in-progress .panel-svg,
.build-btn.in-progress .panel-portrait {
    background: linear-gradient(to top, rgba(230, 170, 70, 0.6) var(--progress), rgba(0, 0, 0, 0.25) var(--progress));
    border-color: var(--accent);
}
.build-btn.in-progress::after {
    content: ''; position: absolute; left: 4px; bottom: 2px; height: 3px; border-radius: 2px;
    width: calc((100% - 8px) * var(--frac, 0)); background: var(--accent); pointer-events: none;
}
.build-btn .queue {
    position: absolute; top: -6px; right: -6px;
    background: var(--accent); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px;
}
.build-btn .queue.cancelable { cursor: pointer; }
.build-btn .queue.cancelable:hover { background: #b33; }
.build-btn .queue.cancelable:hover::after { content: ' ✕'; }
button.off { opacity: 0.55; }
.toggle { display: flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.panel-note { color: var(--muted); padding: 14px 4px; }
.panel-icon { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; font-size: 30px; }
.controls-help { color: var(--muted); font-size: 12px; margin-top: 6px; }

.pause-note {
    position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    font-size: 34px; font-weight: 700; color: #ffd98a; letter-spacing: 0.04em;
    background: rgba(26, 21, 16, 0.78); border: 1px solid var(--border); border-radius: 10px; padding: 14px 26px;
    pointer-events: none; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}
.pause-note small { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.pause-note.hidden { display: none; }
.tip-card {
    position: absolute; left: 12px; top: 12px; width: min(340px, calc(100% - 24px));
    background: rgba(33, 27, 21, 0.95); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px;
    display: grid; gap: 6px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}
.tip-card .tip-title { color: var(--accent); }
.tip-card .tip-title::before { content: '💡 '; }
.tip-card .tip-text { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--text); }
.tip-card .tip-buttons { display: flex; gap: 8px; }
.tip-card .tip-off { opacity: 0.7; font-size: 12px; }
.alert-note {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
    background: rgba(90, 20, 14, 0.9); border: 1px solid #e0603f; border-radius: 8px; padding: 6px 16px;
    color: #ffe2c8; font-weight: 600; pointer-events: none; white-space: nowrap;
    box-shadow: 0 0 14px rgba(224, 96, 63, 0.45);
}
.alert-note small { font-weight: 400; color: #f0bfa6; margin-left: 8px; }
#pause-toggle.on, #speed-toggle.on { color: #ffd98a; border-color: rgba(255, 217, 138, 0.6); }

.hover-info {
    position: absolute;
    left: 12px;
    bottom: 12px;
    background: rgba(26, 21, 16, 0.92);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    max-width: 420px;
    pointer-events: none;
}

.overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex; align-items: center; justify-content: center;
}
.overlay-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 40px;
    text-align: center;
}
.overlay-box h2 { font-size: 24px; color: var(--text); text-transform: none; letter-spacing: 0; margin-bottom: 18px; }
.overlay-box { max-height: 92vh; overflow-y: auto; }

.feedback-button.has-errors::after { content: attr(data-errors); margin-left: 6px; font-size: 11px; color: #fff; background: var(--danger); border-radius: 8px; padding: 1px 6px; }
.feedback-overlay { z-index: 50; }
.feedback-box { text-align: left; width: min(560px, 92vw); display: grid; gap: 12px; }
.feedback-box h2 { margin-bottom: 0; }
.feedback-box p { color: var(--muted); font-size: 14px; margin: 0; }
.feedback-box .field { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.feedback-box .field input { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font: inherit; }
.feedback-box textarea { width: 100%; resize: vertical; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font: inherit; }
.feedback-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.feedback-status { color: var(--ok) !important; min-height: 1em; }
.feedback-hint { font-size: 12px !important; }

/* Kezdőképernyő és főmenü: festett háttérkép lassú kameramozgással, a tábortűz pislákol, parázs száll (js/title.js). */
.title-screen { position: relative; overflow: hidden; background: #0b0a09; }
.title-bg { position: absolute; inset: 0; overflow: hidden; }
.title-pan { position: absolute; inset: 0; animation: title-pan 60s ease-in-out infinite alternate; transform-origin: 70% 75%; }
.title-art { position: absolute; inset: 0; background: url("assets/ui/title.jpg") center / cover no-repeat; }
.title-fireglow {
    position: absolute; width: 34vmax; height: 34vmax; margin: -17vmax 0 0 -17vmax; border-radius: 50%; pointer-events: none;
    background: radial-gradient(circle, rgba(255, 150, 60, 0.32), rgba(255, 110, 30, 0.1) 40%, transparent 70%);
    mix-blend-mode: screen; animation: fire-flicker 2.3s ease-in-out infinite;
}
#embers { position: absolute; inset: 0; width: 100%; height: 100%; }
.title-vignette {
    position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(ellipse at 65% 55%, transparent 35%, rgba(5, 4, 3, 0.75) 100%),
        linear-gradient(to bottom, rgba(5, 4, 3, 0.35), transparent 25%, transparent 70%, rgba(5, 4, 3, 0.6));
}
@keyframes title-pan { from { transform: scale(1.04) translate(0, 0); } to { transform: scale(1.12) translate(-1.5%, -1%); } }
@keyframes fire-flicker {
    0%, 100% { opacity: 0.85; transform: scale(1); }
    23% { opacity: 1; transform: scale(1.05); }
    41% { opacity: 0.7; transform: scale(0.97); }
    67% { opacity: 0.95; transform: scale(1.03); }
}
@media (prefers-reduced-motion: reduce) {
    .title-pan, .title-fireglow, .press-start { animation: none; }
}

.game-title {
    font-family: "Cinzel", Georgia, serif; font-weight: 900; font-size: clamp(48px, 9vw, 128px); line-height: 1; margin: 0;
    letter-spacing: 0.04em; color: #f6dca4;
    background: linear-gradient(180deg, #fff1c8 0%, #f2c46e 45%, #c46a26 100%); -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 3px 0 rgba(40, 18, 4, 0.9)) drop-shadow(0 0 28px rgba(255, 140, 50, 0.35));
}
.game-title em { font-style: normal; font-weight: 500; font-size: 0.42em; vertical-align: 0.55em; letter-spacing: 0.08em; }
.game-title.small { font-size: clamp(34px, 3.4vw, 52px); }

.splash {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 16px; cursor: pointer; z-index: 2;
}
.splash .game-title { animation: title-rise 1.6s ease-out both; }
.tagline {
    font-family: "Cinzel", Georgia, serif; font-size: clamp(13px, 1.6vw, 20px); letter-spacing: 0.18em; color: #e8d3a8;
    margin: 18px 0 0; text-shadow: 0 2px 8px #000; animation: title-rise 1.6s 0.3s ease-out both;
}
.press-start {
    position: absolute; bottom: 12vh; font-family: "Cinzel", Georgia, serif; letter-spacing: 0.25em; font-size: 15px; color: #f3dfb4;
    text-shadow: 0 0 12px rgba(255, 150, 60, 0.8), 0 2px 4px #000; animation: press-pulse 2.4s ease-in-out infinite;
}
.splash.leaving { opacity: 0; transition: opacity 0.6s ease; pointer-events: none; }
@keyframes title-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes press-pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

.main-menu {
    position: absolute; inset: 0; z-index: 2; display: flex; gap: 32px; padding: 5vh 4vw; align-items: stretch;
    animation: menu-in 0.7s ease-out both;
}
@keyframes menu-in { from { opacity: 0; } to { opacity: 1; } }
.menu-column {
    width: 340px; flex: 0 0 340px; display: flex; flex-direction: column; padding: 28px 26px; border-radius: 6px;
    background: linear-gradient(180deg, rgba(14, 11, 8, 0.82), rgba(14, 11, 8, 0.62));
    border: 1px solid rgba(217, 140, 58, 0.25); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px);
}
.menu-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 28px; }
.menu-item {
    all: unset; box-sizing: border-box; cursor: pointer; padding: 10px 14px 10px 18px; border-radius: 4px; position: relative;
    font-family: "Cinzel", Georgia, serif; font-weight: 700; font-size: 21px; letter-spacing: 0.04em; color: #ecdcbc;
    transition: color 0.15s, background 0.15s, padding 0.15s;
}
.menu-item small {
    display: block; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-weight: 400; font-size: 12px;
    letter-spacing: 0; color: var(--muted); margin-top: 1px;
}
.menu-item::before {
    content: ""; position: absolute; left: 0; top: 18%; bottom: 18%; width: 3px; border-radius: 2px; background: #f08a32;
    box-shadow: 0 0 10px #ff9a40; opacity: 0; transition: opacity 0.15s;
}
.menu-item:hover:not(:disabled), .menu-item:focus-visible, .menu-item.active {
    color: #ffd38a; background: linear-gradient(90deg, rgba(240, 138, 50, 0.18), transparent); padding-left: 24px;
}
.menu-item:hover:not(:disabled)::before, .menu-item:focus-visible::before, .menu-item.active::before { opacity: 1; }
.menu-item:disabled { opacity: 0.45; cursor: default; }
.menu-item.has-errors::after { content: attr(data-errors); margin-left: 8px; font-size: 11px; color: var(--danger); font-family: system-ui, sans-serif; }
.menu-version { margin-top: auto; padding-top: 18px; font-size: 11px; color: rgba(168, 151, 124, 0.7); }

.menu-panels { flex: 1; min-width: 0; display: flex; align-items: flex-start; justify-content: flex-end; }
.menu-panel {
    width: min(620px, 100%); max-height: 100%; overflow-y: auto; padding: 26px 30px; border-radius: 6px;
    background: rgba(18, 14, 10, 0.86); border: 1px solid rgba(217, 140, 58, 0.25); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px); animation: panel-in 0.25s ease-out both;
}
@keyframes panel-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.menu-panel h2 { font-family: "Cinzel", Georgia, serif; font-size: 26px; margin: 0 0 14px; color: #f2d398; letter-spacing: 0.04em; }
.menu-panel h2 small { font-family: system-ui, sans-serif; font-size: 13px; color: var(--muted); font-weight: 400; }
.menu-panel h3 { font-family: "Cinzel", Georgia, serif; font-size: 17px; margin: 18px 0 8px; color: #e8c88a; }
.menu-panel .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.menu-panel .field select, .menu-panel .field input { font-size: 14px; padding: 6px 8px; }
.menu-panel .toggle { display: block; margin-bottom: 10px; }
.menu-panel .primary.big { margin-top: 8px; }
.menu-sub { color: var(--muted); margin: 4px 0 16px; }
.map-desc { margin: -4px 0 12px; font-size: 12px; }
.menu-list { margin: 0 0 18px; padding-left: 18px; line-height: 1.6; color: #e3d6bd; }
.menu-credits { color: var(--muted); font-size: 14px; line-height: 1.9; margin: 0; }
.menu-credits a { color: #e8c88a; }
button.big { font-size: 17px; padding: 10px 22px; }
@media (max-width: 860px) {
    .main-menu { flex-direction: column; padding: 16px; gap: 16px; overflow-y: auto; }
    .menu-column { width: auto; flex: 0 0 auto; padding: 18px 16px; }
    .menu-nav { margin-top: 14px; }
    .menu-item { font-size: 18px; }
    .menu-panels { justify-content: stretch; }
    .menu-panel { width: 100%; max-height: none; padding: 18px 16px; }
}

/* Lobby (js/lobby.js) */
.lobby-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.lobby-row .field { flex: 1; min-width: 160px; margin-bottom: 0; }
.lobby-status { font-size: 12px; color: var(--muted); margin: 0 0 14px; padding: 6px 10px; border-left: 3px solid var(--accent); background: rgba(217, 140, 58, 0.08); }
.room-list { display: flex; flex-direction: column; gap: 6px; }
.room-list .empty { color: var(--muted); font-style: italic; padding: 10px 0; }
.room-entry { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 4px; background: rgba(44, 36, 27, 0.6); }
.room-entry .info { flex: 1; min-width: 0; }
.room-entry b { color: #f2d398; }
.room-entry small { display: block; color: var(--muted); }
.room-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.room-code { font-family: "Cinzel", Georgia, serif; font-size: 20px; letter-spacing: 0.25em; color: #ffd38a; }
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin: 10px 0; }
.slot { padding: 12px; border-radius: 4px; border: 1px solid var(--border); background: rgba(44, 36, 27, 0.6); border-left: 6px solid var(--slot-color, #555); }
.slot.empty { opacity: 0.55; border-left-color: #444; font-style: italic; }
.slot b { display: block; color: #f3e6cc; }
.slot small { color: var(--muted); }
.slot .ready { color: var(--ok); font-weight: 600; }
.slot .not-ready { color: var(--muted); }
.chat { margin-top: 10px; border: 1px solid var(--border); border-radius: 4px; background: rgba(10, 8, 6, 0.5); }
.chat-log { height: 130px; overflow-y: auto; padding: 8px 10px; font-size: 13px; line-height: 1.5; }
.chat-log .sys { color: var(--muted); font-style: italic; }
.chat-log b { color: #e8c88a; }
.chat form { display: flex; border-top: 1px solid var(--border); }
.chat input { flex: 1; border: 0; background: transparent; padding: 8px 10px; color: var(--text); }
.chat button { border-radius: 0; }
.room-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.room-actions .note { font-size: 12px; color: var(--muted); flex-basis: 100%; }

/* Funkció-bemutatók: lista a főmenüben, magyarázó doboz a csatatéren. */
.scenario-list { max-height: 60vh; overflow-y: auto; padding-right: 4px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin-top: 8px; }
.scenario-list button { text-align: left; padding: 8px 10px; }
.scenario-list button small { display: block; color: var(--muted); margin-top: 2px; }
.scenario-panel {
    position: absolute;
    right: 12px;
    top: 12px;
    width: min(360px, calc(100% - 24px));
    background: rgba(26, 21, 16, 0.92);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
}
.scenario-panel h4 { margin: 0 0 6px; }
.scenario-panel .caption { margin: 0 0 8px; color: var(--accent); }
.scenario-panel ul { margin: 0 0 8px; padding-left: 18px; color: var(--muted); max-height: 160px; overflow-y: auto; }
.scenario-panel .result { border-top: 1px solid var(--border); padding-top: 6px; margin-bottom: 8px; }
.scenario-panel .result p { margin: 2px 0; }
.scenario-panel button + button { margin-left: 6px; }
.spectator-side { margin: 0 0 6px; }
.spectator-side small { display: block; color: var(--muted); }
.spectator-side small.note { color: var(--accent); }
.spectator-side.player b, #scenario-panel span.player { color: #6aa8e8; }
.spectator-side.enemy b, #scenario-panel span.enemy { color: #e8736a; }
.spectator-speed button { margin-left: 4px; }
.spectator-speed button.active { outline: 2px solid var(--accent); }
.spectator-camera { margin-top: 6px; }
.spectator-camera button { margin-left: 4px; }
.spectator-camera button.active { outline: 2px solid var(--accent); }
.spectator-camera small.shot { display: block; color: var(--accent); margin-top: 4px; }

/* Futó rítus: a gomb és a felső sáv jelzése. */
.build-btn.active { outline: 2px solid #c9a0ff; outline-offset: -2px; }
.res.ritual b { color: #d8bfff; }

/* Tisztelet-győzelem visszaszámlálása. */
.victory-note { color: #ffd98a; font-weight: 600; padding: 2px 8px; border: 1px solid rgba(255, 217, 138, 0.5); border-radius: 4px; }
.victory-note.hidden { display: none; }

/* Meccs végi összesítő (Battle.showEndScreen): sötétített, elmosott csatatér előtt egy pergamen-sötét lap, fent az
   eredmény, alatta a két törzs pontszáma és a fülek. A kék törzs színe balra, a pirosé jobbra. */
.end-overlay {
    --blue: #7fb3ea; --red: #e98a80; --gold: #f2c36b;
    background: radial-gradient(ellipse at 50% 0%, rgba(40, 26, 12, 0.55), rgba(5, 3, 2, 0.88) 70%);
    backdrop-filter: blur(3px) saturate(0.7);
    z-index: 40; padding: 16px;
}
.end-overlay.end-loss { --gold: #c9b39a; background: radial-gradient(ellipse at 50% 0%, rgba(30, 18, 18, 0.6), rgba(4, 3, 3, 0.92) 70%); }
.end-screen {
    width: min(980px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
    background: linear-gradient(180deg, #2a2016, #1a140f 40%);
    border: 1px solid #5a4630; border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 220, 160, 0.08);
    padding: 0 0 22px; animation: end-in 0.6s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes end-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
.end-hero {
    position: relative; text-align: center; padding: 34px 24px 22px; overflow: hidden;
    background: radial-gradient(ellipse at 50% 120%, rgba(242, 140, 50, 0.32), transparent 65%);
    border-bottom: 1px solid #4a3a28;
}
.end-loss .end-hero { background: radial-gradient(ellipse at 50% 120%, rgba(120, 60, 50, 0.3), transparent 65%); }
.end-hero::after { content: ""; position: absolute; left: 15%; right: 15%; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.end-kicker { font-family: "Cinzel", Georgia, serif; font-size: 13px; letter-spacing: 0.35em; text-transform: uppercase; color: var(--muted); }
.end-hero h2 {
    font-family: "Cinzel", Georgia, serif; font-weight: 900; font-size: clamp(38px, 6vw, 64px); line-height: 1.05;
    margin: 6px 0 8px; color: var(--gold); letter-spacing: 0.04em;
    text-shadow: 0 0 28px rgba(242, 160, 70, 0.35), 0 2px 0 rgba(0, 0, 0, 0.6);
    animation: end-title 0.9s 0.15s cubic-bezier(.2, .8, .2, 1) both;
}
.end-loss .end-hero h2 { text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6); }
@keyframes end-title { from { opacity: 0; letter-spacing: 0.3em; } to { opacity: 1; letter-spacing: 0.04em; } }
.end-reason { margin: 0; color: #d8c6a6; font-size: 15px; }

.end-stats { display: grid; gap: 16px; padding: 18px 26px 0; text-align: left; }
.end-meta { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.end-meta span { font-size: 12px; color: var(--muted); background: rgba(255, 255, 255, 0.04); border: 1px solid #3e3124; border-radius: 999px; padding: 3px 10px; }

.end-score { display: grid; grid-template-columns: 170px 1fr 170px; gap: 18px; align-items: center; }
.end-team {
    display: grid; justify-items: center; gap: 2px; padding: 14px 8px; border-radius: 10px;
    background: rgba(255, 255, 255, 0.03); border: 1px solid #3e3124;
}
.end-team.player { border-top: 3px solid var(--blue); }
.end-team.enemy { border-top: 3px solid var(--red); }
.end-team.won { box-shadow: 0 0 0 1px rgba(242, 195, 107, 0.5), 0 0 24px rgba(242, 160, 70, 0.18); }
.end-team-name { font-family: "Cinzel", Georgia, serif; font-weight: 700; font-size: 16px; }
.end-team.player .end-team-name { color: var(--blue); }
.end-team.enemy .end-team-name { color: var(--red); }
.end-total { font-family: "Cinzel", Georgia, serif; font-size: 40px; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); }
.end-team-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.end-team.won .end-team-label { color: var(--gold); }

.end-parts, .end-duels { display: grid; gap: 7px; }
.duel { display: grid; grid-template-columns: 52px 1fr minmax(120px, auto) 1fr 52px; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.duel-label { text-align: center; font-size: 13px; color: #d8c6a6; white-space: nowrap; }
.duel-ico { width: 16px; height: 16px; vertical-align: -3px; }
.duel-v { font-size: 14px; color: var(--muted); }
.duel-v.player { text-align: right; }
.duel-v.lead { color: var(--text); font-weight: 700; }
.duel-bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.05); display: flex; overflow: hidden; }
.duel-bar.player { justify-content: flex-end; }
.duel-bar i { display: block; width: var(--w); border-radius: 4px; animation: bar-grow 0.9s 0.3s cubic-bezier(.2, .8, .2, 1) both; }
.duel-bar.player i { background: linear-gradient(90deg, rgba(127, 179, 234, 0.35), var(--blue)); transform-origin: right; }
.duel-bar.enemy i { background: linear-gradient(90deg, var(--red), rgba(233, 138, 128, 0.35)); transform-origin: left; }
@keyframes bar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.end-tabs { display: flex; gap: 4px; border-bottom: 1px solid #4a3a28; margin-top: 4px; }
.end-tabs button {
    background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0;
    padding: 8px 14px; color: var(--muted); font-family: "Cinzel", Georgia, serif; font-weight: 700; font-size: 14px; letter-spacing: 0.04em;
}
.end-tabs button:hover { color: var(--text); background: none; }
.end-tabs button.active { color: var(--gold); border-bottom-color: var(--gold); }
.end-tab { animation: panel-in 0.25s ease both; }
.end-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.end-charts { display: grid; gap: 10px; }
.end-h { font-family: "Cinzel", Georgia, serif; font-size: 15px; color: #e8c88a; margin: 18px 0 8px; }

.end-stats .chart { background: rgba(0, 0, 0, 0.22); border: 1px solid #3e3124; border-radius: 8px; padding: 8px 10px 6px; }
.end-stats .chart-title { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 12px; align-items: center; }
.end-stats .chart-title b { color: #d8c6a6; font-weight: 600; margin-right: auto; }
.end-stats .chart-title i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 4px; border-radius: 2px; }
.chart-body { position: relative; cursor: crosshair; }
.end-stats svg { width: 100%; height: auto; display: block; overflow: visible; }
.end-stats svg text { fill: var(--muted); font-size: 10px; }
.end-stats svg line.grid { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1; }
.end-stats svg line.axis { stroke: #5a4630; stroke-width: 1; }
.chart-cursor { position: absolute; top: 0; bottom: 16px; width: 1px; background: rgba(242, 195, 107, 0.6); pointer-events: none; }
.chart-tip {
    position: absolute; top: 4px; display: grid; gap: 1px; pointer-events: none; min-width: 120px;
    background: rgba(20, 15, 10, 0.94); border: 1px solid #5a4630; border-radius: 6px; padding: 5px 8px; font-size: 12px; font-variant-numeric: tabular-nums;
}
.chart-tip .player, .roster h4.player, .lane-name.player { color: var(--blue); }
.chart-tip .enemy, .roster h4.enemy, .lane-name.enemy { color: var(--red); }

.rosters { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.roster h4 { margin: 0 0 6px; font-size: 14px; display: flex; justify-content: space-between; align-items: baseline; }
.roster h4 small { color: var(--muted); font-weight: 400; font-size: 12px; }
.roster ul, .roster ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.roster li { display: grid; grid-template-columns: minmax(0, 1.2fr) 1fr 32px; gap: 8px; align-items: center; font-size: 13px; }
.roster li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster li b { text-align: right; font-variant-numeric: tabular-nums; }
.roster li.empty { display: block; color: var(--muted); font-style: italic; }
.roster-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.roster-bar i { display: block; height: 100%; width: var(--w); transform-origin: left; animation: bar-grow 0.8s cubic-bezier(.2, .8, .2, 1) both; }
.roster-bar.player i { background: var(--blue); }
.roster-bar.enemy i { background: var(--red); }
.tech-list li { grid-template-columns: 40px 20px 1fr; }
.tech-list time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.tech-list .ico { width: 18px; height: 18px; }

.timeline { display: grid; gap: 14px; padding: 14px 0 4px; }
.lane { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 10px; }
.lane-name { font-family: "Cinzel", Georgia, serif; font-weight: 700; font-size: 13px; text-align: right; }
.lane-track { position: relative; height: 34px; border-radius: 6px; background: rgba(0, 0, 0, 0.25); border: 1px solid #3e3124; }
.lane-track .era-band { position: absolute; top: 0; bottom: 0; }
.era-band { display: inline-block; }
.era-band.era-1 { background: rgba(140, 110, 80, 0.18); }
.era-band.era-2 { background: rgba(110, 150, 90, 0.26); }
.era-band.era-3 { background: rgba(214, 160, 70, 0.3); }
.tech-mark {
    position: absolute; top: 2px; transform: translateX(-50%); width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center; background: #2c241b; border: 1px solid #6a5438; font-size: 12px; cursor: help;
    animation: end-in 0.4s both;
}
.tech-mark.low { top: 10px; }
.tech-mark.era { border-color: var(--gold); box-shadow: 0 0 10px rgba(242, 195, 107, 0.5); z-index: 1; }
.tech-mark .ico { width: 16px; height: 16px; }
.lane-ticks { position: relative; height: 14px; margin-left: 106px; }
.lane-ticks span { position: absolute; transform: translateX(-50%); font-size: 10px; color: var(--muted); }
.era-legend { display: flex; gap: 16px; justify-content: center; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.era-legend i { width: 14px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; border: 1px solid #4a3a28; }

.end-buttons { display: flex; gap: 10px; justify-content: center; padding: 20px 26px 0; }
.end-buttons button { min-width: 180px; padding: 10px 18px; font-size: 15px; }

@media (max-width: 760px) {
    .end-stats { padding: 14px 14px 0; }
    .end-score { grid-template-columns: 1fr 1fr; }
    .end-parts { grid-column: 1 / -1; order: 3; }
    .end-grid, .rosters { grid-template-columns: 1fr; }
    .duel { grid-template-columns: 40px 1fr minmax(90px, auto) 1fr 40px; }
    .lane { grid-template-columns: 70px 1fr; }
    .lane-ticks { margin-left: 80px; }
    .end-buttons { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
    .end-screen, .end-hero h2, .duel-bar i, .roster-bar i, .tech-mark { animation: none; }
}
