/* Solo setup, game screen (simple view), placeholder cards, colour choice, game menu and result.
   Same language as the start page: ink and paper, 2px lines, 3px corners, Barlow. Two motifs carry over:
   the hard block edge under things you can act on (box-shadow 0 4px 0) and the cut corner facet in the
   accent. The accent itself marks only whose turn it is ("Du bist dran", the active seat plate) and focus. */

:root {
  --on-accent: #ffffff;
  --edge-h: 4px;
  /* Colour fields, same as js/cards/palette.js (ink per colour below). */
  --c-glut: #f75f1c;
  --c-honig: #ffc74c;
  --c-moos: #096d3f;
  --c-tau: #03cadf;
  --c-beere: #6d3d8f;
  --c-bluete: #dc81ae;
  --c-none: #232a36;
  --back: #2b3443;
  --back-facet: #b83a14;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --on-accent: #171c24; }
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

.primary,
.act,
.g-btn {
  position: relative;
  min-height: 2.75rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 700 1.0625rem/1.15 var(--font-head);
  cursor: pointer;
  box-shadow: 0 var(--edge-h) 0 var(--line);
  margin-bottom: var(--edge-h);
  touch-action: manipulation;
}
.act, .g-btn { padding: 0 1rem; }
.act:active, .g-btn:active, .primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--line); }
.act-main { background: var(--ink); color: var(--paper); }
.act-danger { background: var(--ink); color: var(--paper); }

/* The main button of a screen: ink block with the accent facet (same corner as the live menu tiles). */
.primary {
  display: grid;
  justify-items: center;
  width: 100%;
  min-height: 3.5rem;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 1.375rem;
}
.primary::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 1.75rem;
  height: 1.75rem;
  background: linear-gradient(225deg, var(--accent) 50%, transparent 50%);
  border-top-right-radius: var(--radius);
}
.primary-line { font: 500 0.9375rem/1.3 var(--font); }

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

.screen { min-height: 100dvh; }

.setup {
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
  padding: max(0.75rem, env(safe-area-inset-top)) 1rem max(1.5rem, env(safe-area-inset-bottom));
}
.screen-head {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.25rem 0 0.75rem;
  border-bottom: 2px solid var(--line);
}
.screen-head h1 { margin: 0; font: 700 1.75rem/1.1 var(--font-head); }
.setup .row-head h2 { margin: 0; font: 700 1.25rem/1.2 var(--font-head); }
.setup-form .primary { margin-top: 1.25rem; }

.stepper { display: flex; align-items: center; gap: 0.5rem; }
.step {
  width: 2.75rem;
  height: 2.75rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 700 1.5rem/1 var(--font-head);
  cursor: pointer;
  touch-action: manipulation;
}
.step:disabled { border-style: dashed; color: var(--muted); cursor: not-allowed; }
.stepper output { min-width: 3rem; text-align: center; font: 700 1.625rem/1 var(--font-head); font-variant-numeric: tabular-nums; }

.disclose {
  display: grid;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.5rem 2.75rem 0.5rem 0.75rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  position: relative;
}
.disclose::after {
  content: '+';
  position: absolute;
  right: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  font: 700 1.5rem/1 var(--font-head);
}
.disclose[aria-expanded="true"]::after { content: '−'; }
.disclose-label { font: 700 1.25rem/1.2 var(--font-head); }
.disclose-line { color: var(--muted); }
.rules-body { padding: 0.75rem 0 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.1875rem 0; }
.sub-switches { margin-top: 0.25rem; padding-left: 0.75rem; border-left: 2px solid var(--line); }
.sub-switches[data-off="true"] .check { color: var(--muted); }
.check-master span { font-size: 1.125rem; }

/* ---------- game screen ---------- */

body[data-screen="game"] { overflow: hidden; }

.game {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto auto;
  grid-template-areas: "top" "notice" "opps" "table" "status" "actions" "hand";
  max-width: 64rem;
  margin: 0 auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  overscroll-behavior: none;
}

.g-top {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem 0.25rem;
}
.g-last {
  flex: 1;
  min-width: 0;
  margin: 0;
  text-align: center;
  font-size: 0.9375rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.g-help {
  position: absolute;
  z-index: 5;
  top: calc(env(safe-area-inset-top) + 3.75rem);
  left: 0.75rem;
  right: 0.75rem;
  max-width: 26rem;
  margin: 0 0 0 auto;
  padding: 0.25rem 0.875rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 var(--edge-h) 0 var(--line);
}

/* The hint that 3D did not start: one line, details behind the info button, dismissable. */
.g-notice {
  grid-area: notice;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.25rem 0.5rem;
  margin: 0.25rem 0.75rem 0;
  padding: 0.375rem 0.5rem 0.375rem 0.75rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  z-index: 4;
}
.g-notice-line { margin: 0; font-size: 0.9375rem; line-height: 1.3; }
.g-notice .g-btn { min-height: 2.75rem; margin-bottom: 0; box-shadow: none; }
.g-notice-more { grid-column: 1 / -1; font-size: 0.9375rem; line-height: 1.35; }
.g-notice-more p { margin: 0.25rem 0; }
.g-notice-tips { margin: 0 0 0.25rem; padding-left: 1.25rem; }

/* seat plates */
.g-opps {
  grid-area: opps;
  list-style: none;
  margin: 0;
  padding: 0.375rem 0.75rem 0.5rem;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0.375rem;
}
.g-opps[data-n="1"], .g-opps[data-n="2"] { grid-auto-columns: minmax(0, 9rem); justify-content: center; }
.opp {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0.125rem;
  min-width: 0;
  padding: 0.375rem 0.25rem 0.3125rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}
.opp-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 600 0.9375rem/1.2 var(--font-head);
}
.opp-count { display: flex; align-items: center; gap: 0.3125rem; }
.opp-back {
  width: 0.875rem;
  height: 1.25rem;
  border-radius: 2px;
  background: linear-gradient(225deg, var(--back-facet) 35%, var(--back) 35%);
  border: 1.5px solid var(--line);
}
.opp-n { font: 700 1.5rem/1 var(--font-head); font-variant-numeric: tabular-nums; }
.opp-flag { font: 700 0.8125rem/1.1 var(--font); }
.opp-flag:empty { display: none; }

/* On turn: thicker accent frame, accent block edge and the accent facet (shape, weight and colour). */
.opp[data-turn="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 var(--edge-h) 0 var(--accent);
}
.opp[data-turn="true"]::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 1rem;
  height: 1rem;
  background: linear-gradient(225deg, var(--accent) 50%, transparent 50%);
}
/* One card left: the plate turns ink and says so in words. */
.opp[data-one="true"] { background: var(--ink); color: var(--paper); }
.opp[data-one="true"] .opp-back { border-color: var(--paper); }
.opp[data-winner="true"] { background: var(--ink); color: var(--paper); }

/* table */
.g-table {
  grid-area: table;
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0.25rem 0.75rem;
}
.g-centre {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas: "pile discard" "state state";
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-items: center;
}
.pile {
  grid-area: pile;
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: var(--radius);
  transition: transform 0.12s;
  touch-action: manipulation;
}
.pile:disabled { cursor: default; }
.pile[data-live="true"] { transform: translateY(-4px); }
.pile[data-live="true"] .card { box-shadow: 0 var(--edge-h) 0 var(--line); }
.pile-n {
  position: absolute;
  right: -0.5rem;
  bottom: -0.5rem;
  min-width: 2rem;
  padding: 0.125rem 0.375rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: 700 0.9375rem/1.1 var(--font-head);
  font-variant-numeric: tabular-nums;
}
.discard { grid-area: discard; }
.g-state { grid-area: state; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.chip {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 0.4375rem;
  min-height: 2.75rem;
  padding: 0.25rem 0.625rem 0.25rem 0.375rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.chip-swatch, .chip-glyph { grid-row: span 2; }
.chip-swatch {
  display: grid;
  place-items: center;
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 2px;
  background: var(--cf, var(--c-none));
  color: var(--ct, #fff);
  font-size: 1rem;
}
.chip-main { font: 700 1rem/1.1 var(--font-head); }
.chip-sub { font-size: 0.8125rem; line-height: 1.1; color: var(--muted); }
.chip-glyph { font: 700 1.625rem/1 var(--font-head); padding: 0 0.125rem; }
.chip-pending { background: var(--ink); color: var(--paper); border-color: var(--ink); grid-template-columns: auto; justify-items: center; padding: 0.125rem 0.75rem; }
.chip-pending .chip-main { font-size: 1.375rem; }
.chip-pending .chip-sub { color: var(--paper); }

/* whose turn, hint, buttons */
.g-status {
  grid-area: status;
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem 0;
  text-align: center;
}
.g-status p { margin: 0; }
.turn {
  padding: 0.25rem 0.875rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  font: 700 1.125rem/1.2 var(--font-head);
}
.turn[data-me="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.hint { min-height: 1.3em; font-size: 0.9375rem; line-height: 1.3; }
/* Own last card: same ink block as a seat plate with one card, plus the block edge. */
.self-flag {
  padding: 0.25rem 0.75rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  font: 700 1.125rem/1.2 var(--font-head);
  box-shadow: 0 var(--edge-h) 0 var(--accent);
}
.g-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 0.5rem;
  min-height: 3.75rem;
  padding: 0.375rem 0.75rem 0;
}

/* hand bar */
.g-hand { grid-area: hand; min-width: 0; }
.hand-strip {
  --overlap: 1.125rem;
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2.25rem 1rem max(0.75rem, env(safe-area-inset-bottom));
  scroll-padding-inline: 1rem;
  scrollbar-width: thin;
}
.hcard {
  position: relative;
  flex: 0 0 auto;
  margin: 0 0 0 calc(var(--overlap) * -1);
  padding: 0;
  border: 0;
  border-radius: 0.375rem;
  background: none;
  cursor: pointer;
  transition: transform 0.14s ease-out;
  touch-action: manipulation;
}
/* Centre the row while it fits; scroll from the first card once it does not. */
.hcard:first-child { margin-left: auto; }
.hcard:last-child { margin-right: auto; }
/* Playable cards rise above their neighbours, so a fitting card is never hidden under the next one. */
.game[data-mine="true"] .hcard[data-playable="true"] { z-index: 1; transform: translateY(-0.75rem); }
.game[data-mine="true"] .hcard[data-playable="true"] .card { box-shadow: 0 var(--edge-h) 0 var(--line); }
/* Dimmed but opaque, so overlapped neighbours do not shine through. */
.game[data-mine="true"] .hcard[data-playable="false"] .card { filter: saturate(0.45) brightness(0.8); }
.hcard:focus-visible { z-index: 2; outline: 3px solid var(--accent); outline-offset: 2px; }
.hcard[aria-pressed="true"] { z-index: 3; transform: translateY(-1.875rem) scale(1.06) !important; }
.hcard[aria-pressed="true"] .card { filter: none !important; }
@media (hover: hover) { .hcard:hover { z-index: 2; } }

/* Colour fill and text per colour id (colour chip, colour picker). */
[data-color="glut"] { --cf: var(--c-glut); --ct: #291007; }
[data-color="honig"] { --cf: var(--c-honig); --ct: #221600; }
[data-color="moos"] { --cf: var(--c-moos); --ct: #f6f0e4; }
[data-color="tau"] { --cf: var(--c-tau); --ct: #001d22; }
[data-color="beere"] { --cf: var(--c-beere); --ct: #f6f0e4; }
[data-color="bluete"] { --cf: var(--c-bluete); --ct: #270f1b; }
[data-color="none"] { --cf: var(--c-none); --ct: #f4efe6; }

/* ---------- cards (pictures from js/cards/face.js, cut corners and rim are in the picture) ---------- */

.card {
  --w: 4rem;
  position: relative;
  display: block;
  width: var(--w);
  aspect-ratio: 5 / 7;
  border-radius: calc(var(--w) * 0.09);
  line-height: 0;
}
.card[data-size="table"] { --w: 4.75rem; }
.card-pic { display: block; width: 100%; height: 100%; }
/* The top card of the pile shows a chosen colour as a thick frame (the colour chip names it). */
.card[data-chosen] { outline: 4px solid var(--chosen); outline-offset: 2px; }
.card[data-chosen="glut"] { --chosen: var(--c-glut); }
.card[data-chosen="honig"] { --chosen: var(--c-honig); }
.card[data-chosen="moos"] { --chosen: var(--c-moos); }
.card[data-chosen="tau"] { --chosen: var(--c-tau); }
.card[data-chosen="beere"] { --chosen: var(--c-beere); }
.card[data-chosen="bluete"] { --chosen: var(--c-bluete); }

/* ---------- dialogs: colour choice, game menu, confirm, result ---------- */

.pick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.625rem; padding: 0.25rem 0 0.25rem; }
.pick-btn {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.625rem;
  align-items: center;
  min-height: 3.5rem;
  padding: 0.375rem 0.625rem 0.375rem 0.375rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 var(--edge-h) 0 var(--line);
  margin-bottom: var(--edge-h);
}
.pick-swatch {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 2px;
  background: var(--cf);
  color: var(--ct);
  font-size: 1.25rem;
}
.pick-name { font: 700 1.125rem/1.1 var(--font-head); }
.pick-sym { font-size: 0.875rem; color: var(--muted); }
.pick-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--line); }

.gmenu-list { margin: 1rem 0 0; }
.gmenu-list .tile { min-height: 3.25rem; padding-right: 1.125rem; }
.gmenu-list .tile:hover { background: var(--ink); color: var(--paper); }
.gmenu-list .tile:hover .tile-line { color: var(--paper); }

.confirm { max-width: 24rem; padding-top: 1rem; }
.confirm h2 { margin: 0 0 0.375rem; font: 700 1.5rem/1.2 var(--font-head); }
.confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.625rem; margin-top: 1rem; }

.result-line { margin: 0.75rem 0 0; font-size: 1.0625rem; }
.result-sub { margin: 1rem 0 0.25rem; font: 700 1.125rem/1.2 var(--font-head); }
.result-list { list-style: none; margin: 0; padding: 0; }
.result-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 30%, transparent);
}
.result-list li[data-winner="true"] { font-weight: 700; }
.result-list li[data-me="true"] .result-name { text-decoration: underline; text-underline-offset: 3px; }
.result-name { font: 600 1.0625rem/1.3 var(--font-head); }
.result-n { font-variant-numeric: tabular-nums; }
.result-actions { display: grid; gap: 0.75rem; margin-top: 1.25rem; }
.result-actions .act { width: 100%; }

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

.act, .g-btn, .step, .disclose, .pick-btn { transition: background-color 0.12s, color 0.12s; }
:root[data-motion="full"] .game dialog[open] { animation: rise 0.18s ease-out; }

/* ---------- landscape phones: seats left, table middle, turn and buttons right ---------- */

@media (orientation: landscape) and (max-height: 32rem) {
  .game {
    max-width: none;
    grid-template-columns: minmax(10rem, 15rem) minmax(0, 1fr) minmax(10rem, 15rem);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "top top top" "notice notice notice" "opps table status" "hand hand hand";
  }
  .g-top { padding: 0.25rem 0.75rem 0; }
  .g-opps {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: center;
    padding: 0.25rem 0 0 max(0.75rem, env(safe-area-inset-left));
  }
  .g-opps[data-n="1"] { grid-template-columns: minmax(0, 1fr); }
  .opp { padding: 0.25rem; }
  .opp-n { font-size: 1.25rem; }
  /* status and buttons share the right column: status on top, buttons at the bottom */
  .g-status { align-self: start; padding-top: 0.5rem; }
  .g-actions {
    grid-area: status;
    align-self: end;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding: 0 max(0.75rem, env(safe-area-inset-right)) 0 0;
  }
  .card[data-size="table"] { --w: 3.75rem; }
  .g-centre { gap: 0.5rem 1rem; }
  .hand-strip { --overlap: 0.875rem; padding-top: 1.75rem; padding-bottom: max(0.375rem, env(safe-area-inset-bottom)); }
  .hcard .card { --w: 3.375rem; }
  .hcard[aria-pressed="true"] { transform: translateY(-1.25rem) scale(1.05) !important; }
  .game[data-mine="true"] .hcard[data-playable="true"] { transform: translateY(-0.5rem); }
}

/* ---------- tall phones: use the height for bigger cards ---------- */

@media (orientation: portrait) and (min-height: 44rem) {
  .card[data-size="table"] { --w: 5.75rem; }
  .hcard .card { --w: 4.5rem; }
  /* 46px of each card stays visible: seven cards fit a 375px screen, every target stays above 44px. */
  .hand-strip { --overlap: 1.625rem; padding-inline: 0.75rem; }
  .g-centre { gap: 1rem 1.75rem; }
}

/* ---------- larger screens ---------- */

@media (min-width: 48rem) and (min-height: 40rem) {
  .g-top { padding: 0.875rem 1.25rem 0.5rem; }
  .g-last { font-size: 1.0625rem; }
  .g-opps { grid-auto-columns: minmax(0, 10rem); justify-content: center; gap: 0.75rem; padding-top: 0.75rem; }
  .opp-name { font-size: 1.0625rem; }
  .opp-n { font-size: 1.75rem; }
  .card[data-size="table"] { --w: 6.5rem; }
  .g-centre { gap: 1.25rem 2.5rem; }
  .hand-strip { --overlap: 1.5rem; padding-top: 3rem; padding-bottom: 1.5rem; }
  .hcard .card { --w: 5.5rem; }
  .turn { font-size: 1.375rem; }
  .hint { font-size: 1.0625rem; }
}


/* ---------- colour symbols (colour chip, colour choice): the polygons of the card faces ---------- */

.symbol { display: block; width: 76%; height: 76%; }
.symbol-shade { fill: var(--cf); opacity: 0.32; }

/* ---------- 3D view: the scene fills the screen, the HTML sits over it ---------- */

.g-scene { position: absolute; inset: 0; z-index: 0; touch-action: none; outline-offset: -4px; }
.g-scene:focus-visible { outline: 3px solid var(--accent); }
.g-scene-load {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  background: var(--paper);
  font: 700 1.25rem/1.2 var(--font-head);
}

.game[data-view="3d"] {
  max-width: none;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  grid-template-areas: "top" "notice" "status" ".";
}
.game[data-view="3d"] .g-table,
.game[data-view="3d"] .g-hand { display: none; }
.game[data-view="3d"] .g-top,
.game[data-view="3d"] .g-notice,
.game[data-view="3d"] .g-status { position: relative; z-index: 3; }
/* Text over the picture always sits on a paper plate, so contrast never depends on the sky or the grass. */
.game[data-view="3d"] .g-last {
  flex: 0 1 auto;
  margin-inline: auto;
  padding: 0.1875rem 0.625rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.game[data-view="3d"] .g-last:empty { display: none; }
.game[data-view="3d"] .g-top { pointer-events: none; }
.game[data-view="3d"] .g-top > * { pointer-events: auto; }
.game[data-view="3d"] .g-status { pointer-events: none; padding-top: 0.125rem; }
.game[data-view="3d"] .turn { background: var(--surface); }
.game[data-view="3d"] .turn[data-me="true"] { background: var(--accent); }
.game[data-view="3d"] .hint:not(:empty) {
  padding: 0.125rem 0.625rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.game[data-view="3d"] .hint:empty { min-height: 0; }
.game[data-view="3d"] .g-actions {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: calc(var(--band, 11rem) + 0.5rem);
  min-height: 0;
  padding: 0 0.75rem;
  pointer-events: none;
}
.game[data-view="3d"] .g-actions .act { pointer-events: auto; }
/* A lifted card is big and sits where the buttons are: a tap on its face must never reach one. */
.game[data-view="3d"][data-lifted="true"] .g-actions { visibility: hidden; }
.game[data-view="3d"] .g-help { z-index: 6; }

/* Name tags: the flat seat plates, placed from the scene's anchors (ui/hudlayout.js picks the size). */
.game[data-view="3d"] .g-opps {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  padding: 0;
  pointer-events: none;
}
.game[data-view="3d"] .opp { position: absolute; width: max-content; min-width: 5.25rem; max-width: 9rem; }
.game[data-view="3d"] .g-opps[data-size="tight"] .opp { min-width: 0; width: 4.25rem; padding-inline: 0.125rem; }
.game[data-view="3d"] .g-opps[data-size="tight"] .opp-name { font-size: 0.875rem; }
.game[data-view="3d"] .g-opps[data-size="tight"] .opp-flag { font-size: 0.8125rem; text-align: center; }
.game[data-view="3d"] .g-opps[data-size="tiny"] .opp { min-width: 0; width: 3.375rem; padding-inline: 0.0625rem; }
.game[data-view="3d"] .g-opps[data-size="tiny"] .opp-name { font-size: 0.8125rem; }
.game[data-view="3d"] .g-opps[data-size="tiny"] .opp-back { display: none; }
.game[data-view="3d"] .g-opps[data-size="tiny"] .opp-flag { font-size: 0.8125rem; text-align: center; }

/* Marks at the piles: how many cards are left to draw, the open penalty. */
.g-marks { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.mark {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 0.125rem 0.4375rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: 700 0.9375rem/1.1 var(--font-head);
  font-variant-numeric: tabular-nums;
}
.mark-pending { background: var(--ink); border-color: var(--ink); color: var(--paper); font-size: 1.25rem; }

/* Wide screens: the turn banner and the hint move into the header row, so the opponents' heads (high in the
   frame on a wide screen) keep the sky to themselves. */
@media (min-aspect-ratio: 4/3) and (min-width: 40rem) and (min-height: 32.0625rem) {
  .game[data-view="3d"] { grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "top" "notice" "."; }
  .game[data-view="3d"] .g-top { padding-inline: 1.25rem; }
  .game[data-view="3d"] .g-last { margin-inline: 0.5rem auto; max-width: calc(50% - 6rem); text-align: left; }
  .game[data-view="3d"] .g-status {
    position: absolute;
    top: calc(env(safe-area-inset-top) + 0.875rem);
    right: 4.75rem;
    max-width: min(30rem, 50%);
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.25rem 0.5rem;
    padding: 0;
  }
}

/* Landscape phones: the name tags take the top, so status and buttons go to the right column below them. */
@media (orientation: landscape) and (max-height: 32rem) {
  .game[data-view="3d"] { grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "top" "notice" "."; }
  .game[data-view="3d"] .g-status {
    position: absolute;
    top: 6.5rem;
    right: max(0.75rem, env(safe-area-inset-right));
    width: 11rem;
    justify-items: end;
    padding: 0;
  }
  .game[data-view="3d"] .g-actions {
    left: auto;
    right: max(0.75rem, env(safe-area-inset-right));
    width: 11rem;
    flex-direction: column;
    align-items: stretch;
  }
  .game[data-view="3d"][data-phase="over"] .g-actions { left: 0; right: 0; width: auto; flex-direction: row; align-items: center; }
}

/* ---------- Letzte Karte: call button, badge, report tap, banner, glowing pile ---------- */

/* Ink block with the accent edge, the same motif as the own "one card" flag. Always visible and always the same
   (no states): a change of look would tell the player when a call is due. */
.act-call { box-shadow: 0 var(--edge-h) 0 var(--accent); }

/* Flat view: the call button owns the left of the buttons row, the others share the rest. */
.game[data-view="simple"] .g-actions { flex-wrap: nowrap; align-items: center; }
.act-rest { flex: 1 1 0; min-width: 0; display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 0.5rem; }
.game[data-view="3d"] .act-rest { display: contents; }
@media (orientation: landscape) and (max-height: 32rem) {
  .game[data-view="simple"] .g-actions { flex-direction: column; align-items: stretch; flex-wrap: wrap; }
  .game[data-view="simple"] .act-rest { flex: 0 1 auto; flex-direction: column; align-items: stretch; }
}

/* The 3D view has its own corner for it; the flat view has it in the buttons row. */
.g-call { display: none; }
.game[data-view="3d"] .act-call:not([data-corner]) { display: none; }
.game[data-view="simple"] .g-call { display: none; }
.game[data-view="3d"] .g-call {
  display: block;
  position: absolute;
  z-index: 4;
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: calc(var(--band, 11rem) + 0.5rem);
}

/* Who has called: a paper pill with a tick and a word, on every plate that shows one. */
.opp-call {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  padding: 0 0.375rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: 700 0.8125rem/1.2 var(--font-head);
}
.opp[data-called="false"] .opp-call { display: none; }
.opp-call-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The report tap covers the whole plate; it has no look of its own (nothing marks who could be reported),
   only a focus ring and the pointer. */
.opp-report {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.opp-report:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.self-called {
  padding: 0.125rem 0.625rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  font: 700 0.9375rem/1.2 var(--font-head);
}
.game[data-view="3d"] .self-called { background: var(--surface); }
.g-help-lc { margin: 0.25rem 0; }

/* The banner for every call and report: ink block over the middle of the picture, calm in height, no input. */
.g-lc {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: calc(100% - 2rem);
  margin: 0;
  padding: 0.5rem 0.875rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 var(--edge-h) 0 var(--accent);
  font: 700 1.1875rem/1.25 var(--font-head);
  text-align: center;
  pointer-events: none;
}
:root[data-motion="full"] .g-lc:not([hidden]) { animation: lc-in 0.2s ease-out; }
@keyframes lc-in { from { opacity: 0; transform: translate(-50%, -40%); } }

/* The draw pile glows when the player on turn has to draw (flat view; the scene has its own glow). Frame and
   edge, not colour alone; the pulse stops under reduced motion and leaves the frame. */
.pile[data-glow="true"] .card {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 var(--edge-h) 0 var(--accent), 0 0 1.25rem 0.25rem var(--accent);
}
:root[data-motion="full"] .pile[data-glow="true"] .card { animation: pile-glow 1.4s ease-in-out infinite; }
@keyframes pile-glow {
  50% { box-shadow: 0 var(--edge-h) 0 var(--accent), 0 0 0.5rem 0 var(--accent); }
}
.game[data-view="3d"] .g-call .act { padding-inline: 0.5rem; font-size: 0.9375rem; }
/* Narrow plates: tick above the word, small type. */
.game[data-view="3d"] .g-opps:is([data-size="tight"], [data-size="tiny"]) .opp-call { flex-direction: column; gap: 0; padding-inline: 0.125rem; font-size: 0.75rem; line-height: 1.1; }
.game[data-view="3d"] .g-opps[data-size="tiny"] .opp-call { font-size: 0.6875rem; }

/* First-time hint for the report tap: same look as the 3D notice, one line and a button, over the picture on paper. */
.g-tip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.25rem 0.5rem;
  margin: 0.25rem 0.75rem 0;
  padding: 0.375rem 0.5rem 0.375rem 0.75rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  position: relative;
  z-index: 4;
}
.g-tip-line { margin: 0; font-size: 0.9375rem; line-height: 1.3; }
.g-tip .g-btn { min-height: 2.75rem; margin-bottom: 0; box-shadow: none; }
