/* ============================================================
   THE QUARTER CLOSE — silo vs. unison operations game
   Uses the site design tokens from styles.css (type scale, palette).
   ============================================================ */

.game-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #fbfcff 0%, #f4f6fd 100%);
  border-bottom: 1px solid var(--line);
  padding: 150px 0 84px;
}
.game-hero h1 { max-width: 16ch; color: var(--brand-deep); }
.game-lede { max-width: 62ch; margin: 26px 0 0; font-size: var(--fs-lg); color: var(--muted); line-height: 1.62; }
.game-note { margin: 14px 0 0; font-size: var(--fs-xs); color: var(--faint); }
.game-hero .btn { margin-top: 30px; }
.game-noscript { font-size: var(--fs-md); color: var(--muted); }

.game-root { min-height: 60vh; }

/* ---------- shared chrome ---------- */
.g-stage { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); overflow: hidden; }
.g-stagehead { padding: 22px 26px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 16px 26px; align-items: center; }
.g-round { font-family: var(--mono); font-size: var(--fs-3xs); letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.g-stagehead h2 { font-size: var(--fs-d4); line-height: var(--lh-d4); color: var(--ink); margin: 4px 0 0; }
.g-stagehead p { margin: 6px 0 0; font-size: var(--fs-sm); color: var(--muted); max-width: 66ch; }
.g-headmain { flex: 1 1 340px; }

/* live meters */
.g-meters { display: flex; gap: 10px; flex-wrap: wrap; }
.g-meter { background: var(--paper-alt); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 14px; min-width: 88px; }
.g-meter dt { font-family: var(--mono); font-size: var(--fs-6xs); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.g-meter dd { margin: 3px 0 0; font-family: var(--mono); font-size: var(--fs-md); font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.g-meter.bad dd { color: var(--red-deep); }
.g-meter.good dd { color: var(--brand); }

/* ---------- intro / briefing ---------- */
.g-brief { padding: 34px 30px 36px; }
.g-brief h2 { font-size: var(--fs-d3); line-height: var(--lh-d3); color: var(--brand-deep); }
.g-brief > p { font-size: var(--fs-md); color: var(--muted); max-width: 68ch; line-height: 1.62; margin: 14px 0 0; }
.g-rules { list-style: none; margin: 26px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 780px) { .g-rules { grid-template-columns: 1fr; } }
.g-rules li { background: var(--paper-alt); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; }
.g-rules b { display: block; font-size: var(--fs-sm); color: var(--ink); margin-bottom: 5px; }
.g-rules span { font-size: var(--fs-2xs); color: var(--muted); line-height: 1.5; display: block; }

/* ---------- the order queue ---------- */
.g-body { display: grid; grid-template-columns: 300px 1fr; gap: 0; align-items: stretch; }
@media (max-width: 900px) { .g-body { grid-template-columns: 1fr; } }
.g-queue { border-right: 1px solid var(--line); background: var(--paper-alt); padding: 20px 18px; }
@media (max-width: 900px) { .g-queue { border-right: none; border-bottom: 1px solid var(--line); } }
.g-queue h3 { font-family: var(--sans); font-weight: 800; font-size: var(--fs-3xs); letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin: 0 0 14px; }
.g-order { width: 100%; text-align: left; font-family: inherit; background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 9px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; display: block; }
.g-order:hover:not(:disabled) { border-color: var(--brand); transform: translateX(2px); }
.g-order[aria-current="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.g-order:disabled { cursor: default; opacity: .62; }
.g-oref { font-family: var(--mono); font-size: var(--fs-3xs); color: var(--brand); letter-spacing: .04em; }
.g-ocust { font-size: var(--fs-sm); font-weight: 700; color: var(--ink); margin-top: 2px; }
.g-oline { font-size: var(--fs-2xs); color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.g-obadge { display: inline-block; margin-top: 7px; font-family: var(--mono); font-size: var(--fs-6xs); letter-spacing: .07em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.g-obadge.done { background: var(--brand-soft); color: var(--brand-deep); }
.g-obadge.err { background: var(--red-soft); color: var(--red-deep); }
.g-obadge.held { background: #fdf4e3; color: #7a5410; }

/* ---------- round 1: the three silos ---------- */
.g-work { padding: 20px 24px 26px; min-width: 0; }
.g-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.g-tab { font-family: var(--sans); font-weight: 700; font-size: var(--fs-2xs); letter-spacing: .04em; padding: 10px 16px; border: 1px solid transparent; border-bottom: none; border-radius: 9px 9px 0 0; background: none; color: var(--muted); cursor: pointer; margin-bottom: -1px; transition: background .15s, color .15s, border-color .15s; }
.g-tab:hover { color: var(--brand); background: var(--brand-soft); }
.g-tab[aria-selected="true"] { background: var(--paper); border-color: var(--line); border-bottom-color: var(--paper); color: var(--brand-deep); }
.g-tab .g-sys { font-family: var(--mono); font-size: var(--fs-6xs); display: block; color: var(--faint); letter-spacing: .08em; margin-top: 2px; }
.g-tab[aria-selected="true"] .g-sys { color: var(--red); }

.g-pane h3 { font-family: var(--serif); font-size: var(--fs-d5); line-height: var(--lh-d4); color: var(--ink); margin: 0 0 4px; }
.g-panesub { font-size: var(--fs-2xs); color: var(--muted); margin: 0 0 18px; }

.g-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.g-field { background: var(--paper-alt); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; }
.g-field dt { font-family: var(--mono); font-size: var(--fs-6xs); letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.g-field dd { margin: 4px 0 0; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.g-field.unknown dd { color: var(--faint); font-weight: 500; font-style: italic; }
.g-field.stale { border-color: #e8d3a4; background: #fdf9ef; }
.g-field.stale dd { color: #7a5410; }
.g-stalenote { font-family: var(--mono); font-size: var(--fs-6xs); color: #a07a28; margin-top: 4px; letter-spacing: .04em; }

.g-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.g-actions .btn { font-size: var(--fs-2xs); padding: 11px 18px; }
.g-cost { font-family: var(--mono); font-size: var(--fs-6xs); color: var(--faint); letter-spacing: .05em; }

.g-empty { font-size: var(--fs-sm); color: var(--faint); padding: 26px 0; }

/* ---------- round 2: the unified card ---------- */
.g-unified { padding: 22px 24px 26px; }
.g-uhead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.g-uhead h3 { font-family: var(--serif); font-size: var(--fs-d4); line-height: var(--lh-d4); color: var(--ink); margin: 0; }
.g-usub { font-size: var(--fs-2xs); color: var(--muted); margin: 0 0 18px; }
.g-signals { display: grid; grid-template-columns: repeat(auto-fit, minmax(146px, 1fr)); gap: 12px; margin-bottom: 18px; }
.g-signal { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--paper-alt); position: relative; }
.g-signal dt { font-family: var(--mono); font-size: var(--fs-6xs); letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.g-signal dd { margin: 4px 0 0; font-size: var(--fs-sm); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.g-signal.ok { border-color: #bcd9c4; background: #f2fbf5; }
.g-signal.ok dd { color: #1d6b39; }
.g-signal.warn { border-color: var(--red); background: var(--red-soft); }
.g-signal.warn dd { color: var(--red-deep); }
.g-live { position: absolute; top: 9px; right: 10px; font-family: var(--mono); font-size: var(--fs-6xs); color: #1d6b39; letter-spacing: .06em; }
.g-signal.warn .g-live { color: var(--red-deep); }

/* ---------- activity log ---------- */
.g-log { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.g-log h4 { font-family: var(--sans); font-weight: 800; font-size: var(--fs-6xs); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 0 0 10px; }
.g-logitems { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 172px; overflow-y: auto; }
.g-logitems li { font-family: var(--mono); font-size: var(--fs-6xs); line-height: 1.55; color: var(--muted); display: flex; gap: 9px; }
.g-logitems li .t { color: var(--faint); flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.g-logitems li.err { color: var(--red-deep); }
.g-logitems li.win { color: #1d6b39; }

/* ---------- scorecard ---------- */
.g-score { padding: 34px 30px 38px; }
.g-score h2 { font-size: var(--fs-d3); line-height: var(--lh-d3); color: var(--brand-deep); }
.g-score > p { font-size: var(--fs-md); color: var(--muted); max-width: 68ch; line-height: 1.62; margin: 14px 0 28px; }
.g-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 780px) { .g-cols { grid-template-columns: 1fr; } }
.g-col { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 24px; }
.g-col.silo { background: var(--paper-alt); }
.g-col.unified { background: linear-gradient(160deg, var(--brand-soft) 0%, #f6f7fd 100%); border-color: var(--brand-soft-2); }
.g-col h3 { font-family: var(--sans); font-weight: 800; font-size: var(--fs-3xs); letter-spacing: .12em; text-transform: uppercase; margin: 0 0 16px; }
.g-col.silo h3 { color: var(--muted); }
.g-col.unified h3 { color: var(--brand); }
.g-rows { list-style: none; margin: 0; padding: 0; }
.g-rows li { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--line-strong); font-size: var(--fs-2xs); color: var(--muted); }
.g-rows li:last-child { border-bottom: none; }
.g-rows b { font-family: var(--mono); font-size: var(--fs-sm); font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.g-rows li.bad b { color: var(--red-deep); }
.g-rows li.good b { color: #1d6b39; }

.g-verdict { margin-top: 26px; background: var(--brand-deep); color: #fff; border-radius: var(--radius); padding: 26px 28px; }
.g-verdict h3 { font-family: var(--serif); font-weight: 400; font-size: var(--fs-d4); line-height: var(--lh-d4); color: #fff; margin: 0 0 10px; letter-spacing: var(--tr-d3); }
.g-verdict p { margin: 0; color: #c6c8f0; font-size: var(--fs-sm); line-height: 1.62; max-width: 70ch; }
.g-verdict .g-delta { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 20px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.18); }
.g-verdict .g-delta div { display: flex; flex-direction: column; }
.g-verdict .g-delta dt { font-family: var(--mono); font-size: var(--fs-6xs); letter-spacing: .08em; text-transform: uppercase; color: #9aa0e8; }
.g-verdict .g-delta dd { margin: 5px 0 0; font-family: var(--serif); font-size: var(--fs-d4); line-height: 1; color: #fff; }

.g-foot { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.g-replay { background: none; border: none; font-family: var(--sans); font-weight: 700; font-size: var(--fs-2xs); color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.g-replay:hover { color: var(--brand); }

/* transitions */
.g-fade { animation: gfade .26s ease; }
@keyframes gfade { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .g-fade { animation: none; } .g-order:hover:not(:disabled) { transform: none; } }


/* the tab and the button the coach is pointing at */
.g-tab[data-hot="true"] { position: relative; }
.g-tab[data-hot="true"]::before { content: ""; position: absolute; top: 5px; right: 7px; width: 7px; height: 7px; border-radius: 999px; background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.btn[data-hot="true"] { box-shadow: 0 0 0 4px var(--brand-soft), 0 6px 18px rgba(28,30,143,.28); }

/* four systems need to wrap gracefully on a phone */
@media (max-width: 620px) { .g-tab { flex: 1 1 auto; text-align: center; padding: 9px 10px; } }

.g-flavour { margin: 0 0 16px; font-size: var(--fs-2xs); font-style: italic; color: var(--faint); line-height: 1.5; }


/* the control the bubble points at */
.btn[data-hot="true"], .g-tab[data-hot="true"] { animation: ghot 1.9s ease-in-out infinite; }
@keyframes ghot { 0%,100% { box-shadow: 0 0 0 0 rgba(224,38,58,.42); } 50% { box-shadow: 0 0 0 7px rgba(224,38,58,0); } }
@media (prefers-reduced-motion: reduce) { .btn[data-hot="true"], .g-tab[data-hot="true"] { animation: none; } }

/* collapsed activity log — the page was much taller than it needed to be */
.g-log > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 7px; font-family: var(--sans); font-weight: 800; font-size: var(--fs-6xs); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.g-log > summary::-webkit-details-marker { display: none; }
.g-log > summary::after { content: "⌄"; font-size: var(--fs-2xs); transition: transform .2s ease; }
.g-log[open] > summary::after { transform: rotate(180deg); }
.g-log > summary:hover { color: var(--brand); }
.g-log .g-logitems { margin-top: 12px; }

/* keep the docked bubble from covering the last row of controls */


/* ---------- the coach bubble ----------
   Glass, not a card. The panel underneath has to stay readable — that is the
   whole point of a game about seeing your data — so the ground is heavily
   blurred rather than opaque, and legibility is bought back with weight and a
   dark scrim behind the text rather than with solidity. */
.g-bubble {
  position: fixed; z-index: 90; width: 258px; max-width: calc(100vw - 20px);
  display: flex; gap: 9px; align-items: flex-start;
  background: rgba(17, 19, 62, .58);
  -webkit-backdrop-filter: saturate(1.7) blur(16px);
  backdrop-filter: saturate(1.7) blur(16px);
  color: #fff;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 12px; padding: 9px 10px 9px 11px;
  box-shadow: 0 8px 26px rgba(15,17,50,.28);
  text-shadow: 0 1px 2px rgba(10,12,40,.55);
  animation: gbub .18s ease;
}
@keyframes gbub { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .g-bubble { animation: none; } }

/* browsers without backdrop-filter would leave unreadable text on glass */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .g-bubble { background: rgba(17,19,62,.93); }
}

/* almost vanishes while you read what is behind it */
.g-bubble:hover { background: rgba(17,19,62,.34); }

.g-bubarrow { position: absolute; width: 10px; height: 10px; background: rgba(17,19,62,.58); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); transform: rotate(45deg); margin-left: -5px; }
.g-bub-below .g-bubarrow { top: -5px; border-left: 1px solid rgba(255,255,255,.22); border-top: 1px solid rgba(255,255,255,.22); }
.g-bub-above .g-bubarrow { bottom: -5px; border-right: 1px solid rgba(255,255,255,.22); border-bottom: 1px solid rgba(255,255,255,.22); }

.g-bubnum { flex: 0 0 auto; width: 19px; height: 19px; border-radius: 999px; background: var(--red); color: #fff; font-family: var(--mono); font-size: 10px; font-weight: 500; display: grid; place-items: center; margin-top: 1px; text-shadow: none; box-shadow: 0 1px 4px rgba(120,10,25,.5); }
.g-bubnum.wide { width: auto; min-width: 30px; padding: 0 6px; border-radius: 999px; font-size: 9.5px; }
.g-bubbody { min-width: 0; flex: 1 1 auto; }
.g-bublab { margin: 0 0 2px; font-family: var(--mono); font-size: 9px; letter-spacing: .09em; text-transform: uppercase; color: #b9bef5; }
.g-bubsay { margin: 0; font-size: 12.5px; font-weight: 700; color: #fff; line-height: 1.4; }
.g-bubwhy { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.2); font-size: 11px; color: #dcdefb; line-height: 1.45; }
.g-bubwhybtn { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; border-radius: 999px; border: 1px solid rgba(255,255,255,.34); background: rgba(255,255,255,.1); color: #fff; font-family: var(--sans); font-size: 11px; font-weight: 700; line-height: 1; cursor: pointer; display: grid; place-items: center; text-shadow: none; transition: background .15s; }
.g-bubwhybtn:hover { background: rgba(255,255,255,.28); }

/* ---------- phone ---------- */
.g-bubble.g-bub-docked {
  left: 8px; right: 8px; bottom: 8px; top: auto; width: auto; max-width: none;
  border-radius: 11px; box-shadow: 0 -4px 20px rgba(15,17,50,.24);
}
.g-bub-docked .g-bubarrow { display: none; }

/* ASK sits bottom-right at a higher stacking order; lift it clear of the dock */
body.g-docked .ask-launcher { bottom: 92px; }
body.g-docked .ask-panel { bottom: 92px; max-height: calc(100vh - 108px); }

/* ---------- mobile layout ----------
   The stage was laid out for a desktop column and simply squeezed. These are
   the pieces that actually needed different proportions on a small screen. */
@media (max-width: 620px) {
  .game-hero { padding: 118px 0 56px; }
  .g-stage { border-radius: 12px; }
  .g-stagehead { padding: 16px 16px 14px; gap: 12px; }
  .g-stagehead h2 { font-size: var(--fs-d5); }
  .g-stagehead p { font-size: var(--fs-2xs); }
  .g-meters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; }
  .g-meter { min-width: 0; padding: 7px 8px; }
  .g-meter dd { font-size: var(--fs-2xs); }
  .g-queue { padding: 14px 12px; }
  .g-order { padding: 10px 12px; margin-bottom: 7px; }
  .g-work, .g-unified { padding: 16px 14px 104px; }   /* room for the docked bubble */
  .g-brief, .g-score { padding: 22px 16px 26px; }
  .g-fields, .g-signals { grid-template-columns: 1fr 1fr; gap: 8px; }
  .g-field, .g-signal { padding: 9px 10px; }
  .g-actions .btn { flex: 1 1 100%; justify-content: center; }
  .g-log { margin-top: 16px; }
  .g-verdict { padding: 20px 18px; }
  .g-verdict .g-delta { gap: 16px 22px; }
}
@media (max-width: 400px) {
  .g-meters { grid-template-columns: repeat(2, 1fr); }
  .g-fields, .g-signals { grid-template-columns: 1fr; }
}
