@font-face {
  font-family: "Geist Pixel";
  src: url("./assets/fonts/GeistPixel-Square.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg-0: oklch(0.04 0.01 140);
  --bg-1: oklch(0.08 0.03 145);
  --bg-2: oklch(0.12 0.05 145);
  --ink-0: oklch(0.98 0 0);
  --ink-1: oklch(0.86 0.02 132);
  --ink-2: oklch(0.74 0.02 130);
  --line: oklch(0.86 0.11 130 / 0.32);
  --line-soft: oklch(0.92 0.06 130 / 0.14);
  --neon: oklch(0.9 0.29 128);
  --neon-strong: oklch(0.82 0.28 128);
  --danger: oklch(0.68 0.22 28);
  --panel-shadow: 0 22px 42px oklch(0 0 0 / 0.46);
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--ink-0);
  font-family: "Geist Pixel", monospace;
  background:
    radial-gradient(circle at 50% 26%, oklch(0.26 0.12 142 / 0.34), transparent 48%),
    radial-gradient(circle at 82% 72%, oklch(0.24 0.1 136 / 0.24), transparent 52%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  overflow-x: hidden;
}

.background-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(oklch(1 0 0 / 0.04) 1px, transparent 1px),
    linear-gradient(90deg, oklch(1 0 0 / 0.03) 1px, transparent 1px),
    linear-gradient(0deg, oklch(0.9 0.18 129 / 0.06), transparent 32%);
  background-size: 52px 52px, 52px 52px, 100% 7px;
  mask-image: radial-gradient(circle at 50% 46%, black 45%, transparent 86%);
}

.shell {
  width: min(1040px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 14px 12px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.topbar {
  display: grid;
  gap: 10px;
  align-items: end;
  grid-template-columns: minmax(0, 1fr) auto;
}

.brand-block {
  display: grid;
  gap: 6px;
}

.eyebrow {
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: oklch(0.93 0.1 130 / 0.66);
}

h1 {
  font-size: clamp(1.8rem, 7vw, 3.6rem);
  letter-spacing: 0.1em;
  line-height: 0.95;
  text-transform: uppercase;
  color: var(--neon);
  text-shadow:
    0 0 30px oklch(0.9 0.28 128 / 0.38),
    0 2px 0 oklch(0.2 0.04 145 / 0.8);
}

.caption {
  font-size: 0.66rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(74px, 1fr));
  gap: 6px;
}

.score-item {
  border: 1px solid var(--line-soft);
  background: linear-gradient(145deg, oklch(0.13 0.03 145 / 0.72), oklch(0.08 0.02 145 / 0.74));
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.09);
  padding: 6px 8px;
  display: grid;
  justify-items: center;
  gap: 4px;
}

.score-label {
  font-size: 0.56rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: oklch(0.9 0.02 130 / 0.62);
}

.score-value {
  font-size: 0.86rem;
  line-height: 1;
  color: var(--neon);
}

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(170deg, oklch(0.1 0.03 145 / 0.84), oklch(0.06 0.01 145 / 0.86));
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.08), var(--panel-shadow);
}

.board-panel {
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 22px 14px 16px;
  overflow: hidden;
}

.board-panel::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid var(--line-soft);
  pointer-events: none;
  z-index: 0;
}

.board-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, oklch(0.25 0.09 142 / 0.2), transparent 56%),
    linear-gradient(0deg, oklch(0.75 0.18 130 / 0.06), transparent 14%);
  pointer-events: none;
  z-index: 0;
}

.seat,
.action-row,
.status,
.end-splash {
  position: relative;
  z-index: 1;
}

.seat {
  width: min(760px, 100%);
  display: grid;
  gap: 8px;
  justify-items: center;
}

.seat-header {
  display: grid;
  justify-items: center;
  gap: 8px;
}

h2 {
  font-size: clamp(0.84rem, 2.2vw, 1rem);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: oklch(0.9 0.04 130 / 0.72);
}

.score-pill {
  font-size: clamp(1.75rem, 6.2vw, 2.8rem);
  line-height: 1;
  color: oklch(0.98 0 0 / 0.95);
  text-shadow: 0 8px 20px oklch(0 0 0 / 0.48);
}

.hand-grid {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: 206px;
  width: min(580px, 100%);
  padding: 4px 0;
}

.card-glyph {
  border: 0;
  background: transparent;
  padding: 0;
  width: 166px;
  min-height: 174px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--ink-0);
  cursor: default;
  transition: transform 160ms ease, filter 160ms ease;
}

.card-glyph + .card-glyph {
  margin-left: -44px;
}

.seat:nth-of-type(2) .card-glyph:nth-child(even) {
  transform: rotate(2.2deg);
}

.seat:nth-of-type(2) .card-glyph:nth-child(odd) {
  transform: rotate(-1.2deg);
}

.card-glyph .symbol {
  font-size: 156px;
  line-height: 1;
  text-shadow:
    0 0 0 oklch(1 0 0 / 0),
    0 4px 16px oklch(0 0 0 / 0.44);
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol",
    "Noto Sans Symbols 2", sans-serif;
}

.card-glyph.suit-hearts .symbol {
  color: oklch(0.72 0.23 25);
  text-shadow: 0 4px 16px oklch(0.56 0.17 25 / 0.34);
}

.card-glyph.suit-diamonds .symbol {
  color: oklch(0.83 0.18 78);
  text-shadow: 0 4px 16px oklch(0.65 0.15 78 / 0.3);
}

.card-glyph.suit-clubs .symbol {
  color: oklch(0.81 0.18 154);
  text-shadow: 0 4px 16px oklch(0.62 0.15 154 / 0.32);
}

.card-glyph.suit-spades .symbol {
  color: oklch(0.84 0.11 252);
  text-shadow: 0 4px 16px oklch(0.65 0.1 252 / 0.34);
}

.card-glyph.suit-back .symbol {
  color: oklch(0.98 0 0);
}

.card-glyph:disabled {
  opacity: 1;
}

.card-glyph.is-clickable {
  cursor: pointer;
}

.card-glyph.is-clickable:hover {
  transform: translateY(-8px) scale(1.035);
  filter: drop-shadow(0 14px 18px oklch(0 0 0 / 0.34));
}

.card-glyph.is-clickable:focus-visible {
  outline: 2px solid var(--neon);
  outline-offset: 4px;
}

.action-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
}

button:not(.card-glyph),
select,
input[type="text"] {
  font-family: "Geist Pixel", monospace;
  border-radius: 0;
}

button:not(.card-glyph) {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid oklch(1 0 0 / 0.56);
  background: oklch(0.04 0.01 145 / 0.94);
  color: var(--ink-0);
  min-height: 42px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease, color 120ms ease;
}

button:not(.card-glyph):hover {
  transform: translateY(-1px);
  border-color: var(--neon);
  color: var(--neon);
  box-shadow: 0 0 0 1px oklch(0.9 0.25 128 / 0.34), 0 12px 18px oklch(0 0 0 / 0.32);
}

button.secondary:not(.card-glyph) {
  border-color: oklch(1 0 0 / 0.36);
  color: var(--ink-1);
}

button:not(.card-glyph):disabled {
  opacity: 0.48;
  transform: none;
  box-shadow: none;
  cursor: not-allowed;
}

#hitButton,
#standButton {
  min-width: 220px;
  min-height: 60px;
  border: 0;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  box-shadow: 0 14px 22px oklch(0 0 0 / 0.36);
}

#hitButton {
  background: linear-gradient(155deg, oklch(0.66 0.21 140), oklch(0.5 0.16 140));
  color: oklch(0.98 0 0);
}

#standButton {
  background: linear-gradient(155deg, oklch(0.64 0.23 28), oklch(0.5 0.18 28));
  color: oklch(0.98 0 0);
}

.status {
  width: min(760px, 100%);
  border: 1px solid oklch(0.88 0.16 130 / 0.34);
  background: linear-gradient(145deg, oklch(0.2 0.08 132 / 0.22), oklch(0.08 0.03 145 / 0.68));
  color: oklch(0.95 0.04 132);
  padding: 9px 12px;
  min-height: 38px;
  display: grid;
  align-items: center;
  justify-items: center;
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.status.error {
  border-color: oklch(0.69 0.23 28 / 0.74);
  color: var(--danger);
}

.end-splash {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  width: min(390px, 88%);
  border: 1px solid oklch(0.95 0.09 130 / 0.4);
  background: linear-gradient(155deg, oklch(0.15 0.04 145 / 0.88), oklch(0.08 0.02 145 / 0.94));
  box-shadow: 0 16px 26px oklch(0 0 0 / 0.42);
  backdrop-filter: blur(3px);
  display: none;
  justify-items: center;
  gap: 6px;
  padding: 12px 12px 14px;
  text-align: center;
}

.end-splash.active {
  display: grid;
}

.end-splash-label {
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: oklch(0.9 0.02 130 / 0.64);
}

.end-splash-title {
  font-size: clamp(1.1rem, 4vw, 1.8rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.end-splash-sub {
  font-size: 0.66rem;
  color: oklch(0.9 0.02 130 / 0.74);
  max-width: 34ch;
}

.end-splash-action {
  min-width: 170px;
  min-height: 42px;
  border: 0 !important;
  color: oklch(0.98 0 0) !important;
  background: linear-gradient(155deg, oklch(0.66 0.21 140), oklch(0.5 0.16 140)) !important;
}

.end-splash.outcome-win .end-splash-title {
  color: oklch(0.9 0.14 146);
}

.end-splash.outcome-lose .end-splash-title {
  color: oklch(0.78 0.21 28);
}

.end-splash.outcome-push .end-splash-title {
  color: oklch(0.94 0.02 130);
}

.control-dock {
  padding: 10px;
  display: grid;
  gap: 10px;
}

.mode-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

select,
input[type="text"] {
  border: 1px solid oklch(1 0 0 / 0.4);
  background: oklch(0.04 0.01 145 / 0.95);
  color: var(--ink-0);
  min-height: 42px;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 10px;
}

select {
  min-width: 148px;
}

input[type="text"] {
  width: 146px;
}

select:focus-visible,
input[type="text"]:focus-visible {
  outline: 1px solid var(--neon);
  border-color: var(--neon);
  outline-offset: 0;
}

#createMatch {
  margin-left: auto;
  background: linear-gradient(155deg, oklch(0.66 0.21 140), oklch(0.5 0.16 140));
  border: 0;
  color: oklch(0.98 0 0);
  min-width: 142px;
}

#refreshMatch {
  min-width: 104px;
}

body[data-mode="solo"] .session-control {
  display: none;
}

.meta-strip {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: oklch(0.92 0 0 / 0.38);
  font-size: 0.58rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.meta-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.meta-label {
  color: oklch(0.9 0 0 / 0.28);
}

.meta-value {
  max-width: 130px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: oklch(0.96 0.01 130 / 0.5);
}

@media (max-width: 940px) {
  .shell {
    width: 100%;
    padding: 12px 10px 10px;
    gap: 10px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .scoreboard {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .board-panel {
    gap: 14px;
    padding: 16px 10px 14px;
  }

  .hand-grid {
    width: min(460px, 100%);
    min-height: 176px;
  }

  .card-glyph {
    width: 138px;
    min-height: 150px;
  }

  .card-glyph + .card-glyph {
    margin-left: -35px;
  }

  .card-glyph .symbol {
    font-size: 130px;
  }

  #hitButton,
  #standButton {
    min-width: 0;
    flex: 1 1 calc(50% - 8px);
    min-height: 54px;
    font-size: 0.82rem;
  }

  .mode-row {
    gap: 6px;
  }

  select,
  input[type="text"],
  .mode-row button {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }

  #createMatch {
    margin-left: 0;
  }
}

@media (max-width: 560px) {
  .eyebrow {
    font-size: 0.56rem;
  }

  .caption {
    font-size: 0.6rem;
  }

  .score-item {
    padding: 5px 6px;
  }

  .score-label {
    font-size: 0.52rem;
  }

  .score-value {
    font-size: 0.74rem;
  }

  .seat {
    gap: 7px;
  }

  h2 {
    font-size: 0.8rem;
  }

  .hand-grid {
    width: min(370px, 100%);
    min-height: 152px;
  }

  .card-glyph {
    width: 118px;
    min-height: 126px;
  }

  .card-glyph + .card-glyph {
    margin-left: -28px;
  }

  .card-glyph .symbol {
    font-size: 108px;
  }

  .status {
    font-size: 0.6rem;
    min-height: 34px;
    padding: 8px;
  }

  .end-splash {
    width: 92%;
    top: 56%;
    padding: 10px;
  }

  .end-splash-title {
    font-size: clamp(1rem, 5.6vw, 1.4rem);
  }

  .meta-strip {
    font-size: 0.54rem;
    gap: 6px 8px;
  }

  .meta-value {
    max-width: 90px;
  }
}
