/*
 * The table's look: the page around the 3D canvas - menu, action buttons,
 * hints, result card, help and report sheets, the phone frame.
 * Loaded by index.html; the 3D scene itself is drawn by src/stage.js.
 */

:root {
  --strip: 100px;
  --ink: #e9e4d6;
  --muted: rgba(233, 228, 214, 0.72);
  --panel: rgba(17, 25, 28, 0.86);
  --gold-1: #ffe08a;
  --gold-2: #e5a12f;
  --blue-1: #78d8ff;
  --blue-2: #2d7fd2;
  --silver-1: #f3f6f8;
  --silver-2: #a6b2bb;
  --font: -apple-system, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  --safe-l: max(12px, env(safe-area-inset-left));
  --safe-r: max(12px, env(safe-area-inset-right));
  --safe-t: max(8px, env(safe-area-inset-top));
}
html,
body {
  margin: 0;
  height: 100%;
  background: #11191c;
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* Pin the page to the screen so a stale iOS resume cannot leave a gap. */
html:not(.phone-frame) body {
  position: fixed;
  inset: 0;
  height: auto;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/*
 * `?phone`: the table inside an iPhone-landscape frame (844x390), for
 * trying the phone layout on a laptop or in a browser pane. The
 * transform makes the frame the containing block of every fixed
 * overlay, so the menu, buttons and result card sit inside it.
 */
html.phone-frame {
  display: grid;
  place-items: center;
  background: #05080a;
}
html.phone-frame body {
  width: min(844px, calc(100vw - 16px));
  height: auto;
  aspect-ratio: 844 / 390;
  border-radius: 28px;
  box-shadow: 0 0 0 6px #1d2326, 0 24px 60px rgba(0, 0, 0, 0.6);
  transform: translateZ(0);
}
html.phone-frame .rotate {
  display: none !important;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* Menu */
.menu {
  position: fixed;
  top: var(--safe-t);
  left: var(--safe-l);
  display: flex;
  gap: 6px;
}
.menu {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
/* With the centre pile the console is put away: the round, the hand, your
   seat wind and the wall count go in this badge, each under a caption
   (round-badge.js). */
.wall-badge {
  display: grid;
  grid-template-columns: auto auto;
  row-gap: 3px;
  margin: 2px 0 0 4px;
  padding: 4px 2px;
  border-radius: 9px;
  background: rgba(27, 35, 38, 0.85);
  color: #e8e2cf;
  pointer-events: none;
}
.wall-badge[hidden] {
  display: none;
}
.badge-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 5px;
  line-height: 1.15;
  white-space: nowrap;
}
.badge-cell:nth-child(even) {
  border-left: 1px solid rgba(232, 226, 207, 0.18);
}
.badge-cell small {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(232, 226, 207, 0.55);
}
.badge-cell b {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 700;
}
.wall-badge .seat-fish {
  flex: none;
  width: 16px;
  height: 10px;
}
.badge-cell.dealer b,
.badge-cell.dealer small {
  color: #ff6b5e;
}
.seat-fish {
  width: 24px;
  height: 14px;
}
.build-label {
  margin: 2px 0 0 4px;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.38);
  pointer-events: none;
  user-select: none;
}
/* The game's own slanted buttons, small, in the dark corner. */
.ghost {
  position: relative;
  min-width: 84px;
  padding: 6px 14px;
  border: 0;
  border-radius: 7px;
  transform: skewX(-12deg);
  background: linear-gradient(180deg, var(--silver-1), var(--silver-2));
  color: #26323a;
  font-size: 12px;
  font-style: italic;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.ghost > span {
  display: block;
  transform: skewX(12deg);
}
.ghost:active {
  filter: brightness(0.92);
}
/* Toggles: a status light marks the state (green = on, grey = off), and an
   on option sits pressed into the panel. Labels stay just the word. */
.ghost[aria-pressed] {
  padding-left: 24px;
}
.ghost[aria-pressed]::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: #7d8a94;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.35);
}
.ghost.on {
  background: linear-gradient(180deg, var(--silver-2), #c4cdd4);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3), inset 0 -1px 0 rgba(255, 255, 255, 0.35);
}
.ghost.on::before {
  background: #6fd08e;
  box-shadow: 0 0 4px rgba(111, 208, 142, 0.55), inset 0 1px 1px rgba(0, 0, 0, 0.2);
}

/* Decisions, above the hand on the right, like the big apps. */
.actions {
  position: fixed;
  right: var(--safe-r);
  bottom: calc(var(--hand-top, var(--strip)) + 10px);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - var(--safe-r) - 20px);
  /* 19px on phones and small windows, growing with the window to 30px: the buttons are sized in em. */
  font-size: clamp(19px, 1.7vw, 30px);
}
html.phone-frame .actions {
  font-size: 19px;
}
.act {
  display: inline-flex;
  align-items: center;
  gap: 0.42em;
  min-height: 2.32em;
  padding: 0 1.05em;
  border: 0;
  border-radius: 0.42em;
  transform: skewX(-12deg);
  font-style: italic;
  font-weight: 800;
  font-size: inherit;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  animation: act-in 180ms ease-out both;
}
.act > * {
  transform: skewX(12deg);
}
.act:active {
  filter: brightness(0.92);
  transform: skewX(-12deg) translateY(1px);
}
.act:disabled {
  opacity: 0.45;
}
.act-win {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  color: #4a2a05;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}
.act-claim {
  background: linear-gradient(180deg, var(--blue-1), var(--blue-2));
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 40, 80, 0.5);
}
.act-pass {
  background: linear-gradient(180deg, var(--silver-1), var(--silver-2));
  color: #26323a;
}
.act-tiles {
  display: inline-flex;
  gap: 0.1em;
}
.act .chip {
  width: 1.16em;
  height: 1.58em;
  border-radius: 0.21em;
}
@keyframes act-in {
  from {
    opacity: 0;
    translate: 0 8px;
  }
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 30px;
  border-radius: 4px;
  background: #f8f6f0;
  box-shadow: inset 0 -2px 0 #8ccbea, 0 1px 2px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.chip img {
  width: 92%;
  height: 92%;
  object-fit: contain;
}
.chip-white img {
  visibility: hidden;
}
.chip-white {
  outline: 2px solid #2a5fa8;
  outline-offset: -6px;
}
.chip-back {
  background: #8ccbea;
}

.callout {
  position: fixed;
  z-index: 5;
  transform: translate(-50%, -50%);
  font-style: italic;
  font-weight: 900;
  font-size: 34px;
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow: 0 2px 0 #1c5d8f, 0 6px 18px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  animation: call-in 260ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.callout-win {
  font-size: 46px;
  color: var(--gold-1);
  text-shadow: 0 2px 0 #9a5a07, 0 8px 24px rgba(0, 0, 0, 0.6);
}
.callout-out {
  transition: opacity 260ms ease, translate 260ms ease;
  opacity: 0;
  translate: 0 -12px;
}
@keyframes call-in {
  from {
    opacity: 0;
    scale: 0.6;
  }
}

/* The Goulash banner: over the middle of the table while tiles are exchanged. */
.goulash {
  position: fixed;
  z-index: 4;
  left: 50%;
  top: calc((100% - var(--hand-top, var(--strip))) / 2);
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  width: min(380px, calc(100% - 340px));
  min-width: 290px;
  padding: 10px 18px 12px;
  border-radius: 14px;
  border: 2px solid var(--gold-2);
  background: rgba(17, 25, 28, 0.93);
  box-shadow: 0 0 0 5px rgba(229, 161, 47, 0.16), 0 14px 40px rgba(0, 0, 0, 0.6);
  text-align: center;
  pointer-events: none;
  animation: call-in 320ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.goulash p {
  margin: 0;
}
.goulash-kicker {
  font-size: 12px;
  color: var(--muted);
}
.goulash h2 {
  margin: 0 0 2px;
  font-style: italic;
  font-weight: 900;
  font-size: 42px;
  line-height: 1.05;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold-1);
  text-shadow: 0 2px 0 #9a5a07, 0 8px 24px rgba(0, 0, 0, 0.6);
}
.goulash-rule {
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}
.goulash-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 9px 0 3px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-1);
}
.goulash-steps span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-2);
}
.goulash-steps span.done {
  background: var(--gold-2);
}
.goulash-steps span.now {
  background: var(--gold-1);
  box-shadow: 0 0 6px var(--gold-1);
}
.goulash-steps span:last-of-type {
  margin-right: 4px;
}
.goulash-task {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}
.goulash-count {
  margin-top: 2px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.goulash-count.ready {
  color: #6fd08e;
  font-weight: 700;
}

/* The result of a hand. */
.result {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--safe-t) var(--safe-r) 8px var(--safe-l);
  /* A plain scrim: a blur over a live 3D scene costs a phone's battery. */
  background: rgba(8, 12, 14, 0.62);
}
.result[hidden] {
  display: none;
}
.result-card {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(220px, 1fr);
  gap: 6px 22px;
  align-items: start;
  width: min(860px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 16px 20px 18px;
  border: 1px solid rgba(233, 228, 214, 0.14);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(30, 40, 44, 0.97), rgba(17, 25, 28, 0.97));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: act-in 220ms ease-out both;
  touch-action: pan-y;
}
/* The final standings: one narrow column, four rows, one button. */
.standings-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: min(420px, 100%);
}
.standings-card h2 {
  margin: 0;
}
.standings-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.standings-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.standings-row.is-winner {
  background: rgba(255, 224, 138, 0.12);
}
.standings-rank {
  color: var(--muted);
}
.standings-row .total {
  font-weight: 700;
}
.result-kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.result-card h2 {
  margin: 2px 0 6px;
  font-size: 26px;
  font-style: italic;
  font-weight: 900;
  color: var(--gold-1);
}
.result-description {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
}
.result-pages {
  color: var(--muted);
}
.result-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.result-group {
  display: inline-flex;
  gap: 2px;
}
.result-tiles .chip {
  width: 28px;
  height: 38px;
}
.result-winning .chip {
  outline: 2px solid var(--gold-1);
}
.result-sums {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: start;
  gap: 2px 18px;
  margin: 0 0 10px;
  font-size: 13px;
}
.result-sums dt {
  color: var(--muted);
}
.result-sums dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.result-scores {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}
.result-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 14px;
  white-space: nowrap;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font: inherit;
  font-size: 14px;
  text-align: left;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
/* A small chevron says the row opens; it turns when it has. */
.result-row::after {
  content: "›";
  color: var(--muted);
  transition: transform 120ms ease-out;
}
.result-row[aria-expanded="true"]::after {
  transform: rotate(90deg);
}
.result-row:hover,
.result-row:focus-visible {
  background: rgba(255, 255, 255, 0.09);
}
.result-row.is-winner {
  background: rgba(255, 224, 138, 0.12);
}
.result-row .gain {
  color: #7ee2a8;
  font-weight: 700;
}
.result-row .loss {
  color: #ff8b80;
  font-weight: 700;
}
.result-row .total {
  min-width: 64px;
  text-align: right;
  color: var(--muted);
}
/* A seat's payments, shown when its row is tapped: each with its reason. */
.result-seat {
  display: grid;
  gap: 2px;
}
.result-why {
  display: grid;
  gap: 6px;
  margin: 0 0 4px;
  padding: 4px 10px 4px 14px;
  list-style: none;
  font-size: 13px;
  line-height: 1.35;
}
.result-why[hidden] {
  display: none;
}
.result-why li {
  display: grid;
  gap: 1px;
  padding-left: 10px;
  border-left: 2px solid rgba(233, 228, 214, 0.2);
}
.result-why .why-pay {
  border-left-color: #ff8b80;
}
.result-why .why-get {
  border-left-color: #7ee2a8;
}
.result-why .why-text {
  font-weight: 600;
  color: var(--ink);
}
.result-why .why-reason {
  font-size: 12px;
  color: var(--muted);
}
.result-side {
  display: grid;
  gap: 10px;
  align-content: start;
  padding-top: 18px;
}
.result-scores {
  margin-bottom: 0;
}
.result-next {
  justify-self: end;
}
/* "Play this hand again": a quiet link, not a second button. */
.result-again {
  justify-self: end;
  margin: 0;
  padding: 6px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: rgba(233, 228, 214, 0.35);
  text-underline-offset: 3px;
  cursor: pointer;
}
.result-again:hover,
.result-again:focus-visible {
  color: var(--ink);
}
/* Narrow screens stack the two columns. */
@media (max-width: 640px) {
  .result-card {
    grid-template-columns: 1fr;
  }
  .result-side {
    padding-top: 0;
  }
}

/* Closest hands: the catalogue hands your tiles are nearest to. */
.corner {
  position: fixed;
  top: var(--safe-t);
  right: var(--safe-r);
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 176px;
}
/* The door to the index of all hands: as quiet as the panel under it. */
.index-open {
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  width: 100%;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(17, 25, 28, 0.55);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.index-open:hover,
.index-open:focus-visible {
  border-color: rgba(140, 203, 234, 0.7);
}
.closest {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 6px 8px 4px;
  border-radius: 10px;
  background: rgba(17, 25, 28, 0.55);
  font-size: 11px;
}
.closest-title {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.closest ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
.closest li {
  padding: 4px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.closest li:first-child {
  border-top: 0;
}
.closest-name {
  display: block;
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.closest-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
/* The mark of a hand pinned to the panel: in the hand's name row, the sheet's button and the index card. */
.closest-name .pin-icon {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin: 0 3px -1px 0;
  color: var(--gold-1);
}
/* The pin, top right of a hand's sheet beside the close cross: an icon, gold and filled while pinned. */
.pin-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 224, 138, 0.4);
  border-radius: 50%;
  background: none;
  color: var(--gold-1);
  cursor: pointer;
}
.pin-button .pin-icon {
  width: 16px;
  height: 16px;
}
.pin-button[aria-pressed="true"] {
  border-color: rgba(255, 224, 138, 0.7);
  background: rgba(255, 224, 138, 0.2);
}
.pin-button[aria-pressed="true"] .pin-icon {
  fill: currentColor;
}
.pin-button.is-blocked {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--muted);
}
.closest-done {
  color: var(--gold-1);
  font-weight: 700;
}
.closest-need {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 3px;
}
.closest-need .chip {
  width: 15px;
  height: 20px;
  border-radius: 3px;
}
.closest-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.closest-item:hover .closest-name,
.closest-item:focus-visible .closest-name {
  text-decoration: underline;
}
.play-icon {
  flex: none;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hand-detail {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: var(--safe-t) var(--safe-r) 8px var(--safe-l, 8px);
  background: rgba(5, 9, 11, 0.62);
}
.hand-detail[hidden] {
  display: none;
}
.detail-card {
  position: relative;
  box-sizing: border-box;
  width: min(460px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 14px 16px 12px;
  border-radius: 14px;
  background: #162126;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  font-size: 13px;
}
.detail-card h2 {
  margin: 0 28px 8px 0;
  font-size: 18px;
}
.detail-card h3 {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.detail-card p {
  margin: 0;
  line-height: 1.4;
}
.detail-line {
  margin-top: 10px;
}
.detail-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}
/* The hand's sheet: wider than the other sheets, laid out to fit a phone's height without scrolling. */
.hand-card {
  /* iOS Safari inflates small text in landscape; the sheet's sizes are meant literally. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  width: min(600px, 100%);
  padding: 10px 14px 12px;
}
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.detail-card .detail-head h2 {
  min-width: 0;
  margin: 0;
}
.detail-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
}
.detail-head .detail-close {
  position: static;
}
.detail-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.detail-fact {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-sizing: border-box;
  min-height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: inherit;
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.detail-fact.detail-done {
  color: var(--gold-1);
  font-weight: 700;
}
.detail-fact small {
  color: var(--muted);
  font-size: 11px;
}
.detail-fact .play-icon {
  width: 15px;
  height: 15px;
}
button.detail-rule {
  cursor: pointer;
  font-weight: 700;
}
.rule-chevron {
  width: 5px;
  height: 5px;
  margin: -3px 0 0 1px;
  border: solid var(--muted);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.detail-rule[aria-expanded="true"] .rule-chevron {
  margin-top: 3px;
  transform: rotate(225deg);
}
.detail-card .detail-note {
  margin-top: 6px;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
}
.detail-card .detail-note[hidden],
.detail-card .pin-note[hidden] {
  display: none;
}
.detail-card .detail-muted {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
.detail-card .detail-lede {
  margin-top: 8px;
}
.detail-need {
  margin-top: 4px;
}
.detail-need .chip {
  width: 24px;
  height: 32px;
}
/* The book's sample hand: a quiet, cool "page from the book" panel, so it never reads as your tiles. */
.detail-book {
  margin-top: 8px;
  padding: 5px 9px 7px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
/* The two section labels: small, sentence case, quiet. */
.detail-card .detail-book h3,
.detail-card .detail-yours h3 {
  margin-bottom: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.detail-sample {
  margin: 0;
}
.detail-sample + .detail-sample {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.detail-sample figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}
.sample-source {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  font-weight: 700;
  white-space: nowrap;
}
.sample-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 7px;
}
.sample-group {
  display: inline-flex;
  gap: 1px;
}
.sample-tiles .chip {
  width: 24px;
  height: 32px;
}
.sample-tiles .chip-any {
  box-sizing: border-box;
  width: 36px;
  padding: 1px;
  background: #f8f6f0;
  color: #1c2a30;
  font-size: 7px;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
}
.detail-card .sample-note {
  margin-top: 2px;
  font-size: 12px;
}
/* Your own hand: set apart below the explanation by a soft gold edge, no box. */
.detail-yours {
  margin-top: 10px;
  padding: 2px 0 2px 10px;
  border-left: 2px solid rgba(229, 161, 47, 0.7);
}
.detail-yours h3 {
  color: var(--gold-1);
}
.detail-yours .detail-need {
  margin-top: 3px;
}
.detail-yours .detail-need .chip {
  width: 20px;
  height: 27px;
}
.help-card {
  width: min(520px, 100%);
}
/* Options: settings in groups, one per row - what it is on the left, its
   control on the right - two columns on a phone held sideways, so the whole
   sheet fits its height. */
.options-card {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  width: min(760px, 100%);
  padding: 12px 14px 8px;
}
.options-card h2 {
  margin-bottom: 6px;
}
.options-grid,
.options-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* One column: the links go last, under the house rules. */
.options-grid > .options-col {
  display: contents;
}
.options-grid .option-links,
.options-grid .option-confirm {
  order: 1;
}
@media (min-width: 540px) {
  .options-grid {
    flex-direction: row;
    align-items: flex-start;
  }
  .options-grid > .options-col {
    display: flex;
    flex: 1 1 0;
    min-width: 0;
  }
  .options-grid .option-links,
  .options-grid .option-confirm {
    order: 0;
  }
}
.option-group {
  padding: 2px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}
.option-group h3 {
  margin: 7px 0 0;
}
.setting {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  min-height: 40px;
  padding: 5px 0;
}
.setting + .setting {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.setting[hidden] {
  display: none;
}
.setting-text {
  flex: 1 1 96px;
  min-width: 0;
}
.setting-text b {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
.setting-text small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.setting-wide .option-note {
  flex-basis: 100%;
}
/* A choice of a few: a dark track, the chosen one a silver key in it. */
.seg {
  display: flex;
  flex: none;
  padding: 3px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.32);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}
.seg button {
  min-width: 44px;
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.seg button[aria-checked="true"] {
  background: linear-gradient(180deg, var(--silver-1), var(--silver-2));
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  color: #26323a;
  font-style: italic;
  font-weight: 800;
}
/* On or off: a switch, lit green when on, like the status lights. */
.switch {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.38);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: background 0.15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--silver-1), var(--silver-2));
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s;
}
.switch[aria-checked="true"] {
  background: #4fae6f;
}
.switch[aria-checked="true"]::after {
  transform: translateX(20px);
}
.option-note {
  margin-top: -2px !important;
  color: var(--muted);
  font-size: 12px;
}
.option-pending {
  color: #f0c36a;
}
.option-note + .option-note {
  margin-top: -6px !important;
}
/* The doors out of Options, quiet under the settings. */
.option-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 4px;
}
.option-links[hidden],
.option-links [hidden],
.option-confirm[hidden] {
  display: none;
}
.option-confirm {
  padding: 8px 12px 6px;
  border-radius: 12px;
  background: rgba(240, 120, 100, 0.1);
  text-align: center;
}
.option-confirm p {
  font-size: 13px;
}
.option-confirm-buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}
.option-link.option-danger {
  color: #f39a88;
}
.option-link {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: #8ccbea;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.option-link:active {
  background: rgba(140, 203, 234, 0.12);
}
@media (prefers-reduced-motion: reduce) {
  .switch,
  .switch::after {
    transition: none;
  }
}

/* The index of all hands: a search bar, a rail of filters, a grid of hands. */
.hand-index {
  position: fixed;
  inset: 0;
  z-index: 29; /* under the hand sheet, which opens from a card */
  display: grid;
  padding: var(--safe-t) var(--safe-r) 8px var(--safe-l);
  background: rgba(5, 9, 11, 0.62);
}
.hand-index[hidden] {
  display: none;
}
.index-panel {
  display: grid;
  grid-template: auto minmax(0, 1fr) / 146px minmax(0, 1fr);
  min-height: 0;
  width: min(1080px, 100%);
  margin: 0 auto;
  border-radius: 14px;
  background: #162126;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  font-size: 12px;
}
.index-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.index-bar h2 {
  flex: none;
  margin: 0;
  font-size: 16px;
}
.index-bar input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font: inherit;
  font-size: 16px; /* iOS Safari zooms into fields below 16px */
  -webkit-user-select: text;
  user-select: text;
}
.index-bar input:focus {
  outline: none;
  border-color: #8ccbea;
}
.index-count {
  flex: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.index-bar .detail-close {
  position: static;
  flex: none;
}
.index-filters,
.index-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
.index-filters {
  padding: 2px 6px 10px 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.index-filters h3 {
  margin: 10px 6px 3px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.index-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-height: 30px;
  padding: 3px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
}
.index-chip small {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.index-chip:hover {
  background: rgba(255, 255, 255, 0.06);
}
.index-chip[aria-pressed="true"] {
  background: rgba(140, 203, 234, 0.2);
  color: #cfeaf8;
  font-weight: 700;
}
.index-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  align-content: start;
  gap: 8px;
  padding: 10px;
}
.index-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 8px 8px 7px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  text-align: left;
  /* Cards below the fold are not laid out or painted until scrolled near: 89 cards carry 1,250 tiles. */
  content-visibility: auto;
  contain-intrinsic-size: auto 150px;
}
.index-card:hover,
.index-card:focus-visible {
  border-color: rgba(140, 203, 234, 0.7);
  outline: none;
}
.index-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.index-card-head strong {
  overflow: hidden;
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.index-value {
  flex: none;
  color: var(--gold-1);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.index-tiles {
  gap: 1px;
  margin: 0;
}
.index-tiles .chip {
  width: 13px;
  height: 18px;
  border-radius: 2px;
  box-shadow: inset 0 -1px 0 #8ccbea;
}
.index-tiles .chip-white {
  outline-width: 1px;
  outline-offset: -4px;
}
.index-text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.index-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  color: var(--muted);
  font-size: 11px;
}
.index-play {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.index-pin {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 0 auto 0 8px;
  color: var(--gold-1);
  font-weight: 700;
}
.index-pin .play-icon {
  width: 12px;
  height: 12px;
}
.index-card.is-pinned {
  border-color: rgba(255, 224, 138, 0.45);
}
.index-away {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 224, 138, 0.16);
  color: var(--gold-1);
  font-weight: 700;
}
.index-empty {
  grid-column: 1 / -1;
  margin: 18px 0 4px;
  color: var(--muted);
  text-align: center;
}
.index-list > .index-chip {
  grid-column: 1 / -1;
  justify-content: center;
  width: auto;
  margin: 0 auto;
  background: rgba(140, 203, 234, 0.2);
}
.closest-empty {
  margin: 0;
  color: var(--muted);
}

/* The report sheet. A phone's keyboard covers the lower half of the page (most
   of it in landscape), so report.js keeps the sheet on the part still visible
   and the card is short: the note and Send side by side, at the top. */
#report-sheet {
  box-sizing: border-box;
  inset: var(--report-top, 0px) 0 auto 0;
  height: var(--report-height, 100%);
  padding-bottom: 6px;
}
@media (pointer: coarse) {
  #report-sheet {
    align-items: start;
  }
}
.report-card {
  width: min(520px, 100%);
}
.report-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
#report-note {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  padding: 8px;
  font: inherit;
  font-size: 16px; /* iOS Safari zooms into fields below 16px */
  line-height: 1.3;
  color: inherit;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  resize: none;
}
#report-send {
  flex: none;
  min-width: 76px;
}
#report-send:disabled {
  opacity: 0.55;
}
.report-status {
  margin-top: 8px;
}
.report-status.bad {
  color: #f0b27a;
}
#report-share {
  margin-top: 8px;
}
.report-fine {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}
/* Barely any room above the keyboard: only the title, the note and Send. */
#report-sheet.tight {
  padding-top: 4px;
  padding-bottom: 4px;
}
.tight .report-card {
  padding: 8px 12px;
}
.tight .report-card h2 {
  margin-bottom: 6px;
  font-size: 15px;
}
.tight .detail-close {
  top: 0;
}
.tight .report-fine {
  display: none;
}
.toast {
  position: fixed;
  top: var(--safe-t);
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
}

.rotate {
  display: none;
}
@keyframes appear {
  from {
    opacity: 0;
  }
}
/* Like the big mahjong apps, the table is landscape only. */
@media (orientation: portrait) and (pointer: coarse) {
  .rotate {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: #11191c;
    font-size: 17px;
    font-weight: 500;
    text-align: center;
  }
  .rotate svg {
    width: 64px;
    height: 64px;
    animation: turn 2.4s ease-in-out infinite;
  }
  /* After a moment, for a phone whose orientation lock keeps it upright. */
  .rotate-lock {
    max-width: min(300px, calc(100vw - 48px));
    margin: -6px 0 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    animation: appear 0.5s ease 3s both;
  }
  .rotate-lock [hidden] {
    display: none;
  }
  @keyframes turn {
    0%,
    30% {
      transform: rotate(0deg);
    }
    60%,
    100% {
      transform: rotate(-90deg);
    }
  }
}
/* In a phone's browser: how to install, under the request to turn, and in
   the sheet behind Options > Install app. */
.install {
  width: min(300px, calc(100vw - 48px));
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 14px;
  font-weight: 400;
  text-align: left;
}
.install h2 {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 600;
}
.install p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}
.install p + p {
  margin-top: 8px;
  color: var(--ink);
}
.install ol {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.install li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  counter-increment: step;
}
.install li + li {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.install li::before {
  content: counter(step);
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(140, 203, 234, 0.18);
  color: #8ccbea;
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
}
.install li span {
  flex: 1;
}
.install li small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.install li svg {
  flex: none;
  width: 22px;
  height: 22px;
  animation: none;
}
.install .ghost {
  display: block;
  margin: 14px auto 2px;
  padding: 9px 22px;
  font-size: 14px;
}
.install[hidden],
.install [hidden] {
  display: none;
}
.install-card {
  width: min(360px, 100%);
}
.install-card .install {
  width: auto;
  margin: 0;
  padding: 2px 4px 0;
  border: 0;
  background: none;
}
@media (prefers-reduced-motion: reduce) {
  .act,
  .callout,
  .goulash,
  .result-card,
  .rotate-lock {
    animation: none;
  }
}
/* The guide (Help): tabs of short cards, each with a picture. */
.guide-card {
  width: min(760px, 100%);
  height: min(560px, 100%);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.guide-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 48px 0 16px;
  border-bottom: 1px solid rgba(233, 228, 214, 0.1);
}
.guide-head h2 {
  margin: 0 0 8px;
  font-style: italic;
  font-weight: 900;
  font-size: 20px;
  color: var(--gold-1);
}
.guide-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.guide-tab {
  flex: none;
  padding: 8px 12px 10px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.guide-tab[aria-selected="true"] {
  border-bottom-color: var(--gold-2);
  color: var(--ink);
}
.guide-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 14px;
  touch-action: pan-y;
}
.guide-intro {
  margin: 0 0 10px !important;
  color: var(--muted);
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.guide-card-item {
  display: flex;
  flex-direction: column;
  padding: 10px 12px 12px;
  border-radius: 12px;
  background: rgba(233, 228, 214, 0.05);
  border: 1px solid rgba(233, 228, 214, 0.08);
}
.guide-wide {
  grid-column: 1 / -1;
}
.guide-card-item h3 {
  margin: 8px 0 3px;
  color: var(--gold-1);
  font-size: 12px;
}
.guide-card-item p {
  color: var(--ink);
  font-size: 13px;
}
.guide-picture {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 6px;
  border-radius: 9px;
  background: radial-gradient(ellipse at 50% 40%, #23695b, #164a40);
}
.guide-tiles,
.guide-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
}
.guide-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.guide-group small,
.guide-throw small {
  color: rgba(233, 228, 214, 0.85);
  font-size: 10px;
  font-style: italic;
}
.guide-faces {
  display: flex;
  gap: 2px;
}
.guide-faces .chip {
  width: 24px;
  height: 33px;
}
.guide-throw {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 8px;
}
.guide-lifted {
  translate: 0 -8px;
  box-shadow: inset 0 -2px 0 #8ccbea, 0 6px 10px rgba(0, 0, 0, 0.45), 0 0 0 2px var(--gold-1);
}
.guide-act {
  animation: none;
  min-height: 34px;
  padding: 0 14px;
  font-size: 15px;
}
.guide-act .chip {
  width: 18px;
  height: 25px;
}
.guide-ghost {
  display: inline-block;
  min-width: 0;
}
.guide-icon svg {
  display: block;
  width: 44px;
  height: 44px;
}
.guide-step {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  font-style: italic;
}
.guide-sketch svg {
  display: block;
  width: 200px;
  max-width: 100%;
  height: auto;
}
.guide-panel {
  width: 170px;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--panel);
  font-size: 11px;
}
.guide-panel-head {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.guide-panel-row {
  display: flex;
  flex-direction: column;
  padding: 3px 0;
}
.guide-panel-row + .guide-panel-row {
  border-top: 1px solid rgba(233, 228, 214, 0.1);
}
.guide-panel-row small {
  color: var(--muted);
}
.guide-search {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(233, 228, 214, 0.25);
  background: var(--panel);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.guide-tips {
  min-width: 0;
}
.guide-tips:disabled {
  opacity: 0.6;
}
.guide-next {
  display: block;
  margin: 12px 0 0 auto;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--blue-1);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* The welcome card: the first time the game opens on a device. */
.welcome {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: grid;
  place-items: center;
  padding: var(--safe-t) var(--safe-r) 8px var(--safe-l);
  background: rgba(5, 9, 11, 0.6);
}
.welcome-card {
  box-sizing: border-box;
  width: min(440px, 100%);
  padding: 16px 22px 14px;
  border-radius: 16px;
  border: 2px solid var(--gold-2);
  background: rgba(17, 25, 28, 0.96);
  box-shadow: 0 0 0 5px rgba(229, 161, 47, 0.16), 0 14px 40px rgba(0, 0, 0, 0.6);
  text-align: center;
  font-size: 14px;
  animation: tip-in-center 300ms cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.welcome-card p {
  margin: 0;
  line-height: 1.4;
}
.welcome-kicker {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.welcome-card h2 {
  margin: 2px 0 8px;
  font-style: italic;
  font-weight: 900;
  font-size: 28px;
  color: var(--gold-1);
  text-shadow: 0 2px 0 #9a5a07, 0 8px 24px rgba(0, 0, 0, 0.6);
}
.welcome-buttons {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 14px 0 10px;
}
.welcome-fine {
  color: var(--muted);
  font-size: 12px;
}
@keyframes tip-in-center {
  from {
    opacity: 0;
    scale: 0.92;
  }
}

/* First-game tips: a note at the top of the table, over the far wall. */
.tip {
  position: fixed;
  z-index: 9;
  top: calc(var(--safe-t) + 4px);
  left: 50%;
  translate: -50% 0;
  box-sizing: border-box;
  width: min(380px, calc(100% - 340px));
  min-width: 260px;
  padding: 9px 14px 6px;
  border-radius: 12px;
  border: 1.5px solid var(--gold-2);
  background: rgba(17, 25, 28, 0.95);
  box-shadow: 0 0 0 4px rgba(229, 161, 47, 0.14), 0 10px 30px rgba(0, 0, 0, 0.55);
  font-size: 13px;
  animation: tip-in 240ms cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.tip b {
  color: var(--gold-1);
  font-style: italic;
  font-weight: 900;
  font-size: 14px;
}
.tip p {
  margin: 2px 0 0;
  line-height: 1.35;
}
.tip-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}
.tip-buttons button {
  padding: 6px 8px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.tip-ok {
  color: var(--blue-1);
}
.tip-stop {
  color: var(--muted);
}
.tip-out {
  transition: opacity 200ms ease, translate 200ms ease;
  opacity: 0;
  translate: -50% -10px;
}
@keyframes tip-in {
  from {
    opacity: 0;
    translate: -50% -14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tip {
    animation: none;
  }
}

/* The opening of a hand: the throw for East, the throw for the wall. A tap skips it. */
.opening {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: var(--strip);
  touch-action: none;
}
.opening.clear {
  pointer-events: auto;
}
.opening-card {
  min-width: 230px;
  max-width: calc(100vw - 32px);
  padding: 12px 18px 8px;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-align: center;
  animation: opening-in 180ms ease-out both;
}
@keyframes opening-in {
  from {
    opacity: 0;
    scale: 0.92;
  }
}
.opening-card h2 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.opening-rows {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
}
.opening-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 86px;
  padding: 6px 8px 4px;
  border-radius: 12px;
  border: 2px solid transparent;
}
.opening-row.east {
  border-color: #ff6b5e;
  background: rgba(255, 107, 94, 0.14);
}
.opening-row.tied {
  border-color: var(--gold-2);
}
.opening-who {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.opening-dice {
  display: flex;
  gap: 6px;
}
.opening-total {
  font-size: 18px;
  line-height: 1.2;
}
.opening-note {
  min-height: 1.3em;
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ink);
}
.opening-hint {
  margin: 2px 0 0;
  font-size: 10px;
  color: var(--muted);
}
.die {
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  width: 34px;
  height: 34px;
  padding: 4px;
  box-sizing: border-box;
  border-radius: 8px;
  background: linear-gradient(160deg, #fffdf6, #dcd6c4);
  box-shadow: 0 3px 0 #a79f88, 0 6px 10px rgba(0, 0, 0, 0.35);
}
.die i {
  place-self: center;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
}
.die i.on {
  background: #20262a;
}
.die.one i.on {
  background: #c8372d;
}
.die.tumbling {
  animation: die-tumble 150ms linear infinite;
}
.die.settled {
  animation: die-settle 200ms ease-out;
}
@keyframes die-tumble {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-5px) rotate(40deg);
  }
  100% {
    transform: translateY(0) rotate(-30deg);
  }
}
@keyframes die-settle {
  from {
    transform: translateY(-6px) rotate(18deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .die.tumbling,
  .die.settled,
  .opening-card {
    animation: none;
  }
}

/* The claims sheet (claims.js): every seat's bonus tiles and melds, upright
   and large, a row per seat; the tapped seat's row is lit in the turn cyan. */
.claims-sheet {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: grid;
  place-items: center;
  padding: var(--safe-t) var(--safe-r) 8px var(--safe-l);
  background: rgba(5, 9, 11, 0.55);
  animation: claims-in 160ms ease-out;
}
.claims-sheet[hidden] {
  display: none;
}
.claims-panel {
  --claims-w: 36px;
  display: grid;
  width: min(820px, 100%);
  max-height: 100%;
  overflow: auto;
  border-radius: 14px;
  background: #162126;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
}
.claims-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  min-height: calc(var(--claims-w) * 1.36 + 18px);
  padding: 0 12px 0 0;
  border-left: 4px solid transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.claims-row:last-child {
  border-bottom: none;
  background: rgba(255, 255, 255, 0.03);
}
.claims-row.lit {
  border-left-color: #62f2ea;
  background: rgba(98, 242, 234, 0.09);
}
.claims-who {
  display: grid;
  grid-template: auto auto / auto 1fr;
  column-gap: 8px;
  align-items: center;
  padding-left: 10px;
  font-size: 13px;
  font-weight: 700;
}
.claims-wind {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #cfd6d8;
  font-size: 16px;
}
.claims-wind.dealer {
  color: #ff6b5e;
}
.claims-name {
  display: flex;
  align-items: center;
  gap: 4px;
}
.claims-score {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.claims-who .seat-fish {
  grid-column: 2;
  width: 22px;
  height: 13px;
}
.claims-tiles {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: calc(var(--claims-w) * 0.45);
  min-width: 0;
  padding: 9px 0;
}
.claims-group {
  display: flex;
  gap: 2px;
  border-radius: 6px;
}
.claims-group.bonus {
  margin-right: calc(var(--claims-w) * 0.5);
  padding-right: calc(var(--claims-w) * 0.45);
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0;
}
.claims-group .chip {
  width: var(--claims-w);
  height: calc(var(--claims-w) * 1.36);
  border-radius: calc(var(--claims-w) * 0.14);
}
.claims-group .chip-white {
  outline-offset: calc(var(--claims-w) * -0.2);
}
.claims-group .claims-copy {
  outline: 2px solid var(--gold-1);
  outline-offset: 1px;
}
.claims-group.fresh {
  animation: claims-fresh 1.4s ease-out;
}
.claims-none {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}
@keyframes claims-in {
  from {
    opacity: 0;
  }
}
@keyframes claims-fresh {
  from {
    box-shadow: 0 0 0 3px #62f2ea, 0 0 18px 4px rgba(98, 242, 234, 0.7);
  }
  to {
    box-shadow: 0 0 0 3px transparent;
  }
}
@media (prefers-reduced-motion: reduce) {
  .claims-sheet,
  .claims-group.fresh {
    animation: none;
  }
}
.claims-group.bonus:last-child {
  margin-right: 0;
  padding-right: 0;
  border-right: none;
}
