.dewcade-home-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid rgba(22, 101, 52, 0.18);
  border-radius: 22px;
  color: #14532d;
  background: linear-gradient(135deg, #dcfce7, #bbf7d0 55%, #d9f99d);
  box-shadow: 0 14px 34px rgba(22, 101, 52, 0.14);
  text-decoration: none;
}
.dewcade-home-banner:hover { transform: translateY(-1px); box-shadow: 0 18px 40px rgba(22, 101, 52, 0.18); }
.dewcade-home-banner-icon { font-size: 1.8rem; }
.dewcade-home-banner-copy { display: grid; gap: 2px; }
.dewcade-home-banner-copy strong { font-size: 1.05rem; }
.dewcade-home-banner-copy small { color: #3f6212; font-weight: 700; }
.dewcade-home-banner-arrow { font-size: 1.45rem; font-weight: 900; }

.dewcade-page { min-height: 100dvh; }
.dewcade-shell { width: min(1040px, calc(100% - 28px)); margin: 0 auto; padding: 28px 0 110px; }
.dewcade-hero { overflow: hidden; background: radial-gradient(circle at 88% 10%, rgba(34,197,94,.22), transparent 24rem), radial-gradient(circle at 65% 110%, rgba(124,58,237,.15), transparent 28rem), var(--surface); }
.dewcade-hero h1 { margin-bottom: 10px; font-size: clamp(2.8rem, 9vw, 6rem); }
.dewcade-hero-copy { max-width: 720px; }
.dewcade-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.dewcade-section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 24px 2px 0; }
.dewcade-section-heading h2 { margin: 2px 0 0; font-size: clamp(1.45rem, 4vw, 2rem); }
.dewcade-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.dewcade-game-card { position: relative; display: grid; gap: 14px; min-height: 230px; padding: 24px; overflow: hidden; border: 1px solid var(--border); border-radius: 28px; background: var(--surface); box-shadow: var(--shadow-soft); text-decoration: none; color: var(--ink); transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.dewcade-game-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: rgba(22,101,52,.42); }
.dewcade-game-card:hover { transform: translateY(-2px); box-shadow: 0 18px 46px rgba(15,23,42,.12); border-color: rgba(22,101,52,.24); }
.dewcade-game-card:focus-visible { outline: 4px solid rgba(22,101,52,.28); outline-offset: 3px; }
.dewcade-game-card.primary { border-color: rgba(22,101,52,.18); background: linear-gradient(145deg, rgba(220,252,231,.92), rgba(255,255,255,.96)); }
.dewcade-mode-card.classic { background: linear-gradient(145deg, rgba(248,250,252,.98), rgba(241,245,249,.9)); }
.dewcade-mode-card.farmdew { background: linear-gradient(145deg, rgba(220,252,231,.94), rgba(254,249,195,.82)); border-color: rgba(22,101,52,.22); }
.dewcade-mode-card.farmdew::before { background: rgba(22,101,52,.78); }
.dewcade-mode-card.farmdew .dewcade-game-icon { background: rgba(255,255,255,.78); box-shadow: 0 12px 28px rgba(22,101,52,.15), inset 0 0 0 1px rgba(22,101,52,.09); }
.dewcade-mode-card.three-check { background: linear-gradient(145deg, rgba(254,249,195,.72), rgba(255,255,255,.96)); }
.dewcade-mode-card.hill { background: linear-gradient(145deg, rgba(254,243,199,.76), rgba(255,255,255,.96)); }
.dewcade-mode-card.chess960 { background: linear-gradient(145deg, rgba(237,233,254,.78), rgba(255,255,255,.96)); }
.dewcade-mode-card.antichess { background: linear-gradient(145deg, rgba(219,234,254,.82), rgba(255,255,255,.97)); }
.dewcade-mode-card.three-check::before { background: rgba(202,138,4,.7); }
.dewcade-mode-card.hill::before { background: rgba(180,83,9,.68); }
.dewcade-mode-card.chess960::before { background: rgba(109,40,217,.6); }
.dewcade-mode-card.antichess::before { background: rgba(37,99,235,.62); }
.dewcade-mode-card.featured { grid-column: 1 / -1; min-height: 210px; grid-template-columns: auto minmax(0,1fr); align-items: center; }
.dewcade-mode-card.featured .dewcade-game-icon { align-self: start; }
.dewcade-mode-card.featured .dewcade-card-footer { grid-column: 1 / -1; }
.dewcade-game-icon { font-size: 3.2rem; }
.dewcade-game-card h2 { margin: 0; font-size: 1.65rem; }
.dewcade-card-footer { display: flex; justify-content: space-between; gap: 12px; align-items: end; margin-top: auto; }
.dewcade-card-footer strong { min-width: 0; }
.dewcade-status-chip { display: inline-flex; width: fit-content; padding: 7px 10px; border-radius: 999px; background: rgba(22,101,52,.1); color: #166534; font-size: .78rem; font-weight: 900; }

.chess-shell { width: min(1040px, calc(100% - 24px)); margin: 0 auto; padding: 18px 0 112px; }
.chess-topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.chess-topbar a { text-decoration: none; }
.chess-lobby-grid { display: grid; gap: 16px; }
.chess-lobby-section { padding: 20px; }
.chess-lobby-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.chess-lobby-heading h2 { margin: 0; font-size: 1.25rem; }
.chess-list { display: grid; gap: 10px; }
.chess-game-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid var(--border); border-radius: 18px; background: rgba(255,255,255,.72); }
.chess-game-row.turn { border-color: rgba(22,101,52,.28); background: rgba(220,252,231,.55); }
.chess-avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 15px; background: rgba(124,58,237,.09); font-size: 1.45rem; }
.chess-row-copy { min-width: 0; }
.chess-row-copy strong, .chess-row-copy small { display: block; }
.chess-row-copy small { margin-top: 2px; color: var(--muted); font-weight: 700; }
.chess-empty { padding: 18px; border: 1px dashed var(--border); border-radius: 18px; color: var(--muted); text-align: center; }
.chess-new-game { display: flex; gap: 10px; flex-wrap: wrap; }

.chess-game-view { display: grid; gap: 14px; }
.chess-variant-status { width: min(100%, 720px); margin: 0 auto; padding: 10px 14px; border: 1px solid rgba(124,58,237,.16); border-radius: 16px; background: rgba(237,233,254,.68); color: #4c1d95; font-size: .86rem; font-weight: 850; text-align: center; }
.chess-player-strip { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.chess-player-id { display: flex; align-items: center; gap: 10px; }
.chess-player-id strong, .chess-player-id small { display: block; }
.chess-player-id small { color: var(--muted); }
.chess-turn-chip { padding: 7px 10px; border-radius: 999px; font-size: .78rem; font-weight: 900; background: rgba(124,58,237,.09); }
.chess-turn-chip.yours { color: #166534; background: #dcfce7; }
.chess-board-wrap { width: min(100%, 720px); margin: 0 auto; }
.chess-board { display: grid; grid-template-columns: repeat(8, 1fr); width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 18px; border: 3px solid #312e81; box-shadow: 0 20px 48px rgba(30, 27, 75, .18); background: #fff; touch-action: manipulation; }
.chess-square { position: relative; display: grid; place-items: center; min-width: 0; border: 0; padding: 0; border-radius: 0; font: inherit; cursor: default; }
.chess-square.light { background: #f2e8d5; }
.chess-square.dark { background: #77956c; }
.chess-square.hill { box-shadow: inset 0 0 0 999px rgba(250,204,21,.19), inset 0 0 0 3px rgba(161,98,7,.35); }
.chess-square.can-move, .chess-square.destination { cursor: pointer; }
.chess-square.selected::after { content: ""; position: absolute; inset: 5%; border: 4px solid rgba(22,101,52,.8); border-radius: 14%; pointer-events: none; }
.chess-square.destination::before { content: ""; position: absolute; width: 24%; aspect-ratio: 1; border-radius: 50%; background: rgba(22,101,52,.52); pointer-events: none; }
.chess-square.capture::before { width: 76%; background: transparent; border: 5px solid rgba(185,28,28,.48); box-sizing: border-box; }
.chess-square.castle::before { width: 70%; background: transparent; border: 5px double rgba(79,70,229,.7); box-sizing: border-box; }
.chess-square.last-move { box-shadow: inset 0 0 0 999px rgba(250,204,21,.18); }
.chess-square.hill.last-move { box-shadow: inset 0 0 0 999px rgba(250,204,21,.28), inset 0 0 0 3px rgba(161,98,7,.38); }
.chess-square.in-check { box-shadow: inset 0 0 0 999px rgba(239,68,68,.28); }
.chess-piece { position: relative; z-index: 2; font-family: "Arial Unicode MS", "Segoe UI Symbol", sans-serif; font-size: clamp(1.8rem, 8vw, 4.35rem); line-height: 1; filter: drop-shadow(0 2px 1px rgba(0,0,0,.2)); }
.chess-coordinate { position: absolute; z-index: 1; left: 3px; bottom: 1px; font-size: clamp(.45rem, 1.6vw, .68rem); font-weight: 900; opacity: .62; }
.chess-status-panel { display: grid; gap: 12px; padding: 16px; }
.chess-status-message { margin: 0; font-weight: 850; text-align: center; }
.chess-actions { display: flex; justify-content: center; gap: 9px; flex-wrap: wrap; }
.chess-move-history { max-height: 210px; overflow: auto; display: grid; grid-template-columns: 42px 1fr 1fr; gap: 6px 10px; padding: 12px 4px 2px; font-variant-numeric: tabular-nums; }
.chess-move-history span { padding: 5px 8px; border-radius: 9px; background: rgba(124,58,237,.05); }
.chess-move-history .move-number { color: var(--muted); background: transparent; text-align: right; }
.chess-promotion-grid, .chess-friend-grid { display: grid; gap: 10px; }
.chess-promotion-grid { grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); }
.chess-promotion-button { min-height: 74px; font-size: 2rem; }
.chess-dialog { width: min(520px, calc(100% - 24px)); border: 0; border-radius: 24px; padding: 20px; box-shadow: 0 24px 80px rgba(15,23,42,.28); }
.chess-dialog::backdrop { background: rgba(15,23,42,.45); }
.chess-dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.chess-dialog-heading h2 { margin: 0; }
.chess-variant-picker { display: grid; gap: 9px; margin: 14px 0 16px; font-weight: 850; }
.chess-variant-picker-label { color: var(--muted); font-size: .82rem; font-weight: 900; letter-spacing: .02em; text-transform: uppercase; }
.chess-variant-native-select { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.chess-selected-mode-card { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid rgba(22,101,52,.16); border-radius: 20px; background: linear-gradient(145deg, rgba(220,252,231,.72), rgba(255,255,255,.98)); box-shadow: 0 12px 28px rgba(15,23,42,.07); }
.chess-selected-mode-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 16px; background: rgba(255,255,255,.82); box-shadow: inset 0 0 0 1px rgba(15,23,42,.06); font-size: 1.75rem; }
.chess-selected-mode-copy { min-width: 0; }
.chess-selected-mode-copy .step-label { margin: 0 0 2px; }
.chess-selected-mode-copy h3 { margin: 0; font-size: 1.2rem; }
.chess-selected-mode-copy .microcopy { margin: 5px 0 0; line-height: 1.35; }
.chess-new-game-dialog[data-variant="three_check"] .chess-selected-mode-card { background: linear-gradient(145deg, rgba(254,249,195,.82), rgba(255,255,255,.98)); }
.chess-new-game-dialog[data-variant="king_of_the_hill"] .chess-selected-mode-card { background: linear-gradient(145deg, rgba(254,243,199,.84), rgba(255,255,255,.98)); }
.chess-new-game-dialog[data-variant="chess960"] .chess-selected-mode-card { background: linear-gradient(145deg, rgba(237,233,254,.86), rgba(255,255,255,.98)); }
.chess-new-game-dialog[data-variant="antichess"] .chess-selected-mode-card { background: linear-gradient(145deg, rgba(219,234,254,.88), rgba(255,255,255,.98)); }
.chess-variant-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.chess-variant-choice { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.82); color: var(--ink); font: inherit; text-align: left; }
.chess-variant-choice:hover { border-color: rgba(22,101,52,.26); background: rgba(240,253,244,.9); }
.chess-variant-choice[aria-pressed="true"] { border-color: rgba(22,101,52,.48); background: #dcfce7; box-shadow: inset 0 0 0 2px rgba(22,101,52,.12); }
.chess-variant-choice:last-child { grid-column: 1 / -1; }
.chess-change-variant { display: none; white-space: nowrap; }
.chess-direct-launch .chess-variant-picker { margin-top: 0; }
.chess-direct-launch .chess-variant-picker-label,
.chess-direct-launch .chess-variant-choice-grid { display: none; }
.chess-direct-launch .chess-change-variant { display: inline-flex; }
.chess-challenge-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; color: var(--muted); font-size: .82rem; font-weight: 900; text-transform: uppercase; letter-spacing: .02em; }
.chess-challenge-divider::before, .chess-challenge-divider::after { content: ""; height: 1px; flex: 1; background: var(--border); }
.chess-friend-button { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%; min-height: 58px; text-align: left; padding: 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--ink); transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.chess-friend-button:hover { border-color: rgba(22,101,52,.3); background: rgba(240,253,244,.72); transform: translateY(-1px); }
.chess-auth-gate { padding: 26px; text-align: center; }
.chess-dialog-handle { display: none; }

@media (max-width: 720px) {
  .dewcade-shell { width: min(100% - 18px, 720px); padding-top: 14px; }
  .dewcade-section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .dewcade-grid { grid-template-columns: 1fr; }
  .dewcade-game-card { min-height: 180px; padding: 20px; }
  .dewcade-mode-card.featured { grid-column: auto; grid-template-columns: 1fr; }
  .dewcade-mode-card.featured .dewcade-card-footer { grid-column: auto; }
  .dewcade-section-heading { align-items: center; }
  .chess-shell { width: min(100% - 12px, 640px); padding-top: 10px; }
  .chess-game-row { grid-template-columns: auto minmax(0,1fr); }
  .chess-game-row > .button { grid-column: 1 / -1; width: 100%; }
  .chess-game-view { gap: 8px; }
  .chess-game-view > .chess-topbar { margin: 0 2px 4px; }
  .chess-player-strip { padding: 10px 11px; border-radius: 14px; }
  .chess-board-wrap { width: calc(100% + 12px); margin-left: -6px; margin-right: -6px; }
  .chess-board { border-radius: 8px; border-width: 2px; box-shadow: 0 14px 32px rgba(30,27,75,.18); }
  .chess-status-panel { border-radius: 18px; padding: 13px; }
  .chess-square.selected::after { border-width: 3px; }
  .chess-square.capture::before, .chess-square.castle::before { border-width: 4px; }
  .chess-new-game-dialog { inset: auto 0 0; width: min(100%, 640px); max-height: min(88dvh, 760px); margin: 0 auto; overflow: auto; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0; }
  .chess-dialog-handle { display: block; width: 42px; height: 5px; margin: 2px auto 12px; border-radius: 999px; background: rgba(100,116,139,.35); }
  .chess-selected-mode-card { grid-template-columns: auto minmax(0,1fr); }
  .chess-change-variant { grid-column: 1 / -1; width: 100%; justify-content: center; }
  .chess-variant-choice-grid { grid-template-columns: 1fr 1fr; }
  .chess-variant-choice { min-height: 52px; }
  .chess-friend-button { min-height: 60px; }
}

@media (max-width: 390px) {
  .chess-variant-choice-grid { grid-template-columns: 1fr; }
  .chess-variant-choice:last-child { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .dewcade-home-banner:hover, .dewcade-game-card:hover, .chess-friend-button:hover { transform: none; }
}
