/* game-frame.css — khung chung cho màn game mới (templates/pages/games/_frame.html, _ui.html).
   Bản vẽ: design/redesign-style-c/frames/GC_KO_*, GC_KA_*, GC_AB_*. Chỉ dùng biến trong tokens.css.
   Khối nên gom vào base.css sau: .gs-bar (focus bar), .gs-actions (thanh hành động dưới), .gs-modal/.gs-dialog,
   .gs-stat, .gs-opt (phương án trắc nghiệm), .gs-chip (ô số liệu trên thanh). */

.gs { min-height: 100vh; background: var(--bg); color: var(--ink); }
.gs-screen { min-height: 100vh; }
.gs-grow { flex-grow: 1; }

/* ── Thanh trên (focus bar) ─────────────────────────────────────── */
.gs-bar {
  height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.gs-x {
  width: 36px; height: 36px; flex-shrink: 0; margin-left: -6px;
  border: 0; border-radius: var(--r); background: none; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; text-decoration: none;
}
.gs-x:hover { background: var(--bg-soft); color: var(--ink); }
.gs-crumb { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* App điện thoại tự vẽ nút quay lại ở góc trên trái → chừa chỗ, bỏ nút thoát của web. */
.gs.is-mobile .gs-bar { padding-left: 64px; height: 52px; }
.gs.is-mobile .gs-x { display: none; }

/* ── Ô số liệu trên thanh (HUD chip) ────────────────────────────── */
.gs-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg);
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.gs-chip .icon { color: var(--accent); }
.gs-chip b { font-size: 15px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ── Trang giới thiệu / sảnh ────────────────────────────────────── */
.gs-intro { max-width: 820px; margin: 0 auto; padding: 48px 40px 64px; }
.gs-tile {
  width: 64px; height: 64px; border-radius: var(--r-lg);
  display: grid; place-items: center;
}
.gs-tile-sm { width: 56px; height: 56px; }
.gs-tone-red { background: var(--red-bg); color: var(--red); }
.tag-red { background: var(--red-bg); color: var(--red); }
.tag-violet { background: var(--violet-bg); color: var(--violet); }
.tag-orange { background: var(--amber-bg); color: var(--amber); }
.gs-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 6px; }
.gs-h1 { margin: 0; font-size: 40px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.gs-h2 { margin: 40px 0 12px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.gs-sub-jp { margin: 0 0 6px; font-family: var(--font-jp); font-size: 16px; color: var(--muted); }
.gs-lead { margin: 0 0 20px; font-size: 15px; color: var(--muted); line-height: 1.5; }
.gs-label { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.gs-hint { margin: 10px 0 18px; font-size: 13px; color: var(--muted); }
.gs-note { margin: 22px 0 0; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.gs-note .icon { color: var(--faint); }
.gs-list { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.9; color: var(--text); }

.gs-levels { display: flex; gap: 8px; flex-wrap: wrap; }
.gs-level {
  min-width: 52px; height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg);
  font-size: 15px; font-weight: 600; color: var(--text); cursor: pointer;
}
.gs-level:hover { border-color: var(--faint); }
.gs-level[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.gs-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.gs-step { padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); }
.gs-step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 15px; font-weight: 600; }
.gs-step-n { width: 24px; height: 24px; border-radius: var(--r); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.gs-step-text { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }

/* Trạng thái kết nối máy chủ */
.gs-status {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: var(--r-sm); font-size: 13px; background: var(--bg-soft); color: var(--text);
}
.gs-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.gs-status.is-ok { background: var(--green-tag); color: var(--green); }
.gs-status.is-ok::before { background: var(--green); }
.gs-status.is-warn { background: var(--amber-bg); color: var(--amber); }
.gs-status.is-warn::before { background: var(--amber); }
.gs-status.is-bad { background: var(--red-bg); color: var(--red); }
.gs-status.is-bad::before { background: var(--red); }

/* ── Thanh hành động dưới ───────────────────────────────────────── */
.gs-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  min-height: 72px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--bg);
  display: flex; align-items: center;
}
.gs-actions-in { width: 100%; max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.gs-actions-text { font-size: 13px; color: var(--muted); }
.gs-pad-actions { padding-bottom: 110px; }

/* ── Hộp nổi trên màn chơi ──────────────────────────────────────── */
.gs-modal {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(15, 23, 42, 0.32);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.gs-dialog {
  width: 420px; max-width: 100%; max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 24px; border-radius: 12px; background: var(--bg); color: var(--ink);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18), 0 0 0 1px var(--line);
}
.gs-dialog-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 14px; }
.gs-dialog-title { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.gs-dialog-kicker { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.gs-dialog-text { margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: var(--muted); }
.gs-dialog-actions { display: flex; gap: 10px; }
.gs-dialog-actions .btn { flex: 1 1 0; }
.gs-full { width: 100%; }

.gs-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.gs-stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); }
.gs-stat-k { margin: 0; font-size: 13px; color: var(--muted); }
.gs-stat-v { margin: 4px 0 0; font-size: 24px; font-weight: 700; color: var(--ink); }

/* Phương án trắc nghiệm (A/B/C/D) */
.gs-opts { display: flex; flex-direction: column; gap: 8px; }
.gs-opt {
  width: 100%; min-height: 50px; display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg);
  font: inherit; text-align: left; cursor: pointer; color: var(--ink);
}
.gs-opt:hover { border-color: var(--accent); }
.gs-opt-l {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: var(--r); background: var(--bg-soft); color: var(--muted);
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
}
.gs-opt-t { flex-grow: 1; font-family: var(--font-jp); font-size: 16px; }
.gs-opt.is-sel { border-color: var(--accent); background: var(--callout); }
.gs-opt.is-sel .gs-opt-l { background: var(--accent); color: var(--on-accent); }
.gs-opt.is-ok { border-color: var(--green); background: var(--green-bg); }
.gs-opt.is-ok .gs-opt-l { background: var(--green); color: var(--on-accent); }
.gs-opt.is-bad { border-color: var(--red); background: var(--red-bg); }
.gs-opt.is-bad .gs-opt-l { background: var(--red); color: var(--on-accent); }
.gs-opt.is-dim { cursor: default; color: var(--faint); }
.gs-opt.is-dim:hover { border-color: var(--line); }

/* Vòng đếm giây (SVG, JS đặt stroke-dashoffset) */
.gs-ring { width: 48px; height: 48px; position: relative; flex-shrink: 0; }
.gs-ring svg { width: 48px; height: 48px; transform: rotate(-90deg); }
.gs-ring circle { fill: none; stroke-width: 4; }
.gs-ring .gs-ring-bg { stroke: var(--line); }
.gs-ring .gs-ring-fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 125.7; transition: stroke-dashoffset 1s linear; }
.gs-ring.is-red .gs-ring-fg { stroke: var(--red); }
.gs-ring-n { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Vòng xoay chờ */
.gs-spin {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--accent);
  animation: gs-spin 1s linear infinite;
}
@keyframes gs-spin { to { transform: rotate(360deg); } }

/* ── Điện thoại / khung ngang thấp ──────────────────────────────── */
@media (max-width: 860px) {
  .gs-intro { padding: 28px 16px 48px; }
  .gs-h1 { font-size: 30px; }
  .gs-h2 { margin-top: 32px; font-size: 20px; }
  .gs-steps { grid-template-columns: minmax(0, 1fr); }
  .gs-bar { padding: 0 12px; }
  .gs-actions { padding: 12px 16px; }
  .prop-name { width: 116px; }
}
@media (max-height: 480px) {
  .gs-intro { padding-top: 20px; }
  .gs-dialog { padding: 16px; }
  .gs-dialog-icon { margin-bottom: 8px; }
  .gs-actions { min-height: 60px; padding: 8px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .gs-spin { animation-duration: 3s; }
  .gs-ring .gs-ring-fg { transition: none; }
}
