@font-face { font-family: 'Cinzel'; font-weight: 500; font-display: swap; src: url('/vendor/fonts/cinzel/cinzel-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-weight: 700; font-display: swap; src: url('/vendor/fonts/cinzel/cinzel-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya Sans'; font-weight: 400; font-display: swap; src: url('/vendor/fonts/alegreya/alegreya-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya Sans'; font-weight: 500; font-display: swap; src: url('/vendor/fonts/alegreya/alegreya-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya Sans'; font-weight: 700; font-display: swap; src: url('/vendor/fonts/alegreya/alegreya-sans-latin-700-normal.woff2') format('woff2'); }

:root {
  --ink: #0d1216;
  --slate: #1b252d;
  --slate2: #233039;
  --slate3: #2d3c47;
  --edge: #3f505c;
  --brass: #c9a35a;
  --brass-hi: #ecd08a;
  --brass-lo: #7d6332;
  --parch: #efe5cc;
  --muted: #a39b86;
  --ok: #7cc56c;
  --warn: #e2a84a;
  --bad: #d85a48;
  --food: #d9734f; --wood: #9b6b3c; --stone: #b8b5ad; --gold: #e6bf45; --iron: #7a8691;
  --display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --ui: 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--parch); font-family: var(--ui); font-size: 16px; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
kbd { font-family: var(--ui); font-size: 11px; padding: 0 4px; border: 1px solid var(--edge); border-radius: 3px; color: var(--muted); background: rgba(0,0,0,.25); }
.dim { color: var(--muted); }
:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 2px; }

/* Bildschirme */
.screen { position: fixed; inset: 0; display: none; }
.screen.on { display: block; }
#attract { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
body[data-screen="game"] #attract { display: none; }
body[data-screen="menu"] #attract, body[data-screen="lobby"] #attract { filter: saturate(.92); }
#screen-menu, #screen-lobby { background: linear-gradient(90deg, rgba(13,18,22,.88) 0%, rgba(13,18,22,.55) 34rem, rgba(13,18,22,0) 60rem); overflow-y: auto; }
#screen-lobby { background: rgba(13,18,22,.55); }

/* Messingbeschlagene Platte */
.plate {
  background: linear-gradient(180deg, var(--slate2), var(--slate));
  border: 1px solid var(--edge);
  box-shadow: inset 0 0 0 1px rgba(201,163,90,.18), 0 18px 60px rgba(0,0,0,.55);
  border-radius: 6px;
  position: relative;
}
.plate::before, .plate::after { content: ''; position: absolute; width: 14px; height: 14px; border: 2px solid var(--brass); }
.plate::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.plate::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }

h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2.6rem, 5vw, 3.6rem); letter-spacing: .02em; margin: 0 0 .4rem; color: var(--brass-hi); text-shadow: 0 2px 0 rgba(0,0,0,.4); line-height: 1.05; }
h1.small { font-size: 1.7rem; margin: 0; }
h2 { font-family: var(--display); font-weight: 500; font-size: 1.05rem; margin: 1.6rem 0 .6rem; color: var(--brass); }
.tagline { font-size: 1.12rem; line-height: 1.5; margin: 0 0 1.6rem; max-width: 34ch; color: #ddd3ba; }

button {
  background: linear-gradient(180deg, var(--slate3), var(--slate2));
  border: 1px solid var(--edge); border-radius: 4px; padding: .55rem 1rem; cursor: pointer;
  transition: border-color .12s, background .12s;
}
button:hover { border-color: var(--brass); }
button:active { transform: translateY(1px); }
button.primary { background: linear-gradient(180deg, #d8b46a, #a7843f); color: #1a1408; border-color: #e8c97e; font-weight: 700; }
button.primary:hover { background: linear-gradient(180deg, #e8c97e, #b8924a); }
button.big { padding: .8rem 1.2rem; font-size: 1.05rem; }
button.mini { padding: .2rem .55rem; font-size: .85rem; }
input, select {
  background: var(--ink); border: 1px solid var(--edge); border-radius: 4px; padding: .5rem .65rem; outline: none;
}
input:focus, select:focus { border-color: var(--brass); }
input.bad { border-color: var(--bad); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.field span { font-size: .9rem; color: var(--muted); }

/* Hauptmenü */
.plate.menu { width: min(440px, calc(100vw - 2rem)); margin: max(4vh, 1rem) 0 2rem max(5vw, 1rem); padding: 2.2rem 2rem 1.5rem; }
.menu .big { width: 100%; }
.join { display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: end; margin-top: 1rem; }
.join .field { margin: 0; }
#code { text-transform: uppercase; letter-spacing: .25em; font-weight: 700; }
#rooms { display: flex; flex-direction: column; gap: .4rem; max-height: 30vh; overflow: auto; }
#rooms p { margin: 0; line-height: 1.45; }
.room { display: grid; grid-template-columns: 4.2rem 1fr auto; gap: .6rem; text-align: left; align-items: center; }
.room b { font-family: var(--display); color: var(--brass-hi); letter-spacing: .1em; }
.room em { font-style: normal; color: var(--muted); font-size: .9rem; }
.conn { font-size: .85rem; margin: 1.4rem 0 0; color: var(--muted); }
.conn.ok::before { content: '● '; color: var(--ok); }
.conn.bad::before { content: '● '; color: var(--bad); }

/* Lobby */
.plate.lobby { width: min(1040px, calc(100vw - 2rem)); margin: 4vh auto 2rem; padding: 1.6rem 1.8rem; }
.lobby header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.lobby header p { margin: .2rem 0 0; }
#roomCode { letter-spacing: .14em; color: var(--parch); }
.cols { display: grid; grid-template-columns: 1.45fr 1fr; gap: 2rem; }
@media (max-width: 820px) { .cols { grid-template-columns: 1fr; gap: 0; } }
#slots { display: flex; flex-direction: column; gap: .35rem; }
.slot { display: grid; grid-template-columns: 6.2rem 1fr 6.4rem 6.5rem; gap: .5rem; align-items: center; padding: .35rem .5rem; background: rgba(0,0,0,.18); border: 1px solid transparent; border-radius: 4px; min-height: 2.6rem; }
.slot.human { border-color: rgba(201,163,90,.25); }
.slot.closed { opacity: .5; }
.slot select { padding: .3rem .45rem; width: 100%; }
.slot select.col { border-left: 14px solid var(--c); }
.slot .who em { color: var(--brass); font-style: normal; }
.sw { display: inline-block; width: 100%; height: 1.2rem; border-radius: 3px; }
.sw.empty { background: repeating-linear-gradient(45deg, #2a343c 0 4px, #222b32 4px 8px); }
.team { color: var(--muted); }
.tag { font-size: .85rem; color: var(--muted); justify-self: end; }
.tag.ok { color: var(--ok); }
.slot button.mini { justify-self: end; }
#settings { display: flex; flex-direction: column; gap: .45rem; }
#settings label { display: grid; grid-template-columns: 1fr 11rem; align-items: center; gap: .6rem; }
#settings label span { color: var(--muted); }
#settings b { font-weight: 500; }
.lobbychat { margin-top: 1.4rem; border-top: 1px solid var(--edge); padding-top: .8rem; }
#lchat { height: 7.5rem; overflow-y: auto; font-size: .95rem; line-height: 1.4; margin-bottom: .5rem; }
#lchat .sys, #chatlog .sys { color: var(--muted); font-style: italic; }
#lchatin { width: 100%; }
.lobby footer { display: flex; align-items: center; gap: .8rem; margin-top: 1.2rem; }
.lobby footer #startHint { flex: 1; font-size: .92rem; }

#notice { position: fixed; top: 1.2rem; left: 50%; transform: translate(-50%, -150%); visibility: hidden; background: var(--slate); border: 1px solid var(--bad); padding: .7rem 1.1rem; border-radius: 4px; transition: transform .25s; z-index: 50; }
#notice.on { transform: translate(-50%, 0); visibility: visible; }

/* ---------------------------------------------------------------- Spiel */
#view, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#overlay { pointer-events: none; }
#hud { position: absolute; inset: 0; pointer-events: none; user-select: none; }
#hud > * { pointer-events: auto; }
#hud #toasts, #hud #chatlog, #hud #players { pointer-events: none; }

#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: 44px;
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 1rem; padding: 0 .8rem;
  background: linear-gradient(180deg, rgba(27,37,45,.97), rgba(27,37,45,.9));
  border-bottom: 1px solid var(--brass-lo);
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
}
#res { display: flex; gap: .9rem; }
.rs { display: flex; align-items: center; gap: .35rem; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 4.2rem; }
.rs.pop { min-width: 5.5rem; }
.rs.full span { color: var(--bad); }
.ico { display: inline-block; width: 14px; height: 14px; border-radius: 3px; flex: none; box-shadow: inset 0 -2px 0 rgba(0,0,0,.3); }
.r-food { background: var(--food); border-radius: 50%; }
.r-wood { background: var(--wood); }
.r-stone { background: var(--stone); clip-path: polygon(20% 0, 100% 15%, 85% 100%, 0 80%); border-radius: 0; }
.r-gold { background: var(--gold); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); border-radius: 0; }
.r-iron { background: var(--iron); clip-path: polygon(0 30%, 100% 0, 100% 70%, 0 100%); border-radius: 0; }
.r-pop { background: var(--parch); border-radius: 50% 50% 3px 3px; }
.r-berry { background: #c2283a; border-radius: 50%; }

/* Das Epochenband: der rote Faden des Spiels */
#epochband { display: flex; height: 26px; border: 1px solid var(--brass-lo); border-radius: 3px; overflow: hidden; background: rgba(0,0,0,.35); min-width: 0; }
.ep { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; border-right: 1px solid rgba(201,163,90,.22); min-width: 0; }
.ep:last-child { border-right: 0; }
.ep span { position: relative; z-index: 1; font-family: var(--display); font-size: 11px; font-weight: 500; color: #6f6a5c; white-space: nowrap; overflow: hidden; text-overflow: clip; padding: 0 .3rem; }
.ep i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, rgba(201,163,90,.25), rgba(236,208,138,.55)); transition: width .3s linear; }
.ep.past { background: rgba(201,163,90,.18); }
.ep.past span { color: #b9a676; }
.ep.now { background: linear-gradient(180deg, #d8b46a, #9c7a38); flex: 1.6; }
.ep.now span { color: #1a1408; font-weight: 700; font-size: 12.5px; }
.ep.next span { color: var(--brass-hi); }
.ep.off { opacity: .35; }
@media (max-width: 1300px) { .ep:not(.now):not(.next) span { font-size: 0; } .ep:not(.now):not(.next) span::first-letter { font-size: 11px; } }
#clock { font-family: var(--display); font-variant-numeric: tabular-nums; color: var(--brass-hi); min-width: 3.4rem; text-align: right; }
#menuBtn { padding: .3rem .8rem; }

#players { position: absolute; top: 52px; right: 10px; display: flex; flex-direction: column; gap: 2px; font-size: .88rem; text-shadow: 0 1px 2px #000; }
.pl { display: grid; grid-template-columns: 10px auto auto auto; gap: .45rem; align-items: center; justify-content: end; background: rgba(13,18,22,.55); padding: 1px 8px; border-radius: 3px; }
.pl b { width: 10px; height: 10px; border-radius: 2px; }
.pl em { font-style: normal; color: var(--muted); }
.pl small { color: var(--muted); }
.pl.dead { opacity: .45; text-decoration: line-through; }

#toasts { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.toast { background: rgba(27,37,45,.94); border: 1px solid var(--edge); padding: .45rem 1rem; border-radius: 4px; font-weight: 500; box-shadow: 0 4px 14px rgba(0,0,0,.4); transition: opacity .5s, transform .5s; }
.toast.ok { border-color: var(--ok); }
.toast.warn { border-color: var(--bad); color: #ffd8d0; }
.toast.epoch { border-color: var(--brass); font-family: var(--display); font-size: 1.15rem; color: var(--brass-hi); padding: .6rem 1.4rem; }
.toast.link { pointer-events: auto; cursor: pointer; }
.toast.out { opacity: 0; transform: translateY(-6px); }

#chatlog { position: absolute; left: 12px; bottom: 214px; width: min(520px, 50vw); font-size: .95rem; line-height: 1.35; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
#chatlog .msg { transition: opacity 1.2s; }
#chatlog .msg.old { opacity: 0; }
#chatbox { position: absolute; left: 12px; bottom: 184px; display: none; }
#chatbox.on { display: block; }
#chatin { width: min(480px, 48vw); background: rgba(13,18,22,.92); }

#panel {
  position: absolute; left: 0; right: 0; bottom: 0; height: 176px;
  display: grid; grid-template-columns: 172px 1fr 288px; grid-template-rows: 160px; gap: 10px; padding: 8px 10px 8px 8px;
  background: linear-gradient(180deg, rgba(35,48,57,.98), rgba(27,37,45,.99));
  border-top: 1px solid var(--brass-lo);
  box-shadow: 0 -3px 14px rgba(0,0,0,.45);
}
.mmwrap { position: relative; width: 196px; height: 158px; overflow: hidden; border: 1px solid var(--brass-lo); border-radius: 3px; background: #000; align-self: center; justify-self: center; }
#minimap { width: 196px; height: 196px; display: block; cursor: crosshair; margin-top: -19px; }
#info { padding: 4px 6px; overflow: hidden; min-width: 0; }
#info h3 { font-family: var(--display); font-weight: 500; font-size: 1.15rem; margin: 0 0 .15rem; color: var(--brass-hi); }
#info p { margin: .15rem 0; font-size: .95rem; }
#info .cls { color: var(--muted); font-size: .88rem; }
#info .owner { display: flex; align-items: center; gap: .35rem; font-size: .9rem; }
#info .owner b { width: 10px; height: 10px; border-radius: 2px; }
#info .warnline { color: var(--warn); }
#info .stats { font-variant-numeric: tabular-nums; }
.one { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; }
.portrait { width: 96px; height: 96px; background: radial-gradient(circle at 50% 40%, #3a4c58, #1d272e); border: 1px solid var(--edge); border-radius: 4px; display: block; }
.portrait.glyph { display: flex; align-items: center; justify-content: center; font-size: 2.4rem; }
.portrait.glyph.r-gold, .portrait.glyph.r-stone, .portrait.glyph.r-iron, .portrait.glyph.r-berry { clip-path: none; border-radius: 4px; box-shadow: inset 0 0 0 26px #1d272e; }
.hp { position: relative; height: 16px; background: rgba(0,0,0,.45); border: 1px solid var(--edge); border-radius: 3px; margin: .35rem 0; max-width: 260px; overflow: hidden; }
.hp i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(180deg, #8fd77e, #4f9a44); }
.hp span { position: relative; font-size: 12px; padding-left: 6px; line-height: 15px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 1px #000; }
.none h3 + p { color: var(--brass); }
.queue { display: flex; gap: 4px; flex-wrap: wrap; margin-top: .3rem; }
.qi { position: relative; width: 38px; height: 38px; padding: 0; overflow: hidden; background: #1d272e; }
.qi img { width: 100%; height: 100%; display: block; }
.qi i { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(236,208,138,.35); }
.qi .glyph { font-size: 1.2rem; color: var(--brass-hi); }
.many { display: flex; flex-wrap: wrap; gap: 5px; align-content: flex-start; max-height: 152px; overflow: hidden; }
.grp { position: relative; width: 52px; height: 52px; padding: 0; background: radial-gradient(circle at 50% 40%, #3a4c58, #1d272e); }
.grp img { width: 100%; height: 100%; display: block; }
.grp b { position: absolute; right: 3px; top: 1px; font-size: 13px; text-shadow: 0 1px 2px #000; }
.grp i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--ok); }

#cmds { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, 50px); gap: 5px; align-content: center; }
.cmd { position: relative; padding: 0; overflow: hidden; background: radial-gradient(circle at 50% 35%, #3b4d5a, #1e2830); }
.cmd img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cmd kbd { position: absolute; left: 3px; top: 2px; font-size: 10px; padding: 0 3px; }
.cmd .lbl { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--brass-hi); }
.cmd.empty { visibility: hidden; }
.cmd.off { filter: grayscale(.85) brightness(.6); }
.cmd.active { border-color: var(--brass-hi); box-shadow: inset 0 0 0 2px var(--brass); }

#tooltip { position: fixed; width: 290px; background: rgba(18,25,30,.97); border: 1px solid var(--brass-lo); border-radius: 4px; padding: .6rem .75rem; font-size: .92rem; line-height: 1.4; display: none; pointer-events: none; z-index: 30; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
#tooltip.on { display: block; }
#tooltip h4 { margin: 0 0 .3rem; font-family: var(--display); font-weight: 500; color: var(--brass-hi); display: flex; justify-content: space-between; }
#tooltip p { margin: .3rem 0 0; }
#tooltip .why { color: var(--bad); }
#tooltip .stats { color: #cfc6ad; }
.cost { display: flex; gap: .7rem; flex-wrap: wrap; }
.cost .c { display: flex; align-items: center; gap: .25rem; font-weight: 700; }
.cost .c.no { color: var(--bad); }

.overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(8,11,14,.6); z-index: 20; }
.overlay.on { display: flex; }
.sheet { background: linear-gradient(180deg, var(--slate2), var(--slate)); border: 1px solid var(--brass-lo); border-radius: 6px; padding: 1.6rem 1.8rem; width: min(520px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.sheet.wide { width: min(860px, 96vw); }
.sheet h2 { font-size: 1.7rem; margin: 0 0 .3rem; color: var(--brass-hi); }
.sheet label { display: grid; grid-template-columns: 11rem 1fr; align-items: center; gap: .8rem; margin: .5rem 0; }
.sheet label.chk { display: flex; gap: .5rem; }
.sheet input[type=range] { accent-color: var(--brass); padding: 0; }
.sheet .row { display: flex; gap: .6rem; margin-top: 1.2rem; flex-wrap: wrap; }
.keys { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: .15rem .6rem; font-size: .88rem; margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--edge); }
.keys b { grid-column: 1 / -1; font-family: var(--display); font-weight: 500; color: var(--brass); margin-bottom: .2rem; }
.keys span { color: var(--parch); }
.keys em { font-style: normal; color: var(--muted); }
#endscreen h2 { font-size: 3rem; }
#endscreen .sub { font-size: 1.1rem; margin: .2rem 0; }
#endscreen table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-variant-numeric: tabular-nums; }
#endscreen th { text-align: left; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--edge); padding: .35rem .4rem; }
#endscreen td { padding: .4rem; border-bottom: 1px solid rgba(63,80,92,.4); }
#endscreen td b { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .45rem; }
#endscreen tr.win td { color: var(--brass-hi); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ================================================================
   Klassisches Gewand: Marmor, Bronze und Gold wie bei den großen
   Epochen-Strategiespielen um 2001. Texturen entstehen per SVG-Rauschen.
   ================================================================ */
:root {
  --marble: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='m' x='0' y='0' width='1' height='1'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0125 0.05' numOctaves='5' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.42  0 0 0 0 0.38  0 0 0 0 0.32  0.6 0.22 0 0 -0.22'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g' x='0' y='0' width='1' height='1'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 -0.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  --bronze-edge: linear-gradient(180deg, #f3dc9a 0%, #c79a48 38%, #7c5a26 62%, #b98c42 100%);
  --stone-a: #6d6455; --stone-b: #4a4337; --stone-c: #2e2a23;
}
/* Logo */
h1.logo { font-size: clamp(2.8rem, 5.6vw, 4.2rem); letter-spacing: .04em; line-height: .95; margin-bottom: .7rem;
  background: linear-gradient(180deg, #fff2c8 0%, #ecd08a 35%, #b8873a 60%, #f0d48c 78%, #8c6426 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,.65)) drop-shadow(0 0 18px rgba(236,208,138,.18)); }
h1.logo small { font-size: .42em; letter-spacing: .2em; vertical-align: .55em; }

/* Platten bekommen Marmor und Bronzerahmen */
.plate, .sheet {
  background: var(--grain), var(--marble), linear-gradient(180deg, #3b3a36, #24221e);
  border: 2px solid #8a6a32; border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255,230,160,.22), inset 0 0 40px rgba(0,0,0,.55), 0 18px 60px rgba(0,0,0,.6);
}
.plate::before, .plate::after { border-color: #f0d48c; width: 18px; height: 18px; }

/* Kopfleiste */
#topbar {
  height: 46px; background: var(--grain), var(--marble), linear-gradient(180deg, var(--stone-a), var(--stone-b));
  border-bottom: 0; box-shadow: 0 3px 0 -1px #2a2318, 0 4px 12px rgba(0,0,0,.55);
}
#topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; background: var(--bronze-edge); }
.rs { background: linear-gradient(180deg, rgba(0,0,0,.42), rgba(0,0,0,.25)); border: 1px solid rgba(0,0,0,.6); box-shadow: inset 0 1px 0 rgba(255,240,200,.12); border-radius: 3px; padding: 3px 8px 3px 6px; color: #f5ead0; text-shadow: 0 1px 1px #000; }
#res { gap: .45rem; }
#epochband { height: 30px; border: 2px solid #2a2318; outline: 1px solid #b58a40; border-radius: 2px; background: linear-gradient(180deg, #1d1a15, #2c271f); }
.ep { border-right: 1px solid rgba(201,163,90,.18); }
.ep b { position: relative; z-index: 1; font-family: var(--display); font-size: 11px; font-weight: 700; color: #6c6352; }
.ep span { display: none; }
.ep.now, .ep.next { flex: 5; }
.ep.now b, .ep.next b { display: none; }
.ep.now span, .ep.next span { display: block; }
.ep.past b { color: #c9a35a; }
.ep.now { background: linear-gradient(180deg, #f0d48c, #b8873a 55%, #8c6426); box-shadow: inset 0 1px 0 #fff2c8; }
.ep.now span { color: #1d1408; font-size: 13px; text-shadow: 0 1px 0 rgba(255,240,200,.5); }
.ep.next span { color: var(--brass-hi); font-size: 12px; }
@media (max-width: 1300px) { .ep:not(.now):not(.next) span { font-size: 0; } }
#clock { color: #fff0c4; text-shadow: 0 1px 2px #000; background: rgba(0,0,0,.35); border: 1px solid rgba(0,0,0,.6); padding: 2px 8px; border-radius: 3px; }
#menuBtn { background: linear-gradient(180deg, #8c7a5a, #574a35); border: 1px solid #c9a35a; color: #fff0c4; font-family: var(--display); }

/* Unteres Bedienfeld */
#panel {
  height: 188px; grid-template-rows: 166px; padding: 12px 12px 8px 10px;
  background: var(--grain), var(--marble), linear-gradient(180deg, var(--stone-a), var(--stone-b) 60%, var(--stone-c));
  border-top: 0; box-shadow: 0 -4px 14px rgba(0,0,0,.55);
}
#panel::before { content: ''; position: absolute; left: 0; right: 0; top: -4px; height: 4px; background: var(--bronze-edge); box-shadow: 0 -1px 0 #2a2318; }
.mmwrap, #info, #cmds { border: 2px solid #2a2318; outline: 1px solid #b58a40; outline-offset: 0; box-shadow: inset 0 0 18px rgba(0,0,0,.75); border-radius: 2px; }
.mmwrap { width: 162px; height: 162px; }
#minimap { width: 158px; height: 158px; margin: 0; }
#info { background: linear-gradient(180deg, rgba(16,20,22,.88), rgba(28,30,30,.92)); padding: 6px 10px; }
#cmds { background: linear-gradient(180deg, rgba(16,20,22,.8), rgba(28,30,30,.88)); padding: 6px; grid-template-rows: repeat(3, 48px); gap: 4px; }
#chatlog { bottom: 226px; } #chatbox { bottom: 196px; }
.cmd {
  background: radial-gradient(circle at 50% 35%, #4b5a5e, #1d2426 75%);
  border: 2px solid; border-color: #d8b46a #6e5226 #5a421e #c9a35a; border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.65), 0 1px 2px rgba(0,0,0,.6);
}
.cmd:hover { border-color: #fff0c4 #a7843f #8c6426 #f0d48c; filter: brightness(1.12); }
.cmd .lbl { font-family: var(--display); font-size: 1.45rem; color: #f0d48c; text-shadow: 0 1px 2px #000; }
.cmd kbd { background: rgba(0,0,0,.55); border-color: rgba(201,163,90,.5); color: #e9dcb8; }
.cmd .badge { position: absolute; right: 2px; bottom: 1px; font-style: normal; font-size: 15px; line-height: 1; color: #fff0c4; text-shadow: 0 0 3px #000, 0 1px 1px #000; }
.cmd .lv { position: absolute; left: 3px; bottom: 1px; font-size: 10px; color: #f0d48c; text-shadow: 0 1px 1px #000; }
.cmd.done { filter: none; opacity: .55; }
.cmd.done::after { content: '✓'; position: absolute; right: 3px; top: 1px; color: var(--ok); font-weight: 700; text-shadow: 0 1px 1px #000; }
.portrait { border: 2px solid; border-color: #d8b46a #6e5226 #5a421e #c9a35a; border-radius: 2px; background: radial-gradient(circle at 50% 40%, #4b5a5e, #1d2426); }
.portrait.glyph { color: #f0d48c; }
#info h3 { color: #f3dc9a; text-shadow: 0 1px 2px #000; }
#info .morale { color: #e9c46a; font-size: .9rem; }
#info .cargo { color: #9fd0ff; font-size: .9rem; }
#info .okline { color: var(--ok); }
#info .techs { font-size: .85rem; line-height: 1.35; max-height: 4.2em; overflow: hidden; }
.hp { border-color: #2a2318; }
.hp i { background: linear-gradient(180deg, #9be08a, #4f9a44 60%, #3c7a33); }
.qi { border: 1px solid #8a6a32; }
.grp { border: 1px solid #8a6a32; }
.pl i { font-style: normal; color: #ffb347; }
#tooltip { background: var(--grain), linear-gradient(180deg, rgba(40,36,30,.98), rgba(22,20,17,.98)); border: 1px solid #b58a40; box-shadow: inset 0 0 0 1px rgba(0,0,0,.6), 0 8px 24px rgba(0,0,0,.6); }
.toast { background: linear-gradient(180deg, rgba(52,46,38,.96), rgba(30,27,23,.96)); border: 1px solid #8a6a32; }
.toast.big { border-color: var(--brass-hi); font-family: var(--display); font-size: 1.05rem; color: var(--brass-hi); }
.toast.warn { border-color: #e2563f; box-shadow: 0 0 18px rgba(226,86,63,.35); }
button { background: linear-gradient(180deg, #5a5446, #39352c); border-color: #7c6a46; }
button:hover { border-color: var(--brass-hi); }
.keys { grid-template-columns: 1.1fr 1fr 1.1fr 1fr; }

/* Lesbarkeit: nichts darf abgeschnitten werden */
.ep { min-width: 15px; }
.ep b { font-size: 10px; }
.ep .short, .ep.now .short { display: none; }
.ep.now, .ep.next { flex: 0 0 auto; padding: 0 10px; }
.ep.now span, .ep.next span { overflow: visible; text-overflow: clip; padding: 0; }
.ep.next .full { display: none; }
.ep.next .short { display: block; }
@media (max-width: 1499px) {
  .ep.now .full { display: none; }
  .ep.now .short { display: block; }
}
@media (max-width: 1299px) {
  #topbar { gap: .6rem; padding: 0 .5rem; }
  #res { gap: .3rem; }
  .rs { min-width: 0; padding: 3px 6px 3px 5px; font-size: .92rem; gap: .25rem; }
  .rs.pop { min-width: 0; }
  .ep.next span { display: none !important; }
  #menuBtn { padding: .3rem .55rem; }
}
.hp span { display: block; font-size: 11px; line-height: 14px; }
.cmd .lbl.long { font-size: 1.05rem; padding-top: 8px; letter-spacing: -.02em; }
.toast { max-width: min(640px, 70vw); text-align: center; }
.toast.big { font-size: .98rem; line-height: 1.35; }
#players { align-items: flex-end; }
.lobby footer { position: sticky; bottom: 0; margin: 1.2rem -1.8rem -1.6rem; padding: .8rem 1.8rem; background: linear-gradient(180deg, rgba(36,34,30,.92), rgba(28,26,23,.98)); border-top: 1px solid #8a6a32; z-index: 2; }
@media (max-height: 760px) { #lchat { height: 4.5rem; } .plate.lobby { margin-top: 2vh; } }
#info p { margin: .1rem 0; font-size: .92rem; line-height: 1.3; }
#info h3 { font-size: 1.08rem; }
#info .hp { margin: .25rem 0; }
.hp { height: 18px; }
.hp span { text-align: center; padding: 0; line-height: 16px; font-size: 11.5px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.hp span { font-weight: 700; text-shadow: 0 1px 1px #000, 0 0 3px rgba(0,0,0,.8); }

/* Markt: Tauschtasten und Kursliste */
.cmd .lbl.trade { gap: 1px; padding-bottom: 9px; font-size: 1rem; }
.cmd .lbl.trade .ico { width: 15px; height: 15px; }
.cmd .lbl.trade i { font-style: normal; font-family: var(--display); color: #f0d48c; font-size: .95rem; line-height: 1; }
#info .market { line-height: 1.5; }
#info .market span { display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; white-space: nowrap; }
#info .market .ico { width: 12px; height: 12px; }
.sheet select { width: 100%; min-width: 0; }
/* Glaubenskraft des Propheten */
#info .hp.mana { margin-top: 4px; }
#info .hp.mana i { background: linear-gradient(#b48cff, #6f4bc4); }

/* Wiederholungen und Spielstände */
#archive { position: fixed; z-index: 60; }
#archive .sheet { max-height: 86vh; display: flex; flex-direction: column; }
#archiveList { overflow-y: auto; min-height: 120px; margin: .6rem 0; }
.archive .arow { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: .55rem .2rem; border-bottom: 1px solid rgba(240,212,140,.12); }
.archive .when { margin: 0; font-size: .92rem; }
.archive .who { margin: .2rem 0 0; display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .88rem; color: #cfc4a8; }
.archive .who span { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.archive .who b { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.archive .who em { font-style: normal; opacity: .65; font-size: .8rem; }
.archive .acts { display: flex; gap: .4rem; flex: none; }
a.btn { display: inline-flex; align-items: center; padding: .45rem .9rem; border-radius: 6px; border: 1px solid rgba(240,212,140,.35); color: inherit; text-decoration: none; font-size: .92rem; }
.filebtn { position: relative; display: inline-flex; align-items: center; padding: .5rem 1rem; border: 1px solid rgba(240,212,140,.35); border-radius: 6px; cursor: pointer; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
button.ghost { background: transparent; border: 1px solid rgba(240,212,140,.3); margin-top: .6rem; }
.loaded { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; padding: .6rem .8rem; margin-bottom: .6rem; border: 1px solid rgba(240,212,140,.35); border-radius: 6px; background: rgba(240,212,140,.06); }
.loaded span { flex: 1 1 12rem; color: #cfc4a8; }
#replaybar { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); z-index: 15; display: flex; align-items: center; gap: .5rem; padding: .35rem .6rem; border-radius: 8px; background: rgba(14,18,22,.88); border: 1px solid rgba(240,212,140,.3); max-width: calc(100vw - 24px); flex-wrap: wrap; justify-content: center; }
#replaybar button { padding: .25rem .55rem; min-width: 0; font-size: .9rem; }
#replaybar .rp-speed { display: inline-flex; gap: 2px; }
#replaybar .rp-speed button.on { background: rgba(240,212,140,.25); }
#replaybar .rp-time, #replaybar .rp-end { font-variant-numeric: tabular-nums; min-width: 3.2rem; text-align: center; font-size: .9rem; }
#replaybar .rp-seek { width: min(20vw, 280px); }
#replaybar { flex-wrap: nowrap; white-space: nowrap; }
@media (max-width: 1100px) { #replaybar { flex-wrap: wrap; } }
#replaybar select { font-size: .88rem; max-width: 14rem; }

/* Diplomatie und Wunder-Countdown */
#dipBtn { padding: .3rem .6rem; font-size: 1.05rem; background: linear-gradient(180deg, #6d6048, #463c2b); border: 1px solid #a88a4e; color: #fff0c4; }
#wonderbar { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); z-index: 14; display: none; padding: .3rem .9rem; border-radius: 6px; font-family: var(--display); font-size: .95rem; white-space: nowrap; background: rgba(90,20,14,.88); border: 1px solid #e0705a; color: #ffe3d8; }
#wonderbar.on { display: block; }
#wonderbar.own { background: rgba(26,70,30,.88); border-color: #7fd07a; color: #e8ffe4; }
#replaybar ~ #wonderbar, body:has(#replaybar) #wonderbar { top: 96px; }
#diplo .sheet { max-height: 86vh; overflow-y: auto; }
#diploList .drow { display: grid; grid-template-columns: minmax(10rem, 1fr) 7rem; gap: .4rem .8rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid rgba(240,212,140,.12); }
#diploList .dwho { display: flex; align-items: center; gap: .45rem; min-width: 0; }
#diploList .dwho em { font-style: normal; opacity: .7; }
#diploList .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
#diploList .trib { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .3rem; }
#diploList .trib button { display: inline-flex; align-items: center; gap: .2rem; padding: .2rem .45rem; font-size: .82rem; }
#diploList .trib button .ico { width: 12px; height: 12px; }
.tag.bad { color: #ffb4a4; border-color: rgba(255,120,100,.5); }

/* Tageszeit und Wetter neben der Uhr */
#envIco { font-size: 1.05rem; line-height: 1; color: #fff0c4; text-shadow: 0 1px 2px #000; background: rgba(0,0,0,.35); border: 1px solid rgba(0,0,0,.6); padding: 3px 6px; border-radius: 3px; cursor: default; letter-spacing: .1em; font-family: 'Segoe UI Symbol', 'DejaVu Sans', sans-serif; }
/* Oberleiste: beliebig viele Elemente rechts der Epochenleiste (Uhr, Wetter, Diplomatie, Menü) */
#topbar { grid-template-columns: auto 1fr; grid-auto-flow: column; grid-auto-columns: auto; }
#diploList .dask { grid-column: 1 / -1; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; color: #f2d79a; font-size: .9rem; padding: .3rem 0 .1rem; }
