/* =========================================================
   SPYREX – Styles
   ========================================================= */

:root {
  --bg: #0b1210;
  --bg-soft: #101a16;
  --panel: rgba(20, 31, 26, 0.82);
  --panel-solid: #141f1a;
  --panel-border: rgba(255, 255, 255, 0.075);
  --panel-border-strong: rgba(255, 255, 255, 0.14);
  --text: #eaf2ed;
  --text-soft: #c6d4cc;
  --muted: #8fa39a;
  --accent: #5ee6ac;
  --accent-strong: #34d399;
  --accent-deep: #0f7a56;
  --amber: #f6c453;
  --danger: #f87171;
  --board-light: #efdcb9;
  --board-dark: #b07c55;
  --board-light-2: #f3e3c4;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --shadow-lg: 0 30px 70px -25px rgba(0, 0, 0, 0.8);
  --shadow-md: 0 16px 36px -20px rgba(0, 0, 0, 0.75);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

.noscript {
  padding: 14px 20px;
  text-align: center;
  background: #3a2020;
  color: #ffd9d9;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

html, body {
  min-height: 100%;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 12% -10%, rgba(48, 148, 110, 0.22), transparent 62%),
    radial-gradient(900px 620px at 105% 0%, rgba(132, 92, 30, 0.14), transparent 58%),
    radial-gradient(800px 800px at 50% 115%, rgba(22, 92, 74, 0.18), transparent 60%),
    linear-gradient(160deg, #0c1512 0%, #0a100e 55%, #0b1412 100%);
  background-attachment: fixed;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }
button { color: inherit; }
img { -webkit-user-drag: none; user-select: none; }

::selection { background: rgba(52, 211, 153, 0.3); }

.page-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.017) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.017) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at 50% 30%, black, transparent 78%);
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 34px;
}

/* ---------- Anmeldung ---------- */

.auth-screen {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 40px 24px;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 450px);
  align-items: center;
  gap: clamp(44px, 7vw, 100px);
  width: min(1060px, 100%);
  margin: auto;
}

.auth-showcase {
  display: flex;
  min-width: 0;
  min-height: 590px;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 14px 0;
}

.auth-brand { margin-bottom: auto; }
.auth-showcase-copy { max-width: 470px; margin: auto 0 24px; }
.auth-eyebrow {
  margin: 0 0 15px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.18em;
}
.auth-showcase-copy h2 {
  max-width: 440px;
  margin: 0;
  font-size: clamp(38px, 4.5vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.055em;
}
.auth-showcase-copy > p:last-child {
  max-width: 390px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}
.auth-showcase-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 220px;
  aspect-ratio: 1;
  padding: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 17px;
  background: linear-gradient(145deg, #253b31, #15231d);
  box-shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.9), 0 0 55px rgba(52, 211, 153, 0.08);
  transform: rotate(-5deg);
}
.auth-showcase-board span {
  display: grid;
  place-items: center;
  background: rgba(235, 224, 199, 0.86);
}
.auth-showcase-board span:nth-child(8n + 1),
.auth-showcase-board span:nth-child(8n + 3),
.auth-showcase-board span:nth-child(8n + 6),
.auth-showcase-board span:nth-child(8n + 8) {
  background: rgba(176, 124, 85, 0.88);
}
.auth-showcase-board img { width: 72%; height: 72%; object-fit: contain; }
.auth-showcase-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 26px 0 0;
  color: var(--text-soft);
  font-size: 12px;
}
.auth-showcase-note span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(94, 230, 172, 0.7);
}

.auth-card {
  width: 100%;
  padding: clamp(27px, 3.4vw, 40px);
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 24px;
  background:
    linear-gradient(150deg, rgba(27, 42, 35, 0.97), rgba(14, 23, 19, 0.98));
  box-shadow: 0 34px 90px -38px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.auth-card h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: -0.045em; }
.auth-intro { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 24px 0 21px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.24);
}

.auth-tab {
  min-height: 41px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.auth-tab.active {
  color: var(--accent);
  background: linear-gradient(145deg, rgba(94, 230, 172, 0.14), rgba(94, 230, 172, 0.07));
  border-color: rgba(94, 230, 172, 0.19);
}

.auth-form { display: flex; flex-direction: column; }
.auth-label { margin: 0 0 7px; color: var(--text-soft); font-size: 12px; font-weight: 650; }
.auth-input {
  width: 100%;
  min-height: 46px;
  margin-bottom: 14px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  outline: none;
  background: rgba(5, 11, 8, 0.42);
  color: var(--text);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.auth-input:focus { border-color: rgba(94, 230, 172, 0.65); background: rgba(5, 11, 8, 0.62); box-shadow: 0 0 0 3px rgba(94, 230, 172, 0.1); }
.auth-confirm[hidden] { display: none; }
.skin-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  margin: -2px 0 16px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.2);
}
.skin-preview-image {
  display: grid;
  flex: 0 0 58px;
  width: 58px;
  height: 60px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(94, 230, 172, 0.08), rgba(255, 255, 255, 0.025));
}
.skin-preview-image img { width: auto; height: 58px; max-width: 56px; object-fit: contain; }
.skin-placeholder { color: var(--muted); font-size: 24px; font-weight: 650; }
.skin-preview strong { color: var(--text-soft); font-size: 12px; }
.skin-preview p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.skin-load { margin-top: 7px; padding: 5px 10px; border: 1px solid rgba(94, 230, 172, .3); border-radius: 7px; background: rgba(94, 230, 172, .08); color: var(--accent); font: inherit; font-size: 10.5px; font-weight: 700; cursor: pointer; transition: background .18s, border-color .18s; }
.skin-load:hover { background: rgba(94, 230, 172, .15); border-color: rgba(94, 230, 172, .45); }
.skin-load[hidden] { display: none; }
.auth-hint, .auth-footnote { margin: -2px 0 16px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.auth-footnote { margin: 16px 0 0; font-size: 10.5px; }
.auth-footnote a, .auth-consent a { color: var(--accent); }
.auth-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 0 15px;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.55;
}
.auth-consent input { flex: 0 0 auto; width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--accent); }
.auth-consent span { min-width: 0; }
.auth-message { margin: 0 0 13px; color: #ffaaaa; font-size: 12px; line-height: 1.45; }
.auth-message a { color: #ffd1a5; font-weight: 700; }
.auth-submit { width: 100%; min-height: 47px; }
.auth-submit:disabled { opacity: 0.65; cursor: wait; }
.account-name { max-width: 150px; overflow: hidden; color: var(--text-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn { padding: 9px 12px; font-size: 12px; }

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: inherit;
  border-radius: 14px;
  outline-offset: 4px;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: linear-gradient(150deg, #1d3b30, #12241d 60%, #0d1915);
  border: 1px solid rgba(94, 230, 172, 0.26);
  box-shadow: 0 12px 26px -14px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-logo img {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 20px;
  letter-spacing: -0.03em;
  font-weight: 750;
}

.brand-text small {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease, color 0.18s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.075);
  border-color: var(--panel-border-strong);
  color: var(--text);
}

.icon-btn:active { transform: scale(0.95); }

.ico {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.ico-sound .wave { opacity: 1; transition: opacity 0.15s; }
.ico-muted { display: none; }
.sound-off .ico-sound { display: none; }
.sound-off .ico-muted { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: translateY(1px) scale(0.99); }

.btn-primary {
  background: linear-gradient(180deg, #46dfa4, #2bbf87);
  color: #06241a;
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 24px -12px rgba(52, 211, 153, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #5cebb2, #34cf95);
  box-shadow: 0 14px 28px -12px rgba(52, 211, 153, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-primary .ico { width: 17px; height: 17px; stroke-width: 2.1; }

.btn-ghost {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--panel-border);
  color: var(--text-soft);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.085);
  border-color: var(--panel-border-strong);
  color: var(--text);
}

.btn-lg { padding: 14px 22px; font-size: 15px; border-radius: 13px; }

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 26px;
  align-items: start;
}

.board-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* ---------- Player strips ---------- */

.player-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 12px;
  border-radius: 15px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.028);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.player-strip.active {
  background: rgba(94, 230, 172, 0.06);
  border-color: rgba(94, 230, 172, 0.24);
  box-shadow: 0 0 0 1px rgba(94, 230, 172, 0.05), 0 12px 30px -24px rgba(94, 230, 172, 0.7);
}

.player-main {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.player-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(160deg, #21382e, #122019);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
}

.player-avatar img {
  width: 26px;
  height: 26px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.player-strip.active .player-avatar {
  border-color: rgba(94, 230, 172, 0.45);
  box-shadow: 0 0 0 3px rgba(94, 230, 172, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.player-meta { min-width: 0; }

.player-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: 0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-name .chip {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
}

.player-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  min-height: 17px;
  font-size: 11.5px;
  color: var(--muted);
}

.captures {
  display: flex;
  align-items: center;
  gap: 1px;
  min-height: 16px;
}

.captures img {
  width: 16px;
  height: 16px;
  margin-right: -4px;
  opacity: 0.85;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.captures .material {
  margin-left: 9px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.clock {
  flex: none;
  min-width: 86px;
  text-align: center;
  padding: 8px 12px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.clock.running {
  color: var(--text);
  background: rgba(94, 230, 172, 0.09);
  border-color: rgba(94, 230, 172, 0.3);
}

.clock.low {
  color: #ffd2d2;
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.4);
  animation: clockPulse 1.1s ease-in-out infinite;
}

.clock.hidden { display: none; }

@keyframes clockPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.62; }
}

/* ---------- Board ---------- */

.board-wrap {
  position: relative;
  width: min(100%, 660px, calc(100dvh - 268px));
  min-width: 0;
  margin: 0 auto;
  border-radius: var(--radius-lg);
}

.board-frame {
  padding: 9px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.1), transparent 34%),
    linear-gradient(160deg, #2b211a, #17110d 62%, #120d0a);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.sq {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  outline: none;
  cursor: default;
}

.sq.light { background: var(--board-light); }
.sq.dark { background: var(--board-dark); }

.sq:focus-visible {
  outline: 3px solid #8df3c8;
  outline-offset: -3px;
  z-index: 7;
}

.sq.playable { cursor: pointer; }

.sq .piece {
  width: 88%;
  height: 88%;
  object-fit: contain;
  pointer-events: none;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 3px 2px rgba(30, 16, 6, 0.32));
  transition: transform 0.1s ease;
}

.sq.playable:hover .piece { transform: translateY(-2px) scale(1.03); }

/* last move */
.sq.last-move::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 209, 102, 0.42);
  z-index: 1;
  pointer-events: none;
}

/* selected */
.sq.selected::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 4px rgba(28, 160, 116, 0.92), inset 0 0 26px rgba(28, 160, 116, 0.35);
  z-index: 4;
  pointer-events: none;
}

/* legal target dot */
.sq.target::after {
  content: "";
  position: absolute;
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: rgba(18, 92, 68, 0.44);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
  z-index: 5;
  pointer-events: none;
}

/* legal capture: ring */
.sq.target.capture::after {
  width: auto;
  height: auto;
  inset: 4%;
  border-radius: 50%;
  background: transparent;
  border: 4px solid rgba(18, 92, 68, 0.4);
  box-shadow: none;
}

.sq.target:hover::after { transform: scale(1.08); }

.sq.drop-hover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  box-shadow: inset 0 0 0 4px rgba(240, 214, 120, 0.95), inset 0 0 24px rgba(255, 232, 150, 0.35);
  pointer-events: none;
}

/* check */
.sq.check::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(220, 45, 45, 0.9), rgba(190, 24, 24, 0.45) 46%, transparent 74%);
  z-index: 3;
  pointer-events: none;
  animation: checkPulse 1.2s ease-in-out infinite;
}

@keyframes checkPulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 0.55; }
}

/* coordinates */
.coord {
  position: absolute;
  z-index: 6;
  font-size: clamp(7px, 1.25vw, 10.5px);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  opacity: 0.72;
  letter-spacing: 0.03em;
}

.coord.file { right: 4px; bottom: 3px; }
.coord.rank { left: 4px; top: 3px; }

.sq.light .coord { color: #7d5c3e; }
.sq.dark .coord { color: #f5e6cc; opacity: 0.78; }

/* drag */
.sq.drag-origin .piece { opacity: 0.22; }

.drag-ghost {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  transform: translate(-50%, -52%);
  will-change: left, top;
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.45));
  transition: none;
}

.drag-ghost img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body.dragging { cursor: grabbing; }

/* ---------- Overlays ---------- */

.board-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(7, 12, 10, 0.6);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: fadeIn 0.22s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.result-card {
  width: min(360px, 100%);
  padding: 26px 24px 20px;
  text-align: center;
  border-radius: 20px;
  background: linear-gradient(165deg, rgba(31, 48, 40, 0.95), rgba(16, 26, 22, 0.97));
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  animation: popIn 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes popIn {
  from { transform: scale(0.94) translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.result-emblem {
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  font-size: 30px;
  border-radius: 50%;
  color: #0b1b14;
  background: linear-gradient(160deg, #7df0be, #34d399);
  box-shadow: 0 12px 30px -12px rgba(52, 211, 153, 0.9);
}

.result-emblem img {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

.result-emblem.draw {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.result-card h2 {
  margin: 0 0 6px;
  font-size: 23px;
  letter-spacing: -0.02em;
}

.result-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 12px;
}

.link-btn {
  background: none;
  border: 0;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  border-radius: 8px;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.2);
  text-underline-offset: 3px;
}

.link-btn:hover { color: var(--text); }

.promotion-card {
  padding: 18px 18px 12px;
  border-radius: 18px;
  text-align: center;
  background: linear-gradient(165deg, rgba(31, 48, 40, 0.97), rgba(16, 26, 22, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-lg);
  animation: popIn 0.2s ease;
}

.promotion-card p {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 700;
}

.promotion-choices {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.promotion-choices button {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #e9d6b4;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.promotion-choices button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -12px rgba(0, 0, 0, 0.9), inset 0 0 0 2px var(--accent);
}

.promotion-choices img {
  width: 48px;
  height: 48px;
  pointer-events: none;
}

/* ---------- Sidebar ---------- */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-width: 0;
}

.card {
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: linear-gradient(165deg, rgba(25, 38, 32, 0.86), rgba(15, 24, 20, 0.9));
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.status-card { padding: 17px 18px 18px; }

.daily-reward-card { padding-bottom: 14px; }
.daily-reward-summary {
  margin: 0;
  padding: 12px 15px 3px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}
.daily-reward-summary strong { color: var(--accent); }
.daily-reward-detail {
  min-height: 34px;
  margin: 0;
  padding: 4px 15px 11px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.daily-reward-button { width: calc(100% - 30px); margin: 0 15px; }
.daily-reward-button:disabled { opacity: 0.62; cursor: default; }

.invitations-card { overflow: hidden; }
.invitations-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 10px 12px 12px;
  list-style: none;
}
.invitation-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(94, 230, 172, 0.12);
  border-radius: 10px;
  background: rgba(94, 230, 172, 0.045);
  color: var(--text-soft);
  font-size: 11.5px;
}
.invitation-entry > span { min-width: 0; overflow-wrap: anywhere; }
.invitation-accept { flex: none; padding: 7px 10px; font-size: 11px; }
.invitation-actions { display: flex; flex: none; gap: 5px; }
.invitation-decline { padding: 6px 8px; border: 1px solid rgba(255,255,255,.1); border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 10px; cursor: pointer; }
.invitation-decline:hover { border-color: rgba(248,113,113,.38); color: #ffaaaa; }
.invite-toast .invitation-decline { flex: 1; padding: 8px 10px; border-radius: 9px; font-size: 11px; }
.invite-toast {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 210;
  width: min(350px, calc(100% - 32px));
  padding: 14px;
  border: 1px solid rgba(94, 230, 172, .3);
  border-radius: 15px;
  background: rgba(20, 34, 28, .98);
  box-shadow: 0 20px 55px rgba(0,0,0,.5);
  animation: casino-panel-in 240ms ease-out both;
}
.invite-toast[hidden] { display: none; }
.invite-toast p { margin: 0 0 10px; color: var(--text); font-size: 13px; font-weight: 700; }
.invite-toast > div { display: flex; gap: 8px; }
.invite-toast .btn { flex: 1; padding: 8px 10px; font-size: 11px; }
.invitation-decline.invite-toast-decline { border-color: rgba(255,255,255,.12); }
.invitation-decline.invite-toast-decline:hover { border-color: rgba(248,113,113,.38); color: #ffaaaa; }
.matchmaking-cancel { width: 100%; margin-top: 12px; color: #ffb1a7; }
.matchmaking-cancel[hidden] { display: none; }

.friends-card { overflow: hidden; padding-bottom: 12px; }
.friend-count {
  min-width: 25px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(94, 230, 172, 0.1);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
}
.friend-form {
  display: flex;
  gap: 7px;
  padding: 11px 12px 7px;
}
.friend-input {
  width: 100%;
  min-width: 0;
  min-height: 37px;
  padding: 8px 10px;
  border: 1px solid var(--panel-border-strong);
  border-radius: 9px;
  outline: none;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  font-size: 11px;
}
.friend-input:focus { border-color: rgba(94, 230, 172, 0.55); }
.friend-add { flex: none; padding: 7px 10px; font-size: 10.5px; }
.friend-message {
  margin: 3px 12px 7px;
  color: var(--accent);
  font-size: 10.5px;
  line-height: 1.4;
}
.friend-message.error { color: #ffaaaa; }
.friends-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 5px 12px;
  list-style: none;
}
.friend-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 6px 7px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-soft);
  font-size: 11px;
}
.friend-entry-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-entry-actions { display: flex; flex: none; gap: 5px; }
.friend-entry-actions button {
  padding: 5px 7px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  font-size: 9.5px;
  cursor: pointer;
}
.friend-entry-actions button:hover { color: var(--accent); border-color: rgba(94, 230, 172, 0.28); }
.friend-requests { padding-top: 5px; }
.friend-requests h4 {
  margin: 7px 14px 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.friends-empty {
  margin: 0;
  padding: 6px 17px 3px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.leaderboard-card { overflow: hidden; }
.leaderboard-head { padding-bottom: 9px; }
.leaderboard-refresh {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.leaderboard-refresh:hover { color: var(--accent); background: rgba(94, 230, 172, 0.08); }
.leaderboard-refresh:disabled { opacity: 0.5; cursor: wait; }
.leaderboard-player {
  margin: 0;
  padding: 11px 15px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}
.leaderboard-player strong { color: var(--accent); }
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 7px 10px 9px;
  list-style: none;
}
.leaderboard-entry {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 31px;
  padding: 4px 7px;
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 11.5px;
}
.leaderboard-entry.current { background: rgba(94, 230, 172, 0.09); color: var(--accent); }
.leaderboard-rank { color: var(--muted); font-family: var(--mono); font-size: 10px; text-align: center; }
.leaderboard-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-score { color: var(--text); font-family: var(--mono); font-size: 11px; font-weight: 700; }
.leaderboard-entry.current .leaderboard-score { color: var(--accent); }
.leaderboard-empty { padding: 10px 7px; color: var(--muted); font-size: 11px; }
.leaderboard-note { margin: 0; padding: 0 15px 12px; color: var(--muted); font-size: 10px; line-height: 1.4; }

.status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(94, 230, 172, 0.09);
  border: 1px solid rgba(94, 230, 172, 0.22);
}
.pill.searching {
  color: #ffd978;
  border-color: rgba(246,196,83,.52);
  background: rgba(246,196,83,.12);
  animation: matchmaking-pulse 1.5s ease-in-out infinite;
}
@keyframes matchmaking-pulse { 50% { box-shadow: 0 0 0 4px rgba(246,196,83,.08); } }

.turn-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.turn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 230, 172, 0.14);
}

.turn-badge.thinking .turn-dot {
  animation: blink 0.9s ease-in-out infinite;
}

.turn-badge.over .turn-dot { background: var(--muted); box-shadow: none; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.status-card h2 {
  margin: 0 0 5px;
  font-size: 19.5px;
  font-weight: 700;
  letter-spacing: -0.022em;
}

.status-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.engine-info {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 13px;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.045);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-soft);
}

.engine-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.engine-bars i {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
  animation: bar 1s ease-in-out infinite;
}

.engine-bars i:nth-child(1) { height: 5px; animation-delay: 0s; }
.engine-bars i:nth-child(2) { height: 8px; animation-delay: 0.15s; }
.engine-bars i:nth-child(3) { height: 11px; animation-delay: 0.3s; }

.engine-info.idle .engine-bars i { animation-play-state: paused; opacity: 0.5; }

@keyframes bar {
  0%, 100% { transform: scaleY(0.45); }
  50% { transform: scaleY(1); }
}

.share-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid rgba(94, 230, 172, 0.32);
  background: linear-gradient(180deg, rgba(94, 230, 172, 0.16), rgba(52, 211, 153, 0.08));
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s;
}

.share-cta:hover { background: rgba(94, 230, 172, 0.2); }
.share-cta:active { transform: scale(0.99); }
.share-cta .ico { width: 17px; height: 17px; }

.share-cta.pulse { animation: sharePulse 1.8s ease-out 2; }

@keyframes sharePulse {
  0% { box-shadow: 0 0 0 0 rgba(94, 230, 172, 0.45); }
  100% { box-shadow: 0 0 0 16px rgba(94, 230, 172, 0); }
}

/* moves */

.moves-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-head h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.move-total {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.moves-scroll {
  max-height: 232px;
  overflow-y: auto;
  padding: 8px 10px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.moves-scroll::-webkit-scrollbar { width: 8px; }
.moves-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.13);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.moves-empty {
  margin: 10px 8px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.move-row {
  display: grid;
  grid-template-columns: 34px 1fr 1fr;
  align-items: center;
  gap: 3px;
  padding: 1px 0;
}

.move-row:nth-child(odd) { background: rgba(255, 255, 255, 0.018); border-radius: 8px; }

.move-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  padding-right: 6px;
}

.san {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-start;
  min-height: 27px;
  padding: 3px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12.5px;
  text-align: left;
  cursor: default;
  white-space: nowrap;
}

.san.current {
  background: rgba(94, 230, 172, 0.13);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(94, 230, 172, 0.2);
}

.san .san-piece {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}

/* actions */

.action-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 4px 9px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.028);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.16s, color 0.16s, border-color 0.16s, transform 0.1s;
}

.action-btn .ico { width: 18px; height: 18px; }

.action-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--panel-border);
  color: var(--text);
}

.action-btn:active { transform: scale(0.96); }

.action-btn:disabled {
  opacity: 0.36;
  cursor: not-allowed;
  transform: none;
}

.action-btn[data-action="resign"]:hover { color: #ffb4b4; border-color: rgba(248, 113, 113, 0.25); background: rgba(248, 113, 113, 0.07); }

.sidebar-foot {
  margin: 0 2px;
  font-size: 11.5px;
  line-height: 1.55;
  color: rgba(143, 163, 154, 0.75);
}

/* ---------- Modals ---------- */

.modal {
  width: min(560px, calc(100% - 28px));
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--text);
  overflow: visible;
}

.modal::backdrop {
  background: rgba(4, 8, 7, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.18s ease;
}

.modal[open] { animation: modalIn 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.05); }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal-card {
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(700px 320px at 20% -20%, rgba(54, 160, 121, 0.16), transparent 70%),
    linear-gradient(165deg, #1a2a23, #101a16 70%);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  max-height: min(90dvh, 820px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  scrollbar-width: thin;
}

.modal-head, .modal-foot { flex: none; }

.modal-body {
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.modal-head p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.modal-head .icon-btn { width: 36px; height: 36px; flex: none; }

.modal-body { padding: 20px 22px 22px; }

.modal-foot {
  padding: 16px 22px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-foot .btn { width: 100%; }

.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  margin-bottom: 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-label.spaced { margin-top: 18px; }

.field-hint {
  margin: 9px 0 0;
  font-size: 11.5px;
  color: rgba(143, 163, 154, 0.85);
  line-height: 1.5;
}

.modal-input {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid var(--panel-border-strong);
  border-radius: 10px;
  outline: none;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
}
.modal-input:focus {
  border-color: rgba(94, 230, 172, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 230, 172, 0.09);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.mode-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 12px 12px 11px;
  text-align: left;
  border-radius: 13px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s, transform 0.1s;
}

.mode-option:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--panel-border-strong); }
.mode-option:active { transform: scale(0.985); }

.mode-option.active {
  border-color: rgba(94, 230, 172, 0.5);
  background: linear-gradient(170deg, rgba(94, 230, 172, 0.14), rgba(52, 211, 153, 0.05));
  box-shadow: 0 0 0 1px rgba(94, 230, 172, 0.12), 0 12px 26px -20px rgba(52, 211, 153, 0.8);
}

.mode-icon { font-size: 19px; line-height: 1.2; margin-bottom: 2px; }
.mode-name { font-size: 13px; font-weight: 650; letter-spacing: -0.01em; }
.mode-desc { font-size: 10.5px; color: var(--muted); }

.segmented {
  display: flex;
  gap: 5px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.segmented button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.segmented button:hover { color: var(--text-soft); }

.segmented button.active {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  box-shadow: 0 4px 12px -6px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.mini-piece { font-size: 16px; line-height: 1; }
.light-piece { color: #f7f2e9; text-shadow: 0 0 1px #000, 0 1px 2px rgba(0, 0, 0, 0.7); }
.dark-piece { color: #1a1512; text-shadow: 0 0 1px rgba(255, 255, 255, 0.35); }

.skill-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.skill-row button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.028);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.skill-row button:hover { background: rgba(255, 255, 255, 0.06); }
.skill-row button:active { transform: scale(0.97); }

.skill-row button strong { font-size: 15px; font-weight: 700; }
.skill-row button small { font-size: 9.5px; color: var(--muted); letter-spacing: 0.01em; }

.skill-row button.active {
  border-color: rgba(94, 230, 172, 0.5);
  background: rgba(94, 230, 172, 0.12);
}

.skill-row button.active small { color: var(--accent); }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-row button {
  padding: 8px 13px;
  border-radius: 9px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.028);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.chip-row button:hover { color: var(--text-soft); background: rgba(255, 255, 255, 0.06); }

.chip-row button.active {
  border-color: rgba(94, 230, 172, 0.45);
  background: rgba(94, 230, 172, 0.12);
  color: var(--accent);
}

.mode-hint {
  margin: 4px 0 0;
  padding: 11px 13px;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.045);
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

#computerOptions[hidden],
#timeOptions[hidden],
.share-cta[hidden],
.engine-info[hidden],
.board-overlay[hidden],
.toast[hidden] { display: none !important; }

/* share */

.share-card .modal-body { padding-top: 18px; }

.share-link-row {
  display: flex;
  gap: 7px;
}

.share-link-row input {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(0, 0, 0, 0.32);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 11.5px;
  outline: none;
}

.share-link-row input:focus {
  border-color: rgba(94, 230, 172, 0.5);
  box-shadow: 0 0 0 3px rgba(94, 230, 172, 0.08);
}

.share-actions { display: flex; gap: 8px; margin-top: 10px; }

.casino-open { gap: 7px; padding: 9px 12px; font-size: 12px; }
.cookie-clicker-link { gap: 7px; padding: 9px 12px; color: var(--text-soft); font-size: 12px; text-decoration: none; }
.cookie-clicker-link:hover { border-color: rgba(240, 191, 116, 0.3); color: var(--amber); }
.casino-dialog { width: min(900px, calc(100% - 28px)); }
.casino-card { background:
  radial-gradient(700px 360px at 50% -12%, rgba(246, 196, 83, 0.17), transparent 70%),
  radial-gradient(500px 380px at 100% 100%, rgba(118, 30, 43, 0.16), transparent 75%),
  linear-gradient(155deg, #182820, #0d1712 72%);
  border-color: rgba(224, 179, 86, 0.31);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.casino-card .modal-body { flex: 1 1 auto; max-height: none; overflow-y: auto; }
.casino-card .modal-head { border-bottom-color: rgba(246, 196, 83, 0.16); }
.casino-card .modal-head h2 { color: #fff3cc; letter-spacing: 0.015em; }
.casino-card .modal-head > div > p:last-child { color: #b6a982; }
.casino-body { padding: 18px 22px 20px; }
.casino-eyebrow {
  margin: 0 0 6px !important;
  color: #f3cb70 !important;
  font-size: 9px !important;
  font-weight: 750;
  letter-spacing: 0.16em;
}
.casino-marquee {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  margin: 0 0 16px;
  padding: 12px 15px 11px;
  border: 1px solid rgba(246, 196, 83, 0.55);
  border-radius: 13px;
  background:
    radial-gradient(ellipse at 50% 0, rgba(247, 204, 107, 0.22), transparent 72%),
    linear-gradient(100deg, #381a20, #5b252b 50%, #31181d);
  box-shadow: inset 0 1px 0 rgba(255, 235, 180, 0.2), 0 9px 28px rgba(0, 0, 0, 0.28);
  text-align: center;
}
.casino-marquee::before, .casino-marquee::after {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(transparent, #ffe9a8, transparent);
  box-shadow: 0 0 11px rgba(255, 213, 112, 0.76);
  content: "";
}
.casino-marquee::before { left: 5px; }
.casino-marquee::after { right: 5px; }
.casino-marquee-title {
  display: block;
  color: #ffeab0;
  font-family: var(--font);
  font-size: clamp(17px, 3vw, 23px);
  font-weight: 900;
  letter-spacing: 0.13em;
  line-height: 1.15;
  text-shadow: 0 0 8px rgba(255, 219, 132, 0.8), 0 2px 0 #7e4c1c;
}
.casino-marquee-subtitle {
  display: block;
  margin-top: 4px;
  color: #e8c982;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.19em;
}
.casino-marquee-lights { color: #ffe79e; font-size: 13px; letter-spacing: 0.13em; text-shadow: 0 0 9px #f7c75e; }
.casino-marquee-center { display: block; min-width: 0; }
.casino-floor {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(218px, 0.78fr);
  align-items: start;
  gap: 16px;
}
.casino-main { min-width: 0; }
.casino-side { display: grid; gap: 11px; min-width: 0; }
.casino-balance {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-color: rgba(246, 196, 83, 0.31);
  border-radius: 14px;
  background:
    radial-gradient(circle at 85% 5%, rgba(246, 196, 83, 0.13), transparent 44%),
    linear-gradient(145deg, rgba(38, 48, 34, 0.94), rgba(15, 23, 18, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 25px rgba(0, 0, 0, 0.19);
}
.casino-balance > span:first-child { color: #c6b990; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.casino-balance strong {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: #ffe19a;
  font-family: var(--mono);
  font-size: clamp(25px, 3vw, 32px);
  line-height: 1.15;
  text-shadow: 0 0 16px rgba(246, 196, 83, 0.24);
}
.casino-balance small { color: #d3c59f; font-family: var(--font); font-size: 11px; font-weight: 600; }
.casino-balance-status { display: flex; align-items: center; gap: 6px; color: #91aa88; font-size: 9px; }
.casino-balance-status i { width: 6px; height: 6px; border-radius: 50%; background: #76d49a; box-shadow: 0 0 9px rgba(118, 212, 154, 0.75); }
.casino-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 0 0 11px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.22);
}
.casino-tab {
  min-height: 39px;
  padding: 7px 5px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.casino-tab span { margin-right: 3px; }
.casino-tab:hover { color: var(--text); transform: translateY(-1px); }
.casino-tab.active {
  border-color: rgba(246, 196, 83, 0.42);
  background: linear-gradient(145deg, rgba(246, 196, 83, 0.17), rgba(246, 196, 83, 0.07));
  color: #ffe095;
  box-shadow: inset 0 1px 0 rgba(255, 242, 205, 0.09), 0 3px 12px rgba(0, 0, 0, 0.15);
}
.casino-game-panel {
  min-height: 190px;
  padding: 14px;
  border: 1px solid rgba(185, 143, 63, 0.25);
  border-radius: 16px;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(39, 111, 72, 0.42), transparent 72%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 4px),
    linear-gradient(145deg, #123b2b, #0b281f 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), inset 0 -18px 34px rgba(0, 0, 0, 0.17), 0 12px 24px rgba(0, 0, 0, 0.17);
  animation: casino-panel-in 320ms cubic-bezier(.2,.8,.2,1) both;
}
.casino-game-panel[hidden] { display: none; }
.casino-game-hint { margin: 0 0 4px; color: #b8cdb8; text-align: center; font-size: 10px; line-height: 1.5; }
.casino-machine {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 5px 0 10px;
  padding: 13px;
  border: 2px solid #a87a31;
  border-radius: 17px;
  background:
    linear-gradient(145deg, rgba(246, 196, 83, 0.13), transparent 42%),
    linear-gradient(145deg, #40231d, #211915 72%);
  box-shadow: inset 0 1px 0 rgba(255, 238, 188, 0.18), 0 0 0 4px rgba(10, 20, 15, 0.48), 0 15px 25px rgba(0, 0, 0, 0.3);
}
.casino-reel {
  display: grid;
  min-height: 96px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff8e4, #e0d1b3);
  color: #172019;
  font-size: 48px;
  text-shadow: 0 2px 1px rgba(0, 0, 0, 0.12);
  transform: translateZ(0);
}
.casino-machine.is-spinning .casino-reel { animation: casino-reel-roll 170ms linear infinite; }
.casino-machine.is-spinning .casino-reel:nth-child(2) { animation-delay: 45ms; }
.casino-machine.is-spinning .casino-reel:nth-child(3) { animation-delay: 90ms; }
.casino-machine.has-win .casino-reel { animation: casino-reel-win 560ms cubic-bezier(.18,.8,.25,1.3) both; }
.casino-coin-stage, .casino-wheel-stage {
  position: relative;
  display: grid;
  min-height: 137px;
  place-items: center;
  perspective: 700px;
}
.casino-coin-stage { min-height: 130px; }
.casino-coin {
  position: relative;
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  border: 5px solid #e8ad39;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #fff0a8, #f3c14f 46%, #b77719 100%);
  box-shadow: inset 0 0 0 3px rgba(111, 63, 8, 0.28), 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 22px rgba(246, 196, 83, 0.16);
  color: #55370b;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 900;
  transform-style: preserve-3d;
}
.casino-coin::before { position: absolute; inset: 9px; border: 1px dashed rgba(102, 62, 12, 0.48); border-radius: 50%; content: ""; }
.coin-heads, .coin-tails { position: absolute; backface-visibility: hidden; }
.coin-tails { transform: rotateY(180deg); }
.casino-coin[data-side="tails"] { transform: rotateY(180deg); }
.casino-coin.is-spinning { animation: casino-coin-flip 520ms ease-in-out infinite; }
.casino-coin.has-win[data-side="heads"] { animation: casino-coin-land-heads 520ms cubic-bezier(.18,.8,.25,1.3) both; }
.casino-coin.has-win[data-side="tails"] { animation: casino-coin-land-tails 520ms cubic-bezier(.18,.8,.25,1.3) both; }
.casino-wheel-stage { min-height: 150px; }
.casino-wheel-pointer { position: absolute; z-index: 2; top: 3px; color: #fff2bd; font-size: 20px; text-shadow: 0 2px 5px #000; }
.casino-wheel {
  display: grid;
  width: 124px;
  height: 124px;
  place-items: center;
  border: 7px solid #d5a440;
  border-radius: 50%;
  background: repeating-conic-gradient(from -6deg, #a9383c 0deg 30deg, #17201c 30deg 60deg);
  box-shadow: inset 0 0 0 4px #17201c, inset 0 0 0 6px rgba(246, 196, 83, 0.8), 0 12px 28px rgba(0, 0, 0, 0.34);
  transition: background 250ms ease;
}
.casino-wheel::before { position: absolute; width: 35px; height: 35px; border: 3px solid #e8c878; border-radius: 50%; background: #18221c; content: ""; }
.casino-wheel > span { z-index: 1; display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; background: #d3a645; color: #202016; font-family: var(--mono); font-size: 11px; font-weight: 900; }
.casino-wheel[data-result="green"] { background: conic-gradient(from -6deg, #238456 0deg 30deg, #17201c 30deg 60deg, #a9383c 60deg 90deg, #17201c 90deg 120deg, #a9383c 120deg 150deg, #17201c 150deg 180deg, #a9383c 180deg 210deg, #17201c 210deg 240deg, #a9383c 240deg 270deg, #17201c 270deg 300deg, #a9383c 300deg 330deg, #17201c 330deg 360deg); }
.casino-wheel[data-result="red"] { background: repeating-conic-gradient(from 6deg, #a9383c 0deg 30deg, #17201c 30deg 60deg); }
.casino-wheel[data-result="black"] { background: repeating-conic-gradient(from 36deg, #a9383c 0deg 30deg, #17201c 30deg 60deg); }
.casino-wheel.is-spinning { animation: casino-wheel-spin 2.3s cubic-bezier(.12,.72,.15,1) both; }
.casino-wheel.has-win { filter: drop-shadow(0 0 13px rgba(246, 196, 83, 0.55)); }
.casino-choice-row { display: flex; justify-content: center; gap: 8px; margin: 0 0 9px; }
.casino-choice {
  min-width: 85px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.casino-choice:hover { transform: translateY(-1px); }
.casino-choice.selected { border-color: rgba(246, 196, 83, 0.6); background: rgba(246, 196, 83, 0.12); color: var(--amber); }
.casino-choice.red.selected { border-color: rgba(231, 95, 95, 0.65); background: rgba(231, 95, 95, 0.13); color: #ff9a94; }
.casino-choice.black.selected { border-color: rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.1); color: #fff; }
.casino-choice.green.selected { border-color: rgba(94, 230, 172, 0.5); background: rgba(94, 230, 172, 0.1); color: var(--accent); }
.casino-controls {
  margin-top: 11px;
  padding: 13px;
  border: 1px solid rgba(246, 196, 83, 0.17);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(25, 30, 23, 0.9), rgba(10, 17, 13, 0.82));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.casino-controls label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 7px; color: var(--text-soft); font-size: 11px; font-weight: 650; }
.casino-controls label span { color: var(--muted); font-size: 10px; font-weight: 500; }
.casino-bet-row { display: flex; gap: 8px; }
.casino-input {
  width: 135px;
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid var(--panel-border-strong);
  border-radius: 10px;
  outline: none;
  background: rgba(0, 0, 0, 0.26);
  color: var(--text);
}
.casino-input:focus { border-color: rgba(246, 196, 83, 0.55); }
.casino-spin { flex: 1; background: linear-gradient(145deg, #f8d77e, #d3932f 68%, #b77723); color: #261b0c; font-weight: 850; letter-spacing: 0.015em; text-shadow: 0 1px rgba(255,255,255,.25); transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease; }
.casino-spin:hover { background: linear-gradient(145deg, #ffe7a4, #edb04c); }
.casino-spin:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(229, 155, 48, 0.22); }
.casino-spin:disabled { opacity: 0.58; cursor: wait; }
.casino-quick-bets { display: flex; gap: 6px; margin-top: 7px; }
.casino-quick-bets button { min-width: 47px; padding: 5px 9px; border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 7px; background: rgba(255, 255, 255, 0.035); color: var(--muted); font: inherit; font-size: 10px; cursor: pointer; transition: border-color 160ms ease, color 160ms ease; }
.casino-quick-bets button:hover { border-color: rgba(246, 196, 83, 0.4); color: var(--amber); }
.casino-result {
  min-height: 42px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: linear-gradient(100deg, rgba(0, 0, 0, 0.3), rgba(27, 38, 27, 0.7));
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
  transition: border-color 220ms ease, color 220ms ease, background 220ms ease;
}
.casino-result.win { border-color: rgba(94, 230, 172, 0.2); color: var(--accent); }
.casino-jackpot-card {
  position: relative;
  overflow: hidden;
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 139px;
  padding: 14px 10px 11px;
  border: 1px solid rgba(246, 196, 83, 0.42);
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 50% 0, rgba(251, 207, 100, 0.24), transparent 65%),
    linear-gradient(160deg, #4a2224, #24181a 75%);
  box-shadow: inset 0 1px 0 rgba(255, 242, 196, 0.16), 0 10px 22px rgba(0, 0, 0, 0.23);
  text-align: center;
}
.casino-jackpot-card::before, .casino-jackpot-card::after {
  position: absolute;
  top: 9px;
  bottom: 9px;
  width: 4px;
  border-radius: 999px;
  background: repeating-linear-gradient(to bottom, #f7d27b 0 3px, transparent 3px 9px);
  content: "";
  opacity: 0.8;
}
.casino-jackpot-card::before { left: 8px; }
.casino-jackpot-card::after { right: 8px; }
.casino-jackpot-label { color: #e8cc8d; font-size: 9px; font-weight: 800; letter-spacing: 0.17em; }
.casino-jackpot-card > strong { color: #ffe49a; font-family: var(--mono); font-size: 48px; line-height: 1; text-shadow: 0 0 18px rgba(255, 210, 105, 0.45), 0 3px 0 #7a4a1e; }
.casino-jackpot-card > strong span { margin-left: 3px; font-size: 23px; }
.casino-jackpot-card > small { max-width: 180px; color: #c8b994; font-size: 9px; line-height: 1.4; }
.casino-chip-stack { position: absolute; right: 18px; bottom: 10px; display: flex; }
.casino-chip-stack i { width: 13px; height: 13px; margin-left: -5px; border: 2px dashed #f2d896; border-radius: 50%; background: #bd3945; box-shadow: 0 2px 0 #76212d; }
.casino-chip-stack i:nth-child(2) { background: #286d50; box-shadow: 0 2px 0 #174530; }
.casino-chip-stack i:nth-child(3) { background: #dfab42; box-shadow: 0 2px 0 #936322; }
.casino-history { margin-top: 0; padding: 12px; border: 1px solid rgba(255, 255, 255, 0.075); border-radius: 13px; background: rgba(3, 10, 7, 0.32); }
.casino-history h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; color: #e2d4ae; font-size: 10px; letter-spacing: 0.04em; }
.casino-history h3 span { color: #eac15e; }
.casino-history ol { display: grid; gap: 5px; max-height: 144px; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.casino-history-entry { display: flex; justify-content: space-between; gap: 8px; padding: 7px 8px; border: 1px solid rgba(255, 255, 255, 0.035); border-radius: 7px; background: rgba(255, 255, 255, 0.035); color: #aab5a8; font-size: 9px; }
.casino-history-entry span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.casino-history-entry strong { flex: 0 0 auto; color: #85d6a5; font-family: var(--mono); font-size: 10px; }
.casino-history-entry strong.loss { color: #ff9a94; }
.casino-history-empty { padding: 8px; color: #87958a; font-size: 9px; line-height: 1.45; }
.casino-side-note { display: flex; align-items: flex-start; gap: 9px; padding: 10px; border: 1px solid rgba(94, 230, 172, 0.13); border-radius: 11px; background: rgba(22, 52, 37, 0.38); }
.casino-side-note > span { color: #d6bd78; font-size: 18px; }
.casino-side-note p { margin: 0; color: #9fb09f; font-size: 9px; line-height: 1.55; }
.casino-side-note strong { color: #d2dcbf; font-size: 10px; }
.casino-footnote { margin: 14px 0 0; color: #89978b; font-size: 9px; line-height: 1.5; text-align: center; }
@media (max-width: 720px) {
  .casino-dialog { width: min(560px, calc(100% - 20px)); }
  .casino-body { padding: 14px; }
  .casino-floor { grid-template-columns: 1fr; gap: 11px; }
  .casino-side { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  .casino-history { grid-row: span 2; }
  .casino-side-note { align-self: stretch; }
  .casino-marquee { margin-bottom: 12px; padding: 10px; }
}
@media (max-width: 430px) {
  .casino-dialog { width: calc(100% - 12px); }
  .casino-body { padding: 11px; }
  .casino-marquee { grid-template-columns: 1fr; gap: 2px; padding: 11px; }
  .casino-marquee-lights { display: none; }
  .casino-marquee-title { font-size: 17px; }
  .casino-marquee-subtitle { font-size: 7px; }
  .casino-side { grid-template-columns: 1fr; }
  .casino-history { grid-row: auto; }
  .casino-game-panel { padding: 11px; }
  .casino-tabs { gap: 3px; padding: 4px; }
  .casino-tab { font-size: 10px; }
  .casino-reel { min-height: 72px; font-size: 36px; }
  .casino-controls { padding: 10px; }
  .casino-controls label { flex-wrap: wrap; }
  .casino-input { width: 105px; }
  .roulette-choices { gap: 5px; }
  .roulette-choices .casino-choice { min-width: 0; padding-inline: 9px; }
}
@keyframes casino-panel-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes casino-reel-roll { 0% { transform: translateY(-5px); filter: blur(1px); } 50% { transform: translateY(5px); filter: blur(2px); } 100% { transform: translateY(-5px); filter: blur(1px); } }
@keyframes casino-reel-win { 0% { transform: scale(.85); box-shadow: 0 0 0 transparent; } 55% { transform: scale(1.12); box-shadow: 0 0 24px rgba(246, 196, 83, .55); } 100% { transform: scale(1); box-shadow: 0 0 8px rgba(246, 196, 83, .2); } }
@keyframes casino-coin-flip { 0% { transform: rotateY(0) translateY(0); } 50% { transform: rotateY(900deg) translateY(-18px); } 100% { transform: rotateY(1800deg) translateY(0); } }
@keyframes casino-coin-land-heads { 0% { transform: rotateY(720deg) scale(1.2); } 70% { transform: rotateY(180deg) scale(.94); } 100% { transform: rotateY(0) scale(1); } }
@keyframes casino-coin-land-tails { 0% { transform: rotateY(720deg) scale(1.2); } 70% { transform: rotateY(360deg) scale(.94); } 100% { transform: rotateY(180deg) scale(1); } }
@keyframes casino-wheel-spin { from { transform: rotate(0); } to { transform: rotate(1260deg); } }
@media (prefers-reduced-motion: reduce) {
  .casino-game-panel, .casino-machine.is-spinning .casino-reel, .casino-machine.has-win .casino-reel,
  .casino-coin.is-spinning, .casino-coin.has-win, .casino-wheel.is-spinning {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  z-index: 200;
  max-width: min(440px, calc(100% - 32px));
  padding: 11px 18px;
  border-radius: 12px;
  background: rgba(24, 40, 33, 0.97);
  border: 1px solid rgba(94, 230, 172, 0.28);
  box-shadow: 0 20px 40px -18px rgba(0, 0, 0, 0.9);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(46, 24, 24, 0.97);
}
@media (prefers-reduced-motion: reduce) {
  .pill.searching, .invite-toast { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1020px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .board-wrap {
    width: min(100%, 620px);
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 12px;
  }

  .moves-card { grid-row: span 2; }
  .status-card, .action-card, .sidebar-foot { grid-column: auto; }
  .sidebar-foot { grid-column: 1 / -1; text-align: center;   }
}

@media (max-width: 860px) {
  .auth-screen { padding: 28px 20px; }
  .auth-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 17px;
    width: min(520px, 100%);
  }
  .auth-showcase {
    min-height: 0;
    display: block;
    padding: 0;
  }
  .auth-brand { margin: 0; }
  .auth-showcase-copy, .auth-showcase-board, .auth-showcase-note { display: none; }
  .auth-card { padding: clamp(25px, 6vw, 36px); }
}

@media (max-width: 700px) {
  .app {
    width: calc(100% - 20px);
    padding: 12px 0 26px;
  }

  .topbar {
    margin-bottom: 14px;
    gap: 10px;
  }

  .brand-logo { width: 44px; height: 44px; border-radius: 13px; }
  .brand-logo img { width: 28px; height: 28px; }
  .brand-text strong { font-size: 17px; }
  .brand-text small { display: none; }

  .topbar-actions { gap: 6px; }
  .icon-btn { width: 38px; height: 38px; border-radius: 10px; }
  .casino-open { width: 38px; height: 38px; justify-content: center; padding: 0; border-radius: 10px; }
  .casino-open span:last-child { display: none; }
  .account-name { display: none; }
  .logout-btn { padding: 8px; font-size: 11px; }

  #btnNewGame span { display: none; }
  #btnNewGame { padding: 0; width: 38px; height: 38px; border-radius: 10px; }

  .board-wrap {
    width: 100%;
    max-width: none;
  }

  .board-frame { padding: 6px; border-radius: 17px; }
  .board { border-radius: 11px; }
  .player-strip { padding: 7px 9px; }
  .player-avatar { width: 34px; height: 34px; }
  .player-avatar img { width: 23px; height: 23px; }
  .player-name { font-size: 13px; }
  .player-sub { font-size: 10.5px; }
  .captures img { width: 14px; height: 14px; }
  .clock { min-width: 70px; font-size: 15px; padding: 6px 9px; }

  .sidebar { grid-template-columns: 1fr; }
  .moves-card { grid-row: auto; }
  .moves-scroll { max-height: 170px; }
  .sidebar-foot { display: block; text-align: center; font-size: 10.5px; margin-top: 2px; }

  .modal-head { padding: 18px 18px 14px; }
  .modal-body { padding: 16px 18px 18px; }
  .modal-foot { padding: 14px 18px 16px; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-option { flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; }
  .mode-icon { font-size: 17px; margin: 0; }
  .mode-name { flex: 1; }
  .mode-desc { font-size: 10.5px; }
}

@media (max-width: 460px) {
  .auth-screen { padding: 22px 15px; }
  .auth-layout { gap: 15px; }
  .auth-brand .brand-logo { width: 44px; height: 44px; }
  .auth-brand .brand-logo img { width: 29px; height: 29px; }
  .auth-brand .brand-text small { display: block; font-size: 11px; }
  .auth-card { padding: 23px 20px; border-radius: 19px; }
  .auth-card h1 { font-size: 27px; }
  .auth-tabs { margin: 20px 0 18px; }
  .casino-reel { min-height: 70px; font-size: 34px; }
  .casino-body { padding: 15px; }
}

@media (max-width: 400px) {
  .skill-row button small { display: none; }
  .segmented button { padding: 9px 4px; font-size: 11.5px; }
  .coords { font-size: 8px; }
}

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

@media (min-width: 1021px) and (max-height: 820px) {
  .app { padding-top: 14px; }
  .topbar { margin-bottom: 14px; }
  .board-wrap { width: min(100%, 620px, calc(100dvh - 230px)); }
  .moves-scroll { max-height: 190px; }
}

/* Version im Footer */
.bc-version {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(94, 230, 172, 0.35);
  color: var(--accent);
  background: rgba(94, 230, 172, 0.1);
  vertical-align: 1px;
}
