/* Solo Tale — dark retro-terminal theme */

:root {
    /* Tarayıcıya "bu sayfa koyu" de: yerli kaydırma çubukları/formlar koyu çizilir
       (2026-08-10: Chrome/Brave haritada bembeyaz çubuk basıyordu). */
    color-scheme: dark;
    --bg: #0b0e14;
    --panel: #131826;
    --panel-border: #263047;
    --text: #c7d2e0;
    --dim: #6b7a94;
    --accent: #e8c15a;      /* amber */
    --danger: #e0564f;
    --ok: #5fbf77;
    --select: #7ec8ff;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Cascadia Mono', Consolas, 'Courier New', monospace;
    font-size: 15px;
}

h1:focus {
    outline: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

.app-main {
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.game-shell {
    width: 100%;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

/* ---------- header ---------- */

.game-header {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.5rem;
    /* Keep the right-aligned items (day/night, seed) clear of the fixed audio/lang bar. */
    padding-right: 13rem;
    flex-wrap: wrap;
}

.game-title {
    color: var(--accent);
    font-size: 1.3rem;
    font-weight: bold;
    letter-spacing: 0.25em;
}

.game-subtitle {
    color: var(--dim);
}

.game-seed {
    margin-left: auto;
    color: var(--dim);
    font-size: 0.8rem;
}

/* ---------- enemy selection ---------- */

.enemy-select h2 {
    font-size: 1rem;
    color: var(--text);
    font-weight: normal;
}

.enemy-choices {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.enemy-choice {
    flex: 1 1 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    color: var(--text);
    padding: 1rem;
    transition: border-color 0.15s;
}

.enemy-choice:hover {
    border-color: var(--accent);
}

.enemy-choice .enemy-emoji {
    font-size: 2.2rem;
}

.enemy-choice .enemy-name {
    font-weight: bold;
}

.enemy-choice .enemy-tier {
    color: var(--accent);
    font-size: 0.8rem;
}

.enemy-choice .enemy-hp {
    color: var(--dim);
    font-size: 0.85rem;
}

.player-summary {
    color: var(--dim);
    text-align: center;
}

/* ---------- enemy card ---------- */

.enemy-card {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 0.8rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.enemy-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.enemy-header .enemy-emoji {
    font-size: 1.6rem;
}

.enemy-header .enemy-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.enemy-header .enemy-tier {
    color: var(--accent);
    margin-left: auto;
    font-size: 0.85rem;
}

.enemy-stats {
    color: var(--dim);
    font-size: 0.85rem;
}

.enemy-intent {
    color: var(--accent);
}

/* Multi-enemy fights: cards become clickable targets (design 6, Goblin King). */
.enemy-card.selectable {
    cursor: pointer;
}

.enemy-card.selectable:hover {
    border-color: var(--accent);
}

.enemy-card.targeted {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

/* Slain/fled enemies stay on screen, dimmed and red-tinged, so reinforcements
   joining mid-fight aren't mistaken for a dead enemy healing back up. */
.enemy-card.down {
    opacity: 0.45;
    border-color: var(--danger);
    filter: saturate(0.5);
    cursor: default;
}

.enemy-card.down .enemy-name {
    text-decoration: line-through;
}

.enemy-down-mark {
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: bold;
    white-space: nowrap;
}

.enemy-target-mark {
    font-size: 0.9rem;
}

.target-help {
    color: var(--muted, #8a8f98);
    font-size: 0.85rem;
    margin: 0;
    text-align: center;
}

/* ---------- HP bars ---------- */

.hp-bar {
    position: relative;
    flex-shrink: 0;
    height: 1.35rem;
    background: #0a0d13;
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    overflow: hidden;
}

.hp-fill {
    height: 100%;
    transition: width 0.25s ease-out;
}

.hp-bar.enemy .hp-fill {
    background: linear-gradient(90deg, #8c2f2b, var(--danger));
}

.hp-bar.player .hp-fill {
    background: linear-gradient(90deg, #2d6e42, var(--ok));
}

.hp-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* ---------- combat log ---------- */

.combat-log {
    display: flex;
    flex-direction: column-reverse; /* keeps the view pinned to the newest line */
    height: 13rem;
    overflow-y: auto;
    background: #0a0d13;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    font-size: 0.88rem;
    line-height: 1.5;
}

.log-line {
    white-space: pre-wrap;
}

.log-line.log-positive {
    color: var(--ok);
}

.log-line.log-negative {
    color: var(--danger);
}

.log-line.log-warning {
    color: var(--accent);
}

/* ---------- player panel ---------- */

.player-panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 0.8rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.player-header {
    display: flex;
    align-items: baseline;
}

.player-name {
    font-weight: bold;
}

.player-stats {
    margin-left: auto;
    color: var(--dim);
    font-size: 0.85rem;
}

.player-crit {
    margin-left: 0.6rem;
    color: var(--dim);
    font-size: 0.85rem;
}

/* ---------- dice ---------- */

.dice-tray {
    display: flex;
    gap: 0.7rem;
    justify-content: center;
}

.die {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    width: 4rem;
    padding: 0.4rem 0;
    background: var(--panel);
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    color: var(--text);
    transition: border-color 0.1s, transform 0.1s;
}

.die:hover {
    border-color: var(--select);
}

.die.selected {
    border-color: var(--select);
    box-shadow: 0 0 8px rgba(126, 200, 255, 0.4);
    transform: translateY(-3px);
}

.die.assigned {
    opacity: 0.35;
}

.die.locked {
    border-color: var(--danger);
    opacity: 0.6;
    cursor: not-allowed;
}

.die-face {
    font-size: 2rem;
    line-height: 1;
}

.die-value {
    font-size: 0.8rem;
    color: var(--dim);
}

.allocation-help {
    text-align: center;
    color: var(--dim);
    font-size: 0.82rem;
    margin: 0.2rem 0;
    /* Metin duruma göre değişir (uzun "seç" / kısa "yerleştir") — iki satırlık yükseklik
       baştan ayrılır ki altındaki yuvalar zıplamasın (2026-08-10). */
    line-height: 1.35;
    min-height: calc(2 * 1.35em);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Stun (Orc Brute's concuss): the attack slot is disabled this turn, so say why in a
   colour the player reads as "against you" rather than as ordinary help text. */
.allocation-help.stunned-note {
    color: var(--danger);
    font-weight: 600;
}

/* ---------- slots ---------- */

.slots {
    display: flex;
    gap: 0.8rem;
}

.slot {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    background: var(--panel);
    border: 2px dashed var(--panel-border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.7rem 0.4rem;
    transition: border-color 0.1s;
}

.slot.highlight {
    border-color: var(--select);
}

.slot.filled {
    border-style: solid;
    border-color: var(--accent);
}

.slot.disabled {
    opacity: 0.45;
    filter: grayscale(70%);
    border-style: solid;
    border-color: var(--panel-border);
    cursor: default;
}

.slot.disabled .slot-label,
.slot.disabled .slot-die {
    color: var(--dim);
}

.slot-icon {
    font-size: 1.4rem;
}

.slot-label {
    font-weight: bold;
    font-size: 0.85rem;
}

.slot-die {
    font-size: 1.3rem;
    color: var(--accent);
    min-height: 1.6rem;
}

.slot-hint {
    color: var(--dim);
    font-size: 0.72rem;
}

/* ---------- actions & outcome ---------- */

.action-area {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.action-buttons {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
}

.action {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    color: var(--text);
    padding: 0.6rem 1.4rem;
    font-size: 0.95rem;
    transition: border-color 0.15s;
}

.action:hover:not(:disabled) {
    border-color: var(--accent);
}

.action.primary {
    border-color: var(--accent);
    color: var(--accent);
    font-weight: bold;
}

.action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.outcome-banner {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 1.2rem;
}

.outcome-banner.victory { border-color: var(--ok); }
.outcome-banner.defeat  { border-color: var(--danger); }
.outcome-banner.fled    { border-color: var(--select); }

.outcome-text {
    font-size: 1.1rem;
    font-weight: bold;
}

/* ---------- Blazor boot & error UI ---------- */

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--panel-border);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--accent);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    color: var(--dim);
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

#blazor-error-ui {
    background: #3a1d1d;
    color: var(--text);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.4);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ---------- map screen ---------- */

.map-screen:focus {
    outline: none;
}

.time-indicator {
    margin-left: auto;
    padding: 0.1rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.stat-block .time-indicator {
    align-self: flex-start;
    margin-left: 0;
    padding-left: 0;
    font-weight: bold;
}

.time-indicator.day {
    color: #f0d98a;
}

.time-indicator.night {
    color: #9ab4e8;
}

.game-header .game-seed {
    margin-left: 1rem;
}

/* The map screen fills the width so the map + info panels sit in one horizontal row. */
.map-screen {
    max-width: 1800px;
    width: 100%;
}

/* map | stats/controls | character panel | log — all side by side. */
.map-layout {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    width: 100%;
}

/* Character panel and log share one column, stacked. */
.map-info {
    flex: 1 1 auto;
    min-width: 13rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 76vh;
}

.map-info > .character-panel {
    flex: 0 1 auto;
    overflow-y: auto;
}

/* When the screen gets narrow, drop the character+log column below the map. */
@media (max-width: 1200px) {
    .map-layout {
        flex-wrap: wrap;
    }

    .map-info {
        flex: 1 1 100%;
        min-width: 0;
        max-height: 42vh;
    }
}

:root {
    --cell: 45px;
    --cell-stride: calc(var(--cell) + 1px); /* cell + gap; MapView.razor Stride must match */
}

/* Scroll window: shows a ~20x20 slice, scroll to reach the rest of the 100x100 world. */
.map-scroll {
    /* Same frame footprint as before (~920px), but only 20 larger tiles across. */
    flex: 0 1 calc(20 * var(--cell-stride) + 8px);
    max-width: calc(20 * var(--cell-stride) + 8px);
    min-width: 240px;
    max-height: min(76vh, calc(20 * var(--cell-stride) + 8px));
    overflow: auto;
    background: #05070c;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 4px;
}

/* Full-size canvas: its width/height (set inline to Size*Stride) drives the scrollbar. */
.map-canvas {
    position: relative;
}

.cell {
    position: absolute;
    width: var(--cell);
    height: var(--cell);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Icons/emoji are 1em, so they scale with the cell size. */
    font-size: calc(var(--cell) * 0.58);
    border-radius: 2px;
    user-select: none;
    /* Skip rendering work for buffered/offscreen cells until needed. */
    content-visibility: auto;
    contain-intrinsic-size: var(--cell) var(--cell);
}

.cell.void { background: #05070c; }
.cell.fog  { background: #10141d; }

/* biome tints, forest → ruins as danger rises */
.cell.biome-forest_edge    { background: #24422a; }
.cell.biome-deep_forest    { background: #1b3320; }
.cell.biome-swamp          { background: #2c3a26; }
.cell.biome-blighted_hills { background: #40342a; }
.cell.biome-castle_ruins   { background: #34313b; }

/* ---------- creature icons (monochrome SVG sprite + CSS tint + emoji badge, design 6.1) ---------- */

.creature-wrap {
    position: relative;
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
}

/* The <use> symbol fills with currentColor, so the tint class's `color` colors it. */
.creature {
    width: 1em;
    height: 1em;
    display: block;
    fill: currentColor;
}

.creature-badge {
    position: absolute;
    top: -0.15em;
    right: -0.35em;
    font-size: 0.55em;
    line-height: 1;
    text-shadow: 0 0 2px #000, 0 0 2px #000;
    pointer-events: none;
}

/* Tint palette (design 6.1) — sets `color`, which drives the sprite's currentColor fills. */
.tint-default  { color: #cfd6ce; }
.tint-golden   { color: #e0b341; }
.tint-moonlit  { color: #7fa8d9; }
.tint-blood    { color: #c0392b; }
.tint-toxic    { color: #7cb56b; }
.tint-bone     { color: #d8d3c3; }
.tint-spectral { color: #9b8fd4; opacity: 0.85; }
.tint-shadow   { color: #6b5b8e; }
.tint-bloodmoon { color: #b5485d; }

/* Species-specific tints (design 6.1). */
.tint-goblin-green { color: #6ab04c; }
.tint-boar-brown   { color: #b5793f; }
.tint-tiger-yellow { color: #e6b422; }
.tint-slime        { color: #4fd0c0; }
.tint-rat          { color: #8a7a6a; }
.tint-venom        { color: #8e44ad; }
.tint-wolf-gray    { color: #a9b7c6; }
.tint-bandit       { color: #6e7681; }
.tint-rot          { color: #93a882; }
.tint-orc          { color: #7f8f3f; }
.tint-stone        { color: #a8a294; }

/* Treasure chest (2026-08-10): warm amber — oiled wood with brass. Kept clear of
   tint-golden (#e0b341), which belongs to the Goblin Chief and King. */
.tint-chest { color: #d98f36; }

/* Event tile: a red exclamation, the classic "something here" mark. Red is otherwise only
   the Dire Boar Matriarch's tint-blood on a single boss tile, so nothing else competes. */
.tint-event { color: #e04a3f; }

/* Playable hero looks (2026-08-10). The Elf wears ice blue rather than turquoise: turquoise
   is spoken for by the Beast Ward frame, and two turquoise cues on one tile would blur. */
.tint-hero-knight    { color: #e8c15a; }
.tint-hero-wizard    { color: #b07fe8; }
.tint-hero-ranger    { color: #5fae6b; }
.tint-hero-barbarian { color: #e06a4a; }
.tint-hero-elf       { color: #7fc9e8; }
.tint-hero-monk      { color: #d9a066; }
.tint-hero-dwarf     { color: #c9a15e; }
.tint-hero-vampire   { color: #c95e7a; }

/* ---------- inline sprite glyphs (GameIcon): chrome, not map tiles ---------- */

/* Sized in em so it tracks whatever text it sits in, and nudged down to sit on the
   baseline the way the emoji it replaced did. */
.game-icon {
    width: 1.05em;
    height: 1.05em;
    fill: currentColor;
    vertical-align: -0.15em;
    flex: none;
}

.game-icon.hero-portrait {
    width: 44px;
    height: 44px;
    vertical-align: middle;
}

.cell.defeated {
    opacity: 0.4;
}

.cell.player-here {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    box-shadow: 0 0 8px rgba(232, 193, 90, 0.5);
}

/* Beast Ward active: the hero's gold frame turns turquoise. This is the ONLY cue that the
   draught is up — deliberately wordless and countless — so it has to read at a glance
   against every biome tint, hence the brighter outline plus a wider glow. */
.cell.player-here.warded {
    outline-color: #3fe0cf;
    box-shadow: 0 0 10px rgba(63, 224, 207, 0.65);
}

.map-sidebar {
    flex: 0 0 14.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    max-height: 76vh;
    overflow-y: auto;
}

.stat-block {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 0.6rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stat-label {
    font-weight: bold;
}

.stat-line {
    font-size: 0.82rem;
    color: var(--dim);
}

.dpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
    max-width: 11rem;
}

.dpad-btn {
    aspect-ratio: 1 / 1;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 1.1rem;
    transition: border-color 0.1s;
}

.dpad-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.dpad-center {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dim);
}

.dpad-hint {
    text-align: center;
    color: var(--dim);
    font-size: 0.72rem;
    margin: 0;
}

.dpad-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-width: 11rem;
}

.dpad-actions .action {
    width: 100%;
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
}

.map-message {
    background: var(--panel);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 0.55rem 0.8rem;
    color: var(--accent);
    font-size: 0.9rem;
}

.map-log {
    flex: 1 1 auto;
    min-height: 6rem;
    height: auto;
}

/* ---------- character / inventory ---------- */

.character-panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 0.7rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    font-size: 0.85rem;
}

.char-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.char-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--accent);
    font-weight: bold;
}

.xp-bar {
    position: relative;
    flex: 1;
    height: 1.1rem;
    background: #0a0d13;
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    overflow: hidden;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #3a5ba8, #7ec8ff);
    transition: width 0.25s;
}

.xp-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.char-gold {
    color: var(--accent);
}

/* Portrait + name sit on one line; the glyph must not stretch when the name is long. */
.char-identity,
.char-gold {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* ---------- start screen (hero picker, 2026-08-10) ---------- */

/* width:100% stops the auto margins from shrinking the card to its content — without it
   the look grid collapses to two columns. */
.start-card {
    background: var(--panel);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    width: 100%;
    max-width: 34rem;
    margin: 1rem auto 0 auto;
}

.start-label {
    color: var(--accent);
    font-size: 0.95rem;
}

.start-input {
    background: #0a0d13;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    color: var(--text);
    padding: 0.6rem 0.8rem;
    font-size: 1.05rem;
    font-family: inherit;
    width: 100%;
}

.start-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Eight looks read best as a 4x2 block — one glance takes in the whole roster. */
.hero-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
}

.hero-option {
    background: #0a0d13;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    color: var(--dim);
    padding: 0.7rem 0.3rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    font-family: inherit;
    font-size: 0.85rem;
}

.hero-option:hover {
    border-color: var(--accent);
}

/* The selected look is the one piece of state on this screen — it gets the gold frame
   the map uses for "this is you". */
.hero-option.selected {
    border-color: var(--accent);
    color: var(--text);
    box-shadow: 0 0 8px rgba(232, 193, 90, 0.35);
}

.char-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    color: var(--dim);
}

.level-up {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    color: var(--accent);
}

.mini-btn {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    color: var(--text);
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    transition: border-color 0.1s;
}

.mini-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.equipment {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border-top: 1px solid var(--panel-border);
    padding-top: 0.5rem;
}

.equip-slot {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.equip-label {
    width: 6.5rem;
    color: var(--dim);
}

.equip-empty {
    color: var(--dim);
}

.backpack {
    border-top: 1px solid var(--panel-border);
    padding-top: 0.5rem;
}

.backpack-title {
    color: var(--dim);
    margin-bottom: 0.35rem;
}

.backpack-empty {
    color: var(--dim);
    font-style: italic;
}

.backpack-items {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.pack-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pack-name {
    flex: 1;
}

.pack-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

.mini-btn.danger {
    color: var(--danger);
}

.mini-btn.danger:hover {
    border-color: var(--danger);
}

.pack-note {
    color: var(--dim);
    font-size: 0.72rem;
}

/* skills */
.skills {
    border-top: 1px solid var(--panel-border);
    padding-top: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 11rem;
    overflow-y: auto;
}

.skills-title {
    color: var(--dim);
    margin-bottom: 0.1rem;
}

.skill-item {
    border: 1px solid var(--panel-border);
    border-radius: 5px;
    padding: 0.25rem 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.skill-item.active {
    border-color: var(--accent);
}

.skill-item.locked {
    opacity: 0.5;
}

.skill-head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.skill-name { font-weight: bold; }
.skill-level { color: var(--dim); font-size: 0.78rem; }
.skill-desc { color: var(--dim); font-size: 0.78rem; }

.skill-actions {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
}

.skill-badge { color: var(--accent); font-size: 0.78rem; }

/* rarity colors */
.rarity-common { color: var(--text); }
.rarity-rare   { color: #6db3f2; }
.rarity-epic   { color: #c98bff; }

/* ---------- combat consumables ---------- */

.consumable-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.consumable-label {
    font-size: 1.1rem;
}

.consumable-btn {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 5px;
    color: var(--text);
    padding: 0.35rem 0.8rem;
    font-size: 0.82rem;
    transition: border-color 0.1s;
}

.consumable-btn:hover:not(:disabled) {
    border-color: var(--ok);
    color: var(--ok);
}

.consumable-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.consumable-note {
    color: var(--dim);
    font-size: 0.75rem;
}

/* ---------- village & vendor ---------- */

.loading-note {
    color: var(--dim);
    text-align: center;
    margin-top: 3rem;
}

.world-tier {
    margin-left: auto;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: bold;
}

.game-header .world-tier + .game-seed {
    margin-left: 1rem;
}

/* Koyu kaydırma çubukları (2026-08-10): color-scheme'in üstüne markaya uygun ince ayar. */
* {
    scrollbar-color: var(--panel-border) var(--bg);
    scrollbar-width: thin;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--bg); }
*::-webkit-scrollbar-thumb { background: var(--panel-border); border-radius: 5px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: #3a4a6b; }
*::-webkit-scrollbar-corner { background: var(--bg); }

/* Köy iki sütun (2026-08-10): geniş kabuk + yan yana kahraman/market. */
.village-wide {
    max-width: 1100px;
}

.village-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
    align-items: start;
}

.village-col {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    min-width: 0;
}

@media (max-width: 900px) {
    .village-columns { grid-template-columns: 1fr; }
}

.village-intro {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 0.7rem 0.9rem;
}

.village-intro p {
    margin: 0.25rem 0;
}

.village-goal {
    color: var(--dim);
    font-size: 0.88rem;
}

.vendor {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 0.7rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.vendor-title {
    font-weight: bold;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}

.vendor-gold {
    color: var(--accent);
    font-weight: normal;
    font-size: 0.85rem;
}

.vendor-stock {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem 1rem;
}

.vendor-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vendor-name {
    flex: 1;
}

.vendor-price {
    color: var(--accent);
    font-size: 0.82rem;
}

.vendor-message {
    color: var(--danger);
    font-size: 0.82rem;
}

.credits {
    margin-top: 0.5rem;
    color: var(--dim);
    font-size: 0.7rem;
    text-align: center;
    line-height: 1.4;
}

@media (max-width: 520px) {
    .vendor-stock {
        grid-template-columns: 1fr;
    }
}

/* ---------- debug / admin panel (design 13) ---------- */

.debug-badge {
    position: fixed;
    bottom: 0.5rem;
    left: 0.6rem;
    z-index: 1200;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 0.2em;
    color: var(--danger);
    opacity: 0.5;
    pointer-events: none;
}

.debug-panel {
    position: fixed;
    top: 3rem;
    left: 0.6rem;
    z-index: 1100;
    width: 19rem;
    max-height: 82vh;
    overflow-y: auto;
    background: rgba(10, 13, 19, 0.97);
    border: 1px solid var(--danger);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text);
}

.debug-panel.collapsed {
    width: auto;
}

.debug-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 0.4rem 0.6rem;
    background: rgba(224, 86, 79, 0.15);
    cursor: pointer;
    font-weight: bold;
    position: sticky;
    top: 0;
}

.debug-body {
    padding: 0.5rem 0.6rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.debug-warn {
    color: var(--accent);
    font-size: 0.72rem;
    line-height: 1.3;
}

.debug-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border-top: 1px solid var(--panel-border);
    padding-top: 0.5rem;
}

.debug-group-title {
    color: var(--dim);
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
}

.debug-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.debug-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.debug-num {
    width: 3.2rem;
}

.debug-num-wide {
    width: 8rem;
}

.debug-select {
    flex: 1;
    min-width: 6rem;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--panel-border);
    border-radius: 4px;
}

.debug-note {
    color: var(--dim);
    font-size: 0.7rem;
}

.debug-panel input[type="number"],
.debug-panel input[type="text"] {
    background: #0a0d13;
    color: var(--text);
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    padding: 0.1rem 0.3rem;
}

/* ---------- audio controls ---------- */

.audio-controls {
    position: fixed;
    top: 0.6rem;
    /* Track the right edge of the centered content (max 1800px) instead of the viewport edge. */
    right: max(0.6rem, calc((100vw - 1800px) / 2 + 0.5rem));
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(19, 24, 38, 0.9);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
}

.audio-btn {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.1rem;
}

.lang-btn {
    background: none;
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: bold;
    padding: 0.1rem 0.4rem;
}

.lang-btn:hover {
    border-color: var(--accent);
}

.audio-volume {
    width: 5rem;
    accent-color: var(--accent);
}

.audio-volume:disabled {
    opacity: 0.4;
}

/* ---------- events ---------- */

.event-card {
    background: var(--panel);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    max-width: 40rem;
    margin: 1rem auto 0 auto;
}

.event-title {
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.event-body {
    margin: 0;
    color: var(--text);
    line-height: 1.5;
}

.event-choices {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.event-choices .action {
    text-align: left;
}

.event-result {
    color: var(--ok);
    line-height: 1.5;
}

/* ---------- run over (death / victory) ---------- */

.runover {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    text-align: center;
    margin-top: 2rem;
}

.runover.victory { border-color: var(--ok); }
.runover.death   { border-color: var(--danger); }

.runover-banner {
    font-size: 1.8rem;
    font-weight: bold;
    letter-spacing: 0.15em;
}

.runover.victory .runover-banner { color: var(--ok); }
.runover.death .runover-banner   { color: var(--danger); }

.runover-tagline {
    color: var(--dim);
    margin: 0;
    max-width: 30rem;
}

.runover-credits {
    color: var(--dim);
    opacity: 0.7;
    font-size: 0.75rem;
}

.runover-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem 1.5rem;
    width: 100%;
    max-width: 32rem;
}

.rs {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--panel-border);
    padding: 0.3rem 0;
}

.rs span { color: var(--dim); }
.rs b { color: var(--accent); }

@media (max-width: 520px) {
    .runover-stats { grid-template-columns: 1fr; }
}

/* ---------- combat test arena (calibration tool) ---------- */

/* Same idea as .debug-badge but the opposite corner, so both can show at once. */
.arena-badge {
    position: fixed;
    bottom: 0.5rem;
    right: 0.6rem;
    z-index: 1200;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 0.2em;
    color: var(--accent);
    opacity: 0.5;
    pointer-events: none;
}

/* The setup page uses the screen's width — three columns; the fight itself stays at
   game width. Columns collapse to two, then one, as the viewport narrows. */
.arena-shell {
    max-width: 1560px;
}

.arena-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.9rem;
    align-items: start;
}

@media (max-width: 1280px) {
    .arena-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
    .arena-grid { grid-template-columns: 1fr; }
}

.arena-col {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    min-width: 0;
}

.arena-card {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.arena-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.45rem;
}

.arena-chip {
    background: rgba(232, 193, 90, 0.1);
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    color: var(--dim);
    font-size: 0.7rem;
    font-weight: normal;
    letter-spacing: normal;
    text-transform: none;
    padding: 0.05rem 0.5rem;
}

.arena-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.arena-select {
    flex: 1;
    min-width: 11rem;
    background: #0a0d13;
    color: var(--text);
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    padding: 0.3rem 0.4rem;
    font-size: 0.9rem;
}

/* Label-above-input field blocks: wrapped rows line up into readable columns. */
.arena-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.9rem;
}

.afield {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    width: 6.4rem;
}

.afield.pair { width: 9.8rem; }
.afield.wide { width: 15rem; }
.afield.tiny { width: 3.9rem; }

.afield-name {
    color: var(--dim);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    white-space: nowrap;
}

.afield input[type="number"] {
    width: 100%;
    background: #0a0d13;
    color: var(--text);
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    padding: 0.25rem 0.35rem;
    font-size: 0.9rem;
}

.afield-pair-inputs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.afield-pair-inputs span { color: var(--dim); }

.afield-hint {
    color: var(--dim);
    font-size: 0.64rem;
    white-space: nowrap;
}

.arena-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text);
    font-size: 0.88rem;
}

/* Label → value fact grid (derived numbers, simulation report). */
.arena-facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.3rem 1rem;
    align-items: baseline;
    background: rgba(10, 13, 19, 0.55);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
    font-size: 0.82rem;
}

.arena-facts .fk {
    color: var(--dim);
    white-space: nowrap;
}

.arena-facts .fv { color: var(--text); }
.arena-facts .fv b { color: var(--accent); }

.arena-note {
    color: var(--dim);
    font-size: 0.7rem;
    line-height: 1.4;
}

.arena-status { font-size: 0.78rem; line-height: 1.4; }
.arena-status.ok { color: var(--ok); }
.arena-status.err { color: var(--danger); }

.arena-mechanics {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    color: var(--dim);
    font-size: 0.74rem;
    line-height: 1.35;
    background: rgba(10, 13, 19, 0.55);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
}

.arena-mechanics-title {
    color: var(--text);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.15rem;
}

.arena-summary {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.arena-summary b { color: var(--accent); }
