/* Whot design tokens and shared components.
   Extracted from the design screens. Use data-theme on <html>. */

:root,
[data-theme="light"] {
  --bg: #F4F6F5;
  --surface: #FFFFFF;
  --ink: #15201C;
  --muted: #55635D;
  --line: #DDE3E0;
  --accent: #8E1B2E;
  --on-accent: #FFFFFF;
  --logo: #7B2046;        /* logo card */
  --logo2: #7B2046;       /* "Card" in the wordmark */
  --chip: #E8EDEA;
  --ok: #1F6B52;
  --felt: #1F6B52;
  --felt-hi: #2A7D61;
  --shadow: 0 1px 2px rgba(21, 32, 28, .06), 0 10px 28px rgba(21, 32, 28, .08);
}

[data-theme="dark"] {
  --bg: #0F1614;
  --surface: #18211E;
  --ink: #EEF3F0;
  --muted: #A3B1AB;
  --line: #2A3632;
  --accent: #E8697C;
  --on-accent: #1A0A0D;
  --logo: #FDFCF9;
  --logo2: #E88FA6;
  --chip: #222D29;
  --ok: #6FCBA8;
  --felt: #143B2E;
  --felt-hi: #1B4B3B;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
}

/* Fixed colours, same in both themes */
:root {
  --card-face: #FDFCF9;
  --card-ink: #7B2046;    /* wine, taken from the owner's reference card */
  --card-edge: #E6E1DA;
  --turn: #F2B84B;        /* your turn, active seat, announcements */
  --on-turn: #1A1405;
  --font-display: Fredoka, ui-rounded, system-ui, sans-serif;
  --font-body: Inter, system-ui, sans-serif;
  --shape-size: 78%;      /* centre shape width, from the owner's reference card */
}

/* Table colour candidates. OPEN ITEM: owner to choose. Default is felt (above). */
.table--oxblood  { --felt: #5A1420; --felt-hi: #74202E; }
.table--charcoal { --felt: #20272A; --felt-hi: #2F393D; }
.table--navy     { --felt: #182C4A; --felt-hi: #223E66; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  transition: background-color .35s, color .35s;
}
*, *::before, *::after { box-sizing: border-box; }
.hd { font-family: var(--font-display); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 14px; border: 0;
  background: var(--accent); color: var(--on-accent);
  font: 600 16px var(--font-body); text-decoration: none; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(142, 27, 46, .28); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { box-shadow: none; border-color: var(--muted); }

/* Icon button (theme toggle, mic, speaker, volume) */
.ib {
  width: 44px; height: 44px; flex: none; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: transform .2s;
}
.ib.live  { background: var(--accent); border-color: var(--accent); color: var(--on-accent); } /* mic on */
.ib.muted { border-style: dashed; color: var(--muted); }                                      /* speaker off */

/* Inputs and panels */
.field {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink);
  font: 500 16px var(--font-body); transition: border-color .15s, box-shadow .15s;
}
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.field::placeholder { color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }

/* Tooltip */
.tipb { width: 44px; height: 44px; border: 0; background: none; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); }
.tipb span { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor; font: 600 13px/1 var(--font-body); display: flex; align-items: center; justify-content: center; }
.tip {
  position: absolute; z-index: 20; top: calc(100% + 2px); left: 0; width: min(320px, 100%);
  padding: 14px 16px 6px; border-radius: 14px; background: var(--ink); color: var(--bg);
  font-size: 14px; line-height: 1.5; box-shadow: 0 10px 24px rgba(0, 0, 0, .25);
  animation: rise .25s cubic-bezier(.2, .7, .2, 1) both;
}

/* Cards. Everything scales from --cw, set on the table. */
.table { container-type: inline-size; }
.table__stage {
  --cw: clamp(58px, 8.2cqw, 104px);
  background: radial-gradient(ellipse at 50% 40%, var(--felt-hi), var(--felt) 70%);
  border-radius: 24px;
}
.card {
  width: var(--cw); height: calc(var(--cw) * 1.4); border-radius: calc(var(--cw) * .08);
  background: var(--card-face); color: var(--card-ink); border: 1px solid var(--card-edge);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .3); position: relative; flex: none; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600;
}
/* Corner index: number, and on star cards a small star holding the doubled number.
   Repeated in the bottom-right corner, rotated 180 degrees. */
.card__corner { position: absolute; top: 5%; left: 8%; font-size: calc(var(--cw) * .3); line-height: 1; display: flex; flex-direction: column; align-items: center; gap: calc(var(--cw) * .03); }
.card__corner--bottom { top: auto; left: auto; bottom: 5%; right: 8%; rotate: 180deg; }
.card__star-num {
  width: calc(var(--cw) * .2); height: calc(var(--cw) * .2); padding-top: 8%;
  background: var(--card-ink); color: var(--card-face);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  display: flex; align-items: center; justify-content: center;
  font: 600 calc(var(--cw) * .08)/1 var(--font-body);
}
.card__shape { width: var(--shape-size); fill: var(--card-ink); }
/* Helper tag on special cards in the hand: Hold, +2, +3, Skip, All +1, Wild. Not on real cards; it is a UI aid. */
.card__tag { position: absolute; bottom: 6%; left: 7%; padding: .25em .55em; border-radius: 999px; background: var(--card-face); border: 1px solid var(--card-ink); font: 600 max(9px, calc(var(--cw) * .1))/1 var(--font-body); letter-spacing: .03em; text-transform: uppercase; }

/* Card back: full-bleed wine, the name twice, the upper one upside down, as on the owner's reference.
   Set in the site's own display face; do not copy a commercial deck's lettering. */
.card--back { background: var(--card-ink); border: 0; flex-direction: column; gap: calc(var(--cw) * .03); }
.card--back::before, .card--back::after { content: "Whot"; font: 600 calc(var(--cw) * .3)/1 var(--font-display); color: #FFFFFF; }
.card--back::before { rotate: 180deg; }

/* Hand */
.hand .card { margin: 0 calc(var(--cw) * -.14); cursor: pointer; transition: transform .18s cubic-bezier(.2, .7, .2, 1), filter .18s; }
.hand .card.is-playable { transform: translateY(-12px); }
.hand .card.is-playable:hover,
.hand .card.is-playable:focus-visible { transform: translateY(-26px) scale(1.05); z-index: 5; }
.hand .card:disabled { filter: saturate(.5) brightness(.78); cursor: default; }
.card:focus-visible { outline: 3px solid var(--turn); outline-offset: 2px; }

/* Motion */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.rise { animation: rise .6s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes seat-glow { 50% { box-shadow: 0 0 0 2px var(--turn), 0 0 0 8px rgba(242, 184, 75, .22); } }
.seat.is-turn { background: rgba(255, 255, 255, .14); box-shadow: 0 0 0 2px var(--turn); animation: seat-glow 1.4s ease-in-out infinite; }
@keyframes talk { 0%, 100% { box-shadow: 0 0 0 2px #FFFFFF; } 50% { box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 7px rgba(255, 255, 255, .3); } }
.avatar.is-talking { animation: talk 1s ease-in-out infinite; }

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