/* 7 Card — an evening card table: green baize under a lamp, teak rim, brass inlay,
   ivory cards with maroon backs, in a dark plum room. Mobile first. */

@font-face {
  font-family: 'Rozha One';
  src: url('/fonts/rozha-one-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Mukta';
  src: url('/fonts/mukta-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Mukta';
  src: url('/fonts/mukta-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Mukta';
  src: url('/fonts/mukta-latin-800-normal.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

:root {
  --room: #1e1219;
  --room-2: #2b1a24;
  --sheet: #2d1c27;
  --teak: #7a4524;
  --teak-dark: #4a2714;
  --brass: #d9a944;
  --brass-dark: #a3741f;
  --baize: #1c6a51;
  --baize-dark: #0f3f31;
  --baize-light: #2a8a68;
  --ivory: #fbf6ea;
  --ivory-edge: #ddd0b4;
  --ink: #1f1a17;
  --card-red: #b0281f;
  --maroon: #7b1e2e;
  --text: #f6eedf;
  --muted: #c3b2ba;
  --line: rgba(246, 238, 223, 0.12);
  --panel: rgba(246, 238, 223, 0.05);
  --good: #5ccf7d;
  --bad: #f0675d;
  --display: 'Rozha One', Georgia, serif;
  --body: 'Mukta', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --card-w: 56px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font: 16px/1.45 var(--body);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
body {
  /* One pool of lamp light over the table. */
  background:
    radial-gradient(ellipse 75% 50% at 50% 40%, rgba(255, 210, 140, 0.11), transparent 70%),
    radial-gradient(ellipse 120% 80% at 50% 0%, var(--room-2), var(--room) 75%) fixed,
    var(--room);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  touch-action: manipulation;
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}

.display {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.app {
  min-height: 100dvh;
  max-width: 980px;
  margin: 0 auto;
  padding: calc(10px + var(--safe-t)) 12px calc(10px + var(--safe-b));
  display: flex;
  flex-direction: column;
}

/* ---------- shared bits ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(246, 238, 223, 0.07);
  font-weight: 600;
  line-height: 1.15;
  transition: transform 0.08s, background 0.15s, opacity 0.15s;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn.primary {
  background: linear-gradient(180deg, #ecc56a, var(--brass-dark));
  color: #2a1c05;
  border-color: rgba(255, 230, 170, 0.5);
}
.btn.danger {
  background: linear-gradient(180deg, #e35b52, #a3241c);
  border-color: transparent;
  color: #fff;
}
.btn.good {
  background: linear-gradient(180deg, #5fd683, #23874a);
  border-color: transparent;
  color: #fff;
}
.btn.ghost {
  background: transparent;
}
.btn.small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 15px;
  border-radius: 10px;
}
.btn.icon {
  width: 40px;
  padding: 0;
  font-size: 20px;
}
.btn.block {
  width: 100%;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 14px;
  color: var(--muted);
}
.input {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  font-size: 17px; /* 16px+ stops iOS zooming on focus */
  outline: none;
  width: 100%;
}
.input:focus {
  border-color: var(--brass);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 600;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 14px;
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.row.center {
  justify-content: center;
}
.row.wrap {
  flex-wrap: wrap;
}
.spacer {
  flex: 1;
}
h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
}

.tag {
  font-size: 12px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 99px;
  background: rgba(217, 169, 68, 0.18);
  color: var(--brass);
}
.tag.you {
  background: rgba(246, 238, 223, 0.12);
  color: var(--text);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  padding: 6px 14px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.35);
  max-width: 100%;
  white-space: nowrap;
}
.status.wide {
  display: flex;
  justify-content: center;
  white-space: normal;
  text-align: center;
  padding: 10px 14px;
}
.status.mine {
  background: var(--brass);
  color: #2a1c05;
}

/* ---------- avatars ---------- */

.avatar {
  --size: 44px;
  position: relative;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  flex: none;
  border-radius: 50%;
  background: hsl(var(--hue, 30) 42% 36%);
  border: 2px solid rgba(251, 246, 234, 0.85);
  color: #fff;
  font-weight: 800;
  font-size: calc(var(--size) * 0.36);
  letter-spacing: 0.02em;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}
.avatar.bot {
  background: #3b3346;
  font-size: calc(var(--size) * 0.5);
}
.avatar.xs {
  --size: 30px;
  border-width: 1.5px;
}
.avatar.empty {
  background: transparent;
  border: 1.5px dashed var(--line);
  box-shadow: none;
}

/* ---------- home ---------- */

.home {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}
.hero {
  text-align: center;
}
.hero h1 {
  font-size: 64px;
  line-height: 1;
  color: var(--ivory);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}
.tagline {
  margin: 6px 0 0;
  color: var(--muted);
}
.hero-fan {
  display: flex;
  justify-content: center;
  height: 100px;
  margin-bottom: 12px;
}
.hero-fan .card {
  --card-w: 62px;
  margin: 0 -11px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}
.hero-fan .card:nth-child(1) {
  transform: rotate(-14deg) translateY(10px);
}
.hero-fan .card:nth-child(3) {
  transform: rotate(14deg) translateY(10px);
}
.form {
  display: grid;
  gap: 14px;
}
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.code-input {
  text-transform: uppercase;
  letter-spacing: 0.4em;
  font-weight: 800;
  text-align: center;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  min-height: 40px;
}
.topbar .title {
  font-size: 24px;
  color: var(--brass);
  line-height: 1;
  padding-top: 4px;
}
.topbar .meta {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.code-chip {
  border: 1px solid rgba(217, 169, 68, 0.5);
  color: var(--brass);
  border-radius: 6px;
  padding: 0 6px;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 13px;
}

/* ---------- lobby ---------- */

.lobby {
  display: grid;
  gap: 12px;
}
.code-box {
  text-align: center;
}
.code-box .code {
  font-size: 54px;
  line-height: 1.1;
  letter-spacing: 0.14em;
  padding-left: 0.14em;
  margin: 2px 0 10px;
  color: var(--ivory);
}
.players-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.players-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  min-height: 50px;
}
.players-list li.empty-seat {
  background: transparent;
  border: 1.5px dashed var(--line);
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.setting-ro {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  padding: 8px 12px;
}
.setting-ro b {
  display: block;
  font-size: 18px;
}
.sticky-actions {
  position: sticky;
  bottom: 0;
  padding: 12px 0 calc(4px + var(--safe-b));
  margin-top: auto;
  background: linear-gradient(0deg, var(--room) 70%, transparent);
}
.stack-actions {
  display: grid;
  gap: 8px;
}

/* ---------- the table ---------- */

.game {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.arena {
  position: relative;
  flex: 1 1 auto;
  min-height: clamp(360px, 60dvh, 660px);
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}
/* Teak rim with a brass inlay around green baize. */
.felt {
  position: absolute;
  inset: 8.5% 10%;
  border-radius: 50%;
  padding: clamp(8px, 2.4vw, 14px);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.14), transparent 40%),
    repeating-linear-gradient(95deg, rgba(0, 0, 0, 0.08) 0 3px, transparent 3px 9px),
    linear-gradient(180deg, var(--teak), var(--teak-dark));
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.12);
}
.felt-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 70% 60% at 50% 42%, var(--baize-light) 0%, var(--baize) 50%, var(--baize-dark) 100%);
  box-shadow:
    inset 0 0 0 2px rgba(217, 169, 68, 0.55),
    inset 0 0 0 5px rgba(0, 0, 0, 0.25),
    inset 0 10px 40px rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
}
.felt-centre {
  width: 82%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.piles {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(14px, 5vw, 36px);
}
.pile {
  --pile-w: clamp(46px, 13vw, 76px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.pile .card {
  --card-w: var(--pile-w);
}
.pile-label {
  font-size: 12px;
  color: rgba(251, 246, 234, 0.72);
  white-space: nowrap;
}
.stack {
  position: relative;
}
.stack .card + .card {
  position: absolute;
  top: -2px;
  left: 2px;
}
.stack .card + .card + .card {
  top: -4px;
  left: 4px;
}
.open-fan {
  display: flex;
  justify-content: center;
  min-width: var(--pile-w);
  min-height: calc(var(--pile-w) * 1.4);
}
.open-fan .card + .card {
  margin-left: calc(var(--pile-w) * -0.58);
}
.open-fan .card:nth-child(odd) {
  transform: rotate(-3deg);
}
.open-fan .card:nth-child(even) {
  transform: rotate(4deg);
}
.timer-num {
  font-variant-numeric: tabular-nums;
  min-width: 1.6em;
  text-align: center;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.2);
  padding: 0 6px;
  font-weight: 800;
}
.timer-num:empty {
  display: none;
}
.timer-num.low {
  background: var(--bad);
  color: #fff;
}
.last-action {
  font-size: 12.5px;
  line-height: 1.3;
  color: rgba(251, 246, 234, 0.75);
  max-width: 100%;
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Verdict in the middle of the table during the reveal. */
.verdict-pop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.verdict-big {
  font-size: clamp(28px, 8vw, 44px);
  line-height: 1.05;
  padding: 6px 16px 2px;
  border-radius: 10px;
  background: var(--brass);
  color: #2a1c05;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
.verdict-pop.wrong .verdict-big {
  background: #b3261e;
  color: var(--ivory);
}
.verdict-sub {
  font-size: 14px;
  color: var(--ivory);
}
@keyframes pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}

/* ---------- seats ---------- */

.seat {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -50%);
  width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  pointer-events: none;
}
.seat-top {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
}
.seat .avatar {
  --size: 44px;
}
.seat-name {
  margin-top: 2px;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.15;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.seat-score {
  font-size: 12px;
  line-height: 1.2;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.offline-note {
  color: var(--bad);
}
.seat.offline .avatar {
  filter: grayscale(0.8);
  opacity: 0.6;
}
.seat.out {
  opacity: 0.45;
}
.seat.me .seat-name {
  color: var(--brass);
}

/* The turn ring doubles as the turn timer (--p goes from 1 to 0). */
.seat.turn .seat-top::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--brass) calc(var(--p, 1) * 360deg), rgba(0, 0, 0, 0.35) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
  z-index: 3;
}
.seat.turn.low .seat-top::before {
  background: conic-gradient(var(--bad) calc(var(--p, 1) * 360deg), rgba(0, 0, 0, 0.35) 0);
}
.seat.turn .seat-top {
  filter: drop-shadow(0 0 10px rgba(217, 169, 68, 0.55));
}

/* Cards held behind the avatar. */
.fan {
  position: absolute;
  left: 50%;
  top: -7px;
  width: 0;
  height: 0;
  z-index: 1;
}
.fan i {
  position: absolute;
  left: -7px;
  top: 0;
  width: 14px;
  height: 20px;
  border-radius: 2px;
  background: var(--maroon);
  border: 1.5px solid var(--ivory);
  transform-origin: 50% 160%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.count-chip {
  position: absolute;
  right: -4px;
  bottom: -2px;
  z-index: 4;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--ivory);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Hands turned face up after a show. */
.seat.revealing {
  z-index: 5;
}
.seat-reveal {
  display: flex;
  margin-top: 3px;
}
.seat-reveal .card + .card {
  margin-left: -13px;
}
/* Seats at the sides lay their revealed hand towards the middle of the table. */
.seat.side-left .seat-reveal {
  align-self: flex-start;
  transform: translateX(16px);
}
.seat.side-right .seat-reveal {
  align-self: flex-end;
  transform: translateX(-16px);
}
.count-chip.pts {
  min-width: 26px;
  height: 22px;
  line-height: 22px;
  font-size: 13px;
  right: -10px;
}
.count-chip.pts.good {
  background: var(--good);
  color: #062611;
}
.count-chip.pts.wrong {
  background: var(--bad);
  color: #fff;
}
.seat.caller .seat-top {
  filter: drop-shadow(0 0 12px rgba(217, 169, 68, 0.8));
}

/* ---------- hand + actions ---------- */

.hand-area {
  padding: 6px 0 var(--safe-b);
}
.hand-area.watching {
  text-align: center;
  padding: 16px;
}
/* Seven cards always fit on one row; with more they overlap instead of wrapping. */
.hand {
  --avail: calc(min(100vw, 980px) - 44px);
  --card-w: min(80px, calc(var(--avail) / 7.4));
  display: flex;
  justify-content: center;
  padding: 16px 0 10px;
}
.hand .card + .card {
  margin-left: min(6px, calc((var(--avail) - var(--n, 7) * var(--card-w)) / (var(--n, 7) - 1)));
}
.hand .card {
  cursor: pointer;
}
.hand .card.selected {
  transform: translateY(-14px);
  box-shadow: 0 0 0 3px var(--brass), 0 10px 18px rgba(0, 0, 0, 0.5);
}
.hand .card.match:not(.selected)::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--good);
}
.hand.disabled .card {
  cursor: default;
}
.actions {
  display: grid;
  grid-template-columns: auto 1fr 1.5fr;
  gap: 8px;
  align-items: center;
  max-width: 560px;
  margin: 0 auto;
}
.points {
  text-align: center;
  padding: 0 6px;
  line-height: 1.05;
}
.points b {
  display: block;
  font-family: var(--display);
  font-weight: 400;
  font-size: 28px;
}
.points span {
  font-size: 12px;
  color: var(--muted);
}
.actions .btn {
  min-height: 54px;
  padding: 0 10px;
  font-size: 16px;
}
.play-hint {
  display: block;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.85;
}

/* ---------- cards ---------- */

.card {
  --w: var(--card-w);
  width: var(--w);
  height: calc(var(--w) * 1.4);
  border-radius: calc(var(--w) * 0.11);
  background: var(--ivory);
  border: 1px solid var(--ivory-edge);
  color: var(--ink);
  position: relative;
  flex: none;
  padding: 0;
  margin: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.card.red {
  color: var(--card-red);
}
.card .corner {
  position: absolute;
  top: calc(var(--w) * 0.05);
  left: calc(var(--w) * 0.09);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.9;
}
.card .corner b {
  font-family: var(--display);
  font-weight: 400;
  font-size: calc(var(--w) * 0.36);
  letter-spacing: -0.04em;
}
.card .corner small {
  font-size: calc(var(--w) * 0.24);
  line-height: 1;
}
.card .pip {
  position: absolute;
  right: calc(var(--w) * 0.08);
  bottom: calc(var(--w) * 0.03);
  font-size: calc(var(--w) * 0.55);
  line-height: 1;
}
.card.joker {
  color: #5b2a86;
}
.card.joker .corner {
  font-family: var(--body);
  font-weight: 800;
  font-size: calc(var(--w) * 0.17);
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: -0.05em;
  line-height: 1;
}
/* Maroon back with a brass lattice. */
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(217, 169, 68, 0.45) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(-45deg, rgba(217, 169, 68, 0.45) 0 1px, transparent 1px 6px),
    radial-gradient(circle, #9a2a3c, var(--maroon));
  border: 3px solid var(--ivory);
  box-shadow:
    inset 0 0 0 1.5px rgba(217, 169, 68, 0.8),
    0 2px 5px rgba(0, 0, 0, 0.4);
}
.card.tiny {
  --card-w: 24px;
  border-radius: 3px;
}
.card.tiny .pip {
  display: none;
}
.mini {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.mini .card {
  --card-w: 30px;
  box-shadow: none;
}

/* ---------- motion ---------- */

.fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
}
.flyer {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
  position: fixed !important;
  margin: 0 !important;
  pointer-events: none;
  will-change: transform, opacity;
  backface-visibility: hidden;
}
.card.in-flight {
  visibility: hidden;
}
.card.flip-in {
  animation: flip-in 0.35s ease-out;
}
.card.flip {
  animation: flip-in 0.45s ease-out both;
  animation-delay: var(--d, 0ms);
}
@keyframes flip-in {
  from {
    transform: perspective(300px) rotateY(90deg);
    filter: brightness(0.6);
  }
}
.bubble {
  position: fixed;
  z-index: 85;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--ivory);
  color: var(--ink);
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}
.bubble.good {
  background: var(--good);
  color: #062611;
}
.bubble.bad {
  background: var(--bad);
  color: #fff;
}

/* ---------- sheets ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(14, 7, 11, 0.7);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.18s ease-out;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.sheet {
  width: 100%;
  max-width: 600px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 20px 16px calc(16px + var(--safe-b));
  animation: rise 0.24s ease-out;
}
@keyframes rise {
  from {
    transform: translateY(40px);
  }
}
.sheet h2 {
  font-size: 22px;
  margin-bottom: 8px;
}
.sheet .panel-title {
  margin-top: 14px;
}
.sheet-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.sheet-actions.two {
  grid-template-columns: 1fr 1fr;
}

.verdict {
  text-align: center;
  padding: 4px 0 6px;
}
.verdict .big {
  font-size: 40px;
  line-height: 1.1;
}
.verdict.good .big {
  color: var(--good);
}
.verdict.wrong .big {
  color: var(--bad);
}
.verdict.win .big {
  color: var(--brass);
}
.trophy {
  font-size: 40px;
  line-height: 1;
}
.knocked {
  text-align: center;
  color: var(--bad);
  font-weight: 600;
  margin: 4px 0 0;
}

/* Score table */
.score-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}
.scores {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}
.scores th,
.scores td {
  padding: 8px 10px;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.scores thead th {
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
}
.scores tbody tr:last-child > * {
  border-bottom: 0;
}
.scores .who {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  background: var(--sheet);
  max-width: 120px;
}
.scores thead .who {
  background: #261720;
}
.who-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.scores .total {
  position: sticky;
  right: 0;
  background: var(--sheet);
  min-width: 64px;
}
.scores thead .total {
  background: #261720;
}
.scores .total b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 20px;
  line-height: 1;
}
.scores .total .bar {
  margin-top: 3px;
}
.scores td.plus {
  color: var(--text);
}
.scores td.na {
  color: rgba(195, 178, 186, 0.5);
}
.scores td.caller.good {
  color: var(--good);
  font-weight: 800;
}
.scores td.caller.wrong {
  color: var(--bad);
  font-weight: 800;
}
.scores .hl {
  background: rgba(217, 169, 68, 0.14);
}
.scores tr.you .who-name {
  color: var(--brass);
}
.scores tr.out {
  opacity: 0.5;
}
.score-block p {
  margin: 8px 2px 0;
}
.bar {
  height: 4px;
  border-radius: 4px;
  background: rgba(246, 238, 223, 0.12);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--good);
}
.bar.warn > i {
  background: var(--brass);
}
.bar.danger > i {
  background: var(--bad);
}

.hands-details {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.hands-details summary {
  cursor: pointer;
  font-weight: 600;
}
.results {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
}
.result .who {
  font-weight: 600;
}
.result .nums {
  color: var(--muted);
  font-size: 14px;
}
.result .mini {
  grid-column: 1 / -1;
}
.result.caller .who {
  color: var(--brass);
}

.rules ul {
  padding-left: 20px;
  margin: 8px 0;
}
.rules li {
  margin: 6px 0;
}
.log-list {
  padding-left: 22px;
  margin: 0;
  max-height: 60dvh;
  overflow-y: auto;
  color: var(--muted);
}
.log-list li {
  margin: 4px 0;
}

.close-warn {
  background: rgba(240, 103, 93, 0.14);
  border: 1px solid var(--bad);
  color: #ffd9d6;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.toast {
  position: fixed;
  left: 50%;
  top: calc(12px + var(--safe-t));
  transform: translate(-50%, -20px);
  z-index: 90;
  background: #3a1513;
  border: 1px solid var(--bad);
  color: #ffd9d6;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  max-width: calc(100vw - 32px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.info {
  background: var(--sheet);
  border-color: var(--brass);
  color: var(--text);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.conn {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 95;
  text-align: center;
  padding: calc(6px + var(--safe-t)) 8px 6px;
  background: var(--bad);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

/* ---------- bigger screens ---------- */

@media (min-width: 720px) {
  .app {
    padding-left: 24px;
    padding-right: 24px;
  }
  .lobby {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .lobby .code-box {
    grid-column: 1 / -1;
  }
  .seat {
    width: 110px;
  }
  .seat .avatar {
    --size: 54px;
  }
  .seat-top {
    width: 62px;
    height: 62px;
  }
  .seat-name {
    font-size: 15px;
  }
  .card.tiny {
    --card-w: 30px;
  }
  .overlay {
    align-items: center;
  }
  .sheet {
    border-radius: 22px;
  }
}

/* Short landscape phones: tighten the vertical rhythm. */
@media (max-height: 520px) and (orientation: landscape) {
  .arena {
    min-height: 300px;
  }
  .hand {
    --card-w: min(56px, calc(var(--avail) / 7.4));
  }
  .pile {
    --pile-w: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
