/* Herrscher von Valanor – Oberfläche
   Walnussholz, Messingbeschläge, Pergamentschrift. */
:root {
  --walnut: #2a2019;
  --walnut-2: #372a20;
  --walnut-3: #463628;
  --brass: #c9a24a;
  --brass-dim: #8e7336;
  --vellum: #efe3c8;
  --vellum-dim: #bfae8e;
  --royal: #2f6fe4;
  --blood: #c8412f;
  --moss: #6fae55;
  --display: "Cinzel", "Palatino Linotype", "URW Palladio L", "Book Antiqua", serif;
  --body: "Alegreya Sans", "Ubuntu", "Noto Sans", sans-serif;
  --panel-w: 340px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1b1712; color: var(--vellum); font-family: var(--body); font-size: 15px; }
button { font-family: var(--body); font-size: 14px; color: var(--vellum); background: var(--walnut-3); border: 1px solid var(--brass-dim); border-radius: 4px; padding: 5px 10px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--brass); background: #56422f; }
button:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
button:disabled { opacity: 0.42; cursor: not-allowed; }
button.primary { background: var(--royal); border-color: #8fb4ff; font-weight: 700; }
button.primary:hover:not(:disabled) { background: #3d7ef0; }
button.danger { background: #6a261c; border-color: var(--blood); }
button.ghost { background: transparent; }
input, select { font-family: var(--body); font-size: 14px; background: #1f1813; color: var(--vellum); border: 1px solid var(--brass-dim); border-radius: 3px; padding: 4px 6px; }
input:focus, select:focus { outline: 2px solid var(--brass); outline-offset: 0; }

#world { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: default; }
body.targeting #world { cursor: crosshair; }

/* Kopfleiste */
#topbar { position: fixed; top: 0; left: 0; right: 0; height: 46px; display: flex; align-items: center; gap: 16px; padding: 0 12px;
  background: linear-gradient(#33271e, #251c15); border-bottom: 2px solid var(--brass-dim); box-shadow: 0 2px 10px rgba(0,0,0,0.5); z-index: 10; }
#res-owner { font-family: var(--display); font-weight: 600; font-size: 15px; min-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#res-owner small { display: block; font-family: var(--body); font-size: 11px; color: var(--vellum-dim); font-weight: 400; }
#res-list { display: flex; gap: 6px; flex: 1; overflow: hidden; }
.res { display: flex; align-items: baseline; gap: 5px; padding: 3px 9px; background: rgba(0,0,0,0.25); border: 1px solid rgba(201,162,74,0.25); border-radius: 3px; white-space: nowrap; }
.res b { font-variant-numeric: tabular-nums; font-size: 15px; }
.res em { font-style: normal; font-size: 11px; color: var(--vellum-dim); font-variant-numeric: tabular-nums; }
.res em.neg { color: #ff8a73; }
#clock { font-variant-numeric: tabular-nums; color: var(--vellum-dim); white-space: nowrap; }
#controls { display: flex; gap: 6px; align-items: center; }
.speed { display: flex; }
.speed button { border-radius: 0; margin-left: -1px; padding: 5px 8px; }
.speed button:first-child { border-radius: 4px 0 0 4px; }
.speed button:last-child { border-radius: 0 4px 4px 0; }
.speed button.on, .seg button.on { background: var(--brass); color: #231a10; font-weight: 700; border-color: var(--brass); }

/* Bedienfeld */
#panel { position: fixed; top: 46px; right: 0; bottom: 0; width: var(--panel-w); background: rgba(38,29,22,0.96); border-left: 2px solid var(--brass-dim);
  z-index: 9; transition: transform 0.22s ease; box-shadow: -4px 0 14px rgba(0,0,0,0.4); }
#panel.collapsed { transform: translateX(var(--panel-w)); }
#panel-toggle { position: absolute; left: -30px; top: 12px; width: 28px; height: 44px; padding: 0; border-radius: 4px 0 0 4px; border-right: none; background: var(--walnut-2); }
#panel.collapsed #panel-toggle { transform: scaleX(-1); border-radius: 0 4px 4px 0; border-left: none; border-right: 1px solid var(--brass-dim); }
#panel-body { height: 100%; overflow-y: auto; padding: 14px 16px 30px; scrollbar-color: var(--brass-dim) transparent; }
#panel h2 { font-family: var(--display); font-weight: 600; font-size: 21px; margin: 0 0 2px; letter-spacing: 0.02em; display: flex; align-items: center; gap: 8px; }
#panel h2 .chip { width: 12px; height: 12px; border-radius: 2px; background: var(--c); border: 1px solid rgba(255,255,255,0.4); flex: none; }
#panel .sub { color: var(--vellum-dim); font-size: 13px; margin-bottom: 10px; }
#panel h3 { font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--brass); margin: 16px 0 6px; padding-bottom: 3px; border-bottom: 1px solid rgba(201,162,74,0.3); }
#panel p { margin: 6px 0; line-height: 1.45; font-size: 14px; }
.stat { display: flex; justify-content: space-between; font-size: 14px; padding: 2px 0; }
.stat span:first-child { color: var(--vellum-dim); }
.bld { display: grid; grid-template-columns: 22px 1fr auto; gap: 2px 8px; align-items: center; padding: 5px 0; border-bottom: 1px dashed rgba(201,162,74,0.15); }
.bld .nm { font-weight: 500; }
.bld .ct { color: var(--vellum-dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.bld .cost { grid-column: 2; font-size: 12px; color: var(--vellum-dim); }
.bld button { grid-row: 1 / span 2; grid-column: 3; padding: 4px 10px; }
.row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; align-items: center; }
.row .lbl { font-size: 13px; color: var(--vellum-dim); min-width: 64px; }
.bigbtn { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 8px 10px; }
.bigbtn small { display: block; color: var(--vellum-dim); font-size: 12px; }
.hpbar { height: 6px; background: rgba(0,0,0,0.5); border-radius: 2px; overflow: hidden; margin: 3px 0 6px; }
.hpbar i { display: block; height: 100%; background: var(--moss); }
.townlist button { display: flex; justify-content: space-between; width: 100%; margin: 4px 0; text-align: left; }
.note { font-size: 13px; color: var(--vellum-dim); }
.keys { font-size: 13px; color: var(--vellum-dim); line-height: 1.6; }
kbd { font-family: var(--body); background: #1f1813; border: 1px solid var(--brass-dim); border-radius: 3px; padding: 0 5px; font-size: 12px; color: var(--vellum); }

/* Übersichtskarte */
#minimap-wrap { position: fixed; left: 10px; bottom: 10px; padding: 6px; background: var(--walnut); border: 2px solid var(--brass-dim); border-radius: 4px; z-index: 8; box-shadow: 0 4px 14px rgba(0,0,0,0.5); }
#minimap { display: block; cursor: pointer; }
/* Meldungen aus-/einblenden: Schalter am rechten Rand der Übersichtskarte, wie der Schalter der Seitenleiste */
#log-toggle { position: absolute; right: -30px; bottom: 6px; width: 28px; height: 44px; padding: 0; border-radius: 0 4px 4px 0; border-left: none; background: var(--walnut-2); }
body.log-hidden #log-toggle { transform: scaleX(-1); border-radius: 4px 0 0 4px; border-right: none; border-left: 1px solid var(--brass-dim); }
body.log-hidden #log { display: none; }
#log-toggle[data-n]::after { content: attr(data-n); position: absolute; top: -8px; right: -6px; transform: scaleX(-1); min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: var(--brass); color: #2a1e12; font-size: 11px; line-height: 16px; font-weight: 700; }
.mini-cap { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--walnut); border: 1px solid var(--brass-dim); color: var(--brass); font-family: var(--display); font-size: 13px; letter-spacing: 0.12em; padding: 0 10px; border-radius: 3px; white-space: nowrap; pointer-events: none; }

/* Nachrichten */
#log { position: fixed; left: 300px; bottom: 12px; width: min(460px, calc(100vw - 670px)); display: flex; flex-direction: column; gap: 4px; z-index: 7; pointer-events: none; }
#log div { background: rgba(28,22,17,0.86); border-left: 3px solid var(--brass); padding: 5px 10px; font-size: 14px; border-radius: 2px; pointer-events: auto; cursor: pointer; animation: logfade 18s forwards; }
#log div.bad { border-left-color: var(--blood); }
#log div.good { border-left-color: var(--moss); }
@keyframes logfade { 0% { opacity: 0; transform: translateY(6px); } 3% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
#banner { position: fixed; top: 58px; left: 50%; transform: translateX(-50%); background: rgba(28,22,17,0.92); border: 1px solid var(--brass); padding: 7px 16px; border-radius: 4px; z-index: 11; display: none; font-size: 14px; }
#banner.show { display: block; }
#toast { position: fixed; top: 100px; left: 50%; transform: translateX(-50%); background: #5a2219; border: 1px solid var(--blood); padding: 7px 16px; border-radius: 4px; z-index: 12; opacity: 0; transition: opacity 0.2s; pointer-events: none; font-size: 14px; }
#toast.ok { background: #28401f; border-color: var(--moss); }
#toast.show { opacity: 1; }
#pause-flag { position: fixed; top: 58px; left: 12px; font-family: var(--display); font-size: 18px; color: var(--brass); background: rgba(28,22,17,0.85); padding: 4px 12px; border: 1px solid var(--brass-dim); border-radius: 3px; display: none; z-index: 8; }
body.paused #pause-flag { display: block; }
#btn-auto.on { background: var(--brass); color: #231a10; font-weight: 700; border-color: var(--brass); }
/* im Automatik-Modus sind die Befehle gesperrt – nur ansehen */
body.auto #panel-body button[data-act]:not([data-act=takeover]):not([data-act=autofocus]):not([data-act=goto]):not([data-act=tab]):not([data-act=stock]) { opacity: 0.35; pointer-events: none; }
.auto-note { background: rgba(201,162,74,0.15); border: 1px solid var(--brass-dim); border-radius: 4px; padding: 8px 10px; margin: 0 0 12px; font-size: 13px; }
.auto-note button { margin-top: 6px; }
/* „Blau übernehmen“ und „Autofokus“ immer nebeneinander */
.auto-btns { display: flex; gap: 6px; margin-top: 6px; }
.auto-btns > button { flex: 1 1 auto; min-width: 0; margin-top: 0; padding: 5px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1000px) { .auto-btns { gap: 4px; } .auto-btns > button { font-size: 12px; padding: 4px 5px; } }   /* schmales Bedienfeld (Handy, Tablet) */
.auto-note .afbtn { opacity: 0.75; }
.auto-note .afbtn.on { opacity: 1; border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass) inset; }

/* Dialoge */
#modal { position: fixed; inset: 0; background: rgba(10,8,6,0.62); display: flex; align-items: center; justify-content: center; z-index: 30; }
#modal.hidden { display: none; }
#modal-card { background: var(--walnut-2); border: 2px solid var(--brass-dim); border-radius: 6px; padding: 20px 24px; width: min(560px, 94vw); max-height: 88vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
#modal-card h2 { font-family: var(--display); font-weight: 600; margin: 0 0 12px; font-size: 22px; }
#modal-card p { line-height: 1.5; max-width: 70ch; }
#modal-card .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
#modal-card label { display: block; margin: 10px 0; }
#modal-card .err { color: #ff8a73; min-height: 1.2em; }
.trade-grid { display: grid; grid-template-columns: 1fr 90px 90px; gap: 6px 10px; align-items: center; margin: 10px 0; }
.trade-grid .h { font-size: 12px; color: var(--vellum-dim); }
.trade-grid input { width: 100%; }
.savelist { margin: 10px 0; max-height: 300px; overflow-y: auto; }
.savelist .it { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed rgba(201,162,74,0.2); }
.savelist .it span { flex: 1; }
.savelist .it small { color: var(--vellum-dim); display: block; font-size: 12px; }
.help h3 { font-family: var(--display); color: var(--brass); font-size: 15px; margin: 14px 0 4px; }
.help p, .help li { font-size: 14px; line-height: 1.5; }
.help ul { padding-left: 18px; margin: 4px 0; }

/* Startbildschirm */
#start-screen { position: fixed; inset: 0; z-index: 20; display: none; align-items: center; padding-left: max(5vw, 24px);
  background: linear-gradient(90deg, rgba(20,15,11,0.9) 0%, rgba(20,15,11,0.7) 38%, rgba(20,15,11,0) 70%); }
body.on-start #start-screen { display: flex; }
body.on-start #topbar, body.on-start #panel, body.on-start #minimap-wrap, body.on-start #log { display: none; }
.start-card { width: min(470px, 92vw); }
.app-ver { text-align: center; color: var(--vellum-dim); font-size: 13px; margin: 10px 0 0; letter-spacing: 0.04em; }
.modal .app-ver { margin-top: 14px; }
.start-card h1 { font-family: var(--display); font-weight: 800; font-size: clamp(40px, 6vw, 68px); line-height: 0.95; margin: 0 0 18px; letter-spacing: 0.01em;
  color: #f4e7c4; text-shadow: 0 3px 0 #3a2a18, 0 6px 22px rgba(0,0,0,0.6); }
.start-card h1 .amp { display: block; font-size: 0.5em; color: var(--brass); margin: 4px 0; }
.lede { font-size: 17px; line-height: 1.55; color: #e6d8b8; max-width: 44ch; margin: 0 0 22px; }
.opt { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.opt > span { width: 110px; color: var(--vellum-dim); }
.seg { display: flex; }
.seg button { border-radius: 0; margin-left: -1px; min-width: 44px; }
.seg button:first-child { border-radius: 4px 0 0 4px; }
.seg button:last-child { border-radius: 0 4px 4px 0; }
.start-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
/* feste Zeilen mit gleich breiten Knöpfen – unabhängig davon, wie breit ein Browser die Schrift setzt */
.act-row { display: flex; gap: 10px; }
.act-row > button, .act-row > a { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 9px 12px; font-size: 15px; box-sizing: border-box; text-align: center; }
.act-row > .hidden { display: none; }
.act-extra { margin-top: 12px; }
.houses { margin-top: 28px; font-size: 13px; color: var(--vellum-dim); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.houses i { display: inline-block; width: 10px; height: 10px; background: var(--c); border: 1px solid rgba(255,255,255,0.5); margin-right: 4px; vertical-align: -1px; }

#world, #minimap { touch-action: none; -webkit-user-select: none; user-select: none; }
#panel-body { touch-action: pan-y; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
.touch-only { display: none; }
body.touch .touch-only { display: inline-block; }
#btn-box.on { background: var(--brass); color: #231a10; }
body.touch button { min-height: 34px; }

@media (max-width: 1100px) {
  #clock { display: none; }
  .res em { display: none; }
  #btn-save .lbl, #btn-load .lbl, #btn-auto .lbl { display: none; }
  #res-owner { min-width: 0; max-width: 120px; }
  #res-owner small { display: none; }
  #topbar { gap: 8px; padding: 0 8px; }
  .res { padding: 3px 6px; }
}
@media (max-width: 900px) {
  :root { --panel-w: 290px; }
  #log { left: 12px; bottom: 150px; width: 55vw; }
}
@media (max-height: 520px) {
  :root { --panel-w: 270px; }
  #panel-body { font-size: 14px; }
  #topbar { height: 40px; }
  #panel { top: 40px; }
  #panel-body { padding: 10px 12px 24px; }
  #minimap { width: 150px; height: 112px; }
  #minimap-wrap { padding: 4px; left: 6px; bottom: 6px; }
  #log { left: 206px; bottom: 6px; width: min(360px, calc(100vw - 510px)); }
  #log div { font-size: 13px; padding: 3px 8px; }
  #banner { top: 48px; font-size: 13px; }
  #pause-flag { top: 48px; }
  #start-screen { align-items: flex-start; overflow-y: auto; padding-top: 14px; padding-bottom: 14px; }
  .start-card h1 { font-size: 36px; margin-bottom: 8px; }
  .start-card h1 .amp { display: inline; margin: 0 6px; font-size: 0.7em; }
  .lede { font-size: 14px; margin-bottom: 8px; }
  .opt { margin: 5px 0; }
  .start-actions { margin-top: 10px; }
  .houses { margin-top: 10px; }
  #modal-card { padding: 14px 16px; max-height: 94vh; }
}
@media (max-width: 700px) {
  .res { font-size: 12px; } .res b { font-size: 13px; }
  #res-owner { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #panel { transition: none; }
  #log div { animation: logfade-still 18s forwards; }
  @keyframes logfade-still { 0%, 80% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
}

/* Optionsfenster für Kämpfer */
#unit-menu { position: fixed; z-index: 15; min-width: 230px; max-width: 300px; background: rgba(38,29,22,0.97); border: 2px solid var(--brass); border-radius: 6px; padding: 8px; box-shadow: 0 8px 26px rgba(0,0,0,0.55); }
#unit-menu.hidden { display: none; }
#unit-menu .um-title { font-family: var(--display); font-size: 13px; color: var(--brass); margin: 2px 4px 6px; display: flex; justify-content: space-between; align-items: center; }
#unit-menu .um-title button { padding: 0 7px; min-height: 0; line-height: 20px; background: transparent; border-color: transparent; }
#unit-menu .um-opt { display: block; width: 100%; text-align: left; margin: 4px 0; padding: 7px 9px; }
#unit-menu .um-opt small { display: block; color: var(--vellum-dim); font-size: 12px; }

/* Musikschalter */
#btn-music.off, #btn-music-start.off, #btn-bell-start.off, #btn-labels.off { opacity: 0.6; }

/* sehr schmale Bildschirme (Handy hochkant): Knöpfe der Leiste enger */
@media (max-width: 480px) {
  #topbar { gap: 4px; padding: 0 4px; }
  #controls { gap: 3px; }
  #controls button { padding-left: 6px; padding-right: 6px; min-width: 0; }
  #controls .seg button { padding-left: 5px; padding-right: 5px; }
}

/* Lautstärkeregler im Hauptmenü */
.vol-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-size: 15px; color: var(--vellum-dim); }
.vol-row label { min-width: 110px; }
.vol-row input[type=range] { flex: 1; max-width: 220px; accent-color: var(--brass); cursor: pointer; height: 28px; }
.vol-row span { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

/* Kopf der Spielanleitung: Titel links, Überspringen/Schließen rechts */
.help-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.help-top h2 { margin: 0; }
.help-top button { flex: none; }
.help-top button.skip { background: var(--brass); color: #1b1712; border-color: var(--brass); font-weight: 600; }

/* Reiter im Menü einer Ortschaft */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0 8px; border-bottom: 1px solid var(--brass-dim); padding-bottom: 6px; }
.tabs button { padding: 4px 10px; font-size: 14px; border-radius: 5px 5px 0 0; opacity: 0.85; }
.tabs button.on { background: var(--brass); color: #1b1712; border-color: var(--brass); opacity: 1; font-weight: 600; }
.tabbody { padding-top: 2px; }
/* Reich Azur: Ortsliste mit Knopf für die Lagerübersicht */
.townrow { display: flex; gap: 4px; align-items: stretch; }
.townrow > button[data-act=goto] { flex: 1; }
.townrow .stockbtn { flex: none; width: 34px; padding: 0; }
#stock-pop { position: fixed; z-index: 60; background: var(--walnut); border: 1px solid var(--brass); border-radius: 8px; padding: 8px 10px 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.5); color: var(--vellum); font-size: 14px; min-width: 330px; }
#stock-pop.hidden { display: none; }
#stock-pop .sp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-family: var(--display); color: var(--brass); margin-bottom: 6px; }
#stock-pop .sp-head button { padding: 0 8px; }
#stock-pop table { border-collapse: collapse; width: 100%; }
#stock-pop th { text-align: right; font-weight: 600; color: var(--vellum-dim); font-size: 12px; padding: 2px 6px; }
#stock-pop th:first-child, #stock-pop td:first-child { text-align: left; }
#stock-pop td { text-align: right; padding: 2px 6px; font-variant-numeric: tabular-nums; border-top: 1px solid rgba(255,255,255,0.06); }
#stock-pop td.pos { color: #9fd18a; } #stock-pop td.neg { color: #e89a8a; }
#stock-pop .note { margin-top: 4px; font-size: 12px; }

/* Reich Azur: Vergleich der Häuser */
table.cmp { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 4px; }
table.cmp th { text-align: right; font-weight: 600; color: var(--vellum-dim); font-size: 12px; padding: 3px 6px; border-bottom: 1px solid var(--brass-dim); }
table.cmp th:first-child, table.cmp td:first-child { text-align: left; }
table.cmp td { text-align: right; padding: 4px 6px; font-variant-numeric: tabular-nums; border-bottom: 1px solid rgba(255,255,255,0.05); }
table.cmp tr.me td { color: var(--brass); font-weight: 600; }
table.cmp tr.dead td { opacity: 0.55; }

/* Bauen-Knopf und Stern (Bauvorhaben) nebeneinander */
.bld .bact { display: inline-flex; gap: 4px; justify-self: end; }
.bld .bact button[data-act=prio] { padding: 2px 7px; min-width: 0; }

/* Bauvorhaben (Prioritätenliste) */
.prio { margin: 8px 0 10px; border: 1px solid var(--brass-dim); border-radius: 6px; padding: 6px 8px; background: rgba(0,0,0,0.12); }
.prio-h { font-weight: 600; margin-bottom: 4px; }
.prio-row { display: grid; grid-template-columns: 22px 1fr auto auto auto; gap: 4px; align-items: center; padding: 4px 2px; border-bottom: 1px dashed rgba(201,162,74,0.18); cursor: grab; }
.prio-row.on .prio-k { color: var(--brass); }
.prio-row.drag { opacity: 0.45; }
.prio-row.over { box-shadow: inset 0 2px 0 var(--brass); }
.prio-n { color: var(--vellum-dim); font-variant-numeric: tabular-nums; }
.prio-k small { display: block; font-size: 11px; color: var(--vellum-dim); }
.prio-row button { padding: 2px 7px; min-width: 0; }
.prio-add { display: flex; gap: 6px; margin-top: 6px; }
.prio-add select { flex: 1; min-width: 0; border: 1px solid var(--brass-dim); border-radius: 4px; padding: 3px; font: inherit; }

/* Auswahlmenüs: gut lesbar (dunkler, deckender Hintergrund, helle Schrift – auch in der aufgeklappten Liste) */
select { color-scheme: dark; background-color: #2b2118; color: #f2e8d2; }
select option, select optgroup { background-color: #2b2118; color: #f2e8d2; }
select option:checked { background-color: #6b5226; color: #fff6e0; }
select:focus { outline: 2px solid var(--brass); outline-offset: 1px; }

/* Kompakte Leiste für kleine Bildschirme (z. B. Handy quer): alles sichtbar, nichts verdeckt */
@media (max-width: 1000px), (max-height: 520px) {
  #topbar { gap: 5px; padding: 0 5px; }
  #res-owner { display: block; min-width: 0; max-width: 72px; font-size: 12px; line-height: 1.1; }
  #res-owner small { display: none; }
  #res-list { flex: 1 1 auto; min-width: 0; gap: 3px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #res-list::-webkit-scrollbar { display: none; }
  .res { padding: 2px 4px; gap: 2px; font-size: 12px; flex: 0 0 auto; }
  .res b { font-size: 12.5px; }
  .res em { display: none; }
  #clock { display: flex; flex-direction: column; align-items: center; font-size: 10.5px; line-height: 1.15; flex: 0 0 auto; }
  #controls { gap: 3px; flex: 0 0 auto; }
  #controls button { padding: 2px 5px; min-width: 0; font-size: 14px; }
  body.touch #controls button { min-height: 30px; }
  .speed button { padding: 2px 5px; }
  #btn-save .lbl, #btn-load .lbl, #btn-auto .lbl { display: none; }
  table.cmp { font-size: 12.5px; }
  table.cmp th { font-size: 11px; padding: 3px 3px; }
  table.cmp td { padding: 3px 3px; }
  table.cmp td:first-child { white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
}

.menu-pair { display: flex; gap: 8px; } .menu-pair .bigbtn { flex: 1; }
/* Schmale Bildschirme: Leiste zweizeilig – oben die Rohstoffe, darunter Titel, Zeit und Knöpfe */
@media (max-width: 860px) {
  #topbar { height: 72px; flex-wrap: wrap; align-content: center; row-gap: 3px; column-gap: 5px; }
  #res-list { order: 1; flex: 1 1 100%; justify-content: center; }
  #res-owner { order: 2; max-width: 90px; }
  #clock { order: 3; flex-direction: row; gap: 4px; font-size: 11px; }
  #controls { order: 4; margin-left: auto; }
  #panel { top: 72px !important; }
  #banner, #pause-flag { top: 80px !important; }
}
/* Hochformat und sehr schmal: Speichern/Laden über das Menü ☰ */
@media (max-width: 520px) {
  #btn-save, #btn-load { display: none; }
  #res-owner { max-width: 70px; font-size: 11px; }
  .res { padding: 2px 3px; } .res b { font-size: 12px; }
}
@media (max-width: 400px) {
  #res-list { gap: 2px; }
  .res { padding: 1px 2px; gap: 1px; font-size: 11px; } .res b { font-size: 11px; letter-spacing: -0.2px; }
}
@media (max-width: 520px) {
  #topbar { height: 100px; row-gap: 4px; }
  #panel { top: 100px !important; }
  #banner, #pause-flag { top: 108px !important; }
}

/* Truppenart wählen */
.sendkind .seg { display: inline-flex; flex-wrap: wrap; gap: 0; }
.sendkind .seg button { padding: 3px 7px; }
.um-pick { display: flex; flex-direction: column; gap: 3px; margin: 4px 0 6px; }
.um-cnt { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.um-cnt span { flex: 1; }
.um-cnt b { min-width: 52px; text-align: center; font-weight: 600; }
.um-cnt button { width: 26px; padding: 2px 0; font-size: 13px; }
.um-apply { font-size: 12px; padding: 3px 4px; margin-top: 2px; }

/* Anzahl je Truppenart */
.pick { margin: 4px 0 6px; }
.pick-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.pick-n { font-variant-numeric: tabular-nums; color: var(--vellum-dim); }
.pick-n b { color: var(--vellum); font-size: 15px; }
.pick-b { display: flex; gap: 3px; }
.pick-b button { flex: 1; min-width: 0; padding: 3px 0; }

/* Vergleich: kompakt, ohne Umbruch */
table.cmp th, table.cmp td { white-space: nowrap; }
table.cmp th { padding-left: 4px; padding-right: 4px; }
table.cmp td { padding-left: 4px; padding-right: 4px; }

/* Zoomanzeige: kurz neben dem Mauszeiger (PC) bzw. in der Bildmitte (Touch) */
#zoom-ind { position: fixed; z-index: 60; pointer-events: none; opacity: 0; transition: opacity 0.25s; white-space: nowrap;
  background: rgba(30,24,18,0.9); color: #f2e8d2; border: 1px solid var(--brass-dim); border-radius: 6px; padding: 3px 9px; font-weight: 600; font-size: 14px; }
#zoom-ind.show { opacity: 1; transition: opacity 0.08s; }
#zoom-ind small { font-weight: 400; color: #cdbf9f; margin-left: 6px; }
#zoom-ind.center { transform: translate(-50%, -50%); font-size: 22px; padding: 8px 18px; border-radius: 10px; }
/* Webfassung: kein Spielserver zum Beenden; Link zum Spielerhandbuch wie ein Knopf; Impressum/Datenschutz in der Versionszeile */
body.web #btn-start-quit { display: none; }
.legal { display: none; }
body.web .legal { display: inline; }
.app-ver a { color: #e8c46a; }
.app-ver .legal, .legal-row { white-space: nowrap; }                     /* Impressum und Datenschutz nie auseinander */
.modal .legal-row, #modal-card .legal-row { margin-top: 4px; }
.btnlink { display: inline-block; text-align: center; text-decoration: none; color: inherit; padding: 8px 14px; border: 1px solid #b08a3c; border-radius: 6px; background: rgba(42, 32, 24, 0.6); font: inherit; line-height: 1.25; }
.btnlink:hover { background: rgba(90, 62, 27, 0.7); }
.btnlink.hidden { display: none; }
/* Schieberegler in allen Browsern gleich: schmale Schiene, goldener Knopf, kein Fokusrahmen (Tastatur: Knopf hervorgehoben) */
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; height: 28px; margin: 0; padding: 0; border: 0; outline: none; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; background: #3a2e22; border: 1px solid #6b5636; border-radius: 4px; }
input[type=range]::-moz-range-track { height: 6px; background: #3a2e22; border: 1px solid #6b5636; border-radius: 4px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: #d6aa3e; border: 1px solid #5a3e1b; cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #d6aa3e; border: 1px solid #5a3e1b; cursor: pointer; box-sizing: border-box; }
input[type=range]::-moz-focus-outer { border: 0; }
input[type=range]:focus { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(214, 170, 62, 0.45); }
input[type=range]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px rgba(214, 170, 62, 0.45); }
