/* Laid out after Apple's interface guidelines: system font and colours,
   grouped lists, frosted materials, filled buttons, sheets. Follows the
   system's light or dark appearance. */

:root {
  color-scheme: light dark;

  --bg: #f2f2f7;                       /* grouped background */
  --panel: #ffffff;                    /* a cell on it */
  --sheet: #f2f2f7;                    /* a dialog's background ... */
  --cell: #ffffff;                     /* ... and its cells */
  --fill: rgba(120, 120, 128, 0.12);   /* grey fill behind buttons and fields */
  --fill-strong: rgba(120, 120, 128, 0.2);
  --line: rgba(60, 60, 67, 0.18);      /* hairline separators */
  --text: #000000;
  --muted: rgba(60, 60, 67, 0.6);
  --faint: rgba(60, 60, 67, 0.35);
  --material: rgba(250, 250, 252, 0.78);
  --material-line: rgba(0, 0, 0, 0.07);
  --plate: rgba(255, 255, 255, 0.86);  /* a seat's name plate on the felt */
  --segment: #ffffff;                  /* the chosen part of a segmented control */
  --bubble: #e9e9eb;                   /* someone else's chat line */
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);

  --accent: #007aff;
  --focus: rgba(0, 122, 255, 0.45);
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --yellow: #ffd60a;

  --felt-light: #2e9a68;
  --felt: #1b7449;
  --felt-dark: #0e4a2e;
  --rail: #26262a;
  --card: #ffffff;
  --card-ink: #1d1d1f;
  --card-red: #e3261f;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "PingFang SC",
             system-ui, sans-serif;
  font-family: var(--font);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --panel: #1c1c1e;
    --sheet: #1c1c1e;
    --cell: #2c2c2e;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.36);
    --line: rgba(84, 84, 88, 0.65);
    --text: #ffffff;
    --muted: rgba(235, 235, 245, 0.6);
    --faint: rgba(235, 235, 245, 0.3);
    --material: rgba(28, 28, 30, 0.78);
    --material-line: rgba(255, 255, 255, 0.08);
    --plate: rgba(44, 44, 46, 0.86);
    --segment: #636366;
    --bubble: #3a3a3c;
    --shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.4);

    --accent: #0a84ff;
    --focus: rgba(10, 132, 255, 0.55);
    --green: #30d158;
    --red: #ff453a;
    --orange: #ff9f0a;
    --rail: #1c1c1e;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, p { margin: 0; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }

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

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 10px max(20px, env(safe-area-inset-right)) 10px max(20px, env(safe-area-inset-left));
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--line);
}
.bar h1 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.manage { display: flex; gap: 2px; }
.conn { margin-left: auto; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.conn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.conn.online::before { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
.conn.offline { color: var(--orange); }
.conn.offline::before { background: var(--orange); }
#lang { background: var(--fill); border-radius: 999px; padding: 4px 12px; color: var(--text); font-weight: 600; font-size: 13px; }

/* ---------------------------------------------------------------- buttons */

button {
  border: 0;
  background: var(--fill);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.15s, filter 0.15s, transform 0.1s, box-shadow 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
button:hover:not(:disabled) { background: var(--fill-strong); }
button:active:not(:disabled) { transform: scale(0.97); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
button:disabled { opacity: 0.38; cursor: default; }

/* Filled: the one thing to do next */
button.primary { background: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.1); }
button.primary.danger, button.primary.danger:hover:not(:disabled) { background: var(--red); }

/* Plain: words in the accent colour, like a toolbar's */
button.quiet { background: transparent; color: var(--accent); font-weight: 400; padding: 6px 10px; border-radius: 8px; font-size: 15px; }
button.quiet:hover:not(:disabled) { background: var(--fill); }
button.destructive, button.fold { color: var(--red); }

button.small { padding: 6px 12px; font-size: 13px; font-weight: 500; border-radius: 8px; }

/* The App Store's "Get": a grey capsule with bold accent words */
button.get {
  border-radius: 999px;
  padding: 6px 18px;
  min-width: 76px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}

/* ---------------------------------------------------------------- fields */

/* :where keeps these weak, so the rules for each place below win */
:where(input:not([type="range"]):not([type="radio"]), select) {
  background-color: var(--fill);
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 16px;
  color: var(--text);
  transition: box-shadow 0.15s;
}
input::placeholder { color: var(--faint); }
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

/* A section's small grey heading, over a grouped list */
.section-label, .card-panel label, .form-grid label, .styles legend, .count-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  padding: 0 16px;
  margin: 18px 0 7px;
}

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

.join { flex: 1; display: flex; justify-content: center; padding: 40px 16px 48px; overflow-y: auto; }
.card-panel { width: min(600px, 100%); display: flex; flex-direction: column; }
.card-panel h2 { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; padding: 0 4px; margin-bottom: 4px; }
.card-panel input { background-color: var(--panel); border-radius: 12px; padding: 14px 16px; font-size: 17px; }
.hint { color: var(--muted); font-size: 13px; padding: 8px 16px 0; }
.error { color: var(--red); font-size: 13px; min-height: 1.4em; padding: 6px 16px 0; }

/* The tables: one grouped list, rows split by inset hairlines */
.tables { list-style: none; margin: 4px 0 0; padding: 0; background: var(--panel); border-radius: 12px; overflow: hidden; }
.tables > .hint { padding: 16px; }
.table-row { position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 16px; }
.table-row + .table-row::before {
  content: ""; position: absolute; top: 0; right: 0; left: 66px;
  border-top: 0.5px solid var(--line);
}
.ticon {
  flex: none; width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center;
  color: #fff; font-size: 20px; line-height: 1;
  background: linear-gradient(180deg, #45d06d, #28a745);
}
.ticon.n1 { background: linear-gradient(180deg, #ff6b62, #e5352c); }
.ticon.n2 { background: linear-gradient(180deg, #ffad33, #f08300); }
.ticon.n3 { background: linear-gradient(180deg, #4aa3ff, #0a6cf0); }
.ticon.n0 { background: linear-gradient(180deg, #8e8cf0, #5856d6); }
.table-row .tinfo { flex: 1; min-width: 0; }
.table-row .tname { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; letter-spacing: -0.02em; }
.table-row .tmeta { color: var(--muted); font-size: 13px; margin-top: 1px; }
.table-row button { flex: 0 0 auto; }

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  vertical-align: 2px;
}
.tag.playing { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }

/* "Open a new table": a row of its own, words in the accent colour */
#create-open {
  margin-top: 20px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  color: var(--accent);
  text-align: left;
  font-size: 17px;
  font-weight: 400;
  padding: 13px 16px;
}
#create-open::before {
  content: "+";
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font-size: 19px; font-weight: 500; line-height: 1;
}
#create-open:hover:not(:disabled) { background: var(--panel); filter: brightness(0.97); }

/* ---------------------------------------------------------------- layout */

.game { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 320px; min-height: 0; }
.play { display: flex; flex-direction: column; min-width: 0; padding: 18px 24px 14px; gap: 14px; }
.side { min-width: 0; border-left: 0.5px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 18px 8px; }
.side-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }

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

.table {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 260px);
  min-height: 300px;
}
/* The seats stand on a ring set in from the edge by half a seat, so a seat
   never sticks out of the table area. The rail runs under them. */
.ring { position: absolute; inset: 52px 76px; }
.felt {
  position: absolute;
  inset: 52px 76px;
  border-radius: 999px;
  background:
    radial-gradient(ellipse 70% 60% at 50% 38%, var(--felt-light), transparent 70%),
    radial-gradient(ellipse at 50% 50%, var(--felt), var(--felt-dark));
  border: 12px solid var(--rail);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    inset 0 12px 40px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 30px 60px -10px rgba(0, 0, 0, 0.45);
}
/* The printed line where bets go */
.felt::after {
  content: "";
  position: absolute;
  inset: 22px 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  width: 60%;
  color: #fff;
}
.stage { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; color: rgba(255, 255, 255, 0.6); text-transform: uppercase; }
.board { display: flex; gap: 7px; justify-content: center; }
.pot {
  font-family: var(--rounded);
  font-weight: 500;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding: 4px 14px;
  border-radius: 999px;
}
.pot b { color: #fff; font-size: 17px; font-weight: 700; }
.result { font-weight: 600; color: var(--yellow); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35); }
.result div + div { margin-top: 2px; }
.center .over { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.center .wait { color: rgba(255, 255, 255, 0.8); font-size: 13px; }

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

.card {
  width: 46px;
  height: 64px;
  border-radius: 7px;
  background: var(--card);
  color: var(--card-ink);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--rounded);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.22);
  flex: none;
}
.card .rank { font-size: 21px; }
.card .suit { font-size: 17px; margin-top: 3px; }
.card.red { color: var(--card-red); }
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.13) 0 2px, transparent 2px 7px),
    linear-gradient(145deg, #6e6cf2, #2f7cf6 60%, #1a5fd6);
  box-shadow: inset 0 0 0 2px #fff, 0 1px 1px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.22);
}
.card.slot { background: rgba(0, 0, 0, 0.14); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.card.small { width: 30px; height: 42px; border-radius: 5px; }
.card.small .rank { font-size: 14px; }
.card.small .suit { font-size: 12px; margin-top: 1px; }
.card.large { width: 62px; height: 86px; border-radius: 9px; }
.card.large .rank { font-size: 28px; }
.card.large .suit { font-size: 23px; margin-top: 4px; }

/* cards written inside a line of text */
.inline-card {
  font-family: var(--rounded);
  font-weight: 700;
  white-space: nowrap;
  background: var(--card);
  color: var(--card-ink);
  border-radius: 4px;
  padding: 0 4px;
  margin: 0 1px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.15);
}
.inline-card.red { color: var(--card-red); }

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

.seat {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.seat .cards { display: flex; gap: 3px; justify-content: center; height: 42px; }

.seat .plate {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px 6px 6px;
  background: var(--plate);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-radius: 18px;
  box-shadow: inset 0 0 0 0.5px var(--material-line), 0 6px 18px rgba(0, 0, 0, 0.28);
  transition: box-shadow 0.25s;
}
.seat.turn .plate {
  box-shadow: 0 0 0 2.5px var(--accent), 0 6px 24px color-mix(in srgb, var(--accent) 45%, transparent);
  animation: turn-glow 1.6s ease-in-out infinite alternate;
}
.seat.winner .plate { box-shadow: 0 0 0 2.5px var(--green), 0 6px 24px color-mix(in srgb, var(--green) 45%, transparent); }
@keyframes turn-glow {
  to { box-shadow: 0 0 0 2.5px var(--accent), 0 6px 34px color-mix(in srgb, var(--accent) 70%, transparent); }
}
/* Dim what is inside, not the plate: a see-through plate lets the rail show. */
.seat.out .cards, .seat.out .avatar, .seat.out .who { opacity: 0.45; }

.avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--rounded);
  font-size: 17px;
  font-weight: 600;
  background-color: var(--avatar, #8e8e93);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(0, 0, 0, 0.08));
}
.avatar.bot { background-color: #8e8e93; background-image: linear-gradient(180deg, #b0b0b6, #85858b); }

.seat .who { flex: 1; min-width: 0; text-align: left; line-height: 1.25; }
.seat .name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.02em; }
.seat.me .name { color: var(--accent); }
.seat .stack { color: var(--muted); font-family: var(--rounded); font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 500; }
.seat .stack .tag { margin-left: 4px; vertical-align: 1px; font-family: var(--font); }
.seat .status { font-size: 12px; color: var(--muted); min-height: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .status:empty { display: none; }
.seat .status.allin { color: var(--orange); font-weight: 600; }
.seat .status.made { color: var(--green); font-weight: 600; }
.seat .status.away { color: var(--orange); }
.seat .timer { font-size: 12px; font-family: var(--rounded); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--orange); min-height: 15px; }

/* The host's "remove" mark, like an app icon's when the home screen jiggles */
.remove {
  position: absolute;
  top: -7px;
  left: -7px;
  z-index: 1;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  font-weight: 600;
  display: grid;
  place-items: center;
  background: rgba(120, 120, 128, 0.92);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.remove:hover:not(:disabled) { background: var(--red); }

.badges { position: absolute; top: -8px; right: -6px; display: flex; gap: 3px; z-index: 1; }
.badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: grid;
  place-items: center;
  background: #fff;
  color: #1d1d1f;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.badge.blind { background: #3a3a3c; color: #fff; }
.badge.host { background: var(--orange); color: #fff; }

.betline { display: none; font-size: 12px; font-weight: 600; color: var(--orange); font-family: var(--rounded); font-variant-numeric: tabular-nums; }

/* A bet lying on the felt in front of its seat */
.bet {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.38);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 2px 10px 2px 4px;
  font-family: var(--rounded);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #fff;
  white-space: nowrap;
}
.bet::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--yellow) 0 38%, #fff 40% 52%, var(--yellow) 54%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Chips on their way somewhere (into the pot, to a winner), over everything */
.bet.flying { position: fixed; z-index: 20; pointer-events: none; }

/* ---------------------------------------------------------------- dock */

.dock {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-radius: 22px;
  box-shadow: inset 0 0 0 0.5px var(--material-line), var(--shadow);
  padding: 14px 16px;
  min-height: 116px;
}
.mine { display: flex; align-items: center; gap: 14px; flex: none; }
.mine .cards { display: flex; gap: 6px; }
.mine .made { color: var(--muted); font-size: 13px; max-width: 150px; }
.actions { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.actions .status-line { color: var(--muted); font-size: 15px; }
.actions .status-line.yours { color: var(--text); font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.buttons button { flex: 1 1 110px; padding: 13px 16px; font-size: 17px; border-radius: 14px; }

.raise-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.raise-row .label { color: var(--muted); font-size: 13px; }
.raise-row input[type="number"] {
  width: 88px;
  padding: 7px 10px;
  font-family: var(--rounded);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  border-radius: 9px;
}

/* A slider like the system's: thin track, filled in the accent colour up to a white knob */
.raise-row input[type="range"] {
  --filled: 0%;
  flex: 1 1 140px;
  min-width: 100px;
  height: 28px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.raise-row input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--filled), var(--fill-strong) var(--filled));
}
.raise-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -11px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0.5px 4px rgba(0, 0, 0, 0.12), 0 6px 13px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
}
.raise-row input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--fill-strong); }
.raise-row input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.raise-row input[type="range"]::-moz-range-thumb {
  width: 26px; height: 26px; border: 0; border-radius: 50%; background: #fff;
  box-shadow: 0 0.5px 4px rgba(0, 0, 0, 0.12), 0 6px 13px rgba(0, 0, 0, 0.12);
}
.raise-row input[type="range"]:focus-visible { box-shadow: none; }
.raise-row input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--focus), 0 6px 13px rgba(0, 0, 0, 0.12); }

/* Raise sizes: a segmented control, the size now chosen standing out */
.segmented { display: inline-flex; background: var(--fill); border-radius: 9px; padding: 2px; gap: 2px; }
.segmented button { background: transparent; border-radius: 7px; padding: 5px 12px; }
.segmented button:hover:not(:disabled) { background: var(--fill); }
.segmented button.on { background: var(--segment); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); font-weight: 600; }
.segmented button.on:hover:not(:disabled) { background: var(--segment); }
.segmented button:active:not(:disabled) { transform: none; }

.keys { color: var(--faint); font-size: 12px; }

/* A vote to end or restart: a banner, like a notification's */
.vote {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: inset 0 0 0 0.5px var(--material-line), var(--shadow);
}
.vote::before {
  content: "?";
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  display: grid; place-items: center;
  background: var(--orange); color: #fff; font-weight: 700;
}
.vote .what { font-weight: 600; }
.vote .who { color: var(--muted); font-size: 13px; }
.vote .buttons { display: flex; flex-wrap: nowrap; gap: 8px; margin-left: auto; }
.vote .buttons button { flex: 0 0 auto; padding: 7px 16px; font-size: 15px; border-radius: 999px; }
.vote .left { color: var(--orange); font-family: var(--rounded); font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; }

.notice { color: var(--red); font-size: 13px; min-height: 1.4em; text-align: center; }

/* ---------------------------------------------------------------- log */

.log { list-style: none; margin: 0; padding: 4px 18px 18px; overflow-y: auto; flex: 1; font-size: 13px; }
.log li { padding: 3px 0; color: var(--muted); overflow-wrap: anywhere; }
.log li.hand-start {
  margin-top: 14px;
  padding: 10px 0 2px;
  border-top: 0.5px solid var(--line);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.log li.hand-start:first-child { margin-top: 0; padding-top: 4px; border-top: 0; }
.log li.win { color: var(--green); font-weight: 600; }
.log li.street { color: var(--text); }
.log li.empty { color: var(--faint); }

/* ---------------------------------------------------------------- chat */

.side-tabs button { position: relative; padding: 5px 14px; font-size: 13px; }
.unread {
  display: inline-grid; place-items: center;
  min-width: 17px; height: 17px; padding: 0 5px; margin-left: 6px;
  border-radius: 9px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; vertical-align: 1px;
}

.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-lines { list-style: none; margin: 0; padding: 6px 14px 8px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; }
.chat-lines .empty { color: var(--faint); font-size: 13px; text-align: center; margin: auto 0; padding: 20px 0; }
.msg { display: flex; flex-direction: column; align-items: flex-start; margin-top: 8px; }
.msg.run { margin-top: 2px; }
.msg.mine { align-items: flex-end; }
.msg .from { font-size: 11px; color: var(--muted); margin: 0 12px 2px; }
.msg .text {
  max-width: 85%;
  padding: 7px 12px;
  border-radius: 18px;
  background: var(--bubble);
  font-size: 14px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  animation: line-in 0.22s ease-out;
}
.msg.mine .text { background: var(--accent); color: #fff; }
.msg:not(:last-child) .text { animation: none; }
@keyframes line-in { from { opacity: 0; transform: translateY(6px) scale(0.96); } }

.phrases { display: flex; gap: 6px; overflow-x: auto; padding: 6px 14px 2px; scrollbar-width: none; }
.phrases::-webkit-scrollbar { display: none; }
.phrase { flex: none; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 500; }
.chat-form { display: flex; align-items: center; gap: 8px; padding: 8px 14px 14px; }
.chat-form input {
  flex: 1;
  min-width: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 15px;
  background-color: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
}
.chat-form input:focus-visible { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--focus); }
.send {
  flex: none; width: 32px; height: 32px; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 17px; font-weight: 700; line-height: 1;
}
.send:hover:not(:disabled) { background: var(--accent); filter: brightness(1.1); }

/* What someone just said, over their seat for a few seconds */
.seat:has(.say) { z-index: 5; }
.say {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translateX(-50%);
  z-index: 4;
  width: max-content;
  max-width: 190px;
  padding: 7px 12px;
  border-radius: 18px;
  background: var(--cell);
  color: var(--text);
  font-size: 14px;
  line-height: 1.3;
  text-align: left;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  transition: opacity 0.3s;
}
.say span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.say::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: inherit;
  border-radius: 2px;
  transform: rotate(45deg);
}
.seat.me .say { background: var(--accent); color: #fff; }
.say.pop { animation: say-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3); transform-origin: 50% 100%; }
.say.fade { opacity: 0; }
@keyframes say-in { from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.6); } }

/* The host's "more" mark on a person's seat, and the menu it opens */
.remove.more { font-size: 8px; letter-spacing: -0.5px; }
.remove.more:hover:not(:disabled) { background: var(--accent); }
.menu {
  position: fixed;
  z-index: 30;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  padding: 5px;
  border-radius: 13px;
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28), inset 0 0 0 0.5px var(--material-line);
  animation: menu-in 0.16s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: scale(0.96); } }
.menu button {
  background: transparent;
  border-radius: 8px;
  padding: 8px 12px;
  text-align: left;
  font-weight: 400;
  font-size: 14px;
}
.menu button:hover:not(:disabled), .menu button:focus-visible { background: var(--accent); color: #fff; box-shadow: none; }
.menu button.danger { color: var(--red); }
.menu button.danger:hover:not(:disabled), .menu button.danger:focus-visible { background: var(--red); color: #fff; }
.menu button:active:not(:disabled) { transform: none; }

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

.summary {
  background: var(--sheet);
  color: var(--text);
  border: 0;
  border-radius: 20px;
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  max-height: min(84vh, 760px);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35), 0 0 0 0.5px var(--material-line);
}
.summary[open] { animation: sheet-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
}
.summary::backdrop {
  background: rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.summary .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px 10px 20px;
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--sheet) 85%, transparent);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.summary .head h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.summary .head button.quiet { font-weight: 600; }
.summary .body { padding: 0 20px 20px; }
.summary h3 {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  margin: 18px 16px 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.summary ul { list-style: none; margin: 0; padding: 8px 16px; font-size: 15px; background: var(--cell); border-radius: 12px; }
.summary li { padding: 3px 0; }
.summary .hint { padding: 8px 16px 0; }

/* Tables in a sheet: a grouped list with a hairline between rows */
.summary .nets {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
  background: var(--cell);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 14px;
}
.summary h3 + .nets { margin-top: 0; }
.summary .nets td { padding: 11px 0 11px 16px; border-top: 0.5px solid var(--line); }
.summary .nets tr:first-child td { border-top: 0; }
.summary .nets td:last-child { text-align: right; padding-right: 16px; font-family: var(--rounded); font-variant-numeric: tabular-nums; font-weight: 600; }
.summary .nets .up { color: var(--green); }
.summary .nets .down { color: var(--red); }
.summary .nets .cards-cell { text-align: right; padding-right: 12px; }
.summary .nets th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 0 6px 16px; }
.summary .nets th:last-child { text-align: right; padding-right: 16px; }
.summary .nets td.chips { text-align: right; padding-right: 16px; font-family: var(--rounded); font-variant-numeric: tabular-nums; }
.summary .nets th.chips { text-align: right; padding-right: 16px; }
.nets thead + tbody tr:first-child td { border-top: 0.5px solid var(--line); }
.nets tr.gone td { color: var(--muted); }

.summary .foot { display: flex; justify-content: flex-end; gap: 10px; padding: 4px 20px 20px; }
.summary .foot button { padding: 12px 22px; font-size: 16px; border-radius: 12px; }

/* Forms in a sheet */
.form-grid { display: flex; flex-direction: column; }
.form-grid label { margin-top: 16px; }
.form-grid input, .form-grid select { background-color: var(--cell); border-radius: 12px; padding: 13px 16px; font-size: 17px; }
.form-grid select { padding-right: 38px; }
.summary .body.form-grid { padding-top: 0; }

/* Bot styles: a grouped list with a check mark on the one chosen */
.styles { margin: 0; padding: 0; border: 0; min-width: 0; }
.styles legend { margin-top: 6px; }
.style-choice {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px 16px;
  background: var(--cell);
  cursor: pointer;
  transition: background-color 0.15s;
}
.style-choice:first-of-type { border-radius: 12px 12px 0 0; }
.style-choice:last-of-type { border-radius: 0 0 12px 12px; }
.style-choice + .style-choice::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--line); }
.style-choice:hover { background: color-mix(in srgb, var(--cell) 94%, var(--text)); }
.style-choice input { position: absolute; opacity: 0; pointer-events: none; }
.style-choice > div { flex: 1; min-width: 0; }
.style-choice b { display: block; font-weight: 500; font-size: 16px; }
.style-choice span { color: var(--muted); font-size: 13px; }
.style-choice::after { content: ""; flex: none; width: 18px; color: var(--accent); font-weight: 700; font-size: 17px; text-align: center; }
.style-choice:has(input:checked)::after { content: "✓"; }
.style-choice:has(input:focus-visible) { box-shadow: inset 0 0 0 3px var(--focus); }
.count-row { display: flex; align-items: center; gap: 8px; }
.count-row input { width: 96px; background-color: var(--cell); font-family: var(--rounded); font-weight: 600; font-variant-numeric: tabular-nums; }

/* A question to confirm: an alert, small and centred, its two answers side by side */
.confirm { width: min(320px, calc(100vw - 48px)); border-radius: 16px; }
.confirm p { padding: 22px 20px 18px; text-align: center; font-size: 15px; }
.confirm .foot { padding: 0 14px 14px; }
.confirm .foot button { flex: 1; padding: 11px 12px; font-size: 16px; }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 860px) {
  .game { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 300px; }   /* the phrase row scrolls, never widens the page */
  .side { border-left: 0; border-top: 0.5px solid var(--line); }
  .play { padding: 10px 10px 8px; gap: 10px; }
  .table { aspect-ratio: 4 / 5; max-height: none; min-height: 440px; }
  .ring, .felt { inset: 46px 46px; }
  .felt { border-width: 9px; }
  .felt::after { inset: 14px; }
  .seat { width: 90px; gap: 3px; }
  .seat .plate { flex-direction: column; gap: 0; padding: 5px 4px 6px; border-radius: 14px; }
  /* Badges and the remove mark go up by the cards, off the short plate's words */
  .seat .plate { position: static; -webkit-backdrop-filter: none; backdrop-filter: none; }   /* a blur would hold them in */
  .badges { top: -6px; right: -12px; }
  .badge.host { font-size: 0; padding: 0; }                       /* a star, not the word */
  .badge.host::before { content: "★"; font-size: 11px; }
  .remove { top: -6px; left: -4px; }
  /* The connection shows as its dot alone, so the bar keeps to two lines */
  .conn { font-size: 0; gap: 0; }
  .seat .avatar { display: none; }
  .seat .who { text-align: center; width: 100%; }
  .seat .name { font-size: 13px; }
  .seat .cards { height: 34px; }
  .card.small { width: 24px; height: 34px; border-radius: 4px; }
  .card.small .rank { font-size: 12px; }
  .card.small .suit { font-size: 10px; }
  .card { width: 36px; height: 51px; border-radius: 6px; }
  .card .rank { font-size: 17px; }
  .card .suit { font-size: 14px; }
  .board { gap: 4px; }
  .board .card { width: 32px; height: 45px; border-radius: 5px; }
  .board .card .rank { font-size: 15px; }
  .board .card .suit { font-size: 12px; }
  .bet:not(.flying) { display: none; }
  .betline { display: block; }
  .card.large { width: 50px; height: 70px; border-radius: 8px; }
  .card.large .rank { font-size: 22px; }
  .card.large .suit { font-size: 19px; }
  .dock { flex-direction: column; align-items: stretch; border-radius: 20px; padding: 12px; }
  .mine { justify-content: center; }
  .keys { display: none; }
  .segmented { flex: 1 1 100%; }
  .segmented button { flex: 1; }
  .bar { gap: 6px 8px; padding: 8px 12px; }
  .say { max-width: 140px; font-size: 13px; }
  .tag { display: none; }
  .join { padding-top: 24px; }
  .card-panel h2 { font-size: 30px; }
}

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