:root {
  color-scheme: light;
  --ocean-top: #1877b7;
  --ocean-bot: #0a426d;
  --sand: #ead49b;
  --sand-border: #b6985a;
  --panel-bg: #f6efe0;
  --panel-card: #fffaf0;
  --panel-line: #d4c6a9;
  --ink: #24211c;
  --muted: #655e52;
  --accent: #1d6ea8;
  --accent-dark: #134d78;
  --danger: #c7322b;
  --gold: #f6c445;
  font: 14px/1.4 "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--ocean-bot);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2.5px solid #f6c445;
  outline-offset: 2px;
}
.ui-icon { flex: none; display: inline-block; vertical-align: middle; }
.tabular-num { font-variant-numeric: tabular-nums; }

.app-shell {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 416px;
  height: 100vh;
  overflow: hidden;
}

/* Left icon rail */
.left-rail {
  background: linear-gradient(180deg, #0e4f80 0%, #093558 100%);
  border-right: 1px solid #ffffff1c;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  gap: 10px;
  z-index: 5;
}

.rail-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid #ffffff2b;
  background: #ffffff14;
  color: #e6f0ff;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 #ffffff24, 0 3px 8px #02142440;
  transition: background .16s ease, transform .16s cubic-bezier(.22,1,.36,1), border-color .16s ease, color .16s ease;
}
.rail-btn:hover {
  background: #ffffff29;
  border-color: #ffffff5c;
  color: #fff;
  transform: translateY(-1px);
}
.rail-btn:active { transform: translateY(1px); }
.rail-btn.active {
  background: linear-gradient(180deg, #ffd866 0%, #f0ad1c 100%);
  border-color: #ffe89e;
  color: #211805;
  box-shadow: inset 0 1px 0 #ffffff88, 0 0 14px #f6c44566;
}
.rail-spacer { flex: 1; }
.conn-dot { width: 10px; height: 10px; border-radius: 50%; background: #4cd964; box-shadow: 0 0 6px #4cd964; }
.conn-dot.offline { background: #ff5b52; box-shadow: 0 0 6px #ff5b52; }

/* Center 3D board stage */
.board-stage {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: radial-gradient(ellipse at 50% 42%, var(--ocean-top) 0%, #0f568b 58%, var(--ocean-bot) 100%);
  overflow: hidden;
}

.phase-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #09375ce0;
  color: #f6f2e8;
  border-bottom: 1px solid #ffffff22;
  font-size: 13px;
  z-index: 4;
  transition: background .2s, box-shadow .2s;
}
.phase-banner.my-action {
  background: linear-gradient(90deg, #0d4b7c 0%, #11588d 100%);
  box-shadow: inset 0 -2px 0 #f6c445;
}
.phase-banner.robber-alert {
  background: linear-gradient(90deg, #6e1c17 0%, #9b2a22 50%, #6e1c17 100%);
  box-shadow: inset 0 -2px 0 #ffe066, 0 4px 16px #c7322b66;
  animation: robberBannerPulse 1.15s infinite ease-in-out;
}
@keyframes robberBannerPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}
.phase-badge {
  background: var(--gold);
  color: #241b07;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
}
.bot-thinking {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #ffffff1a;
  border: 1px solid #ffffff33;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #ffe89e;
  white-space: nowrap;
}
.bot-thinking i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulseDot 1s infinite ease-in-out;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(.75); opacity: .5; }
  50% { transform: scale(1.25); opacity: 1; }
}

.board-wrap {
  position: relative;
  display: grid;
  place-items: center;
  padding: 6px 14px;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.board-wrap.panning { cursor: grabbing; }

.ocean-shimmer {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 25% 30%, #4cb3ee1c 0 18%, transparent 40%),
    radial-gradient(circle at 75% 70%, #58c2ff18 0 20%, transparent 42%);
  pointer-events: none;
  animation: oceanDrift 12s infinite alternate ease-in-out;
}
@keyframes oceanDrift {
  from { transform: translate(-1.5%, -1%) scale(1); }
  to { transform: translate(1.5%, 1%) scale(1.04); }
}

#board-svg {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 196px);
  max-width: 920px;
  user-select: none;
  display: block;
  shape-rendering: geometricPrecision;
}

.board-zoom-bar {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 10px;
  background: #0a3558d8;
  border: 1.5px solid #ffffff38;
  box-shadow: 0 6px 16px #03162766;
}
.board-zoom-bar button {
  min-width: 30px;
  height: 28px;
  padding: 0 7px;
  border: 0;
  border-radius: 7px;
  background: #ffffff1a;
  color: #fff8e6;
  font-weight: 800;
  font-size: 13px;
}
.board-zoom-bar button:hover {
  background: #ffffff36;
}
#btn-zoom-reset {
  min-width: 48px;
  font-size: 11.5px;
  background: #ffffff10;
}

.board-dice-stack {
  position: absolute;
  bottom: 12px;
  right: 14px;
  z-index: 6;
  display: grid;
  gap: 6px;
  justify-items: end;
}
.board-dice-dock {
  padding: 6px 8px;
  border-radius: 12px;
  background: #0a3558e0;
  border: 1.5px solid #ffffff3d;
  box-shadow: 0 8px 22px #03162780;
}
.turn-timer-box {
  width: 100%;
  min-width: 196px;
  padding: 6px 10px;
  border-radius: 10px;
  background: #0a3558eb;
  border: 1.5px solid #ffffff3d;
  box-shadow: 0 6px 18px #03162770;
  color: #f7f2e4;
  display: grid;
  gap: 4px;
}
.turn-timer-box.mine { border-color: #f6c445aa; }
.turn-timer-box.warn { border-color: #ff9d3b; }
.turn-timer-box.urgent {
  border-color: #ff564a;
  background: #581414eb;
  animation: timerUrgentPulse .8s infinite ease-in-out;
}
@keyframes timerUrgentPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 6px 18px #03162770; }
  50% { transform: scale(1.02); box-shadow: 0 0 18px #ff564a99; }
}
.turn-timer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
}
.turn-timer-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.extend-timer-btn {
  border: 1px solid #ffe382;
  background: linear-gradient(180deg, #ffd866 0%, #eab308 100%);
  color: #2b1d04;
  font-size: 11px;
  font-weight: 900;
  padding: 1px 7px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
  transition: transform .12s ease, filter .12s ease;
}
.extend-timer-btn:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.05);
  filter: brightness(1.06);
}
.extend-timer-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.turn-timer-head strong {
  font-size: 13px;
  font-weight: 900;
  color: #ffe382;
}
.turn-timer-box.urgent .turn-timer-head strong { color: #ffd4cf; }
.turn-timer-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #ffffff24;
  overflow: hidden;
}
.turn-timer-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4cd964, #f6c445);
  transition: width .35s linear, background .25s ease;
}
.turn-timer-box.warn .turn-timer-fill { background: linear-gradient(90deg, #f6c445, #ff8f26); }
.turn-timer-box.urgent .turn-timer-fill { background: #ff5247; }

/* SVG Board elements */
.hex-poly { stroke: #f5e4b8; stroke-width: 2; transition: filter .15s; }
.hex-side { stroke: #00000035; stroke-width: 0.7; }
.hex-group.selectable { cursor: pointer; }
.hex-group.selectable:hover .hex-poly { filter: brightness(1.18); stroke: #fff; stroke-width: 3; }
.hex-group.signaled .hex-poly { filter: brightness(1.16); stroke: #fff2a6; stroke-width: 3; }
.robber-target-ring {
  fill: #ffdf5ed8;
  stroke: #9b1f19;
  stroke-width: 2.2;
  cursor: pointer;
  animation: targetBlink 0.95s infinite ease-in-out;
}
.robber-target-dot {
  fill: #9b1f19;
  pointer-events: none;
}
.hex-group.selectable:hover .robber-target-ring {
  fill: #ffffff;
  stroke: #c7322b;
  stroke-width: 2.8;
}
@keyframes targetBlink {
  0%, 100% { opacity: 0.72; transform: scale(0.94); }
  50% { opacity: 1; transform: scale(1.08); }
}

.token-rim { fill: #9c8657; }
.token-circle { fill: #f7eed6; stroke: #76623d; stroke-width: 1.4; }
.hex-group.signaled .token-circle { fill: #fff7cf; stroke: #e09c14; stroke-width: 2.6; }
.token-num { font: 800 15px/1 Georgia, serif; text-anchor: middle; dominant-baseline: central; fill: #24211c; }
.token-num.hot { fill: var(--danger); }
.token-pips { font: 700 8px/1 sans-serif; text-anchor: middle; fill: #332e24; letter-spacing: 1.2px; }
.token-pips.hot { fill: var(--danger); }

.pier-line { stroke: #946230; stroke-width: 4.5; stroke-linecap: round; }
.pier-edge { stroke: #513213; stroke-width: 7; stroke-linecap: round; }
.harbor-rim { fill: #8b7449; }
.harbor-badge { fill: #fdf7e7; stroke: #473923; stroke-width: 1.6; }
.harbor-text { font: 800 9.5px/1 sans-serif; text-anchor: middle; fill: #1f1b14; }

.edge-road-shadow { stroke: #00000045; stroke-width: 10.5; stroke-linecap: round; pointer-events: none; }
.edge-road-outline { stroke: #1e1b16; stroke-width: 9.5; stroke-linecap: round; pointer-events: none; }
.edge-road { stroke-width: 6.5; stroke-linecap: round; pointer-events: none; }
.edge-selectable { cursor: pointer; }
.edge-guide { stroke: #ffe173c8; stroke-width: 5; stroke-dasharray: 4 4; stroke-linecap: round; pointer-events: none; }
.edge-ring {
  fill: #ffe678e8;
  stroke: #2c2414;
  stroke-width: 1.8;
  pointer-events: none;
  animation: spotPulse 1.2s infinite ease-in-out;
}
.edge-ring.ship {
  fill: #8ae8ffe8;
  stroke: #113a52;
}
.edge-selectable:hover .edge-guide { stroke: #ffffff; stroke-dasharray: none; stroke-width: 7; }
.edge-selectable:hover .edge-ring { fill: #ffffff; r: 10.5; }
.ship-selectable { cursor: pointer; }

.vertex-hit { fill: transparent; cursor: default; }
.vertex-selectable { cursor: pointer; }
.vertex-ring {
  fill: #ffe678e8;
  stroke: #2c2414;
  stroke-width: 1.8;
  pointer-events: none;
  animation: spotPulse 1.2s infinite ease-in-out;
}
.vertex-selectable:hover .vertex-ring { fill: #ffffff; r: 10.5; }
@keyframes spotPulse {
  0%, 100% { fill-opacity: 0.82; }
  50% { fill-opacity: 1; }
}
.piece-shape { stroke: #221e17; stroke-width: 1.4; stroke-linejoin: round; pointer-events: none; }

/* Floating offer bar */
.floating-offer {
  position: absolute;
  bottom: 146px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  background: var(--panel-card);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 10px 26px #06213885;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  max-width: min(94%, 640px);
}

/* Bottom dock & Illustrated Trading Cards */
.bottom-dock {
  background: linear-gradient(180deg, #f4ebd6, #e6d7b6);
  border-top: 2px solid var(--panel-line);
  padding: 8px 12px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 14px;
  z-index: 4;
}

.hand-tray {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.hand-cards {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.res-card {
  position: relative;
  width: 74px;
  height: 104px;
  border-radius: 10px;
  border: 2.5px solid #3c3020;
  background: linear-gradient(165deg, #fffdf7 0%, #f7eed6 100%);
  box-shadow: 0 4px 0 #3c302040, 0 7px 14px #0000002c;
  padding: 4px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 3px;
  user-select: none;
  transition: transform .16s ease, box-shadow .16s ease, opacity .15s;
}
.res-card::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 6px;
  border: 1px solid #c9b58a;
  pointer-events: none;
}
.res-card.stacked {
  box-shadow:
    3px 3px 0 #f4ead2,
    4px 4px 0 #3c302085,
    6px 6px 0 #e6d8b8,
    7px 7px 0 #3c302060,
    0 9px 16px #00000030;
}
.res-card.empty {
  opacity: .38;
  filter: grayscale(.65);
  box-shadow: none;
}
.res-card:not(.empty):hover {
  transform: translateY(-6px) scale(1.03);
}

.res-card-frame {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  border: 1.5px solid #6b5839;
  background: var(--card-art-bg);
  display: grid;
  place-items: center;
}
.res-card-frame svg {
  width: 100%;
  height: 100%;
  display: block;
}

.res-card-count {
  position: absolute;
  top: 2px;
  left: 2px;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--res-color);
  border: 1.5px solid #fffdf6;
  color: #fff;
  font-weight: 900;
  font-size: 12px;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 4px #00000050;
  z-index: 2;
}

.res-card-name {
  text-align: center;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #292218;
  background: #ede1c4;
  border: 1px solid #cdb98e;
  border-radius: 4px;
  padding: 1px 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dev-group {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.dev-chip {
  width: 64px;
  height: 92px;
  padding: 5px 4px;
  border-radius: 9px;
  border: 2px solid #483578;
  background: linear-gradient(160deg, #faf7ff 0%, #dfd2ff 100%);
  color: #27194a;
  font-weight: 800;
  font-size: 10px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  gap: 3px;
  box-shadow: 0 3px 0 #48357855, 0 5px 10px #00000024;
  transition: transform .15s;
}
.dev-chip svg { width: 34px; height: 34px; }
.dev-chip span { line-height: 1.1; text-align: center; }
.dev-chip:disabled { opacity: .52; cursor: default; box-shadow: none; }
.dev-chip:not(:disabled):hover { background: linear-gradient(160deg, #ffffff 0%, #d3c2ff 100%); transform: translateY(-4px); }

.action-tray {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.act-btn {
  min-height: 38px;
  padding: 7px 13px;
  border-radius: 10px;
  border: 1.5px solid #baa57d;
  background: linear-gradient(180deg, #ffffff 0%, #f1e5ca 100%);
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: inset 0 1px 0 #ffffffcc, 0 2.5px 0 #b7a27a, 0 4px 10px #2b210a1a;
  transition: transform .15s cubic-bezier(.22,1,.36,1), background .15s, border-color .15s, box-shadow .15s;
}
.act-btn small {
  background: #e3d5b7;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 800;
}
.act-btn:not(:disabled):hover {
  background: linear-gradient(180deg, #fffdf8 0%, #e9dab9 100%);
  border-color: #8f7b55;
  transform: translateY(-1px);
}
.act-btn:not(:disabled):active {
  transform: translateY(1.5px);
  box-shadow: inset 0 1px 0 #ffffffaa, 0 1px 0 #b7a27a;
}
.act-btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.act-btn.primary {
  background: linear-gradient(180deg, #2d8fe0 0%, #1763a6 100%);
  border-color: #0e4578;
  color: #fff;
  box-shadow: inset 0 1px 0 #ffffff52, 0 2.5px 0 #0c3d68, 0 6px 14px #0e4a8038;
}
.act-btn.primary:not(:disabled):hover {
  background: linear-gradient(180deg, #399ceb 0%, #1d70ba 100%);
  border-color: #13538e;
}
.act-btn.primary:not(:disabled):active {
  box-shadow: inset 0 1px 0 #ffffff33, 0 1px 0 #0c3d68;
}
.act-btn.dark-glass {
  background: #ffffff17;
  border: 1px solid #ffffff30;
  color: #f1f5ff;
  box-shadow: inset 0 1px 0 #ffffff24, 0 4px 12px #03091a38;
}
.act-btn.dark-glass:not(:disabled):hover {
  background: #ffffff29;
  border-color: #ffffff5c;
  color: #fff;
}
.act-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, #ffea9c 0%, #f5c342 100%);
  border-color: #a87407;
  color: #241902;
  box-shadow: inset 0 1px 0 #ffffffaa, 0 2px 0 #9f6d04;
}
.act-btn.action-ready:not(:disabled) {
  border-color: #d99b14;
  box-shadow: 0 0 0 2px #f6c44580, 0 3px 10px #f6c44545;
  background: #fff4cc;
}
.act-btn.primary.action-ready:not(:disabled) {
  background: #2384ca;
  border-color: #ffe27a;
  box-shadow: 0 0 0 2.5px #f6c445b0, 0 4px 14px #f6c44566;
}
.act-btn.guide-pulse:not(:disabled) {
  animation: btnGuidePulse 1.15s infinite ease-in-out;
}

.dock-icon-btn,
.dock-piece-btn {
  flex-direction: column;
  gap: 2px;
  padding: 5px 10px 6px;
  min-height: 56px;
  min-width: 72px;
}
.btn-icon-slot {
  display: grid;
  place-items: center;
  height: 24px;
}
.btn-piece-preview {
  display: grid;
  place-items: center;
  height: 26px;
}
.piece-btn-svg {
  width: 30px;
  height: 24px;
  display: block;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}
.btn-piece-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}
.dock-icon-btn .btn-label {
  font-size: 12px;
}
.dev-chip.action-ready:not(:disabled) {
  box-shadow: 0 0 0 2.5px #f6c445b0, 0 5px 14px #7a42b855;
}
@keyframes btnGuidePulse {
  0%, 100% { box-shadow: 0 0 0 2px #f6c44588, 0 0 10px #f6c44555; transform: translateY(0); }
  50% { box-shadow: 0 0 0 4px #ffe47ae6, 0 0 20px #f6c445b5; transform: translateY(-1.5px); }
}

/* Right sidebar: 1/3 Zug-Protokoll at top, Bank + Players + Status below */
.right-rail {
  background: var(--panel-bg);
  border-left: 2px solid var(--panel-line);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px 10px;
  overflow: hidden;
}

.panel {
  background: var(--panel-card);
  border: 1.5px solid var(--panel-line);
  border-radius: 10px;
  padding: 8px 10px;
}

.log-panel { display: flex; flex-direction: column; min-height: 0; padding: 8px 10px; }
.log-panel[open] {
  min-height: 175px;
  height: 33vh;
}
.log-panel summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 6px;
  flex: none;
}
.pill {
  font-size: 10.5px;
  background: #e8dcc2;
  padding: 1.5px 8px;
  border-radius: 999px;
  color: var(--muted);
}

.game-log {
  list-style: none;
  margin: 0;
  padding: 0 2px 0 0;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.48;
  color: var(--muted);
}
.game-log li { padding: 3px 0; border-top: 1px solid #ede2cb; }
.game-log li:first-child { border-top: 0; color: var(--ink); font-weight: 600; }

.log-dice {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
  background: #efe3c6;
  border: 1px solid #cbb78b;
  border-radius: 6px;
  padding: 1px 5px;
  margin: 0 2px;
}
.log-mini-die {
  width: 14px;
  height: 14px;
  display: block;
  flex: none;
}
.log-dice-sum {
  font-weight: 900;
  font-size: 11.5px;
  color: #241f18;
  margin-left: 1px;
}
.log-dice-sum.hot { color: var(--danger); }
.log-res {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 700;
  color: #2c2418;
  white-space: nowrap;
}
.inline-res-logo {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: -2px;
  flex: none;
}

.bank-panel { padding: 7px 9px 10px; }
.bank-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}
.res-card.bank-card {
  width: 100%;
  height: auto;
  aspect-ratio: 74 / 102;
  padding: 3px;
  border-radius: 8px;
  border-width: 2px;
  gap: 2px;
}
.res-card.bank-card::before {
  inset: 2px;
  border-radius: 5px;
}
.res-card.bank-card.stacked {
  box-shadow:
    2px 2px 0 #f4ead2,
    3px 3px 0 #3c302085,
    4px 4px 0 #e6d8b8,
    5px 5px 0 #3c302060,
    0 6px 10px #00000026;
}
.res-card.bank-card:not(.empty):hover {
  transform: translateY(-2px);
}
.res-card.bank-card .res-card-count {
  min-width: 18px;
  height: 17px;
  padding: 0 4px;
  font-size: 10.5px;
  top: 2px;
  left: 2px;
}
.res-card.bank-card .res-card-name {
  font-size: 9px;
  padding: 1px 2px;
}

.players-section {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.players-dice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: #efe3c8;
  border: 1.5px solid #d2c19d;
  border-radius: 10px;
}

.player-count-box {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.player-count-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.player-count-num {
  font-size: 19px;
  font-weight: 900;
  color: var(--ink);
}

.dice-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dice-box {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  background: #dfd0b2;
  border-radius: 9px;
  border: 1.5px solid #baa783;
  box-shadow: inset 0 2px 4px #00000018;
}

.die {
  position: relative;
  width: 33px;
  height: 33px;
  border-radius: 7px;
  background: var(--die-face, linear-gradient(145deg, #ffffff 0%, #f1ead8 100%));
  border: 1.5px solid var(--die-edge, #7d6d50);
  box-shadow: inset 0 1px 3px var(--die-shine, transparent), 0 2.5px 0 var(--die-edge, #8a795b), 0 4px 8px #0000002c;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 4px;
  gap: 1px;
  place-items: center;
}
.die.rolling {
  animation: diceTumble .65s cubic-bezier(.3, 1.3, .5, 1);
}
@keyframes diceTumble {
  0% { transform: translateY(0) rotate(0deg) scale(1); }
  25% { transform: translateY(-10px) rotate(-135deg) scale(1.16); }
  55% { transform: translateY(-5px) rotate(-280deg) scale(1.08); }
  80% { transform: translateY(2px) rotate(-350deg) scale(.96); }
  100% { transform: translateY(0) rotate(-360deg) scale(1); }
}

.die-pip {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--die-pip, #231f1a);
}
.die[data-value="1"] .die-pip { background: var(--die-pip, #c53028); width: 6.5px; height: 6.5px; }
.die-empty {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  font-weight: 800;
  color: var(--die-pip, #8b7c62);
}
.dice-shop-card .die { flex: 0 0 33px; }
.dice-shop-card .crate-card-info { flex: 1; }
[data-dice-skin="seaglass"] {
  --die-face: linear-gradient(140deg, #e1fbf3, #73cdbd);
  --die-edge: #32857c;
  --die-pip: #154c49;
  --die-shine: #ffffffc0;
}
[data-dice-skin="terracotta"] {
  --die-face: linear-gradient(145deg, #bf6247, #8a3c2c);
  --die-edge: #6b2d26;
  --die-pip: #fff1cd;
}
[data-dice-skin="compass"] {
  --die-face: repeating-conic-gradient(from 22.5deg, #183d65 0deg 45deg, #102e50 45deg 90deg);
  --die-edge: #aa7b34;
  --die-pip: #ffe198;
  --die-shine: #e2b45a75;
}
[data-dice-skin="jade"] {
  --die-face: repeating-linear-gradient(124deg, #c0e0b0 0 3px, #82b286 7px, #acd3a1 10px);
  --die-edge: #37774e;
  --die-pip: #174430;
  --die-shine: #fff9;
}
[data-dice-skin="amethyst"] {
  --die-face: conic-gradient(from 30deg at 44% 34%, #7044ac, #372058, #8159ac, #4a2c74, #7044ac);
  --die-edge: #462474;
  --die-pip: #f7ebff;
  --die-shine: #dcc2fa99;
}
[data-dice-skin="ember"] {
  --die-face: radial-gradient(ellipse at 32% 80%, #a8432d, #4c2827 51%, #21181b 82%);
  --die-edge: #994732;
  --die-pip: #ffd285;
  --die-shine: #f3724e8c;
}
[data-dice-skin="sunken_gold"] {
  --die-face: linear-gradient(135deg, #ffe09f 0%, #db9f45 38%, #f9d078 53%, #986127 100%);
  --die-edge: #794725;
  --die-pip: #372214;
  --die-shine: #fff1cb;
}
[data-dice-skin="aurora"] {
  --die-face: radial-gradient(ellipse at 10% 12%, #287472, transparent 70%),
    linear-gradient(145deg, #25344d, #56467e 58%, #27264f);
  --die-edge: #497170;
  --die-pip: #e3fff0;
  --die-shine: #a7f8e394;
}
.dice-sum {
  font-weight: 900;
  font-size: 14px;
  color: #362d1c;
  padding-right: 1px;
}

.roll-btn {
  min-height: 40px;
  padding: 6px 14px;
  font-size: 13.5px;
}

.players-panel { display: grid; gap: 7px; align-content: start; overflow-y: auto; min-height: 0; flex: 1 1 0; padding-right: 2px; }
.player-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid #e6dac0;
  background: #fff;
}
.player-card.active { border-color: #d39612; background: #fff9e5; box-shadow: 0 0 0 2px #f6c44555; }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2.5px solid #2b251b;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
}
.player-meta { min-width: 0; }
.player-name { font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.player-stats { font-size: 12px; color: var(--muted); display: flex; gap: 9px; flex-wrap: wrap; margin-top: 1px; }
.award-tag { font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 5px; background: #ffe48d; color: #543b00; }
.player-vp { font-weight: 900; font-size: 18px; text-align: right; line-height: 1.05; }
.player-vp small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; }

.self-panel { background: #efe4cb; font-size: 12px; }
.self-top { display: flex; justify-content: space-between; align-items: center; font-weight: 800; margin-bottom: 4px; }
.harbor-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.harbor-pill { font-size: 11px; background: #fffaf0; border: 1px solid #cbb996; border-radius: 999px; padding: 2px 7px; }

/* Full-Screen 3D Game Lobby */
.lobby-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: radial-gradient(ellipse at 50% 35%, #2b4580 0%, #1d2f5c 55%, #111c3b 100%);
  overflow: hidden;
}

.lobby-3d-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
.lobby-3d-canvas:active { cursor: grabbing; }

.lobby-hud {
  position: relative;
  z-index: 2;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  pointer-events: none;
  padding: 12px 16px 8px;
  gap: 8px;
}

.lobby-topbar {
  position: relative;
  z-index: 4;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(11, 20, 44, 0.78);
  backdrop-filter: blur(16px);
  border: 1px solid #ffffff24;
  border-radius: 16px;
  padding: 9px 14px;
  color: #fff;
  box-shadow: inset 0 1px 0 #ffffff1c, 0 12px 30px #03091a55;
}

.lobby-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #ffd866 0%, #d97706 100%);
  color: #1f1402;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 #ffffff88, 0 3px 10px #d9770655;
}
.lobby-brand h1 { margin: 0; font-size: 19px; font-weight: 900; letter-spacing: -.015em; }
.room-pill {
  background: #ffffff18;
  border: 1px solid #ffffff2e;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #ffe382;
  letter-spacing: .03em;
}
.host-wait-pill {
  font-size: 12px;
  font-weight: 700;
  color: #cfe2ff;
  padding: 5px 10px;
  border-radius: 999px;
  background: #ffffff12;
  border: 1px solid #ffffff22;
}

.lobby-tabs {
  display: flex;
  gap: 6px;
  background: #ffffff0e;
  padding: 4px;
  border-radius: 11px;
  border: 1px solid #ffffff1a;
}
.lobby-tab {
  padding: 6px 14px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  font-weight: 800;
  font-size: 13px;
  color: #cfe0ff;
  transition: background .16s, color .16s;
}
.lobby-tab:hover { background: #ffffff1a; color: #fff; }
.lobby-tab.active {
  background: linear-gradient(180deg, #ffd866 0%, #f0ad1c 100%);
  color: #211805;
  box-shadow: inset 0 1px 0 #ffffff88, 0 2px 8px #00000033;
}

.lobby-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hud-right-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  margin-left: auto;
}
.lobby-top-right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.hud-wallet-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.hud-wallet-chip {
  min-height: 29px;
  padding: 4px 10px;
  font-size: 12px;
}
.hud-icon-only {
  width: 38px;
  min-width: 38px;
  padding: 0;
  justify-content: center;
}

.hud-pill-btn {
  min-height: 38px;
  padding: 6px 13px;
  border-radius: 11px;
  border: 1px solid #ffffff2b;
  background: #ffffff16;
  color: #f3f7ff;
  font-weight: 800;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  position: relative;
  box-shadow: inset 0 1px 0 #ffffff24, 0 4px 12px #040b1d45;
  transition: background .16s ease, border-color .16s ease, transform .15s cubic-bezier(.22,1,.36,1), box-shadow .16s ease;
}
.hud-pill-btn:hover {
  background: #ffffff28;
  border-color: #ffffff5c;
  transform: translateY(-1px);
  color: #fff;
}
.hud-pill-btn:active { transform: translateY(1px); }
.hud-pill-btn.active {
  background: linear-gradient(180deg, #ffd866 0%, #f0ad1c 100%);
  border-color: #ffe89e;
  color: #211805;
  box-shadow: inset 0 1px 0 #ffffff88, 0 4px 14px #f59e0b55;
}
.hud-coins-btn {
  background: linear-gradient(135deg, rgba(69, 46, 8, 0.9) 0%, rgba(114, 75, 10, 0.9) 100%);
  border-color: #f6c44599;
  color: #ffe799;
}
.hud-coins-btn:hover {
  background: linear-gradient(135deg, rgba(87, 58, 10, 0.96) 0%, rgba(140, 92, 12, 0.96) 100%);
  border-color: #ffe070;
  color: #fff4c2;
}
.hud-sp-btn {
  background: linear-gradient(135deg, rgba(16, 40, 74, 0.92) 0%, rgba(28, 60, 108, 0.92) 100%);
  border-color: #60a5fa66;
  color: #e0f2fe;
}
.hud-sp-btn:hover {
  border-color: #93c5fd;
  color: #fff;
}
.rank-mini-tag {
  font-size: 11px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rank-col, #fbbf24) 24%, transparent);
  border: 1px solid color-mix(in srgb, var(--rank-col, #fbbf24) 75%, transparent);
  color: #fff;
}
.hud-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #34d399;
  color: #042818;
  font-size: 11px;
  font-weight: 900;
  display: grid;
  place-items: center;
}
.hud-badge.alert { background: #ef4444; color: #fff; }
.user-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: #ffffff14;
  border: 1px solid #ffffff26;
  color: #f4f7ff;
  font-size: 12.5px;
  font-weight: 800;
}
.user-badge-pill small { color: #ffe382; font-weight: 700; }

.lobby-middle {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  min-height: 0;
  pointer-events: none;
}
.lobby-middle.centered {
  align-items: center;
  justify-content: center;
}
.lobby-middle.home-hub {
  align-items: center;
  justify-content: center;
  padding-left: clamp(0px, 16vw, 240px);
}

/* Login Screen Card in Center */
.login-card {
  pointer-events: auto;
  width: min(94vw, 420px);
  background: rgba(13, 24, 52, 0.88);
  backdrop-filter: blur(18px);
  border: 1px solid #ffffff30;
  border-radius: 22px;
  padding: 24px 26px;
  color: #f5f8ff;
  box-shadow: inset 0 1px 0 #ffffff24, 0 28px 70px #030816c8;
  display: grid;
  gap: 14px;
}
.login-head { text-align: center; display: grid; gap: 5px; justify-items: center; }
.login-head h2 { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: -.02em; color: #fff; }
.login-head p { margin: 0; font-size: 13px; color: #b9ccef; }
.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #ffffff10;
  border: 1px solid #ffffff1a;
  padding: 4px;
  border-radius: 12px;
}
.login-tab {
  padding: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #cbd9f5;
  font-weight: 800;
  font-size: 13px;
  transition: background .15s, color .15s;
}
.login-tab:hover { color: #fff; background: #ffffff12; }
.login-tab.active {
  background: linear-gradient(180deg, #ffd866 0%, #f0ad1c 100%);
  color: #211805;
  box-shadow: inset 0 1px 0 #ffffff88, 0 2px 8px #00000033;
}
.login-form { display: grid; gap: 11px; }
.login-form label.stack { color: #d5e2fa; font-size: 12px; }
.login-form input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid #ffffff2b;
  background: #0e1b3de8;
  color: #fff;
  transition: border-color .15s, background .15s;
}
.login-form input:focus { border-color: #f6c445; background: #13234ef2; outline: none; }
.login-form input::placeholder { color: #889ec9; }
.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #96aad3;
  font-size: 11.5px;
  font-weight: 700;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #ffffff24;
}
.login-invite-note {
  background: #f6c44524;
  border: 1px solid #f6c44588;
  color: #ffe89e;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

/* Home Hub ("Spielen" in the middle, character unobstructed) */
.home-center-stage {
  pointer-events: auto;
  display: grid;
  justify-items: center;
  gap: 13px;
  text-align: center;
  padding: 24px 32px;
  border-radius: 28px;
  background: radial-gradient(ellipse at center, rgba(10, 20, 46, 0.72) 0%, rgba(10, 20, 46, 0.34) 68%, transparent 100%);
  max-width: min(92vw, 460px);
}
.home-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #ffffff16;
  border: 1px solid #ffffff28;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #ffe485;
}
.home-hero-title {
  margin: 0;
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 900;
  letter-spacing: -.02em;
  color: #fff;
  text-shadow: 0 4px 18px #040a1acc;
}
.home-stats-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(11, 20, 44, 0.72);
  border: 1px solid #ffffff22;
  font-size: 12.5px;
  color: #d6e4ff;
  font-variant-numeric: tabular-nums;
}
.home-stats-row strong { color: #fff; }

.play-hero-btn {
  position: relative;
  overflow: hidden;
  min-width: 248px;
  min-height: 56px;
  padding: 13px 32px;
  border-radius: 15px;
  border: 1.5px solid #ffea96;
  background: linear-gradient(180deg, #ffe066 0%, #f59e0b 54%, #d97706 100%);
  color: #211400;
  font-size: 18.5px;
  font-weight: 900;
  letter-spacing: .04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.7), 0 5px 0 #92400e, 0 16px 36px rgba(0, 0, 0, 0.5);
  transition: transform .15s cubic-bezier(.22,1,.36,1), filter .15s, box-shadow .15s;
}
.play-hero-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,0.42) 50%, transparent 100%);
  transform: skewX(-18deg);
  transition: left .55s ease;
}
.play-hero-btn:not(:disabled):hover::after { left: 160%; }
.play-hero-btn:not(:disabled):hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}
.play-hero-btn:not(:disabled):active {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 0 #92400e, 0 8px 18px rgba(0, 0, 0, 0.45);
}
.play-hero-btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.play-hero-btn.compact {
  min-width: auto;
  min-height: 38px;
  padding: 7px 15px;
  border-radius: 11px;
  font-size: 13.5px;
  letter-spacing: .01em;
  gap: 6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.65), 0 3px 0 #92400e, 0 6px 16px rgba(0,0,0,0.3);
}
.play-hero-btn.compact:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 1px 0 #92400e;
}
.home-secondary-row {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: center;
}
.home-play-stack {
  display: grid;
  gap: 10px;
  justify-items: center;
  width: 100%;
}
.ranked-hero-btn {
  min-width: 248px;
  min-height: 44px;
  padding: 9px 24px;
  border-radius: 13px;
  border: 1px solid #93c5fd66;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.85) 0%, rgba(29, 78, 216, 0.92) 100%);
  color: #eff6ff;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: .02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 22px rgba(15, 23, 42, 0.45);
  transition: transform .15s, filter .15s;
}
.ranked-hero-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.ranked-hero-btn:active { transform: translateY(1px); }
.ranked-search-card {
  border: 1px solid #60a5fa55;
  box-shadow: 0 20px 44px rgba(2, 6, 23, 0.65);
}
.ranked-search-pulse {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 3px solid rgba(250, 204, 21, 0.3);
  border-top-color: #facc15;
  animation: rankedSpin 1s linear infinite;
}
@keyframes rankedSpin { to { transform: rotate(360deg); } }
.ranked-search-sub {
  margin: 0;
  font-size: 12.5px;
  color: #cbd5e1;
}
.ranked-picker-hint {
  margin: 2px 0 0;
  padding: 9px 11px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-size: 12px;
  line-height: 1.4;
}

.shop-coins-view { display: grid; gap: 8px; }
.shop-coin-card {
  background: #fff;
  border: 1.5px solid var(--panel-line);
  border-radius: 11px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.shop-coin-card small { display: block; color: var(--muted); font-size: 11.5px; }

/* Settings Modal + Modern Toggle Switches + Range Sliders */
.settings-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 4px;
  background: #eadec4;
  border-radius: 11px;
}
.settings-tab-btn {
  padding: 7px 13px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, color .15s, box-shadow .15s;
}
.settings-tab-btn:hover { color: var(--ink); background: #ffffff66; }
.settings-tab-btn.active {
  background: linear-gradient(180deg, #2d8fe0 0%, #1763a6 100%);
  color: #fff;
  box-shadow: 0 2px 6px #134d7844;
}
.settings-section {
  background: #f5ecda;
  border: 1.5px solid #dccba9;
  border-radius: 12px;
  padding: 13px 14px;
  display: grid;
  gap: 11px;
}
.settings-section h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.toggle-track {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #c5b594;
  border: 1px solid #a89672;
  flex: none;
  transition: background .18s ease, border-color .18s ease;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px #00000040;
  transition: transform .18s cubic-bezier(.22,1,.36,1);
}
.toggle-switch input:checked + .toggle-track {
  background: linear-gradient(180deg, #2d8fe0 0%, #1763a6 100%);
  border-color: #0e4578;
}
.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
}
.toggle-switch input:focus-visible + .toggle-track {
  outline: 2px solid #f6c445;
  outline-offset: 2px;
}
.range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}
.range-row strong { font-variant-numeric: tabular-nums; color: var(--accent-dark); }
.range-row input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #dac8a6;
  accent-color: var(--accent);
  cursor: pointer;
}
.friend-status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  background: #969ba6;
}
.friend-status-dot.online { background: #2bb84a; box-shadow: 0 0 6px #2bb84a80; }
.friend-status-dot.lobby { background: #e89b14; box-shadow: 0 0 6px #e89b1480; }
.invite-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #fff5d6;
  border: 1.5px solid #e0ad26;
}

.studio-dock {
  pointer-events: auto;
  width: min(100%, 425px);
  background: #f8f1e2eb;
  backdrop-filter: blur(10px);
  border: 2px solid var(--panel-line);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 18px 42px #07112880;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}
.studio-dock > :not(.studio-scroll) {
  flex: 0 0 auto;
}

.studio-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.studio-cat-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.studio-cat-btn {
  padding: 5px 9px;
  border-radius: 7px;
  border: 1px solid #c5b593;
  background: #efe4cc;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink);
  flex: 0 0 auto;
}
.studio-cat-btn.active {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #fff;
}

.studio-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}
.studio-scroll > * {
  flex: 0 0 auto;
}

.studio-presets-bar {
  display: grid;
  gap: 6px;
  padding: 8px 9px;
  border-radius: 10px;
  background: #efe4cc;
  border: 1px solid #d2c09a;
}
.studio-presets-bar.is-guest {
  padding: 6px 9px;
  color: var(--muted);
}
.studio-presets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11.5px;
}
.studio-presets-head small {
  color: var(--muted);
  font-size: 10.5px;
}
.preset-sub-link {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 10.5px;
  cursor: pointer;
  text-decoration: underline;
}
.preset-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 8px;
  border: 1px solid #c8b68f;
  background: #fffdf8;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
}
.preset-chip.empty {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
}
.preset-chip.locked {
  border-style: dashed;
  background: #f6eed9;
  color: #7c5812;
  cursor: pointer;
}
.preset-chip-equip {
  border: 0;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.preset-chip-name {
  max-width: 82px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preset-chip-act {
  border: 0;
  background: #efe3c6;
  color: var(--ink);
  border-radius: 5px;
  width: 18px;
  height: 18px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  cursor: pointer;
}
.preset-chip-act.danger:hover {
  background: #fee2e2;
  color: #991b1b;
}
.preset-save-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.preset-save-row input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 8px;
  font-size: 11.5px;
}

.pass-hero-card {
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(160deg, #fffdf6 0%, #f5e9cb 100%);
  border: 1.5px solid #d9b65c;
  display: grid;
  gap: 8px;
}
.pass-hero-card.active {
  border-color: #16a34a;
  background: linear-gradient(160deg, #f0fdf4 0%, #dcfce7 100%);
}
.pass-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.pass-hero-top h3 {
  margin: 2px 0 0;
  font-size: 15px;
}
.pass-eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  color: #92400e;
  text-transform: uppercase;
}
.pass-price-tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: #d97706;
  color: #fff;
  font-size: 11.5px;
  font-weight: 900;
  flex: none;
}
.pass-hero-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink);
}
.pass-perks {
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 3px;
  font-size: 12px;
}
.pass-cosmetic-note {
  font-size: 11px;
  color: var(--muted);
}
.pass-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 2px;
}

.cust-section { display: grid; gap: 6px; }
.cust-section strong { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cust-tip { margin: 0; font-size: 11.5px; color: var(--muted); }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.choice-btn {
  padding: 7px 8px;
  border-radius: 8px;
  border: 1.5px solid #cbb996;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  text-align: left;
}
.choice-btn.active { border-color: var(--accent); background: #e5f2fc; color: #0f436b; }
.choice-btn.locked { border-style: dashed; background: #fcfaf4; }
.choice-btn.locked:hover { border-color: #d97706; background: #fffbeb; }
.choice-btn.previewing { border-style: solid; border-color: #d97706; background: #fef3c7; box-shadow: 0 0 0 2px #f59e0b44; }
.choice-btn:disabled { opacity: .55; cursor: default; }
.choice-btn small { font-size: 10.5px; color: #8c5a08; }
.choice-label-wrap {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.choice-label-wrap > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}
.rarity-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--r-col, #475569);
  background: var(--r-bg, #e2e8f0);
}
.gem-tag {
  flex: 0 0 auto;
  font-weight: 800;
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e !important;
  border: 1px solid #fcd34d;
}
.studio-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  box-shadow: 0 6px 16px rgba(146, 64, 14, 0.14);
}
.studio-preview-info {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 12px;
}
.studio-preview-info small {
  font-size: 11px;
  color: #78350f;
}

.swatch-row { display: flex; flex-wrap: wrap; gap: 6px; }
.accessory-color { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.accessory-color label { display: inline-flex; align-items: center; gap: 6px; }
.accessory-color input { width: 30px; height: 24px; padding: 1px; cursor: pointer; }
.accessory-color .swatch-row { width: 100%; }
.swatch-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #2b251b44;
  padding: 0;
}
.swatch-btn.active { border: 2.5px solid #fff; box-shadow: 0 0 0 2.5px var(--accent); transform: scale(1.1); }

.lobby-bottom {
  pointer-events: auto;
  display: grid;
  gap: 10px;
}

.pedestal-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.pedestal-bar.six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.pedestal-card {
  background: rgba(13, 24, 52, 0.84);
  backdrop-filter: blur(10px);
  border: 1.5px solid #ffffff2b;
  border-radius: 13px;
  padding: 9px 10px;
  color: #fff;
  display: grid;
  gap: 6px;
}
.pedestal-card.mine { border-color: var(--gold); box-shadow: 0 0 0 1px #f6c44555; }
.pedestal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 13px;
}
.pedestal-empty {
  color: #b5c7eb;
  font-size: 12px;
  text-align: center;
}

.lobby-config-bar {
  background: #f6efe0f5;
  backdrop-filter: blur(10px);
  border: 1.5px solid var(--panel-line);
  border-radius: 14px;
  padding: 9px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.cfg-tile {
  flex: 1 1 135px;
  min-height: 44px;
  padding: 6px 11px;
  border-radius: 10px;
  border: 1.5px solid #c5b38f;
  background: linear-gradient(180deg, #ffffff 0%, #f1e6cd 100%);
  color: var(--ink);
  display: grid;
  gap: 1px;
  text-align: left;
  box-shadow: inset 0 1px 0 #ffffffcc, 0 2px 0 #baa57a;
  transition: transform .13s ease, border-color .13s ease, background .13s ease;
}
.cfg-tile:not(:disabled):hover {
  border-color: var(--accent);
  background: linear-gradient(180deg, #fffdf9 0%, #e7eff7 100%);
  transform: translateY(-1px);
}
.cfg-tile:disabled { opacity: .65; cursor: default; box-shadow: none; }
.cfg-label {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.cfg-val {
  font-size: 12.5px;
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pre-mode-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.picker-card {
  padding: 11px 13px;
  border-radius: 12px;
  border: 1.5px solid #cbb894;
  background: linear-gradient(180deg, #ffffff 0%, #f4ebd7 100%);
  color: var(--ink);
  text-align: left;
  display: grid;
  gap: 4px;
  box-shadow: inset 0 1px 0 #ffffffcc, 0 2px 0 #bfa97d;
  transition: transform .13s ease, border-color .13s ease, box-shadow .13s ease, background .13s ease;
}
.picker-card:not(:disabled):hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.picker-card.active {
  border-color: var(--accent);
  background: linear-gradient(180deg, #eef7ff 0%, #dcecfb 100%);
  box-shadow: 0 0 0 2px #1d6ea840, 0 3px 10px #1d6ea828;
}
.picker-card:disabled { opacity: .48; cursor: default; box-shadow: none; }
.picker-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.picker-card small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.picker-check {
  margin-left: auto;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
}

.welcome-bar {
  background: #f6efe0f2;
  backdrop-filter: blur(10px);
  border: 2px solid var(--panel-line);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.welcome-bar.simple-create-bar {
  display: grid;
  gap: 10px;
}
.simple-create-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.simple-create-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.simple-create-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}
.color-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.color-dot-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(25, 32, 48, 0.35);
  background: var(--dot-col, #d9483b);
  padding: 0;
  transition: transform .13s, box-shadow .13s;
}
.color-dot-btn:hover { transform: scale(1.1); }
.color-dot-btn.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2.5px var(--accent), 0 4px 10px rgba(0,0,0,0.28);
  transform: scale(1.12);
}
.simple-create-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.color-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.color-opt {
  padding: 6px 10px;
  border-radius: 9px;
  border: 2px solid #d0c3a5;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}
.color-opt.selected { border-color: var(--accent); background: #eaf4fc; }
.color-swatch { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid #2b251b; }

.shop-wallet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: #efe3c8;
  border: 1.5px solid #cbb996;
  border-radius: 10px;
}
.shop-wallet-label { display: block; font-size: 11px; color: var(--muted); font-weight: 700; }
.shop-balance { font-size: 17px; color: #3d2c05; }
.shop-list { display: grid; gap: 6px; }
.shop-row {
  background: #fff;
  border: 1.5px solid var(--panel-line);
  border-radius: 9px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.shop-future-note {
  padding: 8px 10px;
  border-radius: 8px;
  background: #eaf4fc;
  border: 1px dashed #69a3d2;
  font-size: 11.5px;
  color: #19456b;
  display: grid;
  gap: 2px;
}
.coin-pack-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.coin-pack-card {
  position: relative;
  background: #fff;
  border: 1.5px solid var(--panel-line);
  border-radius: 11px;
  padding: 10px;
  display: grid;
  gap: 4px;
  text-align: center;
}
.coin-pack-card.featured {
  border-color: #f59e0b;
  background: linear-gradient(180deg, #fffdf5 0%, #fef3c7 100%);
}
.coin-pack-badge {
  position: absolute;
  top: -7px;
  right: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 800;
  background: #d97706;
  color: #fff;
}
.coin-pack-amount { font-size: 16px; color: #1e293b; }
.coin-pack-title { font-size: 12px; font-weight: 800; color: #334155; }
.coin-pack-sub { font-size: 10.5px; color: var(--muted); margin-bottom: 3px; }
.rarity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.crate-list { display: grid; gap: 8px; }
.crate-card {
  background: #fff;
  border: 1.5px solid var(--panel-line);
  border-radius: 11px;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.crate-card-info { display: grid; gap: 3px; min-width: 0; }
.crate-card-info p { margin: 0; font-size: 11.5px; color: var(--ink); line-height: 1.3; }
.crate-card-info small { font-size: 10.5px; color: var(--muted); }
.crate-loot-banner {
  background: var(--r-bg, #fef3c7);
  border: 2px solid var(--r-col, #d97706);
  border-radius: 11px;
  padding: 10px 12px;
  display: grid;
  gap: 3px;
}
.crate-loot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 800;
  color: #334155;
}
.crate-loot-title { font-size: 15.5px; color: #0f172a; }
.crate-loot-sub { font-size: 11.5px; color: #334155; }

.slot-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: #f7f0e0;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
}
.avatar { overflow: hidden; padding: 0; background: #1e315c; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  margin: 10px 0;
  padding: 10px;
  background: #f5ecda;
  border: 1px solid var(--panel-line);
  border-radius: 10px;
}
.preset-desc {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.field-stack { display: grid; gap: 10px; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-gap > * { flex: 1; }
label.stack { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1.5px solid #c3b496;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
textarea { resize: vertical; min-height: 88px; }

dialog.modal {
  width: min(94vw, 490px);
  border: 2px solid #c9b58e;
  border-radius: 18px;
  padding: 0;
  background: var(--panel-card);
  color: var(--ink);
  box-shadow: 0 26px 65px #030e1da8;
  max-height: 90dvh;
  overflow: hidden;
}
dialog.modal[open] {
  display: flex;
  flex-direction: column;
  animation: modalIn .18s cubic-bezier(.22,1,.36,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
dialog.modal.wide { width: min(94vw, 640px); }
dialog.modal.xwide { width: min(96vw, 880px); }
dialog::backdrop { background: rgba(4, 18, 36, 0.68); backdrop-filter: blur(5px); }
.modal-head {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  padding: 14px 18px 10px;
  border-bottom: 1.5px solid #e7d9bc;
  background: inherit;
  z-index: 4;
}
dialog.modal > :not(.modal-head) {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 18px 18px;
}
.modal-head h2 { margin: 0; font-size: 19px; font-weight: 900; }
.close-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1.5px solid #cbb894;
  background: linear-gradient(180deg, #fffdf8 0%, #efe2c6 100%);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  display: grid;
  place-items: center;
  transition: background .15s, border-color .15s, color .15s;
}
.close-btn:hover { background: #fde6e3; border-color: #d96b5e; color: #8f1d14; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Map Editor layout */
.editor-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 14px;
  align-items: start;
}
.editor-canvas {
  background: radial-gradient(circle at 50% 45%, #166ea8, #0c4570);
  border-radius: 12px;
  padding: 10px;
  border: 1.5px solid #235881;
}
.editor-canvas svg { width: 100%; height: auto; max-height: 58vh; display: block; }
.editor-tools { display: grid; gap: 10px; }
.editor-hex { cursor: pointer; }
.editor-hex.selected polygon { stroke: #fff; stroke-width: 3.5; filter: brightness(1.16); }
.editor-edge-btn { cursor: pointer; }

.trade-grid { display: grid; gap: 8px; }
.bank-trade-group { display: grid; gap: 6px; margin-bottom: 10px; }
.bank-trade-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}
.trade-pick-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.trade-pick-tile {
  position: relative;
  border: 2px solid #b9a47a;
  border-radius: 10px;
  background: linear-gradient(170deg, #fffdf8 0%, #f5ebd4 100%);
  padding: 4px;
  display: grid;
  grid-template-rows: 52px auto auto;
  gap: 3px;
  text-align: center;
  transition: transform .13s ease, border-color .13s ease, box-shadow .13s ease, opacity .13s ease;
}
.trade-pick-tile:not(:disabled):hover {
  transform: translateY(-2px);
  border-color: #7c6742;
}
.trade-pick-tile.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2.5px #f6c445, 0 6px 14px #1d6ea845;
  transform: translateY(-2px);
}
.trade-pick-tile:disabled {
  opacity: .42;
  filter: grayscale(.55);
  cursor: default;
}
.trade-pick-art {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #796544;
  background: var(--card-art-bg, #f4ead2);
}
.trade-pick-art svg { width: 100%; height: 100%; display: block; }
.trade-pick-stock {
  position: absolute;
  top: 2px;
  left: 2px;
  min-width: 18px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #231e16d8;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.trade-pick-title {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trade-pick-delta {
  font-size: 12px;
  font-weight: 900;
  border-radius: 6px;
  padding: 1px 0;
}
.trade-pick-delta.give {
  background: #fde4dc;
  color: #9e2d18;
  border: 1px solid #e7b5a6;
}
.trade-pick-delta.want {
  background: #dff5df;
  color: #196428;
  border: 1px solid #a8d9aa;
}
.trade-preview-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 7px 10px;
  margin-bottom: 8px;
  border-radius: 9px;
  background: #efe3c8;
  border: 1px solid #d0be97;
  font-weight: 800;
  font-size: 13px;
  flex-wrap: wrap;
}
.offer-summary {
  justify-content: space-between;
}
.offer-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.trade-empty-chip {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
}
.trade-target-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.trade-target-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1.5px solid #c5b493;
  background: #fff;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 800;
}
.trade-target-pill.active {
  border-color: var(--accent);
  background: #e5f2fc;
  color: #0f436b;
  box-shadow: 0 0 0 2px #3b82f633;
}
.trade-offer-tile {
  position: relative;
  border: 2px solid #cbb996;
  border-radius: 10px;
  background: linear-gradient(170deg, #fffdf8 0%, #f5ebd4 100%);
  padding: 4px;
  display: grid;
  grid-template-rows: 46px auto auto;
  gap: 3px;
  text-align: center;
}
.trade-offer-tile.active-give {
  border-color: #d9534f;
  box-shadow: 0 0 0 2px #f8717144;
}
.trade-offer-tile.active-want {
  border-color: #16a34a;
  box-shadow: 0 0 0 2px #4ade8044;
}
.trade-stepper {
  display: grid;
  grid-template-columns: 22px 1fr 22px;
  align-items: center;
  gap: 2px;
  background: #efe3c8;
  border-radius: 6px;
  padding: 1px 2px;
}
.trade-stepper button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}
.trade-stepper button:disabled { opacity: .35; }
.trade-stepper strong { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.trade-stepper strong.give { color: #9e2d18; }
.trade-stepper strong.want { color: #196428; }
.offer-inline-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.ranked-ingame-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 3px 6px 3px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(30, 58, 138, 0.92), rgba(15, 23, 42, 0.95));
  border: 1px solid #60a5fa88;
  color: #fde68a;
  font-size: 11.5px;
  font-weight: 800;
}
.res-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: #f7f0e0;
  border-radius: 8px;
}
.counter-btns { display: inline-flex; align-items: center; gap: 6px; }
.counter-btns button { width: 28px; height: 28px; border-radius: 6px; border: 1px solid #b5a687; background: #fff; font-weight: 800; }

.rules-content ul { padding-left: 18px; display: grid; gap: 8px; }

.toast {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: #231e16;
  color: #fff8e7;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid var(--gold);
  box-shadow: 0 8px 24px #00000050;
  font-weight: 600;
}

/* =========================================================
   Animations, Flying Cards, Steal Spotlight & Live Callouts
   ========================================================= */
.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 45;
  overflow: hidden;
  perspective: 1100px;
}

.action-callout-stack {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  max-width: min(92%, 560px);
}

.action-callout {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #fffaf0;
  background: linear-gradient(180deg, rgba(13, 45, 76, 0.94) 0%, rgba(8, 28, 50, 0.96) 100%);
  border: 1.5px solid rgba(138, 212, 255, 0.45);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(8px);
  animation: calloutIn .26s cubic-bezier(.22, 1.28, .36, 1) forwards;
}
.action-callout.gain {
  background: linear-gradient(180deg, rgba(18, 79, 44, 0.95) 0%, rgba(10, 50, 28, 0.96) 100%);
  border-color: #6ee7b7;
}
.action-callout.loss,
.action-callout.robber {
  background: linear-gradient(180deg, rgba(122, 27, 24, 0.95) 0%, rgba(79, 15, 13, 0.96) 100%);
  border-color: #fca5a5;
}
.action-callout.gold {
  background: linear-gradient(180deg, rgba(114, 73, 10, 0.96) 0%, rgba(74, 46, 5, 0.98) 100%);
  border-color: #fde047;
  color: #fffbeb;
}
.action-callout.leaving {
  animation: calloutOut .24s ease-in forwards;
}
@keyframes calloutIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes calloutOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-8px) scale(0.94); }
}

.callout-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  vertical-align: middle;
}
.callout-res {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px 1px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-weight: 800;
}

.flying-card {
  position: fixed;
  top: 0;
  left: 0;
  width: 72px;
  height: 102px;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.42));
}
.flying-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}
.flying-card-inner.flipped {
  transform: rotateY(180deg);
}
.flying-card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 10px;
  border: 2.5px solid #3c3020;
  overflow: hidden;
}
.flying-card-front {
  background: linear-gradient(165deg, #fffdf7 0%, #f7eed6 100%);
  padding: 4px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 3px;
}
.flying-card-art {
  border-radius: 6px;
  overflow: hidden;
  border: 1.5px solid #6b5839;
  background: var(--card-art-bg);
  display: grid;
  place-items: center;
}
.flying-card-art svg {
  width: 100%;
  height: 100%;
  display: block;
}
.flying-card-name {
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  color: #292218;
  background: #ede1c4;
  border: 1px solid #cdb98e;
  border-radius: 4px;
  padding: 1px 3px;
}
.flying-card-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #1d1a14;
  color: #ffe27a;
  border: 2px solid #fffdf6;
  font-size: 11.5px;
  font-weight: 900;
  display: grid;
  place-items: center;
  z-index: 3;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}
.flying-card-back {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at 50% 42%, #294c7a 0%, #152b4a 68%, #0d1c33 100%);
  border-color: #e6c26b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #ffe391;
  box-shadow: inset 0 0 0 3px rgba(246, 196, 69, 0.35);
}
.flying-card-back-crest {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #f6c445;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: rgba(246, 196, 69, 0.14);
}
.flying-card-back-label {
  font-size: 7.5px;
  font-weight: 900;
  letter-spacing: .12em;
  opacity: .9;
}

.steal-spotlight-halo {
  position: fixed;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 224, 102, 0.65) 0%, rgba(255, 224, 102, 0.18) 45%, transparent 72%);
}
.steal-spotlight-halo.loss {
  background: radial-gradient(circle, rgba(239, 68, 68, 0.62) 0%, rgba(239, 68, 68, 0.18) 45%, transparent 72%);
}
.steal-spotlight-caption {
  position: fixed;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(18, 24, 38, 0.94);
  border: 2px solid #f6c445;
  color: #fffaf0;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}
.steal-spotlight-caption.loss {
  border-color: #f87171;
  background: rgba(68, 16, 16, 0.95);
}
.spotlight-res-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #fde68a;
  font-weight: 900;
}

.float-delta-badge {
  position: fixed;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  background: #15803d;
  border: 1.5px solid #dcfce7;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.38);
  white-space: nowrap;
  pointer-events: none;
  z-index: 48;
}
.float-delta-badge.loss {
  background: #b91c1c;
  border-color: #fee2e2;
}
.float-delta-badge.info {
  background: #1d4ed8;
  border-color: #dbeafe;
}
.float-delta-badge.gold {
  background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%);
  border-color: #fef3c7;
  color: #fffbeb;
}

.fx-board-ring {
  position: fixed;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid #ffd866;
  pointer-events: none;
  box-shadow: 0 0 18px rgba(255, 216, 102, 0.55);
}

.fx-board-mover {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.5));
}

.hidden-for-flight {
  opacity: 0;
}
.robber-land-pop {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: robberLandPop .46s cubic-bezier(.22, 1.45, .36, 1);
}
@keyframes robberLandPop {
  0% { transform: scale(1.35, 0.72); }
  55% { transform: scale(0.92, 1.12); }
  100% { transform: scale(1, 1); }
}

.robber-block-ring {
  fill: rgba(185, 28, 28, 0.14);
  stroke: rgba(239, 68, 68, 0.85);
  stroke-width: 2;
  stroke-dasharray: 4 3;
  animation: robberRingPulse 1.8s infinite ease-in-out;
}
@keyframes robberRingPulse {
  0%, 100% { stroke-opacity: 0.55; }
  50% { stroke-opacity: 1; }
}

.hex-group.hex-producing .hex-poly {
  filter: brightness(1.26) saturate(1.15);
  stroke: #fff59d;
  stroke-width: 3.5;
  animation: hexProdFlash 1.1s ease-out;
}
@keyframes hexProdFlash {
  0% { filter: brightness(1.45) saturate(1.3); }
  100% { filter: brightness(1) saturate(1); }
}

.hex-group.hex-robber-hit .hex-poly {
  filter: brightness(0.84) sepia(0.25);
  stroke: #ef4444;
  stroke-width: 3.2;
}

.piece-just-built {
  transform-box: fill-box;
  transform-origin: center;
  animation: piecePopIn .48s cubic-bezier(.22, 1.5, .36, 1);
}
@keyframes piecePopIn {
  0% { transform: scale(0.3); opacity: 0.2; }
  70% { transform: scale(1.22); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.res-card.card-gain-pop {
  animation: cardGainPop .75s cubic-bezier(.22, 1.4, .36, 1);
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.45), 0 10px 22px rgba(22, 163, 74, 0.38);
}
@keyframes cardGainPop {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-13px) scale(1.12); }
  100% { transform: translateY(0) scale(1); }
}

.res-card.card-loss-pop {
  animation: cardLossPop .75s ease-out;
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.48), 0 8px 18px rgba(220, 38, 38, 0.32);
}
@keyframes cardLossPop {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px) rotate(-3deg); }
  45% { transform: translateX(5px) rotate(3deg); }
  70% { transform: translateX(-3px); }
}

.bank-card.bank-pop {
  animation: bankPop .55s ease-out;
}
@keyframes bankPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); box-shadow: 0 0 0 2px #f6c445; }
  100% { transform: scale(1); }
}

.player-card.player-gain-pop {
  animation: playerGainPop .75s ease-out;
}
@keyframes playerGainPop {
  0% { transform: scale(1); }
  35% { transform: scale(1.03); background: #ecfdf5; border-color: #22c55e; }
  100% { transform: scale(1); }
}

.player-card.player-loss-pop {
  animation: playerLossPop .75s ease-out;
}
@keyframes playerLossPop {
  0% { transform: scale(1); }
  30% { transform: translateX(-3px); background: #fef2f2; border-color: #ef4444; }
  60% { transform: translateX(3px); }
  100% { transform: scale(1); }
}

/* Visual Steal Picker Modal */
.steal-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.steal-target-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 2px solid var(--target-color, #9c8657);
  background: linear-gradient(180deg, #fffdf8 0%, #f3e6ca 100%);
  cursor: pointer;
  text-align: left;
  transition: transform .16s ease, box-shadow .16s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.steal-target-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2), 0 0 0 3px color-mix(in srgb, var(--target-color) 35%, transparent);
}
.steal-target-head {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
}
.steal-target-info {
  display: grid;
  min-width: 0;
}
.steal-target-info strong {
  font-size: 14px;
  color: #261f14;
}
.steal-target-info span {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
.steal-card-fan {
  position: relative;
  height: 54px;
  width: 100%;
  display: grid;
  place-items: center;
}
.steal-fan-card {
  position: absolute;
  width: 34px;
  height: 48px;
  border-radius: 6px;
  background: radial-gradient(circle at 50% 42%, #294c7a 0%, #152b4a 75%);
  border: 1.8px solid #f6c445;
  color: #ffe391;
  font-size: 13px;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.28);
  transform: translateX(var(--fan-x, 0px)) rotate(var(--fan-rot, 0deg));
  transition: transform .18s ease;
}
.steal-target-card:hover .steal-fan-card {
  transform: translateX(calc(var(--fan-x, 0px) * 1.35)) translateY(-5px) rotate(calc(var(--fan-rot, 0deg) * 1.2));
}
.steal-target-cta {
  padding: 5px 12px;
  border-radius: 999px;
  background: #1b65a6;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

/* Language Switcher, Discord/Google OAuth & Global/Regional Leaderboard */
.hud-lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  background: rgba(15, 29, 64, 0.78);
  border: 1px solid rgba(147, 197, 253, 0.35);
  gap: 2px;
}
.hud-lang-btn {
  border: 0;
  background: transparent;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.hud-lang-btn:hover { color: #fff; }
.hud-lang-btn.active {
  background: linear-gradient(180deg, #ffd866 0%, #f0ad1c 100%);
  color: #2c1e05;
}

.lang-switch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.oauth-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.oauth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
}
.oauth-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.oauth-btn.discord {
  background: linear-gradient(180deg, #6b76ff 0%, #5865f2 100%);
  color: #ffffff;
  border-color: #818cf8;
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.35);
}
.oauth-btn.google {
  background: #ffffff;
  color: #1f2937;
  border-color: #d1d5db;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

.home-ranked-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  width: 100%;
}
.leaderboard-hub-btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 800;
}

.lb-country-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f5ebd4;
  border: 1px solid #d5c39b;
}
.lb-my-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  background: linear-gradient(90deg, #eef6ff 0%, #fff9e5 100%);
  border: 1.5px solid #cbd5e1;
  font-size: 13px;
}
.lb-table-wrap {
  max-height: 360px;
  overflow-y: auto;
  border: 1.5px solid #d8c7a3;
  border-radius: 10px;
  background: #fffdf8;
}
.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.lb-table th {
  position: sticky;
  top: 0;
  background: #efe2c6;
  color: #3a2e1a;
  font-size: 11.5px;
  font-weight: 800;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1.5px solid #d4c19a;
}
.lb-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #efe5d0;
  vertical-align: middle;
}
.lb-table tr.me {
  background: #fff4cc;
}
.lb-rank {
  font-weight: 900;
  width: 44px;
}
.lb-name {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lb-prov {
  display: inline-flex;
  align-items: center;
  opacity: 0.9;
}
.lb-tier-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  background: color-mix(in srgb, var(--tier-col) 18%, #fff);
  color: #1f1b14;
  border: 1px solid var(--tier-col);
}
.lb-empty {
  text-align: center;
  padding: 22px 12px;
  color: var(--muted);
  margin: 0;
}

/* Clickable whole trade cards */
.trade-card-click {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 3px;
  width: 100%;
  cursor: pointer;
  color: inherit;
  text-align: center;
}
.trade-card-click:disabled {
  cursor: default;
  opacity: 0.72;
}
.trade-card-click:not(:disabled):hover .trade-pick-art {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
}
.trade-pick-art {
  transition: transform .13s ease, box-shadow .13s ease;
}

/* Prominent Rules Button & Detailed Rules Cards */
.rules-hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 900;
  cursor: pointer;
  color: #fffbeb;
  background: linear-gradient(180deg, #1e6cb3 0%, #114378 100%);
  border: 1.5px solid #93c5fd;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 14px rgba(15, 45, 90, 0.45);
  transition: transform .15s ease, filter .15s ease;
}
.rules-hero-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  max-height: 68vh;
  overflow-y: auto;
  padding-right: 4px;
}
.rules-card {
  background: #fffdf7;
  border: 1.5px solid #dccaa4;
  border-radius: 12px;
  padding: 11px 13px;
  display: grid;
  gap: 6px;
  align-content: start;
  box-shadow: 0 2px 8px rgba(48, 34, 12, 0.06);
}
.rules-card h3 {
  margin: 0;
  font-size: 14px;
  color: #1c4e80;
  border-bottom: 1px solid #efe4cb;
  padding-bottom: 5px;
}
.rules-card-text {
  font-size: 12.5px;
  line-height: 1.48;
  color: #2f281c;
}
.rules-cost-grid {
  display: grid;
  gap: 6px;
}
.rules-cost-grid > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 8px;
  background: #f7efdc;
  font-size: 12px;
}
.rules-res-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
}

/* Trade tabs & Dev Card inspection modal */
.trade-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.trade-tab-btn {
  min-height: 36px;
  border-radius: 10px;
  border: 1.5px solid #cbb78f;
  background: #f3ead5;
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
}
.trade-tab-btn.active {
  background: linear-gradient(180deg, #2780c2 0%, #175d94 100%);
  border-color: #134b77;
  color: #fff;
}
body.dark-mode .trade-tab-btn:not(.active) {
  background: #1e2a3b;
  border-color: #364963;
  color: #e8eef7;
}
.dev-chip.unplayable {
  opacity: 0.72;
}
.dev-inspect-box {
  display: grid;
  gap: 12px;
}
.dev-inspect-head {
  display: flex;
  gap: 14px;
  align-items: center;
}
.dev-inspect-art {
  flex: none;
  width: 68px;
  height: 92px;
  border-radius: 10px;
  border: 2px solid #c9b58e;
  background: #f5ebd4;
  display: grid;
  place-items: center;
  padding: 6px;
}
.dev-inspect-art svg {
  width: 100%;
  height: 100%;
}
body.dark-mode .dev-inspect-art {
  background: #1d2838;
  border-color: #3d526e;
}
.dev-inspect-copy {
  display: grid;
  gap: 6px;
}
.dev-inspect-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}
.dev-inspect-status {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.dev-inspect-status.ready {
  color: #1d6ea8;
}
body.dark-mode .dev-inspect-status.ready {
  color: #7dd3fc;
}

/* Friend Link Card with prominent Copylink */
.friend-link-card {
  display: grid;
  gap: 7px;
  background: linear-gradient(135deg, #eef6ff 0%, #fffdf6 100%);
  border: 1.5px solid #9dc3ea;
  border-radius: 12px;
  padding: 10px 12px;
}
.friend-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.friend-copylink-btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 800;
  border-radius: 9px;
}
body.dark-mode .friend-link-card {
  background: linear-gradient(135deg, #16263a 0%, #172130 100%);
  border-color: #36577d;
}

/* Referral / Affiliate panel */
.referral-panel {
  display: grid;
  gap: 7px;
  background: linear-gradient(180deg, #fffdf6 0%, #f5ebd4 100%);
  border: 1.5px solid #d5c195;
  padding: 10px 12px;
  border-radius: 12px;
}
.ref-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ref-desc,
.ref-guest-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.ref-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.ref-url-input {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #cbb78f;
  background: #fff;
}
.ref-list-wrap {
  display: grid;
  gap: 4px;
}
.ref-list-label {
  font-weight: 800;
  font-size: 11.5px;
  color: var(--muted);
}
body.dark-mode .referral-panel {
  background: linear-gradient(180deg, #1b2738 0%, #141d2b 100%);
  border-color: #344760;
}
body.dark-mode .ref-url-input {
  background: #0f1722;
  color: #e2e8f0;
  border-color: #354963;
}

/* Favorite color picker in Character Studio */
.fav-color-grid {
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
}
.fav-color-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: flex-start;
  padding: 6px 9px;
}
.fav-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: none;
  border: 1.5px solid rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

/* Post-game detailed Match Summary */
.finish-summary-wrap {
  display: grid;
  gap: 10px;
}
.finish-round-line {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.finish-reward-line {
  margin: 0;
  font-weight: 800;
  color: #1d6ea8;
  font-size: 13.5px;
}
.finish-awards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.finish-award-card {
  background: #f5ebd5;
  border: 1.5px solid #d5c39c;
  border-radius: 11px;
  padding: 8px 10px;
  display: grid;
  gap: 4px;
}
.finish-award-card.claimed {
  background: linear-gradient(180deg, #fff9e3 0%, #f7e6b2 100%);
  border-color: #dfae36;
}
.finish-award-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.finish-award-owner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.finish-players-grid {
  display: grid;
  gap: 7px;
  max-height: 44vh;
  overflow-y: auto;
  padding-right: 2px;
}
.finish-player-card {
  background: #fffdf8;
  border: 1.5px solid #dcd0b4;
  border-left: 5px solid var(--p-col, var(--accent));
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 6px;
}
.finish-player-card.winner {
  background: #fff9e5;
  border-color: #e6b43c;
  border-left-width: 5px;
}
.finish-player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.finish-player-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.finish-win-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f6c445;
  color: #241b07;
}
.finish-vp-total {
  font-weight: 900;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.finish-vp-total small {
  font-weight: 600;
  color: var(--muted);
}
.finish-stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}
.finish-stat-chips > span {
  background: #f3ead7;
  border: 1px solid #dfd1b3;
  border-radius: 7px;
  padding: 2px 7px;
  font-variant-numeric: tabular-nums;
}

/* Mobile view switcher (hidden on desktop) */
.mobile-panel-tabs {
  display: none;
  gap: 6px;
  padding: 5px 8px;
  background: #0a3659;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.mob-tab-btn {
  flex: 1;
  min-height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  color: #e5effd;
  font-weight: 800;
  font-size: 12.5px;
}
.mob-tab-btn.active {
  background: linear-gradient(180deg, #ffd866 0%, #f0ad1c 100%);
  border-color: #ffe89e;
  color: #211805;
}

/* Dark Mode */
body.dark-mode {
  color-scheme: dark;
  --ocean-top: #0b2d4d;
  --ocean-bot: #041322;
  --sand: #2a241b;
  --sand-border: #594b34;
  --panel-bg: #111824;
  --panel-card: #192334;
  --panel-line: #2d3d52;
  --ink: #eef2f8;
  --muted: #98a9be;
  --accent: #3d91e5;
  --accent-dark: #256bb0;
  --gold: #f6c445;
  background: var(--ocean-bot);
  color: var(--ink);
}
body.dark-mode .board-stage {
  background: radial-gradient(ellipse at 50% 42%, #0e385c 0%, #08233c 58%, #03111f 100%);
}
body.dark-mode .left-rail {
  background: linear-gradient(180deg, #0b1626 0%, #060e19 100%);
  border-right-color: #1e2d40;
}
body.dark-mode .right-rail,
body.dark-mode .panel {
  background: #111824;
  border-color: #2c3b4f;
  color: #eef2f8;
}
body.dark-mode .phase-banner {
  background: rgba(11, 22, 38, 0.92);
  border-bottom-color: #23354a;
}
body.dark-mode .phase-banner.my-action {
  background: linear-gradient(90deg, #11355c 0%, #164778 100%);
}
body.dark-mode .bottom-dock {
  background: rgba(13, 21, 33, 0.94);
  border-top-color: #2a3a50;
}
body.dark-mode .hand-panel,
body.dark-mode .game-log,
body.dark-mode .players-panel,
body.dark-mode .bank-row,
body.dark-mode .self-panel {
  color: #eef2f8;
}
body.dark-mode .act-btn:not(.primary):not(.dark-glass),
body.dark-mode .close-btn,
body.dark-mode .pill,
body.dark-mode .studio-cat-btn:not(.active),
body.dark-mode .settings-tab-btn:not(.active),
body.dark-mode .choice-btn:not(.active),
body.dark-mode .trade-target-pill:not(.active) {
  background: #1e2a3b;
  color: #e8eef7;
  border-color: #364963;
}
body.dark-mode .act-btn:not(.primary):not(:disabled):hover,
body.dark-mode .choice-btn:not(.active):hover {
  background: #27374d;
  border-color: #4f6a8f;
}
body.dark-mode select,
body.dark-mode input[type="text"],
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode input[type="number"],
body.dark-mode textarea {
  background: #1a2434;
  color: #eef2f8;
  border-color: #3a4c64;
}
body.dark-mode dialog.modal,
body.dark-mode .studio-dock,
body.dark-mode .auth-card,
body.dark-mode .lobby-panel,
body.dark-mode .prelobby-card,
body.dark-mode .ranked-search-card {
  background: #131c29;
  color: #eef2f8;
  border-color: #304259;
}
body.dark-mode .modal-head {
  border-bottom-color: #2b3a4f;
}
body.dark-mode .settings-section,
body.dark-mode .rules-card,
body.dark-mode .crate-card,
body.dark-mode .shop-coin-card,
body.dark-mode .coin-pack-card,
body.dark-mode .shop-wallet,
body.dark-mode .shop-future-note,
body.dark-mode .studio-preview-bar,
body.dark-mode .slot-row,
body.dark-mode .player-row,
body.dark-mode .trade-offer-tile,
body.dark-mode .trade-preview-bar,
body.dark-mode .trade-pick-tile,
body.dark-mode .lb-country-bar,
body.dark-mode .lb-table-wrap,
body.dark-mode .finish-player-card,
body.dark-mode .finish-award-card {
  background: #1b2636;
  border-color: #33465e;
  color: #eef2f8;
}
body.dark-mode .rules-card h3 {
  color: #93c5fd;
  border-bottom-color: #2f4158;
}
body.dark-mode .rules-card-text,
body.dark-mode .finish-vp-total small,
body.dark-mode .cust-tip {
  color: #cbd5e1;
}
body.dark-mode .rules-cost-grid > div,
body.dark-mode .finish-stat-chips > span {
  background: #233146;
  border-color: #384c68;
  color: #e2e8f0;
}
body.dark-mode .finish-award-card.claimed {
  background: linear-gradient(180deg, #332914 0%, #241d0f 100%);
  border-color: #b5892a;
}
body.dark-mode .finish-player-card.winner {
  background: linear-gradient(180deg, #2b2615 0%, #1c1d28 100%);
  border-color: #d9a734;
}
body.dark-mode .finish-reward-line {
  color: #7dd3fc;
}
body.dark-mode .lb-my-banner {
  background: linear-gradient(90deg, #17273c 0%, #2b2416 100%);
  border-color: #3b4f69;
  color: #eef2f8;
}
body.dark-mode .lb-table th {
  background: #16202e;
  color: #e2e8f0;
  border-bottom-color: #33455d;
}
body.dark-mode .lb-table td {
  border-bottom-color: #263549;
}
body.dark-mode .lb-table tr.me {
  background: rgba(246, 196, 69, 0.14);
}
body.dark-mode .lb-tier-pill {
  color: #f8fafc;
  background: color-mix(in srgb, var(--tier-col) 24%, #111827);
}
body.dark-mode .trade-stepper strong.give { color: #fca5a5; }
body.dark-mode .trade-stepper strong.want { color: #86efac; }
body.dark-mode .floating-offer {
  background: #182334;
  border-color: #3b4f69;
  color: #eef2f8;
}
body.dark-mode .oauth-btn.google {
  background: #1f2937;
  color: #f9fafb;
  border-color: #4b5563;
}
body.dark-mode .mobile-panel-tabs {
  background: #0a1421;
  border-top-color: #1f2e42;
}

/* Comprehensive Dark Mode Fixes (Players, Cards, Lobby, Studio, Shop, Modals, Board Tokens) */
body.dark-mode .player-card {
  background: #182334;
  border-color: #32455f;
  color: #eef2f8;
}
body.dark-mode .player-card.active {
  background: linear-gradient(180deg, #2b2615 0%, #1d2433 100%);
  border-color: #eab308;
  box-shadow: 0 0 0 2px #f6c44544;
}
body.dark-mode .award-tag {
  background: #423310;
  color: #fde68a;
  border: 1px solid #a16207;
}
body.dark-mode .self-panel {
  background: #182334;
  border-color: #32455f;
  color: #eef2f8;
}
body.dark-mode .harbor-pill {
  background: #223146;
  border-color: #3d526f;
  color: #e2e8f0;
}
body.dark-mode .players-dice-header {
  background: #182334;
  border-color: #32455f;
}
body.dark-mode .dice-box {
  background: #111927;
  border-color: #2e4058;
}
body.dark-mode .dice-sum {
  color: #f8fafc;
}
body.dark-mode .game-log li {
  border-top-color: #263549;
}
body.dark-mode .log-dice {
  background: #1f2d40;
  border-color: #384d69;
}
body.dark-mode .log-dice-sum {
  color: #f8fafc;
}
body.dark-mode .log-dice-sum.hot {
  color: #fca5a5;
}
body.dark-mode .log-res {
  color: #e2e8f0;
}
body.dark-mode .res-card {
  background: linear-gradient(165deg, #222e40 0%, #17202e 100%);
  border-color: #415570;
  box-shadow: 0 4px 0 #0a0f18, 0 7px 14px #00000044;
}
body.dark-mode .res-card::before {
  border-color: #3b4f69;
}
body.dark-mode .res-card.stacked {
  box-shadow:
    3px 3px 0 #1f2a3a,
    4px 4px 0 #0a0f18,
    6px 6px 0 #182230,
    7px 7px 0 #0a0f18,
    0 9px 16px #00000055;
}
body.dark-mode .res-card.bank-card.stacked {
  box-shadow:
    2px 2px 0 #1f2a3a,
    3px 3px 0 #0a0f18,
    4px 4px 0 #182230,
    5px 5px 0 #0a0f18,
    0 6px 10px #0000004d;
}
body.dark-mode .res-card-frame,
body.dark-mode .trade-pick-art {
  border-color: #465b78;
  filter: brightness(0.84) saturate(1.06);
}
body.dark-mode .res-card-count {
  border-color: #0f1722;
}
body.dark-mode .res-card-name {
  background: #151e2c;
  border-color: #32445c;
  color: #e2e8f0;
}
body.dark-mode .dev-chip {
  background: linear-gradient(160deg, #2c2447 0%, #1d1733 100%);
  border-color: #6d52b8;
  color: #ede9fe;
}
body.dark-mode .dev-chip:not(:disabled):hover {
  background: linear-gradient(160deg, #372d59 0%, #261e42 100%);
}
body.dark-mode .act-btn small {
  background: #2b3b52;
  color: #e2e8f0;
}
body.dark-mode .act-btn.action-ready:not(:disabled) {
  background: #2f2814;
  border-color: #f59e0b;
  color: #fef3c7;
}
body.dark-mode .act-btn.primary.action-ready:not(:disabled) {
  background: #2384ca;
  border-color: #ffe27a;
  color: #fff;
}
body.dark-mode .lobby-screen {
  background: radial-gradient(ellipse at 50% 35%, #162647 0%, #0e1830 55%, #070d1c 100%);
}
body.dark-mode .welcome-bar,
body.dark-mode .lobby-config-bar {
  background: rgba(15, 23, 36, 0.92);
  border-color: #2f425b;
  color: #eef2f8;
}
body.dark-mode .cfg-tile {
  background: linear-gradient(180deg, #1e2a3b 0%, #16202e 100%);
  border-color: #364963;
  color: #eef2f8;
  box-shadow: inset 0 1px 0 #ffffff14, 0 2px 0 #0c121b;
}
body.dark-mode .cfg-tile:not(:disabled):hover {
  background: linear-gradient(180deg, #26354a 0%, #1c2838 100%);
  border-color: #53a8ec;
}
body.dark-mode .color-opt {
  background: #1c2738;
  border-color: #364963;
  color: #eef2f8;
}
body.dark-mode .color-opt.selected {
  background: #17304d;
  border-color: #53a8ec;
}
body.dark-mode .choice-btn.active {
  background: #193654;
  border-color: #53a8ec;
  color: #e0f2fe;
}
body.dark-mode .choice-btn.locked {
  background: #17202e;
  border-color: #394b63;
  color: #cbd5e1;
}
body.dark-mode .choice-btn.locked:hover {
  background: #262216;
  border-color: #d97706;
}
body.dark-mode .choice-btn.previewing {
  background: #332712;
  border-color: #f59e0b;
  color: #fef3c7;
}
body.dark-mode .choice-btn small {
  color: #fcd34d;
}
body.dark-mode .gem-tag {
  background: #3b2d12;
  color: #fde68a !important;
  border-color: #b45309;
}
body.dark-mode .studio-preview-bar {
  background: #282112;
  border-color: #d97706;
  color: #fef3c7;
}
body.dark-mode .studio-preview-info small {
  color: #fde68a;
}
body.dark-mode .shop-row {
  background: #1b2636;
  border-color: #33465e;
  color: #eef2f8;
}
body.dark-mode .shop-balance {
  color: #fde68a;
}
body.dark-mode .shop-future-note {
  background: #16263a;
  border-color: #3b6a9c;
  color: #bfdbfe;
}
body.dark-mode .coin-pack-card.featured {
  background: linear-gradient(180deg, #2d2412 0%, #1e1a12 100%);
  border-color: #d97706;
}
body.dark-mode .coin-pack-amount {
  color: #f8fafc;
}
body.dark-mode .coin-pack-title {
  color: #cbd5e1;
}
body.dark-mode .crate-loot-banner {
  background: color-mix(in srgb, var(--r-col, #d97706) 18%, #16202e);
}
body.dark-mode .crate-loot-head,
body.dark-mode .crate-loot-sub {
  color: #cbd5e1;
}
body.dark-mode .crate-loot-title {
  color: #f8fafc;
}
body.dark-mode .settings-tabs {
  background: #0d1520;
  border: 1px solid #263549;
}
body.dark-mode .settings-grid {
  background: #1b2636;
  border-color: #33465e;
}
body.dark-mode .ranked-picker-hint {
  background: #16263a;
  border-color: #355880;
  color: #bfdbfe;
}
body.dark-mode .invite-card {
  background: #2b2312;
  border-color: #b45309;
  color: #fef3c7;
}
body.dark-mode .trade-target-pill.active {
  background: #193654;
  border-color: #53a8ec;
  color: #e0f2fe;
}
body.dark-mode .trade-pick-delta.give {
  background: #3f1d1b;
  border-color: #991b1b;
  color: #fca5a5;
}
body.dark-mode .trade-pick-delta.want {
  background: #133822;
  border-color: #166534;
  color: #86efac;
}
body.dark-mode .trade-stepper {
  background: #111824;
}
body.dark-mode .trade-stepper button {
  background: #243247;
  color: #eef2f8;
}
body.dark-mode .res-counter {
  background: #1b2636;
  border: 1px solid #33465e;
}
body.dark-mode .counter-btns button {
  background: #243247;
  border-color: #3b4f69;
  color: #eef2f8;
}
body.dark-mode .steal-target-card {
  background: linear-gradient(180deg, #1f2b3d 0%, #151e2c 100%);
  color: #eef2f8;
}
body.dark-mode .steal-target-info strong {
  color: #f8fafc;
}
body.dark-mode .close-btn:hover {
  background: #451a1a;
  border-color: #dc2626;
  color: #fecaca;
}
body.dark-mode .range-row strong {
  color: #7dd3fc;
}
body.dark-mode .range-row input[type="range"] {
  background: #2c3c52;
}
body.dark-mode .toggle-track {
  background: #2c3c52;
  border-color: #465b78;
}
body.dark-mode .hex-poly {
  stroke: #3b4f6b;
}
body.dark-mode .token-circle {
  fill: #1c2838;
  stroke: #465d7a;
}
body.dark-mode .hex-group.signaled .token-circle {
  fill: #332912;
  stroke: #eab308;
}
body.dark-mode .token-num {
  fill: #f1f5f9;
}
body.dark-mode .token-num.hot {
  fill: #f87171;
}
body.dark-mode .token-pips {
  fill: #94a3b8;
}
body.dark-mode .token-pips.hot {
  fill: #f87171;
}
body.dark-mode .harbor-badge {
  fill: #1c2838;
  stroke: #4b6484;
}
body.dark-mode .harbor-text {
  fill: #e2e8f0;
}
body.dark-mode .preset-cat-pill.standard { background: #133822; color: #86efac; }
body.dark-mode .preset-cat-pill.large { background: #3b2a10; color: #fde68a; }
body.dark-mode .preset-cat-pill.seafarers { background: #162e4f; color: #93c5fd; }
body.dark-mode .offer-status-tag.yes { background: #133822; color: #86efac; }
body.dark-mode .offer-status-tag.no { background: #3f1d1b; color: #fca5a5; }
body.dark-mode .offer-status-tag.wait { background: #3b2a10; color: #fde68a; }
body.dark-mode .offer-status-tag.counter { background: #162e4f; color: #93c5fd; }
body.dark-mode .linked-provider-ico.google {
  background: #1f2937;
  color: #f9fafb;
  border-color: #374151;
}
body.dark-mode .rarity-pill {
  background: color-mix(in srgb, var(--r-col, #94a3b8) 22%, #111827);
  color: #f1f5f9;
}
body.dark-mode .studio-presets-bar {
  background: #182233;
  border-color: #304259;
}
body.dark-mode .preset-chip {
  background: #1f2c40;
  border-color: #384c68;
  color: #eef2f8;
}
body.dark-mode .preset-chip.empty {
  background: transparent;
  color: #94a3b8;
}
body.dark-mode .preset-chip.locked {
  background: #282114;
  border-color: #92400e;
  color: #fde68a;
}
body.dark-mode .preset-chip-act {
  background: #2b3b52;
  color: #eef2f8;
}
body.dark-mode .preset-sub-link {
  color: #7dd3fc;
}
body.dark-mode .pass-hero-card {
  background: linear-gradient(160deg, #1d2738 0%, #161e2c 100%);
  border-color: #b45309;
  color: #eef2f8;
}
body.dark-mode .pass-hero-card.active {
  background: linear-gradient(160deg, #122e22 0%, #142230 100%);
  border-color: #22c55e;
}
body.dark-mode .pass-eyebrow {
  color: #fcd34d;
}
@keyframes playerGainPopDark {
  0% { transform: scale(1); }
  35% { transform: scale(1.03); background: #103221; border-color: #22c55e; }
  100% { transform: scale(1); }
}
@keyframes playerLossPopDark {
  0% { transform: scale(1); }
  30% { transform: translateX(-3px); background: #3f1d1b; border-color: #ef4444; }
  60% { transform: translateX(3px); }
  100% { transform: scale(1); }
}
body.dark-mode .player-card.player-gain-pop {
  animation-name: playerGainPopDark;
}
body.dark-mode .player-card.player-loss-pop {
  animation-name: playerLossPopDark;
}

/* Responsive Mobile Layout */
@media (max-width: 900px) {
  .app-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }
  .left-rail {
    flex: none;
    flex-direction: row;
    border-right: 0;
    border-bottom: 1px solid #0b3c61;
    padding: 5px 8px;
    gap: 6px;
    overflow-x: auto;
  }
  .rail-btn {
    width: 34px;
    height: 34px;
    flex: none;
  }
  .board-stage {
    flex: 1 1 0;
    min-height: 220px;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }
  .board-wrap {
    padding: 4px;
  }
  #board-svg {
    max-height: 100%;
  }
  .board-dice-dock {
    top: 6px;
    right: 6px;
    gap: 5px;
    transform: scale(0.88);
    transform-origin: top right;
  }
  .board-zoom-bar {
    bottom: 6px;
    right: 6px;
  }
  .mobile-panel-tabs {
    display: flex;
    flex: none;
  }
  .bottom-dock {
    max-height: 35dvh;
    overflow-y: auto;
    padding: 7px 8px;
    gap: 6px;
  }
  .hand-panel {
    gap: 5px;
  }
  .res-card {
    width: 52px;
    height: 74px;
  }
  .action-tray {
    gap: 5px;
  }
  .act-btn {
    min-height: 34px;
    padding: 5px 8px;
    font-size: 12px;
  }
  .right-rail {
    display: none;
    border-left: 0;
    border-top: 2px solid var(--panel-line);
    padding: 8px;
    gap: 8px;
    overflow-y: auto;
  }
  body.mobile-tab-info .bottom-dock {
    display: none;
  }
  body.mobile-tab-info .right-rail {
    display: flex;
    flex-direction: column;
    flex: 0 0 40dvh;
    max-height: 44dvh;
  }
  .lobby-hud {
    padding: 8px;
    gap: 8px;
  }
  .lobby-topbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 7px 10px;
  }
  .lobby-tabs {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }
  .lobby-middle {
    align-items: flex-end;
    justify-content: center;
  }
  .lobby-middle.centered {
    align-items: center;
    overflow-y: auto;
  }
  .lobby-middle.home-hub {
    padding-left: 0;
    align-items: flex-end;
  }
  .studio-dock {
    width: 100%;
    max-height: 48dvh;
    padding: 10px;
  }
  .auth-card {
    width: 100%;
    max-height: 78dvh;
    overflow-y: auto;
    padding: 14px;
  }
  dialog.modal,
  dialog.modal.wide,
  dialog.modal.xwide {
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
    max-height: 92dvh;
    overflow: hidden;
    padding: 0;
  }
  .finish-awards-grid {
    grid-template-columns: 1fr;
  }
  .editor-shell,
  .settings-grid,
  .picker-grid {
    grid-template-columns: 1fr;
  }
  .pedestal-bar,
  .pedestal-bar.six {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .phase-banner {
    padding: 6px 10px;
    font-size: 12px;
    gap: 6px;
    flex-wrap: wrap;
  }
  .oauth-btn-grid {
    grid-template-columns: 1fr;
  }
  .rules-grid {
    grid-template-columns: 1fr;
  }
  .trade-pick-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .lobby-brand h1 {
    font-size: 15px;
  }
}

/* Legal / Imprint & Contact UI */
.lobby-legal-bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 11px;
  line-height: 1.2;
  color: rgba(215, 228, 255, 0.36);
  padding: 0 2px;
}
.lobby-legal-link {
  background: transparent;
  border: 0;
  padding: 2px 4px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 4px;
  transition: color .15s ease, background .15s ease;
}
.lobby-legal-link:hover,
.lobby-legal-link:focus-visible {
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.settings-legal-footer {
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid #d9cab0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.settings-legal-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}
.settings-legal-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.settings-legal-btn {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
}

.legal-dl {
  margin: 0;
  display: grid;
  gap: 9px;
}
.legal-row {
  display: grid;
  grid-template-columns: minmax(130px, 185px) 1fr;
  gap: 6px 12px;
  align-items: baseline;
  font-size: 13px;
}
.legal-row dt {
  font-weight: 700;
  color: var(--muted);
}
.legal-row dd {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}
.legal-email-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.legal-mail-link {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-note-text {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}
.legal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.legal-success-box {
  padding: 9px 12px;
  border-radius: 10px;
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
  font-size: 12.5px;
  font-weight: 700;
}

body.dark-mode .settings-legal-footer {
  border-top-color: #2b3a4f;
}
body.dark-mode .legal-row dd {
  color: #eef2f8;
}
body.dark-mode .legal-mail-link {
  color: #7dd3fc;
}
body.dark-mode .legal-success-box {
  background: #103221;
  border-color: #22794b;
  color: #86efac;
}

@media (max-width: 600px) {
  .legal-row,
  .legal-form-grid {
    grid-template-columns: 1fr;
  }
  .lobby-legal-bar {
    justify-content: center;
  }
}

/* Map & Expansion Thumbnails in Preset & Mode Pickers + Pre-Lobby */
.picker-grid.preset-picker-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.picker-card.has-thumb {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}
.preset-thumb {
  width: 78px;
  height: 68px;
  flex: 0 0 78px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid #bfa97d;
  box-shadow: 0 2px 6px rgba(13, 35, 58, 0.18);
  background: #0e4c78;
}
.preset-thumb.compact {
  width: 64px;
  height: 54px;
  flex: 0 0 64px;
}
.preset-thumb-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.picker-card-body {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 4px;
}
.preset-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.preset-cat-pill,
.preset-meta-pill {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  line-height: 1.25;
}
.preset-cat-pill.standard { background: #dcfce7; color: #166534; }
.preset-cat-pill.large { background: #fef3c7; color: #92400e; }
.preset-cat-pill.seafarers { background: #dbeafe; color: #1e40af; }
.preset-meta-pill { background: #e8dec9; color: #4f4331; }

.cfg-tile.has-thumb {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.cfg-mini-thumb {
  width: 40px;
  height: 34px;
  flex: 0 0 40px;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid #9db7d466;
  background: #0e4c78;
}
.cfg-tile-text {
  display: grid;
  text-align: left;
}

.pre-preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 5px;
  border-radius: 10px;
  border: 1.5px solid #cbb894;
  background: linear-gradient(180deg, #ffffff 0%, #f4ebd7 100%);
  color: var(--ink);
  text-align: left;
  min-height: 40px;
  box-shadow: inset 0 1px 0 #ffffffcc, 0 2px 0 #bfa97d;
  transition: transform .13s ease, border-color .13s ease;
}
.pre-preset-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.pre-preset-thumb {
  width: 38px;
  height: 32px;
  flex: 0 0 38px;
  border-radius: 7px;
  overflow: hidden;
  background: #0e4c78;
}
.pre-preset-text {
  display: grid;
  line-height: 1.2;
}
.pre-preset-text small {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}
.pre-preset-text strong {
  font-size: 12px;
  font-weight: 800;
  max-width: 195px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Account & Security: Linked Providers + Password Change */
.linked-provider-list {
  display: grid;
  gap: 8px;
}
.linked-provider-card {
  border-radius: 10px;
  border: 1px solid #dccba9;
  background: #fbf6eb;
  padding: 9px 11px;
  display: grid;
  gap: 8px;
}
.linked-provider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.linked-provider-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.linked-provider-meta strong {
  display: block;
  font-size: 13px;
}
.linked-provider-meta small {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  word-break: break-word;
}
.linked-provider-ico {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: none;
}
.linked-provider-ico.discord {
  background: #5865f2;
  color: #fff;
}
.linked-provider-ico.google {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #d1d5db;
}
.linked-inline-form {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.linked-inline-form input {
  flex: 1 1 160px;
  min-width: 0;
}
.security-pwd-form {
  display: grid;
  gap: 10px;
}

body.dark-mode .picker-card {
  background: linear-gradient(180deg, #1f2c3f 0%, #172130 100%);
  border-color: #364963;
  color: #eef2f8;
  box-shadow: 0 2px 0 #0d141e;
}
body.dark-mode .picker-card.active {
  background: linear-gradient(180deg, #1d3550 0%, #15283d 100%);
  border-color: #53a8ec;
}
body.dark-mode .preset-meta-pill {
  background: #253449;
  color: #cbd5e1;
}
body.dark-mode .pre-preset-btn {
  background: linear-gradient(180deg, #1e2a3b 0%, #151e2c 100%);
  border-color: #364963;
  color: #eef2f8;
  box-shadow: none;
}
body.dark-mode .linked-provider-card {
  background: #151f2e;
  border-color: #2f4158;
}

@media (max-width: 680px) {
  .picker-grid.preset-picker-grid {
    grid-template-columns: 1fr;
  }
}

/* Bot-match surrender button in phase banner */
.btn-surrender {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #fca5a555;
  background: rgba(185, 28, 28, 0.35);
  color: #fee2e2;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  flex: none;
  transition: background .15s, border-color .15s, transform .12s;
}
.btn-surrender:hover {
  background: rgba(220, 38, 38, 0.62);
  border-color: #fca5a5aa;
  transform: translateY(-1px);
}
#ranked-ingame-pill:not([hidden]) ~ .btn-surrender {
  margin-left: 0;
}

/* Multi-player trade offer proposer selection bar */
.offer-proposer-wrap {
  display: grid;
  gap: 8px;
  width: 100%;
}
.offer-proposer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.offer-responses-list {
  display: grid;
  gap: 6px;
}
.offer-resp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 5px 9px;
  border-radius: 9px;
  background: #f5ebd4;
  border: 1px solid #d7c39a;
  font-size: 12.5px;
}
.offer-resp-row.accepted {
  background: #ecfdf5;
  border-color: #86efac;
}
.offer-resp-row.counter {
  background: #eff6ff;
  border-color: #93c5fd;
}
.offer-resp-row.declined {
  opacity: 0.72;
}
.offer-resp-who {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.offer-status-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
}
.offer-status-tag.yes { background: #bbf7d0; color: #166534; }
.offer-status-tag.no { background: #fee2e2; color: #991b1b; }
.offer-status-tag.wait { background: #fef3c7; color: #92400e; }
.offer-status-tag.counter { background: #dbeafe; color: #1e40af; }

body.dark-mode .offer-resp-row {
  background: #1d293b;
  border-color: #364963;
}
body.dark-mode .offer-resp-row.accepted {
  background: #103221;
  border-color: #22794b;
}
body.dark-mode .offer-resp-row.counter {
  background: #172a45;
  border-color: #3b82f6;
}
