/* =============================================================================
 * Stash — game.css   (owner: Game)
 * Everything inside #screen-game: the in-game layout (phone / phone-land /
 * tablet / desk), HUD regions, action bar, banners, reveal, results, tutorial.
 * Built on the UI kit in pixel.css (px-btn, px-panel, px-pill, px-chip, …).
 * Layout class comes from JS: .g-root[data-gl="phone|phone-land|tablet|desk"].
 * ========================================================================== */

.g-root {
  --gap: 8px;
  --panel: clamp(320px, 28vw, 400px);
  --bar-head: 28px;
  --bar-main: 64px;
  --bar-foot: var(--px-btn-h, 48px);
  position: relative;
  width: 100%; height: 100%;
  display: grid;
  overflow: hidden;
  background: var(--c-ink);
  color: var(--c-mist);
  font: 16px/24px var(--font-body);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
.g-root *, .g-root *::before, .g-root *::after { box-sizing: border-box; }
.g-root button { touch-action: manipulation; }

/* ------------------------------------------------------------ grid layouts -- */
.g-root[data-gl="phone"], .g-root[data-gl="tablet"] {
  grid-template-columns: 100%;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  grid-template-areas: "top" "opp" "stage" "ticker" "bar";
}
.g-root[data-gl="tablet"] { --bar-head: 32px; --bar-main: 80px; padding: 0 16px 8px; }
.g-root[data-gl="desk"] {
  grid-template-columns: minmax(0, 1fr) var(--panel);
  grid-template-rows: 56px auto auto auto minmax(0, 1fr);
  grid-template-areas: "top top" "stage opp" "stage bar" "stage card" "stage log";
  column-gap: 16px; row-gap: 12px;
  padding: 0 16px 16px;
  --bar-main: 72px; --bar-foot: 40px;
}
.g-root[data-gl="phone-land"] {
  grid-template-columns: minmax(160px, 1fr) auto minmax(200px, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  grid-template-areas: "top stage bar" "opp stage bar" "ticker stage bar";
  column-gap: 8px;
  --bar-main: 112px;
}
.g-top { grid-area: top; }
.g-opp { grid-area: opp; }
.g-stage { grid-area: stage; }
.g-ticker { grid-area: ticker; }
.g-bar { grid-area: bar; }
.g-cardmod { grid-area: card; }
.g-logmod { grid-area: log; }
.g-root:not([data-gl="desk"]) .g-cardmod,
.g-root:not([data-gl="desk"]) .g-logmod { display: none; }
.g-root[data-gl="desk"] .g-ticker { display: none; }

/* ------------------------------------------------------------- status strip -- */
.g-top {
  display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 4px 4px 0;
  min-width: 0;
}
.g-top .px-btn.icon { flex: none; width: 44px; height: 40px; min-width: 44px; }
.g-brand { display: none; flex: none; }
.g-turnchip-top { display: none; }
.g-night {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.g-night-cv { display: block; flex: none; image-rendering: pixelated; }
.g-night-cv.tick { animation: g-tick 400ms steps(2, end); }
.g-night-txt { font: 16px/16px var(--font-ui); text-transform: uppercase; color: var(--c-fog); white-space: nowrap; }
.g-night-txt.warn { color: var(--c-amber); }
.g-night-txt.last { color: var(--c-pink); animation: g-blink 1000ms steps(2, end) infinite; }
.g-skip { display: none; flex: none; min-width: 72px; }
.g-root[data-gl="desk"] .g-top { padding: 8px 0 0; gap: 16px; }
.g-root[data-gl="desk"] .g-brand { display: block; font-size: 16px; color: var(--c-amber); }
.g-root[data-gl="desk"] .g-turnchip-top { display: block; flex: none; }
.g-root[data-gl="desk"] .g-night { justify-content: flex-start; }
.g-root[data-gl="desk"] .g-top .g-menu { order: 10; }
.g-root[data-gl="phone-land"] .g-top { flex-wrap: wrap; }
.g-root[data-gl="phone-land"] .g-night { flex-direction: column; gap: 2px; }
.g-root[data-gl="phone"] .g-night { flex-direction: column; gap: 0; }
.g-root[data-gl="phone"] .g-night-txt { line-height: 16px; margin-top: -2px; }

/* turn chip */
.g-tc {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px 0 6px;
  background: var(--c-quay);
  border: 2px solid var(--c-ink);
  border-bottom: 4px solid var(--c-steel);
  font: 16px/16px var(--font-ui); text-transform: uppercase; color: var(--c-white);
  white-space: nowrap; max-width: 100%;
}
.g-tc .g-tc-t { overflow: hidden; text-overflow: ellipsis; }
.g-tc.s1 { border-bottom-color: var(--c-p1); }
.g-tc.s2 { border-bottom-color: var(--c-p2); }
.g-tc.s3 { border-bottom-color: var(--c-p3); }
.g-tc.s4 { border-bottom-color: var(--c-p4); }
.g-myturn .g-tc { animation: g-pulse 600ms steps(2, end) 1; }

/* -------------------------------------------------------------- opponent -- */
.g-opp {
  display: flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 2px 8px;
  border-bottom: 2px solid var(--c-quay);
  min-width: 0;
}
.g-opp.active { background: linear-gradient(90deg, rgba(181, 80, 136, .22), transparent 70%); }
.g-port { position: relative; flex: none; width: 48px; height: 48px; background: var(--c-quay); box-shadow: 0 0 0 2px var(--c-ink), 0 0 0 4px var(--c-p4-dark); cursor: pointer; }
.g-port-cv { display: block; width: 48px; height: 48px; image-rendering: pixelated; }
.g-opp-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.g-opp-l1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.g-opp-name { color: var(--c-white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-opp-l2 { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.g-opp-stats { display: none; font-size: 16px; line-height: 20px; }
.g-thinking { color: var(--c-p4); }
.g-thinking::after { content: ''; animation: g-dots 1000ms steps(4, end) infinite; }
.g-prog > i { width: 10px; height: 14px; }
.g-rp { flex: none; height: 22px; font-size: 16px; }
.g-rp .px-icon { width: 16px; height: 16px; }

.g-loot { display: inline-flex; align-items: center; gap: 6px; }
.g-lc { display: inline-flex; align-items: center; gap: 2px; font: 16px/16px var(--font-ui); color: var(--c-white); }
.g-lc.zero b { color: var(--c-steel); }
.g-lc.hot { padding: 0 2px; box-shadow: 0 0 0 2px var(--c-uranium-dark); background: rgba(99, 199, 77, .15); }
.g-lc.hot b { color: var(--c-uranium-light); }
.g-loot-in { font-size: 16px; }

.g-coin16, .g-coin32 {
  display: inline-block; flex: none;
  background: var(--coin) 0 0 / 100% 100% no-repeat;
  image-rendering: pixelated;
}
.g-coin16 { width: 16px; height: 16px; }
.g-coin32 { width: 32px; height: 32px; }
.g-coin16.copper, .g-coin32.copper { --coin: var(--img-coin-copper); }
.g-coin16.silver, .g-coin32.silver { --coin: var(--img-coin-silver); }
.g-coin16.gold, .g-coin32.gold { --coin: var(--img-coin-gold); }
.g-coin16.uranium, .g-coin32.uranium { --coin: var(--img-coin-uranium); }
.g-coin16.copper.off, .g-coin32.copper.off { --coin: var(--img-coin-copper-off); }
.g-coin16.silver.off, .g-coin32.silver.off { --coin: var(--img-coin-silver-off); }
.g-coin16.gold.off, .g-coin32.gold.off { --coin: var(--img-coin-gold-off); }
.g-coin16.uranium.off, .g-coin32.uranium.off { --coin: var(--img-coin-uranium-off); }

/* pass-and-play players strip */
.g-pls { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; width: 100%; }
.g-pl {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  min-width: 0; padding: 2px 4px;
  background: var(--c-ink); border-left: 4px solid var(--c-slate);
}
.g-pl.s1 { border-left-color: var(--c-p1); } .g-pl.s2 { border-left-color: var(--c-p2); }
.g-pl.s3 { border-left-color: var(--c-p3); } .g-pl.s4 { border-left-color: var(--c-p4); }
.g-pl.active { background: var(--c-slate); }
.g-pl-name { color: var(--c-white); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 40px; }
.g-pl .g-loot { gap: 3px; }
.g-pl .g-lc { gap: 1px; }
.g-pls.n3 .g-pl .px-chip, .g-pls.n4 .g-pl .px-chip { display: none; }
.g-pls.n3 .g-pl .g-coin16 { width: 12px; height: 12px; }
.g-pls.n3 .g-loot { gap: 2px; min-width: 0; overflow: hidden; }
.g-root:not([data-gl="desk"]) .g-pls.n3 .g-lc { gap: 0; }
.g-root:not([data-gl="desk"]) .g-pls.n3 .g-lc.hot { padding: 0; box-shadow: none; }
.g-root:not([data-gl="desk"]) .g-pls.n3 .g-pl, .g-root:not([data-gl="desk"]) .g-pls.n4 .g-pl { padding: 2px 3px; }
.g-pls.n4 .g-lc b { font-size: 16px; }

.g-root[data-gl="desk"] .g-opp {
  align-items: flex-start; padding: 12px; gap: 12px;
  background: var(--c-quay); border: 0; box-shadow: 0 4px 0 var(--c-ink);
  border-top: 4px solid var(--c-p4);
}
.g-root[data-gl="desk"][data-mode="local"] .g-opp { border-top-color: var(--c-slate); padding: 8px; }
.g-root[data-gl="desk"] .g-port, .g-root[data-gl="desk"] .g-port-cv { width: 72px; height: 72px; }
.g-root[data-gl="desk"] .g-opp-stats { display: block; }
.g-root[data-gl="desk"] .g-pls { grid-auto-flow: row; grid-auto-columns: auto; }
.g-root[data-gl="desk"] .g-pls .px-chip { display: inline-block !important; }
.g-root[data-gl="desk"] .g-pl { padding: 4px 8px; gap: 8px; flex-wrap: nowrap; }
.g-root[data-gl="desk"] .g-pl .g-coin16 { width: 16px; height: 16px; }
.g-root[data-gl="phone-land"] .g-opp { flex-wrap: wrap; border: 0; }
.g-root[data-gl="phone-land"] .g-pls { grid-auto-flow: row; }

/* -------------------------------------------------------------- the stage -- */
.g-stage { position: relative; min-height: 0; min-width: 0; overflow: hidden; }
.g-board { position: absolute; inset: 4px; touch-action: none; }
.g-root[data-gl="phone"] .g-board, .g-root[data-gl="phone-land"] .g-board { inset: 0; }
.g-root[data-gl="desk"] .g-stage { margin-top: 0; }
.g-root[data-gl="phone-land"] .g-stage { height: 100%; aspect-ratio: 1 / 1; max-width: calc(100vw - 360px); }
.g-dealing .g-board { animation: g-fadein 600ms steps(4, end); }

/* banner (non-blocking) */
.g-banner {
  position: absolute; left: 0; right: 0; top: 28%;
  display: none; justify-content: center;
  pointer-events: none; z-index: 20;
}
.g-banner.show { display: flex; animation: g-slide 1060ms steps(12, end) forwards; }
.g-banner.show.warn, .g-banner.show.last, .g-banner.show.raid, .g-banner.show.dawn,
.g-banner.show.win, .g-banner.show.lose, .g-banner.show.tie { animation: g-slidehold 2400ms steps(16, end) forwards; }
.g-banner.show.still { animation: g-fadeonly 1060ms steps(2, end) forwards; }
.g-banner-in {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 8px 16px;
  background: var(--c-ink);
  border-top: 4px solid var(--c-slate); border-bottom: 4px solid var(--c-slate);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .4);
  justify-content: center; text-align: center;
}
.g-banner-t { font-size: 16px; line-height: 24px; }
.g-banner-s { color: var(--c-mist); font-size: 16px; line-height: 20px; margin-top: 2px; }
.g-banner.warn .g-banner-in { border-color: var(--c-amber); }
.g-banner.warn .g-banner-t { color: var(--c-amber); }
.g-banner.last .g-banner-in {
  border-image: repeating-linear-gradient(45deg, var(--c-amber) 0 4px, var(--c-ink) 4px 8px) 4;
}
.g-banner.last .g-banner-t { color: var(--c-pink); }
.g-banner.raid .g-banner-in { border-color: var(--c-danger); }
.g-banner.raid .g-banner-t { color: var(--c-white); }
.g-banner.win .g-banner-t, .g-banner.dawn .g-banner-t { color: var(--c-gold-light); }
.g-banner.lose .g-banner-in { border-color: var(--c-p4); }
.g-root[data-gl="desk"] .g-banner-t, .g-root[data-gl="tablet"] .g-banner-t { font-size: 24px; line-height: 32px; }

/* bot speech bubble */
.g-bubble.px-tooltip {
  display: none; position: absolute; left: 8px; top: 6px; z-index: 25;
  max-width: 220px; --notch-x: 12px;
  font: 16px/20px var(--font-body);
}
.g-bubble.show { display: block; }
.g-root[data-gl="desk"] .g-bubble.px-tooltip { left: auto; right: 8px; top: 8px; --notch-x: calc(100% - 24px); }

/* centre: raid verdict etc. */
.g-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 30; }
.g-verdict {
  pointer-events: auto;
  width: min(340px, calc(100% - 24px)); text-align: center;
  animation: px-rise 80ms steps(2, end);
}
.g-v-stamp { font-size: 32px; line-height: 40px; margin: 4px 0 8px; }
.g-verdict.good .g-v-stamp { color: var(--c-ok); }
.g-verdict.bad .g-v-stamp { color: var(--c-pink); }
.g-verdict.hit { border-top: 4px solid var(--c-ok); }
.g-verdict.miss { border-top: 4px solid var(--c-steel); }
.g-v-line { color: var(--c-white); }
.g-v-pts { margin: 8px 0 4px; }
.g-v-note { font-size: 16px; line-height: 20px; }

/* toasts */
.g-toasts { position: absolute; left: 8px; right: 8px; top: 6px; display: flex; justify-content: center; z-index: 40; pointer-events: none; }
.g-toast { max-width: 420px; font-size: 16px; line-height: 20px; }
.g-root[data-gl="desk"] .g-toasts { top: auto; bottom: 16px; }

/* ----------------------------------------------------------------- ticker -- */
.g-ticker {
  display: flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; overflow: hidden;
  color: var(--c-fog); font-size: 16px; line-height: 20px;
  white-space: nowrap; cursor: pointer;
  border-top: 2px solid var(--c-quay);
}
.g-ticker > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; }
.g-tick-more { color: var(--c-steel); }
.g-logchip.px-chip { width: 14px; height: 14px; flex: none; }
.g-dot0 { display: inline-block; flex: none; width: 14px; height: 14px; background: var(--c-slate); box-shadow: inset 0 0 0 2px var(--c-ink); }

/* -------------------------------------------------------------- action bar -- */
.g-bar {
  display: grid;
  grid-template-rows: var(--bar-head) var(--bar-main) var(--bar-foot);
  gap: 6px;
  padding: 6px 8px calc(8px);
  background: var(--c-quay);
  border-top: 4px solid var(--c-slate);
  min-width: 0;
}
.g-root[data-gl="desk"] .g-bar { border: 0; box-shadow: 0 4px 0 var(--c-ink); padding: 10px 12px 12px; }
.g-root[data-gl="phone-land"] .g-bar { border: 0; grid-template-rows: auto minmax(0, 1fr) auto; padding: 6px; }
.g-myturn .g-bar { border-top-color: var(--c-amber); }
.g-bar-head { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; }
.g-head-turn { flex: none; }
.g-head-turn .g-tc { height: 26px; border-bottom-width: 3px; padding: 0 6px 0 4px; gap: 6px; }
.g-head-turn .px-chip { width: 16px; height: 16px; }
.g-head-t { flex: 1 1 auto; min-width: 0; color: var(--c-white); font: 16px/20px var(--font-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-head-t.warn { color: var(--c-pink); }
.g-bar-main { min-height: 0; min-width: 0; display: flex; align-items: stretch; }
.g-bar-foot { display: flex; align-items: stretch; gap: 8px; min-width: 0; }
.g-bar-foot > .px-btn { flex: 1 1 0; min-width: 0; height: var(--bar-foot); }
.g-bar-foot > .px-btn.icon { flex: none; width: var(--bar-foot); min-width: var(--bar-foot); }
.g-msg { align-self: center; font-size: 16px; line-height: 20px; color: var(--c-mist); }
.g-hazard { padding: 6px 8px; border: 2px solid var(--c-amber); background: repeating-linear-gradient(45deg, rgba(254, 174, 52, .14) 0 6px, transparent 6px 12px); color: var(--c-white); }
.g-key { display: none; }
.g-root[data-gl="desk"] .g-key { display: inline; position: absolute; right: 2px; top: -6px; font: 16px/16px var(--font-ui); color: var(--c-fog); opacity: .8; transform: scale(.75); }

/* tray */
.g-tray { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; }
.g-tray.dim { opacity: .6; }
.g-tray.pulse { animation: g-pulse 400ms steps(2, end) 2; }
.g-tb.px-btn {
  min-width: 0; height: 100%; padding: 0 4px 4px; gap: 4px;
  flex-direction: row; justify-content: center;
}
.g-tb.px-btn { touch-action: none; }
.g-tb .g-tb-v { display: none; }
.g-tb .g-tb-n { font: 16px/16px var(--font-ui); color: var(--c-white); }
.g-tb.none .g-tb-n { color: var(--c-steel); }
.g-tb.armed { box-shadow: 0 0 0 3px var(--c-amber), 0 4px 0 var(--c-ink); }
.g-tb.armed .g-coin32 { animation: g-bob 600ms steps(2, end) infinite; }
.g-tb.none { opacity: .75; }
.g-root[data-gl="desk"] .g-tb.px-btn { flex-direction: column; gap: 2px; padding-top: 4px; }
.g-root[data-gl="desk"] .g-tb .g-coin32 { width: 32px; height: 32px; }
.g-root[data-gl="phone-land"] .g-tray { grid-template-columns: repeat(2, 1fr); }
.g-root[data-gl="phone-land"] .g-cardbtn > span:last-child { display: none; }
.g-root[data-gl="phone-land"] .g-top { justify-content: space-between; }

.g-cardbtn .px-icon, .g-raidbtn .px-icon { margin-right: -2px; }
.g-raidbtn.used { color: var(--c-fog); }
.g-raidbtn.used .px-pill { height: 22px; }
.g-raidbtn.dim { opacity: .55; }
.g-cardbtn > span:last-child { overflow: hidden; text-overflow: ellipsis; }

/* lens (count chooser) */
.g-lens {
  display: flex; align-items: center; gap: 4px; width: 100%;
  padding: 0 2px; overflow: hidden;
}
.g-lens-end { flex: none; color: var(--c-fog); font-size: 16px; writing-mode: vertical-rl; transform: rotate(180deg); }
.g-chip {
  -webkit-appearance: none; appearance: none;
  flex: 0 1 52px; min-width: 22px; height: calc(var(--bar-main) - 10px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  margin: 0; padding: 0; border: 0;
  background: var(--c-ink); box-shadow: inset 0 -4px 0 var(--c-slate);
  color: var(--c-fog); font: 16px/16px var(--font-ui);
  cursor: pointer; opacity: .6;
  transform: translateY(4px);
}
.g-chip.lift { opacity: 1; transform: none; box-shadow: 0 0 0 2px var(--c-white), inset 0 -4px 0 var(--c-steel); color: var(--c-white); background: var(--c-slate); }
.g-chip .g-coin32 { max-width: 100%; }
.g-cut { flex: none; width: 2px; align-self: stretch; margin: 4px 1px; background: repeating-linear-gradient(var(--c-amber) 0 4px, transparent 4px 8px); }
.g-take { flex: 2 1 auto !important; align-self: center; text-align: center; color: var(--c-white); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-cnt.px-btn { font-size: 24px; }

/* raid owners */
.g-owners { display: flex; gap: 6px; width: 100%; }
.g-owner.px-btn { flex: 1 1 0; min-width: 0; height: 100%; }

/* -------------------------------------------------------------- card module (desk) -- */
.g-cardmod { position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.g-cardmod.empty { display: none; }
.g-card { display: flex; gap: 12px; align-items: flex-start; padding: 8px; }
.g-card.big { justify-content: center; margin: 0 auto 12px; width: max-content; max-width: 100%; }
.g-minimap { display: block; flex: none; image-rendering: pixelated; box-shadow: 0 0 0 2px var(--c-ink); }
.g-card-info { flex: 1 1 auto; min-width: 96px; display: flex; flex-direction: column; gap: 2px; }
.g-card-shape { color: var(--c-ink); font-size: 16px; margin-bottom: 4px; }
.g-cr { display: flex; justify-content: space-between; gap: 8px; font: 16px/22px var(--font-ui); color: var(--c-ink); }
.g-cr.safe { color: var(--c-crate); }
.g-cr b { min-width: 24px; text-align: right; }
.g-cr-b { color: var(--c-danger-dark); font-size: 16px; }
.g-star { display: inline-block; width: 10px; height: 10px; background: var(--img-star) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; vertical-align: -1px; }
.g-cardback { display: flex; align-items: center; justify-content: center; min-height: 96px; }
.g-cardtoggle.px-btn { position: absolute; right: 8px; top: 8px; min-width: 0; height: 32px; padding: 0 8px 2px; font-size: 16px; }
.g-cardmod .px-card.back + .g-cardtoggle { position: static; align-self: stretch; height: 40px; }

/* log module (desk) */
.g-logmod { min-height: 0; display: flex; flex-direction: column; padding: 8px; overflow: hidden; }
.g-logmod-title { margin-bottom: 6px; font-size: 16px; }
.g-loglist { overflow-y: auto; overscroll-behavior: contain; min-height: 0; flex: 1 1 auto; font-size: 16px; line-height: 20px; -webkit-user-select: text; user-select: text; }
.g-log-line { display: flex; align-items: center; gap: 6px; padding: 1px 0; color: var(--c-mist); }
.g-log-line:first-child { color: var(--c-white); }
.g-log-round { color: var(--c-steel); font-size: 16px; margin: 4px 0 2px; border-top: 2px solid var(--c-slate); padding-top: 4px; }
.g-sheetlog { max-height: 60vh; }

/* -------------------------------------------------------------- hints -- */
.g-hint {
  position: absolute; z-index: 60; display: none;
  padding: 8px 10px; background: var(--c-parchment); color: var(--c-ink);
  border: 2px solid var(--c-ink); box-shadow: 0 4px 0 var(--c-ink);
  cursor: pointer;
}
.g-hint.show { display: flex; gap: 10px; align-items: flex-start; animation: px-up-small 80ms steps(2, end); }
.g-hint-in { flex: 1; font-size: 16px; line-height: 20px; }
.g-hint-x { flex: none; color: var(--c-copper-dark); font-size: 16px; padding-top: 2px; }
.g-hint::after {
  content: ''; position: absolute; left: var(--nx, 20px); top: 100%;
  border: 6px solid transparent; border-top-color: var(--c-ink);
}
.g-hint.below::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--c-ink); }

/* coach (tutorial) */
.g-coach {
  position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 35;
  display: none; gap: 10px; align-items: flex-start;
  padding: 10px 12px; background: var(--c-parchment); color: var(--c-ink);
  border: 2px solid var(--c-ink); box-shadow: 0 4px 0 var(--c-ink);
  max-width: 520px; margin: 0 auto;
}
.g-coach.show { display: flex; }
.g-coach.top { bottom: auto; top: 8px; }
.g-coach .g-coach-port { flex: none; width: 48px; height: 48px; image-rendering: pixelated; box-shadow: 0 0 0 2px var(--c-ink); background: var(--c-quay); }
.g-coach-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.g-coach-t { font: 16px/22px var(--font-body); }
.g-coach-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.g-coach-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.g-coach-dots i { width: 8px; height: 8px; background: var(--c-mist); box-shadow: inset 0 0 0 1px var(--c-ink); }
.g-coach-dots i.on { background: var(--c-amber); }
.g-coach .px-btn { height: 40px; min-width: 88px; }
.g-tut-arrow {
  position: absolute; z-index: 55; pointer-events: none;
  width: 0; height: 0; border: 10px solid transparent; border-top: 14px solid var(--c-amber);
  filter: drop-shadow(0 2px 0 var(--c-ink));
  animation: g-arrow 600ms steps(2, end) infinite;
}
.g-tut .g-spotdim { opacity: .45; pointer-events: none; }
.g-tut-glow { box-shadow: 0 0 0 3px var(--c-amber) !important; position: relative; z-index: 2; }
.g-float {
  position: absolute; z-index: 50; pointer-events: none; transform: translate(-50%, -50%);
  font: 16px/16px var(--font-display); color: var(--c-gold-light); text-shadow: 0 2px 0 var(--c-ink);
  animation: g-float 1600ms steps(8, end) forwards; white-space: nowrap;
}

/* -------------------------------------------------------------- modal layer -- */
.g-layer .px-scrim { position: fixed; z-index: 100; }
.g-scrim.g-dim { background: rgba(24, 20, 37, .5); }
.g-scrim.g-bottom { align-items: flex-end; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.g-scrim.g-side { align-items: flex-end; }
.g-root[data-gl="desk"] .g-scrim.g-side { align-items: center; justify-content: flex-end; padding-right: 24px; background: rgba(24, 20, 37, .55); }
.g-root[data-gl="desk"] .g-scrim.g-dim.g-bottom { align-items: center; }
.g-modal .px-modal-title .px-chip { vertical-align: middle; }
.g-modal .px-modal-title { overflow-wrap: anywhere; }
.g-modal p { margin: 0 0 8px; }
.g-eyebrow { text-align: center; color: var(--c-amber); }
.g-subtitle { text-align: center; margin: -8px 0 12px; }
.g-memo.px-modal { max-width: 420px; }
.g-memo .px-modal-body { text-align: center; }
.g-sheet .g-sheet-x { position: absolute; right: 8px; top: 8px; }
.g-help-body p { margin: 0 0 10px; }
.g-root[data-gl="phone"] .g-memo.px-modal { padding: 12px; }
.g-root[data-gl="phone"] .g-memo .px-modal-title { margin-bottom: 8px; }
.g-root[data-gl="phone"] .g-memo .g-card.big { margin-bottom: 8px; }
.g-root[data-gl="phone"] .g-memo .px-modal-actions { margin-top: 12px; }

/* results */
.g-scrim.g-sheetwrap { align-items: flex-end; padding: 0; }
.g-results.px-modal { max-width: 560px; max-height: 92%; overflow-y: auto; overscroll-behavior: contain; padding: 16px; }
.g-root[data-gl="desk"] .g-scrim.g-sheetwrap { align-items: center; justify-content: flex-end; padding: 16px 16px 16px 0; background: rgba(24, 20, 37, .55); }
.g-root[data-gl="desk"] .g-results.px-modal { width: min(480px, var(--panel) + 120px); max-height: 100%; }
.g-root[data-gl="phone"] .g-results.px-modal { max-height: 80%; max-width: 100%; padding: 12px; }
.g-results .px-modal-title { margin-bottom: 4px; color: var(--c-gold-light); }
.g-root .g-results .px-modal-actions { position: sticky; bottom: -16px; z-index: 2; padding: 8px 0 4px; background: var(--c-quay); box-shadow: 0 -8px 8px -4px var(--c-quay); }
.g-root .g-results .px-modal-actions { margin-top: 12px; display: flex; flex-direction: row; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.g-results .px-modal-actions > .px-btn { flex: 1 1 auto; width: auto; min-width: 0; padding-left: 8px; padding-right: 8px; font-size: 16px; }
.g-results .px-modal-actions > .px-btn.primary { flex-basis: 100%; }
.g-scorewrap { overflow-x: auto; overscroll-behavior: contain; }
.g-mult { font-size: 16px; color: var(--c-ok); margin-left: 2px; }
.g-mult.caught { color: var(--c-pink); }
.g-score.n3 thead .px-chip, .g-score.n4 thead .px-chip { display: none; }
.g-score { width: 100%; border-collapse: collapse; font: 16px/20px var(--font-ui); }
.g-score th, .g-score td { padding: 3px 4px; text-align: right; border-bottom: 2px solid var(--c-slate); white-space: nowrap; }
.g-score th:first-child { text-align: left; color: var(--c-fog); font-weight: 400; }
.g-score thead th { color: var(--c-white); text-align: right; }
.g-score thead th.win { color: var(--c-gold-light); }
.g-score thead .px-chip { width: 16px; height: 16px; }
.g-score tr.tot td { font-size: 16px; color: var(--c-white); }
.g-score tr.tot b { font-size: 16px; color: var(--c-gold-light); }
.g-score td .px-muted { font-size: 16px; }
.g-tips { list-style: none; margin: 8px 0; padding: 0; font-size: 16px; line-height: 20px; }
.g-tips li { display: flex; gap: 6px; align-items: center; }
.g-bluff { display: flex; gap: 12px; align-items: center; padding: 8px; margin: 8px 0; background: var(--c-ink); border-left: 4px solid var(--c-p4); }
.g-bluff-n { color: var(--c-white); min-width: 72px; text-align: center; }
.g-bluff .px-body { font-size: 16px; line-height: 20px; }
.g-ins { margin: 0 0 6px; padding-left: 18px; font-size: 16px; line-height: 20px; }
.g-ins li { margin-bottom: 4px; }
.g-wasted { margin: 4px 0 0 !important; font-size: 16px; line-height: 20px; }
.g-root[data-gl="phone"] .g-score th, .g-root[data-gl="phone"] .g-score td { padding: 1px 3px; }
.g-root[data-gl="phone"] .g-tips { margin: 6px 0; }
.g-root[data-gl="phone"] .g-results .px-modal-actions { margin-top: 8px; }
.g-root[data-gl="phone"] .g-score td .g-sq { display: none; }

/* -------------------------------------------------------------- reveal -- */
.g-revealing .g-opp { opacity: .5; }
.g-cols { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; width: 100%; min-height: 0; }
.g-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--c-ink); border-top: 4px solid var(--c-slate); padding: 2px 6px; }
.g-col.s1 { border-top-color: var(--c-p1); } .g-col.s2 { border-top-color: var(--c-p2); }
.g-col.s3 { border-top-color: var(--c-p3); } .g-col.s4 { border-top-color: var(--c-p4); }
.g-col-h { display: flex; align-items: center; gap: 4px; font-size: 16px; color: var(--c-white); white-space: nowrap; overflow: hidden; }
.g-col-h .px-chip { width: 14px; height: 14px; }
.g-col-rows { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.g-col-r { display: flex; justify-content: space-between; gap: 4px; font: 16px/16px var(--font-ui); color: var(--c-mist); animation: px-up-small 80ms steps(2, end); }
.g-col-r.gain b { color: var(--c-ok); } .g-col-r.loss b { color: var(--c-pink); } .g-col-r.none b { color: var(--c-fog); }
.g-col-t { display: flex; justify-content: space-between; border-top: 2px solid var(--c-slate); color: var(--c-fog); padding-top: 2px; }
.g-col-t b { color: var(--c-white); }
.g-col.win { background: var(--c-slate); }
.g-col.win .g-col-t b { color: var(--c-gold-light); }
.g-col.lose { opacity: .7; }
.g-bar[data-m="reveal"] { grid-template-rows: var(--bar-head) calc(var(--bar-main) + var(--bar-foot) + 6px); }
/* phones: the HUD steps aside during the reveal so the score columns get room */
.g-root[data-gl="phone"].g-revealing .g-opp, .g-root[data-gl="phone"].g-revealing .g-ticker { display: none; }
.g-root[data-gl="phone"].g-revealing .g-bar[data-m="reveal"] { grid-template-rows: var(--bar-head) 168px; }
.g-root[data-gl="phone"].g-tiny.g-revealing .g-bar[data-m="reveal"] { grid-template-rows: var(--bar-head) 150px; }
.g-bar[data-m="reveal"] .g-bar-foot { display: none; }
.g-bar[data-m="reveal"] .g-bar-main { grid-row: 2 / span 2; }
.g-rvskip.px-btn { flex: none; height: 28px; min-width: 64px; padding: 0 8px 2px; font-size: 16px; }
.g-stamp {
  position: absolute; z-index: 45; pointer-events: none;
  transform: translate(-50%, -50%) rotate(-8deg);
  padding: 2px 6px; font-size: 16px; line-height: 20px;
  border: 2px solid currentColor; background: var(--c-ink);
  animation: g-stamp 1300ms steps(8, end) forwards;
}
.g-stamp.good { color: var(--c-ok); } .g-stamp.bad { color: var(--c-pink); }
.g-confetti { position: absolute; inset: 0; pointer-events: none; z-index: 44; overflow: hidden; }
.g-cf { position: absolute; top: -8px; width: 6px; height: 6px; animation: g-fall 1600ms steps(16, end) forwards; }
.g-cf.copper { background: var(--c-copper); } .g-cf.silver { background: var(--c-mist); }
.g-cf.gold { background: var(--c-gold); } .g-cf.uranium { background: var(--c-uranium-light); }

/* pass-and-play peek card */
.g-peekpop { position: absolute; left: 8px; bottom: 8px; z-index: 36; pointer-events: none; }
.g-peekpop.top { bottom: auto; top: 8px; }
.g-peekpop .g-card { padding: 6px; gap: 8px; }

/* tray drag ghost */
.g-ghost { position: absolute; left: 0; top: 0; z-index: 90; pointer-events: none; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .5)); }
.g-flycard { position: absolute; z-index: 120; pointer-events: none; transition: transform 480ms steps(8, end), opacity 480ms steps(8, end); transform-origin: center; }

/* stash brackets pulse during the memorise moment */
.g-pulse-stashes .g-board { animation: g-glow 800ms steps(2, end) infinite; }

/* -------------------------------------------------------------- short screens -- */
.g-root[data-gl="phone"].g-tiny { --bar-head: 24px; --bar-main: 56px; }
.g-root[data-gl="phone"].g-tiny .g-opp { min-height: 46px; }
.g-root[data-gl="phone"].g-tiny .g-port, .g-root[data-gl="phone"].g-tiny .g-port-cv { width: 40px; height: 40px; }
.g-root[data-gl="desk"].g-short .g-opp-stats { display: none; }
.g-root[data-gl="desk"].g-short .g-port, .g-root[data-gl="desk"].g-short .g-port-cv { width: 48px; height: 48px; }
.g-root[data-gl="desk"].g-short { row-gap: 8px; }
.g-root[data-gl="desk"].g-short .g-card-shape { display: none; }

/* -------------------------------------------------------------- keyframes -- */
@keyframes g-slide {
  0% { transform: translateX(-100%); } 19% { transform: none; }
  85% { transform: none; opacity: 1; } 100% { transform: translateX(100%); opacity: 0; }
}
@keyframes g-slidehold {
  0% { transform: translateX(-100%); } 8% { transform: none; }
  92% { transform: none; opacity: 1; } 100% { transform: translateX(100%); opacity: 0; }
}
@keyframes g-fadeonly { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes g-pulse { 50% { filter: brightness(1.4); } }
@keyframes g-tick { 50% { filter: brightness(1.6); } }
@keyframes g-blink { 50% { color: var(--c-white); } }
@keyframes g-bob { 50% { transform: translateY(-2px); } }
@keyframes g-dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@keyframes g-fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes g-arrow { 50% { transform: translateY(-6px); } }
@keyframes g-float { 0% { opacity: 0; margin-top: 0; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -32px; } }
@keyframes g-stamp { 0% { transform: translate(-50%, -50%) rotate(-8deg) scale(2); opacity: 0; } 12% { transform: translate(-50%, -50%) rotate(-8deg) scale(1); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes g-fall { 0% { transform: translate(0, 0); } 100% { transform: translate(var(--dx, 0), 110vh); } }
@keyframes g-glow { 50% { filter: brightness(1.15); } }

/* reduced motion: hold still, keep information */
:root[data-motion="reduced"] .g-root *, .g-root.g-still * { animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
:root[data-motion="reduced"] .g-banner.show { animation: g-fadeonly 1060ms steps(2, end) forwards !important; }
@media (prefers-reduced-motion: reduce) {
  .g-root * { animation-iteration-count: 1 !important; }
  .g-banner.show { animation: g-fadeonly 1060ms steps(2, end) forwards !important; }
  .g-cf, .g-flycard { display: none; }
}
