/* =====================================================================
 * Auctions of Fate – style.css
 * Dunkles "Auktionshaus bei Kerzenlicht"-Thema mit Gold-Akzenten.
 * Alle Grafiken sind Platzhalter aus CSS + Emoji (später echte Assets).
 * ===================================================================== */

:root {
  --bg: #12100e;
  --bg-2: #1a1714;
  --panel: #211d19;
  --panel-2: #2a2520;
  --line: #3a332b;
  --line-soft: #2e2822;
  --text: #ece4d8;
  --muted: #a69a88;
  --gold: #d9ad55;
  --gold-2: #f0cc7c;
  --gold-dark: #8a6a2c;
  --good: #6fbf73;
  --warn: #e0a84a;
  --bad: #d9665b;
  --info: #6aa6d9;

  /* Zustandsfarben */
  --st-new: #7fd0ff;
  --st-stable: #6fbf73;
  --st-needs: #e0a84a;
  --st-decaying: #d9665b;

  /* Stufenfarben der Auktionen */
  --t-small: #7fa7c9;
  --t-medium: #b48ad6;
  --t-large: #d9ad55;
  --t-special: #d9665b;

  --radius: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  --font-display: 'Cinzel', Georgia, serif;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(217, 173, 85, .08), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(180, 138, 214, .06), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* ---------------- Buttons ---------------- */
.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 8px 14px;
  border-radius: 9px;
  font-weight: 600;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--gold-dark); background: #332c25; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-gold {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: var(--gold);
  color: #2a1d06;
}
.btn-gold:hover:not(:disabled) { background: linear-gradient(180deg, #f7da97, var(--gold-2)); border-color: var(--gold-2); }
.btn-ghost { background: transparent; }
.btn-danger { border-color: #7a3a33; color: #ffb3aa; background: #3a1f1c; }
.btn-danger:hover:not(:disabled) { background: #4a2420; border-color: var(--bad); }
.btn-block { width: 100%; }
.btn-col { display: flex; flex-direction: column; gap: 8px; }
.mini {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
}
.mini:hover:not(:disabled) { border-color: var(--gold-dark); }
.mini.ghost { background: transparent; color: var(--muted); }
.mini.ghost:hover { color: var(--bad); border-color: var(--bad); }

/* ---------------- Obere Leiste ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 24px;
  background: rgba(18, 16, 14, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px;
  background: radial-gradient(circle at 35% 30%, #4a3c22, #1d1710);
  border: 1px solid var(--gold-dark);
  box-shadow: 0 0 18px rgba(217, 173, 85, .25);
}
.brand-title { font-family: var(--font-display); font-weight: 800; color: var(--gold-2); letter-spacing: .04em; font-size: 18px; }
.city-name { background: none; border: none; padding: 0; color: var(--muted); font-size: 13px; }
.city-name:hover { color: var(--text); }

.top-stats { display: flex; gap: 12px; flex: 1; }
.stat {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 8px 14px; min-width: 170px;
}
.stat.coins { border-color: var(--gold-dark); min-width: 200px; }
.stat-icon { font-size: 22px; }
.stat-value { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--gold-2); line-height: 1.1; }
.stat-sub { font-size: 12px; color: var(--muted); }
.stat-grow { flex: 1; }
.stat-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.stat-row b { color: var(--text); }
.meter { height: 8px; background: #0c0b09; border-radius: 99px; overflow: hidden; border: 1px solid var(--line-soft); }
.meter.thin { height: 5px; }
.meter i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--gold); transition: width .4s; }
.meter i.low { background: var(--bad); }
.meter i.mid { background: var(--warn); }
.meter i.high { background: var(--good); }
#dayBar { background: linear-gradient(90deg, #6a5530, var(--gold-2)); transition: width .25s linear; }
.top-actions { display: flex; gap: 8px; }
.btn-work { min-width: 180px; }

/* ---------------- Tabs ---------------- */
.tabs {
  display: flex; gap: 4px; padding: 10px 24px 0;
  border-bottom: 1px solid var(--line-soft);
}
.tab {
  background: none; border: none; padding: 10px 16px 12px;
  color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 8px; white-space: nowrap; flex: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold-2); border-bottom-color: var(--gold); }
.badge {
  font-size: 11px; padding: 1px 7px; border-radius: 99px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.badge.lead { background: rgba(111, 191, 115, .15); border-color: var(--good); color: var(--good); }
.badge.alert { background: rgba(217, 102, 91, .2); border-color: var(--bad); color: #ffb3aa; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .55; } }

main { padding: 20px 24px 60px; max-width: 1500px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } }

/* ---------------- Panels ---------------- */
.panel {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 16px;
}
.panel h3 { font-family: var(--font-display); font-size: 15px; color: var(--gold-2); margin-bottom: 10px; letter-spacing: .03em; }
.kv { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--line-soft); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }

/* ---------------- Stadt ---------------- */
.city-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.city-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 100px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.slot-section { margin-bottom: 22px; }
.slot-section header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.slot-section h3 { font-family: var(--font-display); font-size: 16px; letter-spacing: .03em; }
.slot-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.slot-count.full { color: var(--warn); }

.slot-grid { display: grid; gap: 10px; }
.slot-grid.large { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.slot-grid.medium { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.slot-grid.rule, .slot-grid.event, .slot-grid.companion, .slot-grid.quest { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.slot {
  border-radius: 10px; min-height: 92px;
  display: flex; gap: 10px; padding: 10px;
}
.slot.empty {
  border: 1.5px dashed var(--line); color: #5e544a;
  align-items: center; justify-content: center; font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(255,255,255,.012) 10px 20px);
}
.slot-grid.medium .slot.empty { min-height: 70px; }
.slot.filled { background: var(--panel); border: 1px solid var(--line-soft); transition: border-color .2s; }
.slot.filled:hover { border-color: var(--line); }
.slot.st-needs { border-color: rgba(224, 168, 74, .35); }
.slot.st-decaying { border-color: rgba(217, 102, 91, .5); background: linear-gradient(180deg, rgba(217,102,91,.07), var(--panel)); }
.slot-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.slot-name { font-weight: 700; font-size: 14px; }
.slot-fx { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.slot-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 4px; }
.slot-actions .mini:first-child { flex: 1; }

/* Platzhalter-"Grafik": CSS-Kachel mit Emoji, Farbe nach Kategorie */
.tile-art {
  flex: none; width: 52px; height: 52px; border-radius: 10px;
  display: grid; place-items: center; font-size: 26px; position: relative; overflow: hidden;
  background: linear-gradient(145deg, #3b3226, #1f1a14);
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: inset 0 -8px 16px rgba(0,0,0,.35);
}
.tile-art::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.14), transparent 55%);
}
.tile-art span { filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); position: relative; z-index: 1; }
.slot-grid.medium .tile-art, .slot-grid.companion .tile-art, .slot-grid.quest .tile-art { width: 42px; height: 42px; font-size: 21px; }
.k-structure { background: linear-gradient(145deg, #5a4626, #231a0f); }
.k-rule      { background: linear-gradient(145deg, #3d3557, #17142a); }
.k-event     { background: linear-gradient(145deg, #5a2f3c, #1f1016); }
.k-npc       { background: linear-gradient(145deg, #2f4a55, #101b20); }
.k-shop      { background: linear-gradient(145deg, #3f5532, #141d0f); }
.k-resource  { background: linear-gradient(145deg, #4b4b4b, #1a1a1a); }
.k-quest     { background: linear-gradient(145deg, #2f5547, #0f1d18); }
.k-special   { background: linear-gradient(145deg, #5a2a26, #1d0e0c); }

.state-badge {
  align-self: flex-start; font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  padding: 1px 7px; border-radius: 99px; border: 1px solid currentColor;
}
.state-badge.st-new { color: var(--st-new); }
.state-badge.st-stable { color: var(--st-stable); }
.state-badge.st-needs { color: var(--st-needs); }
.state-badge.st-decaying { color: var(--st-decaying); animation: blink 1.6s infinite; }
.state-badge.st-timed { color: var(--gold-2); }
.state-badge.st-target { color: #ffb3aa; margin-top: -2px; }
.cond { height: 4px; background: #0c0b09; border-radius: 99px; overflow: hidden; }
.cond i { display: block; height: 100%; background: var(--st-stable); }
.st-new .cond i { background: var(--st-new); }
.st-needs .cond i { background: var(--st-needs); }
.st-decaying .cond i { background: var(--st-decaying); }

.mini-log { list-style: none; padding: 0; margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.mini-log li { padding: 5px 0; border-bottom: 1px dashed var(--line-soft); }
.ml-day { color: var(--gold); font-weight: 700; margin-right: 4px; }

/* ---------------- Auktionen ---------------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--panel); border: 1px solid var(--line-soft); padding: 4px; border-radius: 10px; }
.seg-btn { background: none; border: none; padding: 6px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--panel-2); color: var(--gold-2); box-shadow: inset 0 0 0 1px var(--line); }

.auction-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.auction {
  --tier: var(--t-small);
  background: var(--panel); border: 1px solid var(--line-soft); border-top: 3px solid var(--tier);
  border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color .2s, box-shadow .2s;
  animation: fadeIn .3s;
}
.auction.tier-medium { --tier: var(--t-medium); }
.auction.tier-large { --tier: var(--t-large); }
.auction.tier-special { --tier: var(--t-special); }
.auction.type-counter { background: linear-gradient(180deg, rgba(217,102,91,.10), var(--panel) 60%); }
.auction.leading { border-color: rgba(111,191,115,.55); border-top-color: var(--good); box-shadow: 0 0 0 1px rgba(111,191,115,.25), var(--shadow); }
.auction.outbid { border-color: rgba(217,102,91,.45); }
.auction.pulse { animation: pulse .5s; }
@keyframes pulse { 40% { transform: scale(1.015); box-shadow: 0 0 24px rgba(217,173,85,.35); } }

.a-head { display: flex; gap: 12px; align-items: center; }
.a-titles { flex: 1; min-width: 0; }
.a-tier { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--tier); font-weight: 700; }
.a-head h3 { font-family: var(--font-display); font-size: 17px; line-height: 1.2; }
.a-flag { font-size: 10.5px; font-weight: 700; color: #2a1d06; background: var(--gold); padding: 2px 8px; border-radius: 99px; align-self: flex-start; }
.a-desc { margin: 0; color: var(--muted); font-size: 13.5px; min-height: 38px; }
.a-effect { font-size: 12.5px; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 8px; padding: 7px 10px; color: #d9cdb8; }
.a-status { display: flex; justify-content: space-between; align-items: flex-end; }
.a-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.a-bid { font-family: var(--font-display); font-weight: 800; font-size: 20px; color: var(--gold-2); }
.a-leader { font-size: 12.5px; min-height: 18px; }
.lead-you { color: var(--good); font-weight: 700; }
.lead-rival { color: #ffb3aa; font-weight: 600; }
.a-timebox { text-align: right; }
.a-timer { font-family: var(--font-display); font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.a-timer.urgent { color: var(--bad); animation: blink .8s infinite; }
.a-bar { height: 4px; background: #0c0b09; border-radius: 99px; overflow: hidden; }
.a-bar i { display: block; height: 100%; background: var(--tier); transition: width .25s linear; }
.a-controls { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; }
.a-input, .input {
  background: #0f0d0b; border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); padding: 8px 10px; font: inherit; width: 100%; min-width: 0;
}
.a-input:focus, .input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217,173,85,.15); }
.a-input:disabled { opacity: .4; }
.a-quick { min-width: 70px; }
.a-note { font-size: 12px; color: var(--warn); min-height: 0; }
.a-note:empty { display: none; }
.empty-hint { color: var(--muted); text-align: center; padding: 40px 0; }

/* ---------------- Logbuch ---------------- */
.logbook { max-width: 900px; }
.log-day { font-family: var(--font-display); color: var(--gold); margin: 20px 0 8px; font-size: 15px; letter-spacing: .04em; }
.log-day:first-child { margin-top: 0; }
.log-list { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.log-entry { display: flex; gap: 10px; align-items: baseline; padding: 7px 12px; position: relative; }
.log-entry::before { content: ''; position: absolute; left: -6px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line); }
.log-entry.cat-auction::before { border-color: var(--gold); }
.log-entry.cat-decay::before { border-color: var(--bad); }
.log-entry.cat-build::before { border-color: var(--good); }
.log-entry.cat-rule::before { border-color: var(--t-medium); }
.log-entry.cat-event::before { border-color: var(--info); }
.log-icon { flex: none; }
.log-text { flex: 1; }
.log-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------------- Shop ---------------- */
.shop-head { margin-bottom: 18px; }
.shop-head h2 { font-family: var(--font-display); color: var(--gold-2); font-size: 24px; margin-bottom: 4px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.pack {
  position: relative; text-align: center; padding: 22px 16px 16px;
  background: linear-gradient(180deg, #2b241b, var(--panel));
  border: 1px solid var(--gold-dark); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.pack-tag { position: absolute; top: -10px; right: 12px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.pack-icon { font-size: 44px; filter: drop-shadow(0 4px 10px rgba(217,173,85,.3)); }
.pack-name { font-family: var(--font-display); font-weight: 600; }
.pack-coins { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--gold-2); }
.pack-bonus { font-size: 12px; color: var(--good); margin-bottom: 6px; }
.shop-earn ul { margin: 0; padding-left: 18px; }
.shop-earn li { margin: 4px 0; }

/* ---------------- Menü ---------------- */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.panel-wide { grid-column: 1 / -1; }
.rules-text p { margin: 0 0 10px; color: #d6cbb8; }
textarea.code { font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; resize: vertical; }

/* ---------------- Toasts & Modal ---------------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: 360px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--info);
  padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow); font-size: 14px;
  animation: slideIn .25s; transition: opacity .3s, transform .3s;
}
.toast.good { border-left-color: var(--good); }
.toast.warn { border-left-color: var(--warn); }
.toast.bad { border-left-color: var(--bad); }
.toast.out { opacity: 0; transform: translateX(20px); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } }

.float-coins {
  position: fixed; z-index: 60; pointer-events: none; transform: translate(-50%, 0);
  font-family: var(--font-display); font-weight: 800; color: var(--gold-2); font-size: 18px;
  text-shadow: 0 2px 8px rgba(0,0,0,.6); animation: floatUp 1s forwards;
}
@keyframes floatUp { to { transform: translate(-50%, -50px); opacity: 0; } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 70; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--gold-dark); border-radius: 14px; padding: 22px; width: min(460px, 100%); box-shadow: var(--shadow); animation: fadeIn .2s; }
.modal h3 { font-family: var(--font-display); color: var(--gold-2); margin-bottom: 10px; font-size: 18px; }
.modal p { margin: 0 0 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1150px) {
  .topbar { flex-wrap: wrap; }
  .top-stats { order: 3; flex-basis: 100%; }
  .city-layout { grid-template-columns: 1fr; }
  .city-side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .menu-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .topbar, .tabs, main { padding-left: 16px; padding-right: 16px; }
  .top-stats { flex-direction: column; }
  .two-col, .menu-grid { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
  .brand { min-width: 0; }
  .top-actions { margin-left: auto; }
  .btn-work { min-width: 0; }
  .auction-grid { grid-template-columns: 1fr; }
}

/* =====================================================================
 * GRAFIK-ASSETS (assets/*.webp)
 * ===================================================================== */

/* ---- Icons ---- */
.stat-img { width: 36px; height: 36px; object-fit: contain; flex: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.tab-img { width: 20px; height: 20px; object-fit: contain; }
.ico-coin { width: 1.05em; height: 1.05em; vertical-align: -0.16em; object-fit: contain; }
.ico-coin.xs { width: .95em; height: .95em; }
.ico-coin.sm { width: .9em; height: .9em; vertical-align: -0.1em; }
.ico-coin.md { width: 1.15em; height: 1.15em; vertical-align: -0.2em; }

/* Coin-Anzeige oben in der Goldplatte */
.stat.coins {
  border: 14px solid transparent;
  border-image: url('../assets/plate.webp') 90 fill / 14px stretch;
  border-radius: 0; background: none; padding: 2px 10px;
}
.stat.coins .stat-sub { color: #e8d6b4; }
.stat.coins .stat-value { text-shadow: 0 2px 4px rgba(0,0,0,.6); }

/* ---- Bildkacheln ---- */
.tile-art.framed, .tile-art.shield {
  background: none; border: 0; box-shadow: none; overflow: visible;
}
.tile-art.framed::after, .tile-art.shield::after { display: none; }
.tile-art.framed img, .tile-art.shield img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.55));
}
.tile-art.framed span { font-size: 24px; margin-top: 4px; }
.slot-grid.large .tile-art { width: 68px; height: 76px; }
.slot-grid.large .tile-art.framed span { font-size: 28px; }
.a-head .tile-art.framed, .a-head .tile-art.shield { width: 58px; height: 64px; }

/* Zustands-Badges mit Schild */
.state-badge { display: inline-flex; align-items: center; gap: 4px; }
.state-badge img { width: 13px; height: 15px; object-fit: contain; margin-left: -2px; }

/* ---- Stadt-Banner (Stadtkarte) ---- */
.city-hero {
  position: relative; min-height: 210px; margin-bottom: 22px;
  border-radius: 14px; overflow: hidden; border: 1px solid var(--gold-dark);
  background: url('../assets/city-map.webp') center 40% / cover;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 24px 28px;
  box-shadow: var(--shadow);
}
.city-hero::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(18,14,10,.88) 0%, rgba(18,14,10,.55) 45%, rgba(18,14,10,.15) 100%),
              linear-gradient(0deg, rgba(18,14,10,.7), transparent 60%);
}
.hero-text, .hero-btn { position: relative; }
.hero-kicker { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.city-hero h1 { font-family: var(--font-display); font-weight: 800; font-size: 40px; color: #f5e3bd; text-shadow: 0 3px 10px rgba(0,0,0,.7); margin: 2px 0 8px; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.hero-facts span {
  font-size: 13px; padding: 3px 10px; border-radius: 99px;
  background: rgba(18,14,10,.7); border: 1px solid rgba(217,173,85,.35); color: #e8dcc6;
}

/* ---- BID-Button (Gold = bieten möglich, Eisen = gesperrt) ---- */
.bid-btn {
  width: 88px; height: 55px; border: 0; padding: 0; flex: none;
  background: url('../assets/bid-gold.webp') center / contain no-repeat;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.5));
  transition: transform .08s, filter .15s;
}
.bid-btn:hover:not(:disabled) { filter: drop-shadow(0 0 10px rgba(240,204,124,.55)) brightness(1.08); transform: translateY(-1px); }
.bid-btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.bid-btn.iron, .bid-btn:disabled { background-image: url('../assets/bid-iron.webp'); }
.bid-btn:disabled { opacity: .75; }
.a-controls { align-items: center; }

/* Timer mit Sanduhr */
.a-timebox { display: flex; align-items: center; gap: 6px; }
.a-hourglass { width: 26px; height: 40px; object-fit: contain; }
.a-head { cursor: pointer; }
.a-head:hover h3 { color: var(--gold-2); }
.a-detail {
  align-self: flex-start; background: none; border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); width: 26px; height: 26px; font-size: 14px; line-height: 1; flex: none;
}
.a-detail:hover { color: var(--gold-2); border-color: var(--gold-dark); }

/* ---- Logbuch auf Pergament ---- */
.log-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.log-head img { width: 64px; height: 68px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,.5)); }
.log-head h2 { font-family: var(--font-display); color: var(--gold-2); font-size: 24px; }
.parchment {
  max-width: 980px;
  border: 64px solid transparent;
  border-image: url('../assets/parchment.webp') 120 fill / 64px stretch;
  padding: 4px 22px 4px 30px; min-height: 300px;
  color: #3b2a17;
}
.parchment .logbook { max-width: none; }
.parchment .log-day { color: #6b4419; }
.parchment .log-list { border-left-color: rgba(90,60,25,.35); }
.parchment .log-entry::before { background: #e9d6ac; border-color: rgba(90,60,25,.5); }
.parchment .log-entry.cat-auction::before { border-color: #a8771c; }
.parchment .log-entry.cat-decay::before { border-color: #a3392e; }
.parchment .log-entry.cat-build::before { border-color: #4f7a33; }
.parchment .log-entry.cat-rule::before { border-color: #6a4c8f; }
.parchment .log-entry.cat-event::before { border-color: #2f6288; }
.parchment .log-text { color: #2f2113; }
.parchment .log-time { color: #7b6446; }
.parchment .empty-hint { color: #6b5536; }

/* ---- Shop-Pakete in Goldplatte ---- */
.pack {
  border: 26px solid transparent;
  border-image: url('../assets/plate.webp') 90 fill / 26px stretch;
  background: none; border-radius: 0; padding: 4px 6px 0;
}
.pack-name { color: #f5e3bd; text-shadow: 0 2px 3px rgba(0,0,0,.7); }
.pack-coins { text-shadow: 0 2px 4px rgba(0,0,0,.7); }
.pack-bonus { color: #b9f0a0; text-shadow: 0 1px 2px rgba(0,0,0,.8); }
.pack-tag { top: -30px; right: -10px; }

/* =====================================================================
 * AUKTIONS-DETAILFENSTER
 * Alle Positionen in % der Vorlage (assets/auction-panel.webp, 16:9),
 * Schriftgrößen in cqw – skaliert dadurch mit der Fenstergröße.
 * ===================================================================== */
.detail-backdrop {
  position: fixed; inset: 0; z-index: 65; background: rgba(0,0,0,.72);
  display: grid; place-items: center; padding: 12px; animation: fadeIn .2s;
}
.detail {
  position: relative; container-type: inline-size;
  width: min(1200px, 96vw, calc(94vh * 16 / 9)); aspect-ratio: 16 / 9;
  background: url('../assets/auction-panel.webp') center / 100% 100% no-repeat;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,.6));
  color: #2f2113;
}
.detail > * { position: absolute; }
.d-close { left: 90.3%; top: 5.2%; width: 4.9%; height: 8.6%; border: 0; border-radius: 50%; background: transparent; }
.d-close:hover { box-shadow: 0 0 2cqw rgba(240,204,124,.6); }

/* Linke Pergament-Fläche: Bild, Beschreibung, eigenes Gebot */
.d-art {
  left: 15.9%; top: 26.5%; width: 24.2%; height: 47.5%;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6cqw;
  overflow: hidden;
}
.d-pic { width: 9cqw; height: 9cqw; display: grid; place-items: center; flex: none; position: relative; }
.d-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 .3cqw .5cqw rgba(0,0,0,.45)); }
.d-pic span { font-size: 6cqw; filter: drop-shadow(0 .3cqw .4cqw rgba(0,0,0,.35)); }
.d-kind { font-size: clamp(9px, .85cqw, 13px); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: #7a4f17; }
.d-desc { margin: 0; font-size: clamp(10px, 1.05cqw, 15px); line-height: 1.35; color: #3b2a17; }
.d-effect { font-size: clamp(10px, .95cqw, 14px); font-weight: 600; color: #4b3416; background: rgba(120,85,30,.12); border-radius: .5cqw; padding: .3cqw .7cqw; }
.d-custom { margin-top: auto; display: flex; gap: .5cqw; width: 100%; }
.d-input {
  flex: 1; min-width: 0; font: inherit; font-size: clamp(10px, 1.05cqw, 15px);
  background: rgba(255,248,230,.7); border: 1px solid #a07a3e; border-radius: .5cqw; padding: .4cqw .6cqw; color: #2f2113;
}
.d-own {
  font-size: clamp(10px, .95cqw, 14px); font-weight: 700; border-radius: .5cqw; padding: .4cqw .8cqw;
  background: #4a3418; color: #f5e3bd; border: 1px solid #a07a3e;
}
.d-own:disabled, .d-input:disabled { opacity: .45; }

/* Mittlere Liste: Gebotsverlauf in den 9 Zeilen der Vorlage */
.d-history {
  left: 47.4%; top: 24.3%; width: 18.6%; height: 51.7%;
  margin: 0; padding: 0; list-style: none;
  display: grid; grid-template-rows: repeat(9, 1fr);
}
.d-history li {
  display: flex; align-items: center; justify-content: space-between; gap: .5cqw;
  font-size: clamp(9px, 1cqw, 15px); color: #e8dcc6; padding-right: .6cqw; overflow: hidden; white-space: nowrap;
}
.d-history li span { overflow: hidden; text-overflow: ellipsis; }
.d-history li b { font-family: var(--font-display); color: var(--gold-2); }
.d-history li.you span, .d-history li.you b { color: #9fe39a; }
.d-history li:first-child:not(.empty) { font-weight: 700; }
.d-history li.empty span { color: #8a7c66; font-style: italic; }

/* Rechte Spalte */
.d-title {
  left: 75.4%; top: 19.4%; width: 13.8%; height: 6%;
  display: grid; place-items: center; text-align: center;
  font-family: var(--font-display); font-weight: 800; color: #f5e3bd;
  font-size: clamp(10px, 1.25cqw, 18px); line-height: 1.1; overflow: hidden;
}
.d-boxes { left: 74.3%; top: 31%; width: 15.8%; height: 9.6%; display: flex; gap: .55%; }
.d-box {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2cqw;
  margin: 0 .35cqw;
}
.d-box span { font-size: clamp(8px, .7cqw, 11px); text-transform: uppercase; letter-spacing: .06em; color: #a69a88; }
.d-box b { font-family: var(--font-display); font-size: clamp(10px, 1.2cqw, 17px); color: var(--gold-2); }
.d-box .ok { color: #9fe39a; } .d-box .bad { color: #ff9c90; }

/* Sterne der Vorlage: nicht erreichte werden abgedunkelt */
.d-stars { left: 75.7%; top: 47.4%; width: 12.6%; height: 4.6%; display: flex; justify-content: space-between; pointer-events: none; }
.d-stars i { width: 2.4cqw; height: 100%; border-radius: 50%; }
.d-stars i:not(.on) { background: radial-gradient(circle, rgba(20,16,12,.85) 45%, rgba(20,16,12,0) 72%); }

.d-coins {
  left: 79.6%; top: 57.3%; width: 10.2%; height: 8.2%;
  display: flex; flex-direction: column; justify-content: center; line-height: 1.15; overflow: hidden;
}
.d-coins b { font-family: var(--font-display); font-size: clamp(11px, 1.45cqw, 20px); color: var(--gold-2); }
.d-coins span { font-size: clamp(8px, .8cqw, 12px); color: #cbbfa9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-timer { font-weight: 700; }
.d-timer.urgent { color: #ff9c90 !important; animation: blink .8s infinite; }

.d-hammer {
  left: 74%; top: 69.3%; width: 15.9%; height: 12%;
  background: transparent; border: 0; border-radius: .8cqw; cursor: pointer;
  display: flex; align-items: center; justify-content: flex-end; padding-right: 1.4cqw;
  transition: box-shadow .15s, background .15s;
}
.d-hammer span { font-family: var(--font-display); font-size: clamp(10px, 1.05cqw, 15px); color: #f5e3bd; text-align: center; line-height: 1.15; }
.d-hammer span b { font-size: clamp(12px, 1.5cqw, 21px); color: var(--gold-2); }
.d-hammer:hover:not(:disabled) { box-shadow: 0 0 2cqw rgba(240,204,124,.55), inset 0 0 1.5cqw rgba(240,204,124,.25); }
.d-hammer:active:not(:disabled) { transform: translateY(1px); }
.d-hammer:disabled { cursor: not-allowed; opacity: 1; background: rgba(20,16,12,.55); }
.d-note {
  left: 44.4%; top: 77.6%; width: 22.4%; text-align: center;
  font-size: clamp(9px, .85cqw, 13px); color: #ffcf8a; text-shadow: 0 1px 2px #000;
}


/* =====================================================================
 * KONTO
 * ===================================================================== */
.user-chip {
  display: inline-block; margin-left: 8px; background: none; border: 1px solid var(--line);
  border-radius: 99px; padding: 0 8px; font-size: 12px; color: var(--muted); line-height: 18px;
}
.user-chip:hover { color: var(--text); border-color: var(--gold-dark); }
.user-chip.in { color: var(--gold-2); border-color: var(--gold-dark); }
.panel-account { border-color: var(--gold-dark); }
.acc-state { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.acc-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 20px; color: #2a1d06;
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); border: 2px solid var(--gold-dark);
}
.acc-state.guest .acc-avatar { background: var(--panel-2); color: var(--muted); border-color: var(--line); }
.form { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--gold); }
.form-error { color: #ff9c90; font-size: 13px; min-height: 0; }
.form-error:empty { display: none; }

/* =====================================================================
 * MOBIL (Handys bis 720 px Breite)
 * App-artig: kompakte Kopfleiste, Tab-Leiste unten, Bottom-Sheets.
 * ===================================================================== */
html { -webkit-text-size-adjust: 100%; }
button, .tab, .slot, .auction { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.slot-free { display: none; }

@media (max-width: 720px) {
  body { font-size: 14px; }

  /* ---- Kopfleiste: eine kompakte Zeile + Werte-Zeile ---- */
  .topbar {
    display: grid; grid-template-columns: 1fr auto; gap: 8px 10px;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  }
  .brand { min-width: 0; gap: 8px; }
  .brand-mark { width: 34px; height: 34px; font-size: 17px; flex: none; }
  .brand-title { font-size: 14px; white-space: nowrap; }
  .city-name { font-size: 12px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
  .user-chip { margin-left: 4px; font-size: 11px; max-width: 28vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
  .top-actions { margin: 0; align-self: center; }
  .btn-buy { display: none; }
  .btn-work { min-width: 0; padding: 8px 12px; min-height: 40px; }
  .hide-sm { display: none; }

  .brand { order: 0; }
  .top-actions { order: 1; }
  .top-stats { grid-column: 1 / -1; order: 2; flex-direction: row; gap: 6px; }
  .stat { min-width: 0; flex: 1; padding: 5px 8px; gap: 6px; border-radius: 10px; }
  .stat-img { width: 24px; height: 24px; }
  .stat-icon { font-size: 18px; }
  .stat.coins { min-width: 0; flex: 1.25; border-width: 10px; border-image-width: 10px; padding: 0 4px; }
  .stat-value { font-size: 17px; }
  .stat.coins .stat-sub { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 26vw; }
  .stat-row { font-size: 11px; margin-bottom: 4px; gap: 4px; }
  .stat-row span { white-space: nowrap; }
  .stat.stability .stat-row span { display: none; }     /* Icon erklärt den Wert */
  .stat.stability .stat-row { justify-content: flex-end; }

  /* ---- Tab-Leiste unten ---- */
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    background: rgba(20, 17, 14, .97); backdrop-filter: blur(10px);
    border-top: 1px solid var(--gold-dark); border-bottom: 0;
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; overflow: visible;
  }
  .tab {
    flex-direction: column; gap: 2px; padding: 6px 2px 5px; min-height: 54px;
    border-bottom: 0; border-radius: 10px; position: relative; justify-content: center;
  }
  .tab.active { background: rgba(217, 173, 85, .12); }
  .tab-ico { font-size: 21px; line-height: 1; height: 24px; display: grid; place-items: center; }
  .tab-ico .tab-img { width: 24px; height: 24px; }
  .tab-lbl { font-size: 11px; }
  .tab .badge { position: absolute; top: 2px; left: 54%; font-size: 10px; padding: 0 5px; }

  main { padding: 14px 12px calc(84px + env(safe-area-inset-bottom)); }

  /* ---- Stadt ---- */
  .city-hero { min-height: 0; padding: 18px 16px; margin-bottom: 16px; flex-direction: column; align-items: stretch; }
  .city-hero h1 { font-size: 28px; }
  .hero-kicker { font-size: 10.5px; }
  .hero-facts span { font-size: 12px; padding: 2px 8px; }
  .hero-btn { display: none; }
  .slot-section { margin-bottom: 16px; }
  .slot-section h3 { font-size: 15px; }
  .slot-grid.large, .slot-grid.medium, .slot-grid.rule, .slot-grid.event,
  .slot-grid.companion, .slot-grid.quest { grid-template-columns: 1fr; gap: 8px; }
  .slot.empty { display: none; }
  .slot-free {
    display: block; text-align: center; padding: 10px; border: 1.5px dashed var(--line); border-radius: 10px;
    color: #7d7163; font-size: 13px;
  }
  .slot { min-height: 0; }
  .slot-actions .mini { min-height: 34px; font-size: 13px; padding: 4px 10px; }
  .slot-actions .mini.ghost { min-width: 40px; }
  .two-col { grid-template-columns: 1fr; gap: 0; }
  .city-side { display: flex; }

  /* ---- Auktionen ---- */
  .toolbar { gap: 8px; margin-bottom: 12px; }
  .seg { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg-btn { flex: none; padding: 8px 12px; }
  .toolbar-right { width: 100%; justify-content: space-between; }
  #rerollBtn { padding: 7px 10px; font-size: 13px; }
  .auction-grid { grid-template-columns: 1fr; gap: 12px; }
  .auction { padding: 12px; gap: 8px; }
  .a-desc { min-height: 0; }
  .a-controls { grid-template-columns: 1fr auto auto; }
  .a-input, .input, .d-input { font-size: 16px; }   /* verhindert Auto-Zoom auf iOS */
  .a-quick { min-height: 44px; }
  .bid-btn { width: 84px; height: 52px; }

  /* ---- Logbuch ---- */
  .log-head img { width: 46px; height: 50px; }
  .log-head h2 { font-size: 20px; }
  .parchment { border-width: 34px; border-image-width: 34px; padding: 0 4px 0 10px; }
  .log-entry { padding: 7px 6px 7px 12px; font-size: 13.5px; }
  .log-time { display: none; }

  /* ---- Shop & Menü ---- */
  .shop-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .pack { border-width: 18px; border-image-width: 18px; }
  .pack-icon { font-size: 34px; }
  .pack-coins { font-size: 18px; }
  .menu-grid { grid-template-columns: 1fr; }

  /* ---- Toasts über der Tab-Leiste ---- */
  .toasts { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); max-width: none; }

  /* ---- Dialoge als Bottom-Sheet ---- */
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal {
    width: 100%; border-radius: 18px 18px 0 0; border-bottom: 0;
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
    max-height: 90vh; overflow-y: auto;
  }
  .modal-actions .btn { flex: 1; min-height: 46px; }

  /* ---- Auktions-Detail als Bottom-Sheet (statt 16:9-Grafik) ---- */
  .detail-backdrop { place-items: end center; padding: 0; }
  .detail {
    width: 100%; aspect-ratio: auto; max-height: 92vh; overflow-y: auto;
    background: var(--panel); border-top: 2px solid var(--gold-dark); border-radius: 18px 18px 0 0;
    filter: none; color: var(--text);
    padding: 18px 14px calc(16px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: 12px;
    animation: sheetUp .25s ease-out;
  }
  .detail > * { position: static; left: auto; top: auto; width: auto; height: auto; }
  .d-close {
    position: absolute; top: 12px; right: 12px; width: 38px; height: 38px;
    background: var(--panel-2); border: 1px solid var(--line);
  }
  .d-close::before { content: '✕'; color: var(--muted); font-size: 16px; }
  .d-title { order: 1; display: block; text-align: left; padding-right: 46px; font-size: 21px; color: var(--gold-2); }
  .d-art {
    order: 2; overflow: visible;
    border: 30px solid transparent; border-image: url('../assets/parchment.webp') 120 fill / 30px stretch;
    margin: -4px -6px; padding: 0 2px; gap: 8px;
  }
  .d-pic { width: 84px; height: 84px; }
  .d-pic span { font-size: 54px; }
  .d-kind { font-size: 11px; }
  .d-desc { font-size: 14px; }
  .d-effect { font-size: 13px; padding: 4px 8px; border-radius: 6px; }
  .d-custom { gap: 6px; margin-top: 4px; }
  .d-input { padding: 9px 10px; border-radius: 8px; }
  .d-own { font-size: 13px; padding: 9px 12px; border-radius: 8px; }
  .d-boxes { order: 3; display: flex; gap: 8px; }
  .d-box { margin: 0; padding: 8px 4px; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 10px; }
  .d-box span { font-size: 10px; }
  .d-box b { font-size: 16px; }
  .d-stars { display: none; }
  .d-coins {
    order: 4; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
    background: var(--bg-2); border: 1px solid var(--gold-dark); border-radius: 10px; padding: 10px 12px;
  }
  .d-coins b { font-size: 22px; }
  .d-coins span { font-size: 13px; }
  .d-timer { margin-left: auto; font-size: 16px !important; }
  .d-hammer {
    order: 5; min-height: 56px; justify-content: center; padding: 0 16px;
    background: linear-gradient(180deg, var(--gold-2), var(--gold)); border: 1px solid var(--gold); border-radius: 12px;
  }
  .d-hammer::before { content: '🔨'; font-size: 22px; margin-right: 10px; }
  .d-hammer span, .d-hammer span b { color: #2a1d06; font-size: 16px; }
  .d-hammer span br { display: none; }
  .d-hammer span b { margin-left: 6px; font-size: 18px; }
  .d-hammer:disabled { background: var(--panel-2); border-color: var(--line); }
  .d-hammer:disabled span, .d-hammer:disabled span b { color: var(--muted); }
  .d-note { order: 6; text-align: left; font-size: 13px; color: var(--warn); text-shadow: none; }
  .d-note:empty { display: none; }
  .d-history { order: 7; display: flex; flex-direction: column; gap: 4px; }
  .d-history::before { content: 'Gebotsverlauf'; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 2px; }
  .d-history li { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
  .d-history li.empty { display: none; }
  .d-history li.empty:first-child { display: flex; }
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }

/* Kleine Handys */
@media (max-width: 370px) {
  .brand-title { display: none; }
  .tab-lbl { font-size: 10px; }
  .shop-grid { grid-template-columns: 1fr; }
}

/* Touch-Geräte: keine "hängenden" Hover-Effekte */
@media (hover: none) {
  .bid-btn:hover:not(:disabled), .d-hammer:hover:not(:disabled) { transform: none; }
}

/* =====================================================================
 * HANDY IM QUERFORMAT (wenig Höhe): Kopfleiste in einer Zeile und nicht
 * fixiert, Tab-Leiste schmal unten – maximaler Platz für den Inhalt.
 * ===================================================================== */
@media (max-height: 500px) and (orientation: landscape) {
  .topbar {
    position: static; display: flex; flex-wrap: nowrap; gap: 8px;
    padding: 6px calc(10px + env(safe-area-inset-right)) 6px calc(10px + env(safe-area-inset-left));
  }
  .brand { min-width: 0; }
  .brand-mark { width: 30px; height: 30px; font-size: 15px; }
  .brand-title { display: none; }
  .top-stats { order: 0; flex: 1; flex-basis: auto; flex-direction: row; gap: 6px; }
  .stat { min-width: 0; padding: 4px 8px; flex: 1; }
  .stat-img { width: 22px; height: 22px; }
  .stat-value { font-size: 16px; }
  .stat.coins { min-width: 0; border-width: 9px; border-image-width: 9px; padding: 0 4px; }
  .stat-sub { display: none; }
  .stat-row { font-size: 11px; margin-bottom: 3px; }
  .btn-buy { display: none; }
  .btn-work { min-width: 0; padding: 6px 10px; }
  .hide-sm { display: none; }

  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; justify-content: center; gap: 2px;
    padding: 2px calc(8px + env(safe-area-inset-right)) calc(2px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left));
    background: rgba(20, 17, 14, .97); border-top: 1px solid var(--gold-dark); border-bottom: 0;
  }
  .tab { flex: 1; max-width: 170px; justify-content: center; padding: 8px 6px; border-bottom: 0; border-radius: 8px; }
  .tab.active { background: rgba(217, 173, 85, .12); }
  .tab-ico .tab-img { width: 20px; height: 20px; }
  main { padding: 12px calc(12px + env(safe-area-inset-right)) calc(60px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)); }
  .city-hero { min-height: 0; padding: 14px 18px; }
  .city-hero h1 { font-size: 26px; }
  .hero-btn { display: none; }
  .city-side { position: static; }
  .toasts { bottom: calc(54px + env(safe-area-inset-bottom)); }
}


/* =====================================================================
 * GEBÄUDEBILDER (assets/buildings) – freistehend, isometrisch
 * Der Zustand ist direkt am Bild sichtbar: wartungsbedürftig = blasser,
 * verfallend = grau, dunkel und leicht gekippt.
 * ===================================================================== */
.tile-art.building { background: none; border: 0; box-shadow: none; overflow: visible; }
.tile-art.building::after { display: none; }
.tile-art.building img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.6));
  transition: filter .4s, transform .4s;
}
.slot-grid.large .tile-art.building { width: 104px; height: 100px; margin: -6px -2px -6px -6px; }
.slot-grid.medium .tile-art.building { width: 64px; height: 64px; }
.a-head .tile-art.building { width: 76px; height: 72px; margin: -8px -4px -8px -6px; }
.slot.filled:hover .tile-art.building img { transform: translateY(-2px) scale(1.03); }

.slot.st-new .tile-art.building img { filter: drop-shadow(0 0 8px rgba(127,208,255,.35)) drop-shadow(0 4px 6px rgba(0,0,0,.6)); }
.slot.st-needs .tile-art.building img { filter: saturate(.55) brightness(.9) drop-shadow(0 4px 6px rgba(0,0,0,.6)); }
.slot.st-decaying .tile-art.building img {
  filter: grayscale(.85) sepia(.25) brightness(.62) contrast(1.05) drop-shadow(0 4px 6px rgba(0,0,0,.6));
  transform: rotate(-2.5deg) translateY(2px);
}

/* Detailfenster: Gebäude groß zeigen */
.d-pic { width: 10.5cqw; height: 10.5cqw; }

@media (max-width: 720px) {
  .slot-grid.large .tile-art.building { width: 92px; height: 88px; }
  .a-head .tile-art.building { width: 66px; height: 62px; }
  .d-pic { width: 150px; height: 140px; }
}

/* Mobil: Tageskachel ohne Sanduhr, damit „Tag N +XXX/Tag“ immer passt */
@media (max-width: 720px) {
  .stat { overflow: hidden; }
  .stat.day .stat-img { display: none; }
  .stat.day { padding-left: 10px; }
}


/* =====================================================================
 * CHARAKTERE (assets/characters)
 * ===================================================================== */
/* Porträt-Kachel für NPCs und Rivalen */
.tile-art.portrait {
  background: #1a1510; border: 1.5px solid var(--gold-dark); border-radius: 12px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4), 0 3px 8px rgba(0,0,0,.45);
}
.tile-art.portrait::after { display: block; background: linear-gradient(0deg, rgba(0,0,0,.35), transparent 45%); }
.tile-art.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-art.portrait.rival { border-color: #8a3a33; }
.slot-grid.companion .tile-art.portrait { width: 56px; height: 56px; }
.a-head .tile-art.portrait { width: 58px; height: 58px; }

.mini-face { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; vertical-align: -4px; margin-right: 5px; border: 1px solid #8a3a33; }
.d-history .mini-face { display: none; }

/* Chip oben (Konto) mit Gesicht */
.user-chip { display: inline-flex; align-items: center; gap: 5px; padding-left: 2px; }
.user-chip img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }
.acc-avatar { overflow: hidden; padding: 0; }
.acc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.acc-state.guest .acc-avatar img { filter: saturate(.6); }

/* Detailfenster: ganze Figur */
.d-pic.tall { width: 10.5cqw; height: 13cqw; }

/* Stadt-Banner: Avatar rechts unten */
.city-hero { min-height: 262px; }
.hero-side { position: relative; display: flex; align-items: flex-end; gap: 18px; margin: -24px -10px -24px 0; }
.hero-side .hero-btn { margin-bottom: 24px; }
.hero-avatar { margin: 0; display: flex; flex-direction: column; align-items: center; position: relative; }
.hero-avatar img { height: 236px; width: auto; display: block; filter: drop-shadow(0 6px 10px rgba(0,0,0,.7)); }
.hero-avatar figcaption {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); min-width: 132px;
  background: rgba(18,14,10,.88); border: 1px solid var(--gold-dark); border-radius: 10px;
  padding: 5px 10px 6px; text-align: center; display: flex; flex-direction: column; gap: 3px;
}
.hero-avatar figcaption b { font-family: var(--font-display); color: var(--gold-2); font-size: 14px; }
.hero-avatar figcaption small { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.rank-bar { display: block; height: 4px; background: #0c0b09; border-radius: 99px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dark), var(--gold-2)); }

@media (max-width: 720px) {
  .city-hero { padding-right: 120px; min-height: 190px; justify-content: flex-start; }
  .hero-side { position: absolute; right: 12px; bottom: 0; margin: 0; }
  .hero-avatar img { height: 180px; }
  .hero-avatar figcaption { min-width: 0; width: 92px; bottom: 6px; padding: 4px 6px; }
  .hero-avatar .nx-name { display: none; }
  .hero-avatar figcaption b { font-size: 12.5px; }
  .hero-avatar figcaption small { font-size: 9.5px; }
  .slot-grid.companion .tile-art.portrait { width: 54px; height: 54px; }
  .d-pic.tall { width: 140px; height: 200px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .city-hero { padding-right: 150px; }
  .hero-side { position: absolute; right: 8px; bottom: 0; margin: 0; }
  .hero-avatar img { height: 150px; }
}


/* =====================================================================
 * BANNER (Regeln) & BAUPLÄTZE
 * ===================================================================== */
.tile-art.banner { background: none; border: 0; box-shadow: none; overflow: visible; }
.tile-art.banner::after { display: none; }
.tile-art.banner img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.6)); transform-origin: 50% 0; transition: filter .4s, transform .4s;
}
.slot-grid.rule .tile-art.banner { width: 46px; height: 72px; }
.a-head .tile-art.banner { width: 44px; height: 66px; }
.slot.filled:hover .tile-art.banner img { transform: rotate(-3deg); }
/* Regeln verblassen wie Gebäude */
.slot.st-needs .tile-art.banner img { filter: saturate(.55) brightness(.9) drop-shadow(0 3px 5px rgba(0,0,0,.6)); }
.slot.st-decaying .tile-art.banner img { filter: grayscale(.85) sepia(.25) brightness(.62) drop-shadow(0 3px 5px rgba(0,0,0,.6)); transform: rotate(6deg); }

/* Ressourcen-Sockel etwas kleiner als Gebäude */
.slot-grid.medium .tile-art.building { width: 70px; height: 66px; margin: -4px -2px -4px -4px; }

/* Leere Bauplätze: Pflaster-Fläche */
.slot.empty { position: relative; flex-direction: column; gap: 2px; }
.slot.empty .plot { width: 46%; max-width: 96px; height: auto; margin-top: -12px; opacity: .2; filter: grayscale(.4); transition: opacity .2s; }
.slot-grid.medium .slot.empty .plot { width: 46%; max-width: 64px; }
.slot.empty:hover .plot { opacity: .45; }
.slot-grid.companion .tile-art.building { width: 64px; height: 58px; margin: -4px -2px -4px -4px; }
.slot.empty span { position: absolute; bottom: 8px; }


/* =====================================================================
 * SHOP IM RAHMEN (assets/ui/frame-shop.webp, 1372×800)
 * ===================================================================== */
.shop-frame {
  border-style: solid; border-color: transparent;
  border-width: 70px 66px 84px;
  border-image: url('../assets/ui/frame-shop.webp') 120 124 145 fill / 70px 66px 84px stretch;
  padding: 6px 4px 4px; margin-bottom: 20px; color: #3b2a17;
}
.shop-frame .shop-head h2 { display: none; }   /* Titel "SHOP" steht im Rahmen */
.shop-frame .shop-head p { margin: 0 0 18px; color: #5a4325; text-align: center; }
.shop-frame .shop-head b { color: #3b2a17; }
@media (max-width: 720px) {
  .shop-frame { border-width: 42px 26px 50px; border-image-width: 42px 26px 50px; padding: 4px 0 0; }
  .shop-frame .shop-head p { font-size: 13px; margin-bottom: 12px; }
}

/* =====================================================================
 * GROSSE SPIELMOMENTE
 * ===================================================================== */
.moment {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  background: radial-gradient(ellipse at center, rgba(10,8,6,.55), rgba(10,8,6,.85));
  animation: moIn .25s ease-out; cursor: pointer; padding: 16px;
}
.moment.out { animation: moOut .28s ease-in forwards; }
@keyframes moIn { from { opacity: 0; } }
@keyframes moOut { to { opacity: 0; } }
.mo-stage { position: relative; width: min(620px, 94vw); display: flex; flex-direction: column; align-items: center; }
.mo-hint { position: absolute; bottom: 18px; color: rgba(236,228,216,.45); font-size: 12px; }

/* Schilder */
.mo-plate {
  position: relative; z-index: 3; width: 100%; aspect-ratio: 900 / 406;
  background: center / contain no-repeat; display: flex; flex-direction: column; align-items: center;
  text-align: center; animation: plateIn .45s cubic-bezier(.2,1.4,.4,1);
}
@keyframes plateIn { from { transform: scale(.6) translateY(20px); opacity: 0; } }
.mo-plate.won { justify-content: center; padding: 6% 16% 0; gap: 2%; filter: drop-shadow(0 -6px 22px rgba(60,220,120,.35)); aspect-ratio: 900 / 402; }
.mo-plate.won b { font-family: var(--font-display); font-weight: 800; color: #f5e3bd; font-size: clamp(18px, 5vw, 32px); text-shadow: 0 2px 6px #000; }
.mo-plate.won span { color: #d9f0c8; font-size: clamp(12px, 2.7vw, 16px); text-shadow: 0 1px 3px #000; }
.mo-plate.lost { padding: 25% 16% 0 22%; }
.mo-plate.lost span { color: #f5dcd0; font-size: clamp(12px, 2.7vw, 16px); text-shadow: 0 1px 3px #000; }
.mo-plate.lost b.over {
  position: absolute; top: -18%; left: 0; right: 0; font-family: var(--font-display); color: #ffb3aa;
  font-size: clamp(18px, 5vw, 28px); text-shadow: 0 2px 6px #000;
}

/* Bild des Gewinns / Verlusts */
.mo-pic { position: relative; z-index: 2; height: 190px; width: auto; max-width: 70%; object-fit: contain; margin-bottom: -26px; filter: drop-shadow(0 8px 14px rgba(0,0,0,.7)); }
.mo-pic.figure { height: 260px; margin-bottom: -40px; }
.mo-pic.rise { animation: rise 1.4s .5s cubic-bezier(.2,.9,.3,1) backwards; }
@keyframes rise { from { transform: translateY(40px) scale(.7); opacity: 0; filter: brightness(3) drop-shadow(0 0 30px #f0cc7c); } }
.mo-pic.rival { height: 250px; margin-bottom: -60px; animation: rivalIn .6s ease-out; }
@keyframes rivalIn { from { transform: translateX(60px); opacity: 0; } }
.mo-pic.dim { filter: grayscale(.8) brightness(.6) drop-shadow(0 8px 14px rgba(0,0,0,.7)); }

/* Goldener Bau-Effekt */
.mo-fx { position: absolute; pointer-events: none; }
.mo-build {
  z-index: 1; top: -150px; left: 50%; height: 440px; transform: translateX(-50%);
  animation: buildFx 3.2s ease-out forwards;
}
@keyframes buildFx {
  0% { opacity: 0; transform: translateX(-50%) translateY(50px) scale(.8); }
  18% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  70% { opacity: 1; }
  100% { opacity: .15; transform: translateX(-50%) translateY(-20px) scale(1.05); }
}
.mo-rays {
  position: absolute; z-index: 1; top: -120px; left: 50%; width: 420px; height: 420px; transform: translateX(-50%);
  background: repeating-conic-gradient(rgba(240,204,124,.18) 0 8deg, transparent 8deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%); mask: radial-gradient(circle, #000 20%, transparent 68%);
  animation: spin 14s linear infinite;
}
@keyframes spin { to { transform: translateX(-50%) rotate(360deg); } }

/* Zerbröckeln */
.mo-crumble {
  z-index: 3; top: -40px; left: 50%; height: 380px; transform: translateX(-50%);
  animation: crumbleFx 2.6s ease-out forwards;
}
@keyframes crumbleFx {
  0% { opacity: 0; transform: translateX(-50%) scale(.85); }
  15% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(60px) scale(1.1); }
}
.mo-pic.crumbling { height: 230px; margin: 40px 0 70px; animation: crumblePic 1.6s .3s ease-in forwards; }
@keyframes crumblePic {
  0% { transform: none; filter: drop-shadow(0 8px 14px rgba(0,0,0,.7)); }
  20% { transform: translateX(-4px) rotate(-1deg); }
  35% { transform: translateX(4px) rotate(1deg); }
  100% { transform: translateY(50px) rotate(4deg) scale(.9); opacity: 0; filter: grayscale(1) brightness(.4); }
}
.mo-caption {
  position: relative; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  background: rgba(20,14,12,.92); border: 1px solid #7a3a33; border-radius: 12px; padding: 12px 22px;
  animation: plateIn .45s .4s cubic-bezier(.2,1.4,.4,1) backwards;
}
.mo-caption b { font-family: var(--font-display); color: #ffb3aa; font-size: 22px; }
.mo-caption span { color: #e8d6c8; font-size: 14px; }

@media (max-width: 720px) {
  .mo-build { height: 340px; top: -110px; }
  .mo-pic { height: 150px; }
  .mo-pic.figure, .mo-pic.rival { height: 210px; }
  .mo-crumble { height: 300px; }
}
@media (prefers-reduced-motion: reduce) {
  .moment *, .moment { animation-duration: .01s !important; }
}


/* =====================================================================
 * WILLKOMMENSBILDSCHIRM
 * ===================================================================== */
.welcome {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(rgba(12,9,6,.78), rgba(12,9,6,.92)), url('../assets/city-map.webp') center / cover;
  animation: moIn .4s ease-out; overflow-y: auto;
}
.welcome.out { animation: moOut .35s ease-in forwards; }
.w-card {
  position: relative; width: min(1060px, 100%); display: flex; align-items: flex-end; gap: 10px;
  background: linear-gradient(180deg, rgba(36,29,22,.96), rgba(22,18,14,.97));
  border: 1px solid var(--gold-dark); border-radius: 18px; padding: 34px 40px 30px 10px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 1px 0 rgba(240,204,124,.15);
}
.w-hero { width: 260px; flex: none; align-self: flex-end; margin: -90px 0 -30px -20px; filter: drop-shadow(0 12px 20px rgba(0,0,0,.7)); }
.w-main { flex: 1; min-width: 0; }
.w-kicker { color: var(--gold); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 700; }
.w-card h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(32px, 5vw, 52px); color: var(--gold-2); text-shadow: 0 3px 12px rgba(0,0,0,.6); margin: 4px 0 10px; line-height: 1.05; }
.w-lead { font-size: 16.5px; color: #e3d7c2; margin: 0 0 22px; max-width: 640px; }
.w-lead b { color: var(--gold-2); }
.w-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.w-step {
  background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  animation: plateIn .5s cubic-bezier(.2,1.4,.4,1) backwards;
}
.w-step:nth-child(2) { animation-delay: .08s; } .w-step:nth-child(3) { animation-delay: .16s; } .w-step:nth-child(4) { animation-delay: .24s; }
.w-step img { height: 58px; width: auto; max-width: 90px; object-fit: contain; filter: drop-shadow(0 3px 5px rgba(0,0,0,.5)); }
.w-step img.round { width: 58px; border-radius: 50%; border: 2px solid var(--gold-dark); object-fit: cover; }
.w-step b { font-family: var(--font-display); color: var(--gold-2); font-size: 16px; }
.w-step span { font-size: 13px; color: var(--muted); line-height: 1.35; }
.w-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.w-go { font-size: 17px; padding: 12px 22px; }
.w-go small { font-weight: 500; opacity: .7; font-size: 13px; }
.w-note { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }

@media (max-width: 860px) {
  .w-card { flex-direction: column; align-items: stretch; padding: 22px 18px 20px; }
  .w-hero {
    position: absolute; right: 8px; top: -34px; width: 104px; height: 150px; margin: 0;
    object-fit: cover; object-position: top;
    -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent);
  }
  .w-lead { margin-top: 14px; }
  .w-main { padding-right: 0; }
  .w-card h1 { padding-right: 100px; }
  .w-kicker { padding-right: 110px; }
  .w-steps { grid-template-columns: 1fr 1fr; gap: 8px; }
  .w-step { padding: 10px 8px; }
  .w-step img { height: 46px; }
  .w-step img.round { width: 46px; }
  .w-lead { font-size: 15px; }
  .w-actions .btn { flex: 1; min-height: 48px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .welcome { place-items: start center; }
  .w-hero { display: none; }
  .w-steps { grid-template-columns: repeat(4, 1fr); }
}

/* =====================================================================
 * TUTORIAL (Spotlight + Begleiter-Sprechblase)
 * ===================================================================== */
.tutorial { position: fixed; inset: 0; z-index: 72; pointer-events: none; }
.tutorial.paused { opacity: 0; transition: opacity .2s; }
.tut-spot {
  position: fixed; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(8,6,4,.62), 0 0 0 2px var(--gold-2), 0 0 24px 4px rgba(240,204,124,.55);
  transition: left .3s, top .3s, width .3s, height .3s, opacity .3s;
  animation: spotPulse 1.8s ease-in-out infinite;
}
@keyframes spotPulse { 50% { box-shadow: 0 0 0 9999px rgba(8,6,4,.62), 0 0 0 2px var(--gold-2), 0 0 34px 10px rgba(240,204,124,.75); } }
.tut-bubble {
  position: fixed; width: min(430px, calc(100vw - 20px)); pointer-events: auto;
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start;
  background: linear-gradient(180deg, #2c241b, #1d1813); border: 1px solid var(--gold-dark); border-radius: 14px;
  padding: 14px 16px 12px; box-shadow: 0 16px 40px rgba(0,0,0,.6);
  transition: left .3s, top .3s;
}
.tut-bubble.pop { animation: plateIn .35s cubic-bezier(.2,1.4,.4,1); }
.tut-bubble::before {
  content: ''; position: absolute; left: var(--ax, 50%); width: 14px; height: 14px; margin-left: -7px;
  background: #2c241b; border: 1px solid var(--gold-dark); transform: rotate(45deg);
}
.tut-bubble[data-arrow="up"]::before { top: -8px; border-right: 0; border-bottom: 0; }
.tut-bubble[data-arrow="down"]::before { bottom: -8px; border-left: 0; border-top: 0; background: #1d1813; }
.tut-bubble[data-arrow="none"]::before { display: none; }
.tut-face { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); box-shadow: 0 3px 8px rgba(0,0,0,.5); }
.tut-meta { font-size: 11px; color: var(--muted); letter-spacing: .03em; }
.tut-body h4 { font-family: var(--font-display); color: var(--gold-2); font-size: 17px; margin: 2px 0 4px; }
.tut-body p { margin: 0; font-size: 14px; color: #e3d7c2; line-height: 1.45; }
.tut-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 8px; }
.tut-skip { background: none; border: 0; color: var(--muted); font-size: 13px; padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; }
.tut-skip:hover { color: var(--text); }
.tut-next { padding: 8px 18px; }
.tut-wait { font-size: 13px; color: var(--gold); display: inline-flex; align-items: center; gap: 6px; }
.tut-wait i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: blink 1s infinite; }
.tut-wait .tut-skip { color: var(--muted); }
.tut-dots { grid-column: 1 / -1; display: flex; gap: 4px; justify-content: center; }
.tut-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.tut-dots i.done { background: var(--gold-dark); }
.tut-dots i.on { background: var(--gold-2); width: 16px; border-radius: 99px; }
@media (max-width: 720px) {
  .tut-face { width: 46px; height: 46px; }
  .tut-body h4 { font-size: 16px; }
  .tut-body p { font-size: 13.5px; }
  .tut-next { min-height: 42px; }
}


/* ---- Ton ---- */
.btn-icon { padding: 8px 11px; font-size: 16px; line-height: 1; }
.field.range { flex-direction: row; align-items: center; gap: 10px; margin-top: 10px; }
.field.range span { width: 58px; }
.field.range input { flex: 1; accent-color: var(--gold); }
@media (max-width: 720px) { .btn-icon { min-height: 40px; } }


/* =====================================================================
 * SCHICKSALS-AUKTION (Mehrspieler)
 * ===================================================================== */
.fate-box { margin-bottom: 18px; }
.fate-card {
  position: relative; display: grid; grid-template-columns: 170px 1fr 270px; gap: 18px; align-items: center;
  padding: 30px 20px 14px; border-radius: 16px; border: 1px solid #8a6a2c;
  background:
    radial-gradient(ellipse at 15% 40%, rgba(155,105,220,.22), transparent 55%),
    radial-gradient(ellipse at 90% 0%, rgba(240,204,124,.12), transparent 50%),
    linear-gradient(180deg, #2a2030, #1b1620);
  box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 1px 0 rgba(240,204,124,.18);
}
.fate-card.loading { display: block; text-align: center; color: var(--muted); padding: 24px; }
.fate-card.live { animation: fateGlow 3s ease-in-out infinite; }
@keyframes fateGlow { 50% { box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 26px rgba(155,105,220,.35), inset 0 1px 0 rgba(240,204,124,.18); } }
.fate-card.leading { border-color: var(--good); }
.fate-card.outbid { border-color: var(--bad); }
.fate-card.pulse { animation: pulse .5s; }
.fate-ribbon {
  position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, #6d4aa0, #4a2f73); color: #f5e3bd; border: 1px solid #8a6a2c; border-top: 0;
  border-radius: 0 0 12px 12px; padding: 4px 16px; font-size: 12px; font-weight: 700; letter-spacing: .06em; white-space: nowrap;
}
.fate-art { height: 150px; display: grid; place-items: center; }
.fate-art img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 8px 14px rgba(0,0,0,.65)); }
.fate-art span { font-size: 80px; }
.fate-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #c9a8f0; font-weight: 700; }
.fate-main h3 { font-family: var(--font-display); font-size: 26px; color: var(--gold-2); margin: 2px 0 6px; }
.fate-desc { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.fate-effect { font-size: 13px; background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.06); border-radius: 8px; padding: 6px 10px; display: inline-block; }
.fate-side { display: flex; flex-direction: column; gap: 8px; }
.fate-stat { display: flex; flex-direction: column; background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.06); border-radius: 10px; padding: 6px 12px; }
.fate-stat > span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fate-stat b { font-family: var(--font-display); font-size: 22px; color: var(--gold-2); }
.fate-stat b.urgent { color: var(--bad); animation: blink .8s infinite; }
.fate-stat em { font-style: normal; font-size: 12.5px; color: var(--muted); min-height: 18px; }
.fate-controls { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.fate-go { width: 100%; min-height: 44px; font-size: 15px; }
.fate-note { font-size: 12px; color: var(--warn); }
.fate-note:empty { display: none; }
.fate-recent { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); border-top: 1px solid rgba(255,255,255,.06); padding-top: 10px; }
.fate-recent em { font-style: normal; color: #c9a8f0; }
.fate-recent b { color: var(--text); font-weight: 600; }
.lead-player { color: #9fd0ff; font-weight: 600; }
.mini-face.player { border-color: #4a7aa8; }

/* Rangliste */
.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.board li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line-soft); }
.board li.me { border-color: var(--gold); background: rgba(217,173,85,.08); }
.board li:nth-child(1) .bd-pos { color: #f0cc7c; } .board li:nth-child(2) .bd-pos { color: #cfd6de; } .board li:nth-child(3) .bd-pos { color: #d39a62; }
.bd-pos { width: 22px; text-align: center; font-family: var(--font-display); font-weight: 800; color: var(--muted); }
.board img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 1px solid var(--gold-dark); }
.bd-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bd-name small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-pts { font-family: var(--font-display); font-weight: 800; color: var(--gold-2); }

@media (max-width: 960px) {
  .fate-card { grid-template-columns: 120px 1fr; }
  .fate-side { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .fate-side .fate-controls, .fate-side .fate-go, .fate-side .fate-note { grid-column: 1 / -1; }
  .fate-art { height: 110px; }
}
@media (max-width: 720px) {
  .fate-card { grid-template-columns: 96px 1fr; gap: 12px; padding: 30px 12px 12px; }
  .fate-art { height: 90px; }
  .fate-main h3 { font-size: 20px; }
  .fate-desc { display: none; }
  .fate-effect { font-size: 12px; }
  .fate-stat b { font-size: 19px; }
  .fate-ribbon { font-size: 11px; padding: 3px 10px; }
}


/* ---- Korrekturen: Zustands-Badges passen in schmale Kacheln ---- */
.state-badge { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.state-badge { background: none; cursor: pointer; font: inherit; font-size: 10.5px; font-weight: 700; }
.state-badge.st-target.t-maintenance { color: var(--st-stable); }
.state-badge.st-target.t-override { color: var(--st-needs); }
.state-badge.st-target.t-counter { color: #ffb3aa; animation: blink 1.4s infinite; }
button.state-badge:hover { background: rgba(255,255,255,.06); }

/* ---- Korrekturen: Logbuch besser lesbar (dunklere, kräftigere Schrift, Pergament gedämpft) ---- */
.parchment { position: relative; }
.parchment .logbook {
  background: rgba(60, 38, 12, .1); border-radius: 8px; padding: 6px 8px 10px;
}
.parchment .log-entry { font-size: 15px; line-height: 1.45; padding: 8px 12px; }
.parchment .log-entry:nth-child(even) { background: rgba(60, 38, 12, .07); border-radius: 6px; }
.parchment .log-text { color: #1c1207; font-weight: 600; }
.parchment .log-time { color: #4e3a20; font-weight: 600; }
.parchment .log-day { color: #4a2c0a; font-size: 17px; font-weight: 800; border-bottom: 1px solid rgba(74,44,10,.25); padding-bottom: 4px; }
.parchment .log-list { border-left-color: rgba(74,44,10,.45); border-left-width: 3px; }
.parchment .log-entry::before { background: #f0e0b8; border-width: 3px; }
.parchment .empty-hint { color: #3b2a14; font-weight: 600; }
@media (max-width: 720px) { .parchment .log-entry { font-size: 14px; } }


/* ---- Debug ---- */
.panel-debug { border: 1px dashed #7a6a3a; background: repeating-linear-gradient(135deg, var(--panel) 0 14px, #262019 14px 28px); }
.debug-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.debug-custom { display: grid; grid-template-columns: 1fr auto; gap: 6px; }


/* =====================================================================
 * RECHTSTEXTE
 * ===================================================================== */
.legal-footer { margin-top: 40px; padding: 18px 0 6px; border-top: 1px solid var(--line-soft); text-align: center; font-size: 12.5px; color: var(--muted); }
.legal-footer a, .w-legal a { color: var(--muted); text-decoration: none; }
.legal-footer a:hover, .w-legal a:hover { color: var(--gold-2); text-decoration: underline; }
.w-legal { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.check a { color: var(--gold-2); }

.legal { position: fixed; inset: 0; z-index: 95; background: rgba(8,6,4,.82); display: grid; place-items: center; padding: 16px; animation: moIn .2s; }
.legal-card {
  width: min(860px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: #f3e6c8; color: #2a1c0c; border-radius: 14px; border: 2px solid var(--gold-dark); overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.legal-card header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; background: #2a2118; border-bottom: 2px solid var(--gold-dark); }
.legal-card header h2 { font-family: var(--font-display); color: var(--gold-2); font-size: 20px; text-transform: uppercase; letter-spacing: .06em; }
.legal-nav { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px 14px; background: #e6d4ad; border-bottom: 1px solid #cdb685; }
.legal-nav button { background: none; border: 0; padding: 6px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; color: #5a4325; }
.legal-nav button.on { background: #2a2118; color: var(--gold-2); }
.legal-scroll { overflow-y: auto; padding: 8px 26px 20px; -webkit-overflow-scrolling: touch; }
.legal-body h3 { font-family: var(--font-display); color: #5a3510; font-size: 16px; margin: 18px 0 6px; }
.legal-body p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.55; }
.legal-body a { color: #7a4a10; }
.legal-form { background: rgba(90,60,25,.08); border: 1px dashed #b39560; border-radius: 8px; padding: 12px 14px; }
.legal-stand { color: #6b5536; font-size: 13px; margin-top: 18px !important; font-style: italic; }
.legal-card footer { padding: 12px 18px; border-top: 1px solid #cdb685; display: flex; justify-content: flex-end; background: #e6d4ad; }
@media (max-width: 720px) {
  .legal { padding: 0; }
  .legal-card { max-height: 100vh; height: 100%; border-radius: 0; border: 0; }
  .legal-scroll { padding: 6px 16px 16px; }
  .legal-card footer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .legal-footer { margin-top: 24px; line-height: 1.8; }
}


/* =====================================================================
 * STADTANSICHT (isometrisch)
 * ===================================================================== */
.city-modes { display: inline-flex; margin: 0 0 14px; }
.cmap { margin-bottom: 20px; }
.cmap-wrap {
  position: relative; overflow: hidden; border-radius: 16px; border: 1px solid var(--gold-dark);
  background: radial-gradient(ellipse at 50% 30%, #2a3320, #151a0f 70%);
  box-shadow: inset 0 0 60px rgba(0,0,0,.6), var(--shadow);
}
.cmap-sizer { position: relative; margin: 0 auto; }
.cmap-stage { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; transform-origin: 0 0; }
.cm-ground { position: absolute; inset: 0; }
.cm-clouds {
  position: absolute; inset: 0; pointer-events: none; z-index: 2000; opacity: .35; mix-blend-mode: multiply;
  background:
    radial-gradient(ellipse 260px 120px at 20% 30%, rgba(0,0,0,.5), transparent 70%),
    radial-gradient(ellipse 320px 140px at 70% 65%, rgba(0,0,0,.45), transparent 70%);
  background-size: 1600px 900px; animation: clouds 60s linear infinite;
}
@keyframes clouds { from { background-position: -400px 0, -200px 0; } to { background-position: 1200px 0, 1400px 0; } }

.cm-obj { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; }
.cm-obj img { display: block; pointer-events: none; }
.cm-bld, .cm-plot, .cm-banner, .cm-fig { cursor: pointer; }
.cm-bld { transition: transform .2s; }
.cm-bld:hover { transform: translate(-50%, -100%) translateY(-6px); }
.cm-bld .cm-base { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); opacity: .75; z-index: -1; }
.cm-bld.large .cm-base { width: 190px; }
.cm-bld.medium .cm-base, .cm-bld.well .cm-base { width: 130px; }
.cm-bld.well .cm-base { display: none; }
.cm-bld .cm-pic { filter: drop-shadow(0 10px 8px rgba(0,0,0,.55)); transition: filter .4s; }
.cm-bld.large .cm-pic { width: 200px; max-height: 230px; object-fit: contain; }
.cm-bld.medium .cm-pic { width: 136px; max-height: 150px; object-fit: contain; }
.cm-bld.well .cm-pic { width: 170px; }
.cm-bld.st-new .cm-pic { filter: drop-shadow(0 0 12px rgba(127,208,255,.55)) drop-shadow(0 10px 8px rgba(0,0,0,.55)); }
.cm-bld.st-needs .cm-pic { filter: saturate(.55) brightness(.88) drop-shadow(0 10px 8px rgba(0,0,0,.55)); }
.cm-bld.st-decaying .cm-pic { filter: grayscale(.85) sepia(.25) brightness(.6) drop-shadow(0 10px 8px rgba(0,0,0,.55)); transform: rotate(-3deg); }
.cm-bld.sel .cm-pic, .cm-banner.sel img, .cm-plot.sel img { filter: drop-shadow(0 0 3px #f0cc7c) drop-shadow(0 0 14px rgba(240,204,124,.8)); }
.cm-token { font-size: 40px; filter: drop-shadow(0 4px 4px rgba(0,0,0,.5)); }
.cm-token.big { font-size: 70px; margin-bottom: 10px; }
.cm-warn {
  position: absolute; top: -6px; right: 18%; font-style: normal; font-size: 20px; width: 32px; height: 32px; display: grid; place-items: center;
  background: rgba(20,14,10,.85); border: 2px solid var(--warn); border-radius: 50%; animation: bob 1.6s ease-in-out infinite;
}
.cm-warn.bad { border-color: var(--bad); }
.cm-warn.threat { right: auto; left: 18%; border-color: var(--bad); }
@keyframes bob { 50% { transform: translateY(-6px); } }

.cm-plot img { opacity: .35; filter: grayscale(.3); transition: opacity .2s; }
.cm-plot.large img { width: 170px; }
.cm-plot.medium img { width: 110px; }
.cm-plot { transform: translate(-50%, -70%); }
.cm-plot:hover img { opacity: .75; }
.cm-plot::after {
  content: '+'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -60%);
  font-size: 34px; font-weight: 800; color: rgba(240,204,124,.0); transition: color .2s;
}
.cm-plot:hover::after, .cm-plot.sel::after { color: rgba(240,204,124,.9); }

.cm-fig img { filter: drop-shadow(0 8px 6px rgba(0,0,0,.55)); }
.cm-fig.player img { height: 150px; }
.cm-fig.npc img { height: 104px; }
.cm-fig.token { background: rgba(20,14,10,.75); border: 2px solid var(--gold-dark); border-radius: 50%; width: 56px; height: 56px; justify-content: center; }
.cm-fig.token .cm-token { font-size: 30px; }
.cm-banner img { height: 96px; filter: drop-shadow(0 6px 5px rgba(0,0,0,.55)); transform-origin: 50% 0; animation: sway 4s ease-in-out infinite; }
.cm-banner:nth-child(odd) img { animation-delay: -2s; }
@keyframes sway { 50% { transform: rotate(2.5deg); } }
.cm-banner.st-needs img { filter: saturate(.55) brightness(.88); }
.cm-banner.st-decaying img { filter: grayscale(.85) brightness(.6); transform: rotate(8deg); animation: none; }
.cm-prop img { height: 74px; filter: drop-shadow(0 6px 5px rgba(0,0,0,.5)); }
.cm-event span {
  display: inline-block; white-space: nowrap; background: rgba(20,14,10,.88); border: 1px solid var(--gold); color: var(--gold-2);
  border-radius: 99px; padding: 6px 16px; font-weight: 700; font-size: 16px; box-shadow: 0 6px 16px rgba(0,0,0,.5);
}

.cmap-info {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 10px; min-height: 58px; padding: 10px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line-soft);
}
.cm-hint { color: var(--muted); font-size: 13.5px; }
.cm-info-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; min-width: 0; }
.cm-info-main b { font-family: var(--font-display); font-size: 17px; color: var(--gold-2); }
.cm-info-main > span:not(.state-badge) { color: var(--muted); font-size: 13px; }
.cm-cond { width: 90px; height: 6px; display: inline-block; }
.cm-info-acts { display: flex; gap: 6px; flex-wrap: wrap; }

@media (max-width: 720px) {
  .cmap-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
  .cmap-sizer { margin: 0; }
  .cmap-info { align-items: stretch; }
  .cm-info-acts { width: 100%; }
  .cm-info-acts .btn { flex: 1; min-height: 42px; }
  .city-modes { display: flex; width: 100%; }
  .city-modes .seg-btn { flex: 1; }
}

/* Stadtansicht: Klickflächen */
.cm-obj { pointer-events: none; }
.cm-hit { position: absolute; pointer-events: auto; cursor: pointer; left: 22%; right: 22%; top: 30%; bottom: 0; }
.cm-bld.large .cm-hit { left: 18%; right: 18%; top: 25%; }
.cm-plot .cm-hit { left: 15%; right: 15%; top: 15%; bottom: 15%; }
.cm-fig .cm-hit, .cm-banner .cm-hit { left: 15%; right: 15%; top: 0; }
.cm-obj:has(.cm-hit:hover).cm-bld { transform: translate(-50%, -100%) translateY(-6px); }
.cm-obj:has(.cm-hit:hover).cm-plot img { opacity: .75; }
.cm-obj:has(.cm-hit:hover).cm-plot::after { color: rgba(240,204,124,.9); }
.cm-bld:hover, .cm-plot:hover img { transform: none; }

/* Stadtansicht: Feinschliff */
.cm-bld.large .cm-pic { width: 182px; }
.cm-token.big {
  font-size: 40px; width: 70px; height: 70px; display: grid; place-items: center; margin-bottom: 18px;
  background: radial-gradient(circle at 40% 35%, #4a3c26, #241b10); border: 2px solid var(--gold-dark); border-radius: 50%;
  box-shadow: 0 8px 12px rgba(0,0,0,.5);
}
.cm-label {
  position: absolute; bottom: 2px; white-space: nowrap; font-size: 12px; font-weight: 700; color: #f5e3bd;
  background: rgba(20,14,10,.8); border-radius: 6px; padding: 1px 6px;
}
.legal-card header .btn-ghost { color: var(--gold-2); border-color: var(--gold-dark); }
.legal-card header .btn-ghost:hover { background: rgba(240,204,124,.1); }


/* =====================================================================
 * ABLAUFBALKEN (Spezial-Auktionen, Detailfenster, Stadtansicht)
 * ===================================================================== */
.tbar {
  position: relative; display: block; height: 16px; border-radius: 99px; overflow: hidden;
  background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.12);
}
.tbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: 99px; background: linear-gradient(90deg, #8a6a2c, var(--gold-2)); transition: width .25s linear; }
.tbar em {
  position: relative; display: block; text-align: center; font-style: normal; font-size: 10.5px; font-weight: 800; line-height: 14px;
  color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; font-variant-numeric: tabular-nums; letter-spacing: .03em;
}
/* Gegengebot: rot solange der Rivale führt, grün wenn du hältst */
.tbar.t-counter i { background: linear-gradient(90deg, #7a2a24, #d9665b); }
.tbar.t-counter.mine i { background: linear-gradient(90deg, #3a6a3a, #6fbf73); }
.tbar.t-maintenance i { background: linear-gradient(90deg, #3a6a3a, #8fd193); }
.tbar.t-override i { background: linear-gradient(90deg, #7a5a1c, #e0a84a); }
.tbar.urgent { animation: tbarPulse .8s ease-in-out infinite; }
@keyframes tbarPulse { 50% { box-shadow: 0 0 10px rgba(217,102,91,.8); } }
.tbar.done { opacity: .5; }

/* In der Slot-Kachel unter dem Hinweis */
.slot-tbar { margin: 1px 0 2px; height: 14px; }
.slot-tbar em { font-size: 10px; line-height: 12px; }

/* Detailfenster (Desktop: über dem Hammer-Feld der Vorlage) */
.d-tbar { position: absolute; left: 74.6%; top: 65.6%; width: 14.8%; }
.detail-tbar { height: 18px; }
.detail-tbar em { line-height: 16px; font-size: 11.5px; }

/* Stadtansicht: Balken unter dem Abwehr-Knopf */
.cm-threat { display: inline-flex; flex-direction: column; gap: 4px; min-width: 170px; }

@media (max-width: 720px) {
  .d-tbar { position: static; order: 4; width: auto; }
  .detail-tbar { height: 22px; }
  .detail-tbar em { line-height: 20px; font-size: 13px; }
  .cm-threat { width: 100%; }
}


/* =====================================================================
 * LOGO
 * ===================================================================== */
.brand-logo { height: 58px; width: auto; flex: none; margin: -8px 0 -8px -6px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.6)); }
.brand { min-width: 0; }
.w-card h1.w-logo { margin: 0 0 6px -10px; line-height: 0; }
.w-logo img { width: min(560px, 100%); height: auto; filter: drop-shadow(0 8px 18px rgba(0,0,0,.7)); }
@media (max-width: 860px) {
  .w-card h1.w-logo { padding-right: 96px; margin-left: -6px; }
  .w-logo img { width: 100%; }
}
@media (max-width: 720px) {
  .brand-logo { height: 44px; margin: -4px 0 -4px -4px; }
}
@media (max-width: 370px) { .brand-logo { height: 36px; } }
@media (max-height: 500px) and (orientation: landscape) { .brand-logo { height: 34px; } }


/* ---- Datei-Import ---- */
.file-drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 14px; margin: 10px 0 4px;
  border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; text-align: center; transition: border-color .15s, background .15s;
}
.file-drop:hover, .file-drop.over { border-color: var(--gold); background: rgba(217,173,85,.06); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.fd-icon { font-size: 30px; }
.fd-text { font-weight: 600; color: var(--gold-2); word-break: break-all; }

.app-ver { opacity: .6; font-variant-numeric: tabular-nums; }
