/* ============================================================
   ai45.xyz — SAT games (games.html)
   Builds on site.css + sat.css (panels, buttons, difficulty tags and the
   Bluebook question classes). Tokens only; animate transform/opacity.
   ============================================================ */

#games-app { margin-top: 36px; min-height: 50vh; }
.g-input {
  height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--hairline);
  background: var(--s-well); color: var(--paper); font: inherit; font-size: 15px; min-width: 0;
}
.g-input:focus { outline: none; border-color: var(--orange); }

/* ---------- gates, waiting screens ---------- */
.g-gate, .g-wait { max-width: 620px; margin: 24px auto; padding: 36px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.g-gate h2, .g-wait h2 { font-size: clamp(24px, 3vw, 32px); line-height: 1.15; }
.g-wait .muted, .g-gate .muted { max-width: 46ch; line-height: 1.6; }
.g-nick { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.g-spinner { width: 42px; height: 42px; border-radius: 999px; border: 3px solid rgba(var(--fg-rgb), 0.12); border-top-color: var(--orange); animation: g-spin 0.9s linear infinite; }
@keyframes g-spin { to { transform: rotate(360deg); } }
.g-code { font-size: clamp(34px, 6vw, 52px); letter-spacing: 0.18em; color: var(--sand); padding: 6px 18px; border-radius: 16px; background: var(--s-well); }
.g-wait .g-timer { display: inline-flex; vertical-align: middle; }
.g-profile { align-items: stretch; text-align: left; }

/* ---------- lobby ---------- */
.g-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-bottom: 22px; border-bottom: 1px solid var(--hairline); }
.g-head h2 { font-size: clamp(24px, 3vw, 34px); line-height: 1.1; margin-top: 6px; }
.g-head__r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.g-stat { display: flex; align-items: baseline; gap: 6px; padding: 0 10px; }
.g-stat b { font-size: 26px; color: var(--sand); }
.g-join { display: flex; gap: 6px; }
.g-join .g-input { width: 132px; height: 36px; text-transform: uppercase; letter-spacing: 0.12em; font-family: var(--font-mono); font-size: 13px; }
.g-sec { margin-top: 40px; }
.g-sec__h { margin-bottom: 16px; }
.g-sec__h h3 { font-size: 22px; margin-top: 4px; }
.g-sec__h .faint { margin-top: 6px; font-size: 14px; }
.g-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.g-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-card { padding: 22px; display: flex; flex-direction: column; gap: 10px; transition: transform 0.25s var(--ease); }
.g-card:hover { transform: translateY(-2px); }
.g-card h4 { font-size: 19px; }
.g-card .muted { font-size: 14px; line-height: 1.55; }
.g-card__ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--c, var(--orange)); background: color-mix(in srgb, var(--c, var(--orange)) 14%, transparent); }
.g-card__ic svg { width: 21px; height: 21px; }
.g-card__f { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.g-card__btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.g-card .g-card__btns { justify-content: flex-start; }
.g-sel { display: flex; flex-direction: column; gap: 5px; }
.g-sel select { height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--hairline); background: var(--s-well); color: var(--paper); font: inherit; font-size: 14px; }

/* "Count toward my practice" switch */
.g-count { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); cursor: pointer; user-select: none; }
.g-count input { position: absolute; opacity: 0; pointer-events: none; }
.g-switch { position: relative; flex: none; width: 36px; height: 20px; border-radius: 999px; background: rgba(var(--fg-rgb), 0.16); transition: background-color 0.2s var(--ease); }
.g-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 999px; background: var(--paper); transition: transform 0.2s var(--ease); }
.g-count input:checked + .g-switch { background: var(--orange); }
.g-count input:checked + .g-switch::after { transform: translateX(16px); background: var(--on-accent, #171C2D); }
.g-count input:focus-visible + .g-switch { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ---------- match frame ---------- */
.g-mhead { position: sticky; top: 12px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 18px; border-radius: 18px; border: 1px solid var(--hairline); background: rgba(var(--glass-rgb), 0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.g-mhead__l { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.g-score { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; font-size: 16px; }
.g-score .mono { font-size: 22px; color: var(--sand); }
.g-score__unit { font-size: 12px; }
.g-away { font-size: 12px; color: var(--s-no); }
.g-timer { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.g-timer b { font-size: 24px; font-variant-numeric: tabular-nums; }
.g-timer b.is-low { color: var(--s-no); }
.g-leave { margin-left: auto; }
.g-mbody { margin-top: 18px; display: flex; flex-direction: column; gap: 16px; }
.g-main { min-width: 0; }
.g-next { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.g-note { color: var(--muted); font-size: 15px; }
.g-verdict { padding: 12px 16px; border-radius: 12px; background: var(--s-well); font-size: 15px; font-weight: 600; }
.g-verdict.ok { color: var(--s-ok); }
.g-verdict.no { color: var(--s-no); }
.g-verdict .faint { font-weight: 500; }
.g-warn { color: var(--s-no); font-size: 13px; }
.g-result { padding: 28px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.g-result h2 { font-size: clamp(28px, 4vw, 40px); }
.g-result.is-win h2 { color: var(--s-ok); }
.g-result.is-loss h2 { color: var(--s-no); }
.g-streak b { font-size: 22px; color: var(--sand); }

/* question layout (mirrors the Bluebook split view, in the page) */
.g-q { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; padding: 24px; border-radius: 18px; border: 1px solid var(--hairline); background: var(--card); }
.g-q--split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.g-q__left { padding-right: 22px; border-right: 1px solid var(--hairline); }
.g-qmeta { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; }
.g-spr { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.g-input--spr { flex: 1 1 220px; height: 48px; font-size: 18px; }
.g-input--spr.is-right { border-color: var(--s-ok); }
.g-input--spr.is-wrong { border-color: var(--s-no); }
.g-accepted { margin-top: 10px; color: var(--muted); font-size: 14px; }
.g-key { margin-top: 18px; padding: 16px 18px; }
.g-key .bb-ex__body { margin-top: 8px; font-size: 15px; line-height: 1.65; color: var(--muted); }
.bb-choice.is-opp .bb-choice__btn { box-shadow: inset 0 0 0 1.5px var(--s-key); }
.g-opptag { flex: none; font-size: 10px; letter-spacing: 0.08em; color: var(--s-key); }
.flash-ok { animation: g-ok 0.5s var(--ease); }
.flash-no { animation: g-no 0.45s var(--ease); }
@keyframes g-ok { 0% { transform: scale(1); } 40% { transform: scale(1.012); } 100% { transform: scale(1); } }
@keyframes g-no { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Duel */
.g-duel { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.g-sidebar { position: sticky; top: 110px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.g-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.g-pill { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--hairline); background: var(--s-well); color: var(--paper); font-family: var(--font-mono); font-size: 13px; display: inline-grid; place-items: center; }
.g-pill.is-cur { border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); }
.g-pill.is-ok { background: color-mix(in srgb, var(--s-ok) 22%, transparent); }
.g-pill.is-no { background: color-mix(in srgb, var(--s-no) 22%, transparent); }
.g-pill.is-done { opacity: 0.55; }
.g-oppbar { font-size: 13px; }

/* Speed Vocab */
.g-vbar { display: flex; gap: 20px; flex-wrap: wrap; align-items: baseline; padding: 12px 16px; border-radius: 12px; background: var(--s-well); font-size: 15px; }
.g-vbar .mono { font-size: 20px; color: var(--sand); }

/* Card Draw */
.g-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.g-cardpick { --cc: var(--s-key); position: relative; aspect-ratio: 3 / 4; border-radius: 16px; border: 1.5px solid color-mix(in srgb, var(--cc) 55%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--cc) 26%, var(--card)), var(--card)); color: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; transition: transform 0.2s var(--ease); }
.g-cardpick--E { --cc: var(--s-ok); }
.g-cardpick--M { --cc: var(--s-key); }
.g-cardpick--H { --cc: var(--s-no); }
.g-cardpick:hover { transform: translateY(-3px); }
.g-cardpick.is-sel { transform: translateY(-8px); box-shadow: 0 0 0 2px var(--cc); }
.g-cardpick__d { font-weight: 700; font-size: 17px; }
.g-cardpick__v { font-size: 13px; color: var(--muted); }
.g-cardpick__dbl { position: absolute; bottom: 10px; left: 10px; right: 10px; padding: 5px 0; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(var(--fg-rgb), 0.1); }
.g-cardpick.is-dbl .g-cardpick__dbl { background: var(--cc); color: var(--on-accent, #171C2D); }
.g-pill--card { border-color: color-mix(in srgb, var(--cc) 55%, transparent); font-family: var(--font-display); font-size: 13px; font-weight: 600; }

/* Bluff */
.g-call { padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; }
.g-call h3 { font-size: 20px; line-height: 1.35; }
.g-oppick { color: var(--s-key); }
.g-call .g-card__btns { justify-content: flex-start; }

/* Weekly ghost */
.g-ghost { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding: 6px 12px; border-radius: 12px; border: 1px dashed color-mix(in srgb, var(--c-gem2, #9B72CB) 60%, transparent); }
.g-ghost b { font-size: 16px; }

/* review + boards */
.g-review { display: flex; flex-direction: column; gap: 10px; }
.g-rev { padding: 0; overflow: hidden; }
.g-rev summary { display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; list-style: none; font-size: 14px; }
.g-rev summary::-webkit-details-marker { display: none; }
.g-rev[open] summary { border-bottom: 1px solid var(--hairline); }
.g-rev .g-q { border: none; border-radius: 0; }
.g-rev__t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.g-rev__x { flex: none; font-size: 12.5px; }
.g-dot { flex: none; width: 10px; height: 10px; border-radius: 999px; background: var(--faint); }
.g-dot.is-ok { background: var(--s-ok); }
.g-dot.is-no { background: var(--s-no); }
.g-board tr.is-me td { color: var(--sand); font-weight: 600; }
.g-myrank { margin-top: 14px; }
#games-app .tbl-wrap + .faint, #games-app .g-myrank + .faint { margin-top: 12px; font-size: 13px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .g-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-q--split { grid-template-columns: minmax(0, 1fr); }
  .g-q__left { padding-right: 0; border-right: none; padding-bottom: 18px; border-bottom: 1px solid var(--hairline); }
}
@media (max-width: 760px) {
  .g-grid, .g-grid--2 { grid-template-columns: minmax(0, 1fr); }
  .g-duel { grid-template-columns: minmax(0, 1fr); }
  .g-sidebar { position: static; }
  .g-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-q { padding: 18px; }
  .g-mhead { top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .g-spinner, .flash-ok, .flash-no { animation: none; }
  .g-card, .g-cardpick { transition: none; }
}
