/* TerraKatan – Oberfläche: Pergament, Holz, weiche Farben */
:root {
  --paper: #f7edd5; --paper2: #efdfb8; --paper3: #e4d0a0;
  --ink: #3b2a1a; --ink2: #6d5538; --line: #b99a62;
  --wood: #b2702f; --wood2: #8a5322; --wood3: #6a3e15;
  --gold: #f0b43c; --good: #3f9a45; --bad: #c0392b; --sea: #2a6e9c;
  --shadow: 0 6px 18px rgba(20, 30, 50, .35);
  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --serif: Georgia, "Palatino Linotype", "Book Antiqua", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1d5b86; color: var(--ink); font-family: var(--font); font-size: 15px; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
.hidden { display: none !important; }
button { font-family: inherit; }
#board { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }

/* ---------------------------------------------------------------- Lade-Anzeige */
#loading { position: fixed; inset: 0; z-index: 99; background: #1d5b86; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.spin { width: 38px; height: 38px; border: 4px solid rgba(255, 255, 255, .3); border-top-color: #fff; border-radius: 50%; animation: sp 0.9s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- Buttons & Felder */
.btn { appearance: none; border: 2px solid var(--wood3); border-radius: 11px; padding: 9px 16px; font-size: 15px; font-weight: 700; color: var(--ink); cursor: pointer;
  background: linear-gradient(180deg, #fbf3dd, #ead9aa); box-shadow: 0 2px 0 var(--wood3), 0 4px 8px rgba(0, 0, 0, .18); transition: transform .08s, filter .15s; }
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 0 0 var(--wood3), 0 2px 4px rgba(0, 0, 0, .2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #ffd273, #e8a02a); color: #3b2305; border-color: #8a5a10; box-shadow: 0 2px 0 #8a5a10, 0 4px 8px rgba(0, 0, 0, .2); }
.btn.good { background: linear-gradient(180deg, #8fdc88, #4ea84a); border-color: #2b6a2a; box-shadow: 0 2px 0 #2b6a2a; color: #12330f; }
.btn.danger { background: linear-gradient(180deg, #f1a095, #cf5545); border-color: #7b1f14; box-shadow: 0 2px 0 #7b1f14; color: #3a0b05; }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 9px; }
.btn.big { padding: 13px 22px; font-size: 18px; border-radius: 14px; width: 100%; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; text-decoration: underline; }
.btn small { display: block; font-weight: 400; font-size: 12px; opacity: .8; margin-top: 2px; }
input[type=text] { width: 100%; padding: 9px 11px; font-size: 16px; border: 2px solid var(--line); border-radius: 10px; background: #fffaf0; color: var(--ink); font-family: inherit; }
input[type=text]:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(240, 180, 60, .35); }
input.code { text-transform: uppercase; letter-spacing: 4px; text-align: center; font-weight: 800; font-size: 20px; }
.btn:focus-visible, .seg button:focus-visible, .tile:focus-visible, .toggle:focus-visible, .ibtn:focus-visible { outline: 3px solid #1b74d1; outline-offset: 2px; }

.seg { display: inline-flex; flex-wrap: wrap; border: 2px solid var(--wood3); border-radius: 11px; overflow: hidden; background: var(--paper2); }
.seg button { border: 0; background: transparent; padding: 7px 13px; font-size: 14px; font-weight: 700; color: var(--ink2); cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: linear-gradient(180deg, #ffd273, #e8a02a); color: #3b2305; }
.toggle { display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px 0; font-size: 14px; color: var(--ink); cursor: pointer; text-align: left; }
.toggle i { position: relative; flex: none; width: 44px; height: 24px; border-radius: 12px; background: #b3a98f; border: 2px solid var(--wood3); transition: background .15s; }
.toggle i::after { content: ""; position: absolute; top: 1px; left: 1px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .4); transition: transform .15s; }
.toggle.on i { background: var(--good); }
.toggle.on i::after { transform: translateX(20px); }
.field { margin: 0 0 14px; }
.field > label { display: block; font-weight: 700; font-size: 13px; color: var(--ink2); margin: 0 0 5px; text-transform: uppercase; letter-spacing: .5px; }
.field > small { display: block; margin-top: 4px; color: var(--ink2); font-size: 12px; }
.colors { display: flex; gap: 10px; }
.swatchbtn { width: 38px; height: 38px; border-radius: 50%; border: 3px solid; cursor: pointer; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
.swatchbtn.on { outline: 3px solid var(--gold); outline-offset: 2px; }
.swatchbtn:disabled { opacity: .25; cursor: not-allowed; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: flex-end; margin-top: 16px; }
.btnrow .muted { flex: 1 1 100%; margin: 0; text-align: right; }
.muted { color: var(--ink2); font-size: 13px; }
.ok { color: #2b7a2d; font-weight: 700; } .bad { color: var(--bad); font-weight: 700; }
.or { text-align: center; color: var(--ink2); margin: 12px 0; font-size: 13px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid; margin-right: 6px; vertical-align: -1px; }
.tag { font-style: normal; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; padding: 1px 6px; border-radius: 8px; background: #d8c8a0; color: var(--ink2); margin-left: 5px; white-space: nowrap; }
.tag.you { background: #ffd273; color: #5a3a05; } .tag.off { background: #e9b3ab; color: #7b1f14; } .tag.on { background: #bfe5b9; color: #1d5a1d; }

/* ---------------------------------------------------------------- Bildschirme (Menü, Einrichtung, Lobby) */
#screens { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(ellipse at center, rgba(20, 50, 80, .15), rgba(10, 30, 50, .55)); overflow: auto; }
#screen { width: 100%; max-height: 100%; display: flex; justify-content: center; }
#screen.scroll { align-items: flex-start; }
.panel { width: min(520px, 100%); background: linear-gradient(180deg, var(--paper), var(--paper2)); border: 3px solid var(--wood3); border-radius: 18px; padding: 22px 24px; box-shadow: var(--shadow), inset 0 0 0 2px #fff6; margin: auto; }
.panel h2 { margin: 0 0 14px; font-family: var(--serif); font-size: 26px; }
.menu { width: min(420px, 100%); text-align: center; margin: auto; }
.logo { margin: 0; font-family: var(--serif); font-size: clamp(44px, 9vw, 72px); font-weight: 900; color: #fff6dc; letter-spacing: 1px; text-shadow: 0 3px 0 var(--wood3), 0 6px 0 #4a2a0c, 0 10px 24px rgba(0, 0, 0, .5); }
.logo span { color: #a6e06a; text-shadow: 0 3px 0 #265a2b, 0 6px 0 #173a1b, 0 10px 24px rgba(0, 0, 0, .5); }
.tagline { margin: 6px 0 22px; color: #fff; font-size: 17px; letter-spacing: 2px; text-shadow: 0 2px 6px rgba(0, 0, 0, .6); }
.menu-btns { display: flex; flex-direction: column; gap: 12px; }
.menu-foot { margin-top: 18px; color: #e7f1f9; font-size: 11.5px; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
.menu-foot .btn.ghost { color: #fff; }

.slots { display: flex; flex-direction: column; gap: 10px; }
.slot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; background: #fffaf0; border: 2px solid var(--line); border-radius: 12px; }
.slot small { display: block; color: var(--ink2); margin-top: 2px; font-size: 12px; }
.slot-btns { display: flex; gap: 6px; flex: none; }

.lobby { width: min(600px, 100%); }
.lb-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.lb-head h2 { margin: 0; flex: 1 1 auto; }
.roombox { display: flex; flex-direction: column; align-items: center; background: #fffaf0; border: 2px dashed var(--wood); border-radius: 12px; padding: 4px 16px; }
.roombox span { font-size: 11px; text-transform: uppercase; color: var(--ink2); letter-spacing: .5px; }
.bigcode { font-size: 30px; letter-spacing: 6px; font-family: var(--serif); }
.lb-seats { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.seat { display: flex; align-items: center; gap: 4px; padding: 8px 12px; background: #fffaf0; border: 2px solid var(--line); border-left: 8px solid var(--c); border-radius: 12px; }
.seat.me { background: #fff3cf; }
.seat .sn { font-weight: 700; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-acts { display: flex; gap: 6px; margin-left: 6px; }
.lb-opts { display: flex; flex-wrap: wrap; gap: 12px 18px; margin: 12px 0; align-items: end; }
.lb-opts .field { margin: 0; }
.lb-chat { margin-top: 8px; }
.lb-chatlist { height: 90px; overflow-y: auto; background: #fffaf0; border: 2px solid var(--line); border-radius: 10px; padding: 6px 8px; font-size: 13px; }
.chatform { display: flex; gap: 6px; padding: 6px; }
.lb-chat .chatform { padding: 6px 0 0; }
.chatform input { padding: 6px 9px; font-size: 14px; }

/* ---------------------------------------------------------------- Spiel-HUD */
#game { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.hud { position: absolute; pointer-events: auto; }
.panelish { background: linear-gradient(180deg, rgba(251, 243, 221, .96), rgba(239, 223, 184, .96)); border: 2px solid var(--wood3); border-radius: 14px; box-shadow: var(--shadow); }

#players { top: 10px; left: 10px; width: 232px; display: flex; flex-direction: column; gap: 7px; pointer-events: none; }
.pl { pointer-events: auto; position: relative; padding: 7px 10px 7px 14px; background: rgba(251, 243, 221, .95); border: 2px solid var(--wood3); border-radius: 12px; box-shadow: 0 3px 8px rgba(0, 0, 0, .3); overflow: hidden; }
.pl::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--c); border-right: 2px solid var(--cd); }
.pl.cur { background: #fff1b8; border-color: #c88410; box-shadow: 0 0 0 3px rgba(255, 210, 90, .75), 0 3px 8px rgba(0, 0, 0, .3); }
.pl.cur::after { content: "▶"; position: absolute; right: 8px; bottom: 4px; font-size: 11px; color: #a86d08; }
.pl.off { opacity: .65; }
.pl-top { display: flex; align-items: center; gap: 2px; }
.pl-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 96px; }
.pl-vp { margin-left: auto; font-weight: 900; font-size: 17px; color: #a86d08; }
.pl-stats { display: flex; gap: 8px; font-size: 12.5px; margin-top: 3px; flex-wrap: wrap; color: var(--ink2); }
.pl-badges { margin-top: 3px; display: flex; gap: 4px; }
.badge { font-size: 11px; font-weight: 800; background: #ffd273; border: 1px solid #a86d08; border-radius: 8px; padding: 0 5px; }

#banner { top: 10px; left: 50%; transform: translateX(-50%); max-width: min(560px, calc(100vw - 520px)); min-width: 220px; text-align: center; padding: 8px 18px; font-weight: 700; font-size: 16px; background: rgba(251, 243, 221, .95); border: 2px solid var(--wood3); border-radius: 14px; box-shadow: var(--shadow); pointer-events: none; }
#banner.mine { background: linear-gradient(180deg, #ffe39a, #ffc94d); border-color: #8a5a10; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255, 210, 90, .5), var(--shadow); } }

#tr { top: 10px; right: 10px; display: flex; gap: 6px; }
.ibtn { width: 42px; height: 42px; font-size: 20px; line-height: 1; border: 2px solid var(--wood3); border-radius: 12px; background: linear-gradient(180deg, #fbf3dd, #ead9aa); box-shadow: 0 2px 0 var(--wood3), 0 4px 8px rgba(0, 0, 0, .25); cursor: pointer; color: var(--ink); }
.ibtn:active { transform: translateY(2px); }
.ibtn.badge-on::after { content: ""; position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); margin: -18px 0 0 14px; }

#logbox { top: 62px; right: 10px; width: 270px; max-height: 38vh; display: flex; flex-direction: column; background: rgba(251, 243, 221, .94); border: 2px solid var(--wood3); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.logtabs { display: flex; border-bottom: 2px solid var(--line); }
.logtabs button { flex: 1; border: 0; background: transparent; padding: 5px; font-weight: 700; font-size: 12px; color: var(--ink2); cursor: pointer; }
.logtabs button.on { background: var(--paper3); color: var(--ink); }
#log, #chatlist { overflow-y: auto; padding: 4px 8px; font-size: 12.5px; line-height: 1.35; min-height: 90px; flex: 1; }
.le { padding: 2px 0 2px 8px; border-left: 4px solid var(--c, #bba97d); margin: 2px 0; word-wrap: break-word; }
.le.priv { font-style: italic; color: var(--ink2); }
.le.chatm { border-left-color: var(--c); }

#floaters { left: 10px; bottom: 220px; width: 260px; pointer-events: none; }
.tcard { pointer-events: auto; background: linear-gradient(180deg, #fffaf0, #f3e4bd); border: 3px solid var(--wood3); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow); animation: pop .25s ease-out; }
.tcard.in { border-color: #b2761a; box-shadow: 0 0 0 4px rgba(255, 210, 90, .6), var(--shadow); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.tcard h4 { margin: 0 0 6px; font-size: 14px; }
.trow { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.arr { font-weight: 800; padding: 0 6px; color: var(--ink2); }
.tresp { margin: 8px 0; display: flex; flex-direction: column; gap: 5px; }
.tr-p { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; }
.tr-p em { font-size: 12px; color: var(--ink2); } .tr-p em.no { color: var(--bad); }
.tbtns { display: flex; gap: 8px; margin-top: 8px; } .tnote { margin: 6px 0 0; font-size: 12.5px; color: var(--ink2); }
.cost { display: inline-flex; align-items: center; gap: 1px; font-size: 13px; margin-right: 4px; }
.cost b { font-size: 13px; }
.ri { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; }
.cost .ri { width: 18px; height: 18px; }

#bottom { left: 0; right: 0; bottom: 0; padding: 0 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
#actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; pointer-events: none; }
#actions.empty { display: none; }
#actions > * { pointer-events: auto; }
.act { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 84px; min-height: 66px; padding: 6px 10px 5px; border: 2px solid var(--wood3); border-radius: 13px; cursor: pointer; font-weight: 800; color: var(--ink);
  background: linear-gradient(180deg, #fbf3dd, #ead9aa); box-shadow: 0 3px 0 var(--wood3), 0 6px 10px rgba(0, 0, 0, .25); transition: transform .08s, filter .15s; }
.act:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-2px); }
.act:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.4); }
.act.active { background: linear-gradient(180deg, #ffe39a, #ffc94d); border-color: #8a5a10; box-shadow: 0 0 0 4px rgba(255, 210, 90, .7), 0 3px 0 #8a5a10; }
.act.big { min-width: 130px; background: linear-gradient(180deg, #ffd273, #e8a02a); border-color: #8a5a10; box-shadow: 0 3px 0 #8a5a10, 0 6px 10px rgba(0, 0, 0, .25); font-size: 16px; }
.act.big .ai { font-size: 26px; }
.ai { font-size: 22px; line-height: 1; } .al { font-size: 12.5px; margin-top: 2px; } .ac { display: flex; margin-top: 2px; min-height: 18px; }
.an { position: absolute; top: -7px; right: -7px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--wood2); color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; border: 2px solid #fff3d6; }

#handrow { display: flex; align-items: flex-end; gap: 10px; padding: 8px 12px; pointer-events: auto; max-width: 100%; overflow-x: auto; background: linear-gradient(180deg, rgba(251, 243, 221, .96), rgba(232, 211, 160, .97)); border: 3px solid var(--wood3); border-radius: 16px; box-shadow: var(--shadow); }
#dice { display: flex; gap: 6px; align-items: center; flex: none; min-width: 120px; }
.die { width: 42px; height: 42px; border-radius: 9px; background: #fff; border: 2px solid #444; box-shadow: 0 2px 0 #444; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 5px; }
.die i { border-radius: 50%; } .die i.on { background: #222; }
.die.blank { display: flex; align-items: center; justify-content: center; color: #aaa; font-weight: 800; font-size: 20px; background: #f1ece0; box-shadow: none; }
#dice.rolling .die { animation: shake .14s infinite; }
@keyframes shake { 25% { transform: rotate(-9deg) translateY(-2px); } 75% { transform: rotate(9deg) translateY(2px); } }
.dsum { font-size: 22px; font-weight: 900; color: #a86d08; font-family: var(--serif); min-width: 28px; }
#hand, #devs { display: flex; gap: 6px; flex: none; }
.card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 64px; padding: 5px 2px 4px; border: 2px solid var(--wood3); border-radius: 10px; background: linear-gradient(180deg, #fffaf0, #f0e0b8); font-family: inherit; color: var(--ink); }
.card .ri { width: 34px; height: 34px; }
.card b { font-size: 18px; line-height: 1.1; } .card span { font-size: 10.5px; color: var(--ink2); }
.card.zero { opacity: .5; }
.card.up { animation: up .9s ease-out; } .card.down { animation: down .9s ease-out; }
@keyframes up { 0% { transform: translateY(8px) scale(1.12); background: #c6f0bd; } 100% { transform: none; } }
@keyframes down { 0% { background: #f3c1b8; } 100% { } }
.card.dev { cursor: default; width: 70px; }
.card.dev.playable { cursor: pointer; border-color: #a86d08; box-shadow: 0 0 0 3px rgba(255, 210, 90, .7); }
.card.dev.playable:hover { transform: translateY(-3px); }
.card .new { position: absolute; top: -8px; right: -6px; font-size: 9.5px; font-style: normal; font-weight: 800; background: #6a8fd6; color: #fff; padding: 1px 5px; border-radius: 7px; }
#vpbox { flex: none; text-align: center; padding: 0 4px; }
.vp-big { display: flex; align-items: baseline; gap: 3px; font-family: var(--serif); } .vp-big span { color: #d99a1b; font-size: 22px; } .vp-big b { font-size: 34px; } .vp-big small { color: var(--ink2); font-size: 13px; }
.vp-hid { font-size: 11px; color: var(--ink2); }

/* ---------------------------------------------------------------- Dialoge */
#modals { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.modal-back { position: fixed; inset: 0; background: rgba(15, 30, 50, .5); display: flex; align-items: center; justify-content: center; padding: 14px; pointer-events: auto; animation: fade .15s; overflow: auto; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(500px, 100%); max-height: 100%; overflow: auto; background: linear-gradient(180deg, var(--paper), var(--paper2)); border: 3px solid var(--wood3); border-radius: 18px; padding: 18px 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); animation: pop .2s ease-out; margin: auto; }
.modal.wide { width: min(680px, 100%); } .modal.small { width: min(380px, 100%); }
.modal h2 { margin: 0 0 12px; font-family: var(--serif); font-size: 23px; }
.modal-body p { margin: 0 0 10px; line-height: 1.45; }
.modal-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.menu-list { display: flex; flex-direction: column; gap: 9px; }
.roomcode { text-align: center; font-size: 15px; } .roomcode b { font-size: 22px; letter-spacing: 4px; font-family: var(--serif); }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 96px; padding: 8px 4px; border: 2px solid var(--wood3); border-radius: 12px; background: linear-gradient(180deg, #fffaf0, #efdfb8); cursor: pointer; font-size: 13px; font-weight: 700; color: var(--ink); }
.tile small { font-weight: 400; font-size: 11px; color: var(--ink2); text-align: center; }
.tile .ri { width: 38px; height: 38px; }
.tile:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-2px); }
.tile.sel { border-color: #a86d08; background: linear-gradient(180deg, #ffe9a8, #ffcf5a); box-shadow: 0 0 0 3px rgba(255, 210, 90, .7); }
.tile.dis, .tile:disabled { opacity: .45; cursor: not-allowed; }
.tile i { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; background: var(--wood2); color: #fff; font-style: normal; font-size: 12px; display: flex; align-items: center; justify-content: center; border: 2px solid #fff3d6; }
.tile.terr { width: 120px; } .tile.terr .swatch { width: 52px; height: 46px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.grid5 { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.gcell { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 90px; } .gcell .ri { width: 36px; height: 36px; } .gcell small { color: var(--ink2); font-size: 11.5px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.sb { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--wood3); background: #fbf3dd; font-size: 17px; font-weight: 800; cursor: pointer; line-height: 1; padding: 0; color: var(--ink); }
.sb:disabled { opacity: .35; cursor: not-allowed; } .sv { min-width: 22px; text-align: center; font-weight: 800; font-size: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } .tcol h4 { margin: 4px 0 8px; }
.trade-line { display: flex; align-items: center; gap: 6px; margin: 5px 0; } .trade-line span { flex: 1; font-size: 14px; }
.victims { display: flex; flex-wrap: wrap; gap: 10px; } .victim { display: flex; align-items: center; gap: 6px; border-left: 8px solid var(--c); }
.winner { font-family: var(--serif); font-size: 26px; text-align: center; margin: 4px 0 12px; }
.score { width: 100%; border-collapse: collapse; } .score td { padding: 7px 8px; border-bottom: 1px solid var(--line); } .score tr.win td { font-weight: 800; background: #fff1b8; }
.help details { border-bottom: 1px solid var(--line); padding: 6px 0; } .help summary { cursor: pointer; font-weight: 800; padding: 5px 0; font-size: 16px; }
.help p, .help ul, .help ol { margin: 6px 0 8px; line-height: 1.5; font-size: 14px; } .help li { margin: 3px 0; }
.help .terra summary::before { content: "🌍 "; }
table.costs { border-collapse: collapse; margin: 6px 0; } table.costs td { padding: 4px 14px 4px 0; vertical-align: middle; }

#toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 460px); }
.toast { background: #2b3a4d; color: #fff; padding: 9px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); text-align: center; animation: pop .2s ease-out; transition: opacity .4s, transform .4s; }
.toast.bad { background: #a8321f; } .toast.good { background: #2d7b36; } .toast.info { background: #3a5a86; } .toast.out { opacity: 0; transform: translateY(-8px); }

/* ---------------------------------------------------------------- Handy / schmale Fenster */
@media (max-width: 900px) {
  /* Zeile 1: Hinweis + Knöpfe, Zeile 2: Spielerleiste */
  #banner { top: 8px; left: 8px; transform: none; width: calc(100vw - 140px); max-width: none; min-width: 0; min-height: 42px; display: flex; align-items: center; justify-content: flex-start; text-align: left; font-size: 13px; line-height: 1.25; padding: 5px 10px; }
  #tr { top: 8px; right: 8px; gap: 4px; }
  .ibtn { width: 38px; height: 38px; font-size: 18px; }
  #b-zoomin, #b-zoomout { display: none; }
  #players { top: 56px; left: 8px; right: 8px; width: auto; max-width: none; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 6px; pointer-events: auto; }
  .pl { flex: 1 0 118px; max-width: 170px; padding: 4px 6px 4px 12px; }
  .pl-name { max-width: 58px; font-size: 13px; } .pl-vp { font-size: 15px; } .pl-stats { gap: 5px; font-size: 11px; margin-top: 1px; flex-wrap: nowrap; }
  .pl-stats span:nth-child(n+5) { display: none; } .pl-badges, .pl.cur::after { display: none; }
  .pl .tag { display: none; } .pl .tag.you, .pl .tag.off { display: inline; }
  #logbox { display: none; top: 118px; width: min(300px, calc(100vw - 16px)); max-height: 40vh; z-index: 5; }
  #logbox.open { display: flex; }
  #floaters { left: 8px; width: min(260px, calc(100vw - 16px)); }
  #bottom { padding: 0 6px 6px; gap: 6px; }
  #actions { width: 100%; flex-wrap: nowrap; gap: 4px; }
  .act { flex: 1 1 0; min-width: 0; min-height: 56px; padding: 4px 2px; }
  .act.big { flex: 1.5 1 0; min-width: 0; } .ai { font-size: 19px; } .al { font-size: 10px; text-align: center; }
  .ac { display: none; } .an { top: -6px; right: -4px; min-width: 18px; height: 18px; font-size: 10px; }
  #handrow { width: 100%; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 6px 8px; overflow: visible; justify-content: space-between; }
  #hand { order: 1; flex: 1 1 auto; justify-content: space-between; gap: 4px; } #vpbox { order: 2; } #dice { order: 3; min-width: 0; } #devs { order: 4; margin-left: auto; }
  #devs:empty { display: none; }
  .die { width: 30px; height: 30px; padding: 3px; } .dsum { font-size: 18px; min-width: 22px; }
  .card { width: 46px; padding: 3px 1px; } .card .ri { width: 24px; height: 24px; } .card b { font-size: 15px; } .card span { font-size: 9px; }
  .card.dev { width: 52px; }
  .vp-big b { font-size: 26px; } .vp-big span { font-size: 18px; } .vp-hid { display: none; }
}
@media (min-width: 561px) and (max-width: 900px) {
  .ac { display: flex; } .ac .ri { display: none; } .ac .cost { font-size: 10px; margin-right: 2px; }
}
@media (max-width: 560px) {
  .al[data-s] { font-size: 0; } .al[data-s]::after { content: attr(data-s); font-size: 10px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  #banner { top: 6px; min-height: 34px; width: calc(100vw - 150px); font-size: 12.5px; padding: 3px 8px; }
  #tr { top: 6px; right: 6px; } .ibtn { width: 34px; height: 34px; font-size: 16px; }
  #players { top: 46px; left: 6px; right: auto; width: 134px; flex-direction: column; overflow: visible; padding: 0; gap: 4px; }
  .pl { flex: none; width: 100%; max-width: none; padding: 3px 5px 3px 11px; } .pl-stats span:nth-child(n+3) { display: none; }
  #logbox { top: 46px; max-height: 60vh; }
  #bottom { padding: 0 6px 4px; gap: 4px; }
  #actions { gap: 4px; } .act { min-height: 44px; } .ac { display: none; } .ai { font-size: 17px; }
  #handrow { flex-wrap: nowrap; justify-content: center; padding: 3px 8px; gap: 8px; }
  #hand { flex: 0 0 auto; } .card span { display: none; } .card { width: 42px; } .card.dev { width: 46px; }
  #vpbox { order: 2; } #devs { margin-left: 0; }
}
@media (max-width: 560px) {
  .panel { padding: 16px; } .two { grid-template-columns: 1fr; } .tile { width: 84px; }
  .btnrow .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Terra+ */
.numgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 8px 0; }
.tile.num { width: auto; padding: 8px 2px; } .tile.num b { font-size: 24px; line-height: 1; } .tile.num .pips { color: #a8362a; font-size: 14px; letter-spacing: -1px; line-height: 1; }
.act .ai { line-height: 1; }
@media (max-width: 900px) {
  #actions.many { flex-wrap: wrap; justify-content: center; }
  #actions.many .act { flex: 1 1 17%; min-height: 48px; }
  #actions.many .act.big { flex: 1.4 1 20%; }
  .numgrid { grid-template-columns: repeat(5, 1fr); gap: 5px; } .tile.num b { font-size: 19px; }
}
@media (max-height: 560px) { #actions.many .act { min-height: 40px; flex: 1 1 10%; } }
.slider { display: flex; align-items: center; gap: 12px; }
.slider input[type=range] { flex: 1; min-width: 0; accent-color: var(--wood3); height: 28px; cursor: pointer; }
.slider .slider-val { min-width: 110px; text-align: right; font-size: 14px; color: var(--ink); }

.seg.wrap { flex-wrap: wrap; }
.seg.wrap button { flex: 1 1 auto; }
