:root{
  --green:#0b3d2e; --green2:#0e4d3a; --greenDark:#072a20;
  --gold:#d4af37; --gold2:#f0d77b; --ink:#f4efe2; --dim:#b9b096;
  --red:#c0392b; --panel:rgba(7,32,24,.92);
}
*{ margin:0; padding:0; box-sizing:border-box; border-radius:0 !important; }
html,body{ width:100%; height:100%; overflow:hidden; background:var(--greenDark); }
body{ font-family:"Segoe UI", system-ui, -apple-system, Arial, sans-serif; color:var(--ink); }
button{ font-family:inherit; cursor:pointer; border:1px solid var(--gold);
  background:var(--green2); color:var(--ink); padding:10px 18px; font-size:15px;
  letter-spacing:.04em; transition:background .15s, transform .05s; }
button:hover{ background:#15604a; }
button:active{ transform:translateY(1px); }
button:disabled{ opacity:.35; cursor:default; }
button.primary{ background:var(--gold); color:#1c1503; font-weight:700; border-color:var(--gold2); }
button.primary:hover{ background:var(--gold2); }
button.danger{ border-color:var(--red); }
input[type=text]{ background:#06231a; border:1px solid var(--gold); color:var(--ink);
  padding:10px 12px; font-size:16px; font-family:inherit; outline:none; }
input[type=text]:focus{ border-color:var(--gold2); }
select{ background:#06231a; border:1px solid var(--gold); color:var(--ink); padding:8px; font-family:inherit; }
::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-thumb{ background:var(--gold); }
::-webkit-scrollbar-track{ background:#06231a; }

#c{ position:fixed; inset:0; display:block; touch-action:none; }

/* ---------- generic screens / overlay ---------- */
.screen{ position:fixed; inset:0; display:flex; flex-direction:column; align-items:center;
  justify-content:center; background:radial-gradient(ellipse at 50% 30%, #11543f 0%, var(--greenDark) 75%);
  z-index:50; gap:18px; padding:20px; }
.hidden{ display:none !important; }
.gold-frame{ border:2px solid var(--gold); background:var(--panel); padding:26px 34px;
  box-shadow:0 0 40px rgba(0,0,0,.55); }
h1.title{ font-size:46px; letter-spacing:.12em; color:var(--gold); text-transform:uppercase;
  text-shadow:0 2px 0 #000; text-align:center; }
.subtitle{ color:var(--ink); letter-spacing:.3em; text-transform:uppercase; font-size:14px;
  text-align:center; margin-top:4px; }
.muted{ color:var(--dim); font-size:13px; }

/* ---------- home ---------- */
#screen-home .menu{ display:flex; flex-direction:column; gap:12px; min-width:340px; }
#screen-home .joinrow{ display:flex; gap:8px; }
#screen-home .joinrow input{ flex:1; text-transform:uppercase; letter-spacing:.3em; }
#home-error{ color:#ff8a7a; min-height:18px; font-size:14px; text-align:center; }

/* ---------- lobby ---------- */
#screen-lobby{ justify-content:flex-start; padding-top:40px; overflow:auto; }
#lobby-box{ width:min(720px, 94vw); }
#lobby-code-row{ display:flex; align-items:center; gap:14px; justify-content:center; margin-bottom:18px; flex-wrap:wrap; }
#lobby-code{ font-size:34px; letter-spacing:.35em; color:var(--gold); font-weight:800; }
#lobby-players{ display:flex; flex-direction:column; gap:8px; margin:14px 0; }
.lp-row{ display:flex; align-items:center; gap:12px; border:1px solid #1d6b52; padding:8px 12px; background:rgba(255,255,255,.03); }
.lp-color{ width:16px; height:16px; flex:none; border:1px solid #000; }
.lp-token{ font-size:24px; width:34px; height:34px; flex:none; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.lp-token img{ width:32px; height:32px; object-fit:cover; }
.lp-name{ flex:1; font-size:17px; }
.lp-badge{ font-size:11px; color:var(--gold); border:1px solid var(--gold); padding:2px 6px; }
#lobby-settings{ display:flex; gap:22px; align-items:center; margin:14px 0; flex-wrap:wrap; }
#lobby-settings label{ display:flex; gap:8px; align-items:center; font-size:14px; }
#lobby-actions{ display:flex; gap:10px; justify-content:center; margin-top:10px; flex-wrap:wrap; }

/* ---------- player editor modal ---------- */
.modal-backdrop{ position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:90;
  display:flex; align-items:center; justify-content:center; }
.modal{ border:2px solid var(--gold); background:var(--panel); padding:24px;
  min-width:320px; max-width:min(560px,94vw); max-height:90vh; overflow:auto; }
.modal h2{ color:var(--gold); margin-bottom:14px; letter-spacing:.08em; font-size:20px; }
#pe-tokens{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin:12px 0; }
#pe-tokens button{ font-size:26px; padding:8px 0; }
#pe-tokens button.sel{ background:var(--gold); }
.pe-row{ display:flex; gap:8px; margin:8px 0; align-items:center; flex-wrap:wrap; }
.modal-actions{ display:flex; gap:10px; justify-content:flex-end; margin-top:16px; }

/* ---------- game hud ---------- */
#hud{ position:fixed; inset:0; pointer-events:none; z-index:40; }
#hud > *{ pointer-events:auto; }

#topbar{ position:absolute; top:0; left:0; right:0; display:flex; align-items:center;
  gap:10px; padding:8px 12px; background:linear-gradient(to bottom, rgba(0,0,0,.55), transparent); pointer-events:none; }
#topbar > *{ pointer-events:auto; }
#logo{ color:var(--gold); font-weight:800; letter-spacing:.1em; font-size:18px; cursor:pointer; user-select:none; }
#room-info{ font-size:13px; color:var(--dim); letter-spacing:.2em; }
#topbar .spacer{ flex:1; pointer-events:none; }
.iconbtn{ padding:6px 10px; font-size:14px; }

#players-panel{ position:absolute; left:10px; top:54px; display:flex; flex-direction:column; gap:6px; width:230px; }
.pp-row{ display:flex; align-items:center; gap:8px; background:var(--panel); border:1px solid #1d6b52;
  border-left:6px solid #fff; padding:6px 8px; cursor:pointer; }
.pp-row.current{ outline:2px solid var(--gold); }
.pp-row.bankrupt{ opacity:.45; filter:grayscale(1); }
.pp-token{ font-size:18px; width:24px; text-align:center; }
.pp-token img{ width:22px; height:22px; object-fit:cover; vertical-align:middle; }
.pp-name{ flex:1; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pp-cash{ font-size:13px; color:var(--gold2); font-variant-numeric:tabular-nums; }
.pp-title{ font-size:10px; color:var(--gold); }
.pp-kick{ padding:2px 7px; font-size:12px; flex:none; }

#actionbar{ position:absolute; left:50%; bottom:14px; transform:translateX(-50%);
  display:flex; flex-direction:column; align-items:center; gap:8px; max-width:94vw; }
#status-line{ background:var(--panel); border:1px solid var(--gold); padding:6px 16px;
  font-size:14px; letter-spacing:.03em; text-align:center; }
#actions{ display:flex; gap:8px; flex-wrap:wrap; justify-content:center; }
#offer-bar{ background:var(--panel); border:1px solid var(--gold); padding:8px 14px;
  display:flex; gap:10px; align-items:center; font-size:14px; }

/* ---------- chat ---------- */
#chat-panel{ position:absolute; right:10px; bottom:14px; width:280px; background:var(--panel);
  border:1px solid #1d6b52; display:flex; flex-direction:column; }
#chat-head{ display:flex; align-items:center; padding:6px 10px; border-bottom:1px solid #1d6b52;
  cursor:pointer; user-select:none; font-size:13px; color:var(--gold); letter-spacing:.08em; }
#chat-body{ display:flex; flex-direction:column; }
#chat-log{ height:180px; overflow-y:auto; padding:8px; font-size:13px; display:flex; flex-direction:column; gap:4px; }
.chat-msg b{ color:var(--gold2); }
.chat-sys{ color:var(--dim); font-style:italic; }
#chat-reactions{ display:flex; gap:4px; padding:4px 8px; border-top:1px solid #1d6b52; }
#chat-reactions button{ padding:2px 6px; font-size:16px; border:none; background:transparent; }
#chat-input-row{ display:flex; border-top:1px solid #1d6b52; }
#chat-input{ flex:1; border:none; background:transparent; color:var(--ink); padding:8px; font-size:13px; outline:none; }
#btn-chat-send{ border:none; padding:6px 10px; }
#chat-panel.collapsed #chat-body{ display:none; }

/* ---------- besitz-seitenleiste ---------- */
#sidebar{ position:absolute; right:58px; top:54px; width:250px; background:var(--panel);
  border:1px solid #1d6b52; display:flex; flex-direction:column; max-height:calc(100vh - 120px); }
#sidebar-head{ display:flex; align-items:center; padding:6px 10px; border-bottom:1px solid #1d6b52;
  cursor:pointer; user-select:none; font-size:13px; color:var(--gold); letter-spacing:.08em; }
#sidebar-toggle{ margin-left:auto; transition:transform .2s; }
#sidebar:not(.collapsed) #sidebar-toggle{ transform:rotate(90deg); }
#sidebar-body{ display:flex; flex-direction:column; flex:1; min-height:0; overflow:hidden; }
#sidebar.collapsed #sidebar-body{ display:none; }
#sidebar-cash{ padding:8px 10px; font-size:13px; border-bottom:1px solid #1d6b52; }
#sidebar-cash .sb-cash{ color:var(--gold2); font-variant-numeric:tabular-nums; }
#sidebar-list{ display:flex; flex-direction:column; gap:6px; padding:8px; overflow-y:auto; min-height:0; }
#sidebar-list .mng-row{ flex-wrap:wrap; }
.sb-jail .mng-name{ color:var(--gold2); }

/* ---------- cards ---------- */
#modal-card .card-visual{ width:320px; min-height:200px; border:3px solid var(--gold);
  padding:18px; background:linear-gradient(135deg,#fffdf4,#f1e6c4); color:#222; position:relative; }
#modal-card .card-visual.schloter{ background:linear-gradient(135deg,#ffe9a8,#d4af37); box-shadow:0 0 30px var(--gold); }
#modal-card .card-kind{ font-size:12px; letter-spacing:.25em; text-transform:uppercase; color:#8a6d1a; }
#modal-card .card-text{ font-size:18px; margin-top:14px; font-weight:600; line-height:1.4; }
#modal-card .card-char{ position:absolute; right:10px; bottom:6px; font-size:34px; }

/* ---------- grundstückskarte (title deed) ---------- */
.deed-card{ width:300px; max-width:88vw; border:2px solid var(--gold); background:linear-gradient(135deg,#fffdf4,#f1e6c4);
  color:#222; box-shadow:0 0 36px rgba(0,0,0,.6); }
.deed-band{ height:56px; border-bottom:2px solid #000; display:flex; align-items:center; justify-content:center; }
.deed-bandname{ color:#fff; font-weight:800; text-transform:uppercase; letter-spacing:.04em; font-size:18px;
  text-align:center; padding:0 12px; text-shadow:0 1px 4px rgba(0,0,0,.7); }
.deed-kind{ text-align:center; font-size:11px; letter-spacing:.25em; text-transform:uppercase; color:#8a6d1a; margin-top:9px; }
.deed-rows{ padding:8px 18px 16px; font-size:14px; }
.deed-row{ display:flex; justify-content:space-between; gap:14px; padding:4px 0; border-bottom:1px dotted rgba(0,0,0,.25); }
.deed-row span:last-child{ font-variant-numeric:tabular-nums; font-weight:700; color:#1c1503; }
.deed-sep{ height:9px; border-bottom:2px solid rgba(0,0,0,.35); margin-bottom:3px; }
.deed-owner{ display:inline-flex; align-items:center; gap:6px; }
.deed-ownerdot{ width:12px; height:12px; flex:none; border:1px solid #000; display:inline-block; }
.deed-info{ padding:10px 2px 4px; font-size:14px; line-height:1.5; color:#3a2f12; text-align:center; }
.mng-row .mng-name{ cursor:pointer; }
.mng-row .mng-name:hover{ color:var(--gold2); }

/* ---------- auction ---------- */
#auc-tile{ font-size:20px; color:var(--gold); margin-bottom:6px; }
#auc-state{ font-size:15px; margin:8px 0; }
#auc-timer{ font-size:26px; color:var(--gold2); text-align:center; font-variant-numeric:tabular-nums; }
#auc-bids{ display:flex; gap:8px; margin:12px 0; justify-content:center; }

/* ---------- manage ---------- */
#mng-list{ display:flex; flex-direction:column; gap:6px; max-height:50vh; overflow:auto; }
.mng-row{ display:flex; align-items:center; gap:8px; border:1px solid #1d6b52; padding:6px 8px; font-size:13px; }
.mng-color{ width:12px; height:26px; flex:none; border:1px solid #000; }
.mng-name{ flex:1; }
.mng-row button{ padding:4px 8px; font-size:12px; }
.mng-mort{ opacity:.55; }

/* ---------- end screen ---------- */
#end-awards{ display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:16px 0; }
.award{ border:1px solid var(--gold); padding:10px; background:rgba(212,175,55,.08); }
.award .a-cat{ font-size:12px; color:var(--gold); letter-spacing:.06em; }
.award .a-who{ font-size:16px; font-weight:700; margin-top:4px; }
#end-winner{ text-align:center; font-size:26px; color:var(--gold); margin:6px 0 2px; }

/* ---------- toasts & fx ---------- */
#toasts{ position:absolute; top:60px; left:50%; transform:translateX(-50%);
  display:flex; flex-direction:column; gap:6px; align-items:center; z-index:60; pointer-events:none; }
.toast{ background:var(--panel); border:1px solid var(--gold); padding:8px 18px; font-size:14px;
  animation:toastIn .25s ease, toastOut .4s ease 3.6s forwards; max-width:80vw; text-align:center; }
.toast.big{ font-size:20px; border-width:2px; color:var(--gold2); }
@keyframes toastIn{ from{ opacity:0; transform:translateY(-12px);} to{ opacity:1; transform:none;} }
@keyframes toastOut{ to{ opacity:0; transform:translateY(-12px);} }

/* ---------- event popup (große Momente) ---------- */
.evpop{ position:absolute; top:88px; left:50%; z-index:62; pointer-events:none;
  display:flex; align-items:center; gap:14px; max-width:min(560px,90vw);
  border:2px solid var(--gold); border-left-width:6px; background:var(--panel);
  padding:13px 22px; box-shadow:0 6px 34px rgba(0,0,0,.55);
  opacity:0; transform:translateX(-50%) translateY(-16px) scale(.96);
  transition:opacity .24s ease, transform .24s cubic-bezier(.2,.9,.3,1.2); }
.evpop.show{ opacity:1; transform:translateX(-50%) translateY(0) scale(1); }
.evpop .evpop-icon{ font-size:34px; line-height:1; filter:drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.evpop .evpop-text{ font-size:17px; letter-spacing:.02em; color:var(--ink); }
.evpop.ev-pay{ border-left-color:#e08a4a; }
.evpop.ev-bad{ border-left-color:var(--red); }
.evpop.ev-good{ border-left-color:var(--gold2); }

#fx-layer{ position:fixed; inset:0; pointer-events:none; z-index:80; overflow:hidden; }
.float-emoji{ position:absolute; font-size:42px; animation:floatUp 2.2s ease-out forwards; }
@keyframes floatUp{ from{ opacity:1; transform:translateY(0) scale(.6);} 60%{opacity:1;}
  to{ opacity:0; transform:translateY(-220px) scale(1.4);} }
.confetti{ position:absolute; width:10px; height:16px; top:-20px; animation:confFall linear forwards; }
@keyframes confFall{ to{ transform:translateY(110vh) rotate(720deg); } }

body.rainbow #hud, body.rainbow .screen{ animation:hueSpin 4s linear infinite; }
@keyframes hueSpin{ from{filter:hue-rotate(0)} to{filter:hue-rotate(360deg)} }

#err-banner{ position:fixed; inset:0; z-index:200; display:flex; align-items:center; justify-content:center;
  background:var(--greenDark); color:var(--ink); text-align:center; padding:30px; font-size:18px; }

/* ---------- controls hint + help (neu) ---------- */
#controls-hint{ position:absolute; left:10px; bottom:14px; max-width:230px; background:var(--panel);
  border:1px solid #1d6b52; padding:8px 12px; font-size:12px; color:var(--dim); line-height:1.5;
  transition:opacity .6s ease; }
#controls-hint b{ color:var(--gold2); }
#controls-hint.fade{ opacity:0; pointer-events:none; }
#modal-help .help-grid{ display:grid; grid-template-columns:auto 1fr; gap:6px 16px; align-items:center; margin:8px 0; }
#modal-help .help-grid div:nth-child(odd){ text-align:right; }
.kbd{ display:inline-block; min-width:20px; padding:2px 8px; border:1px solid var(--gold);
  background:#06231a; color:var(--gold2); font-size:12px; font-family:inherit; text-align:center; }
#cam-controls{ position:absolute; right:10px; top:54px; display:flex; flex-direction:column; gap:6px; }
#cam-controls button{ width:40px; height:40px; padding:0; font-size:18px; opacity:.85; }
#cam-controls button:hover{ opacity:1; }

/* ---------- Lautstärke-Regler ---------- */
#vol-slider{ width:84px; accent-color:var(--gold); cursor:pointer; vertical-align:middle; }

/* ---------- Hotkey-Feedback ---------- */
.kbpulse{ animation:kbpulse .32s ease; }
@keyframes kbpulse{
  0%{ box-shadow:0 0 0 0 rgba(240,215,123,0); }
  40%{ box-shadow:0 0 14px 4px rgba(240,215,123,.85); }
  100%{ box-shadow:0 0 0 0 rgba(240,215,123,0); }
}

/* ---------- Handel ---------- */
#trade-body{ display:flex; flex-direction:column; gap:12px; }
.trade-partner{ display:flex; align-items:center; gap:8px; font-size:14px; }
.trade-cols{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.trade-col{ border:1px solid #1d6b52; padding:8px; display:flex; flex-direction:column; gap:5px;
  min-height:60px; background:rgba(255,255,255,.03); }
.trade-col-head{ font-size:13px; color:var(--gold); letter-spacing:.04em; border-bottom:1px solid #1d6b52;
  padding-bottom:5px; margin-bottom:3px; }
.trade-tile{ display:flex; align-items:center; gap:7px; font-size:13px; cursor:pointer; }
.trade-tile.disabled{ opacity:.4; cursor:default; }
.trade-tile input{ accent-color:var(--gold); }
.trade-swatch{ width:11px; height:18px; flex:none; border:1px solid #000; }
.trade-cash{ display:flex; align-items:center; gap:6px; font-size:13px; margin-top:auto; padding-top:6px;
  border-top:1px dashed #1d6b52; }
.trade-cash-inp{ width:90px; background:#06231a; border:1px solid var(--gold); color:var(--ink);
  padding:6px 8px; font-family:inherit; font-size:14px; outline:none; }
.trade-cash-inp:focus{ border-color:var(--gold2); }
.trade-actions{ display:flex; gap:10px; align-items:center; justify-content:center; flex-wrap:wrap; }
.trade-offer-head{ text-align:center; font-size:15px; color:var(--gold2); letter-spacing:.06em; }

/* ---------- feinschliff: interaktion & feedback ---------- */
button{ transition:background .15s, transform .05s, box-shadow .15s, border-color .15s; }
button:hover{ box-shadow:0 2px 12px rgba(0,0,0,.35); }
button.primary:hover{ box-shadow:0 0 16px rgba(212,175,55,.5); }
.iconbtn:hover{ box-shadow:0 0 10px rgba(212,175,55,.35); }

/* anklickbare Zeilen reagieren auf Hover/Klick */
.pp-row{ transition:background .15s, box-shadow .2s, transform .08s; }
.pp-row:hover{ background:#0e4d3a; }
.pp-row:active{ transform:scale(.99); }
.mng-row{ transition:background .15s, border-color .15s; }
.mng-row:hover{ border-color:var(--gold); background:rgba(212,175,55,.06); }
#sidebar-head:hover, #chat-head:hover{ background:rgba(212,175,55,.08); }

/* aktiver Spieler pulsiert dezent golden */
@keyframes currentPulse{ 0%,100%{ box-shadow:0 0 0 rgba(212,175,55,0);} 50%{ box-shadow:0 0 16px rgba(212,175,55,.5);} }
.pp-row.current{ animation:currentPulse 2.4s ease-in-out infinite; }

/* Hauptaktion (würfeln/kaufen/beenden) zieht den Blick an */
@keyframes actGlow{ 0%,100%{ box-shadow:0 0 0 rgba(212,175,55,0);} 50%{ box-shadow:0 0 18px rgba(212,175,55,.55);} }
#actions button.primary{ animation:actGlow 2s ease-in-out infinite; }
#status-line{ box-shadow:0 2px 14px rgba(0,0,0,.3); }

/* Bargeld-Änderung blitzt kurz auf (grün rauf / rot runter) */
@keyframes cashUp{ 0%{ color:#86f0a8; transform:scale(1.22);} 100%{ color:var(--gold2); transform:none;} }
@keyframes cashDown{ 0%{ color:#ff8a7a; transform:scale(1.22);} 100%{ color:var(--gold2); transform:none;} }
.pp-cash, .sb-cash{ display:inline-block; }
.pp-cash.flash-up, .sb-cash.flash-up{ animation:cashUp .75s ease-out; }
.pp-cash.flash-down, .sb-cash.flash-down{ animation:cashDown .75s ease-out; }

@media (max-width:760px){
  #vol-slider{ display:none; }
}

@media (max-width:760px){
  #players-panel{ width:160px; }
  #chat-panel{ width:220px; }
  #sidebar{ width:172px; }
  h1.title{ font-size:30px; }
  #controls-hint{ display:none; }
}

/* ---- Profile & Statistik (Modal) ---- */
#profiles-body{ display:flex; flex-direction:column; gap:12px; max-height:60vh; overflow:auto; }
.prof-card{ border:1px solid #1d6b52; background:rgba(255,255,255,.03); padding:10px 14px; }
.prof-name{ color:var(--gold); font-weight:700; letter-spacing:.04em; margin-bottom:8px; }
.prof-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:4px 18px; }
.prof-stat{ display:flex; justify-content:space-between; border-bottom:1px dotted #1d6b52; padding:2px 0; font-size:14px; }
.prof-k{ color:var(--dim); }
.prof-v{ color:var(--ink); font-weight:700; }
@media (max-width:760px){ .prof-grid{ grid-template-columns:1fr; } }
