/* ===========================================================================
   速成學習遊戲 — 霓虹街機 (Neon Arcade) 視覺系統
   深色底、霓虹光暈、圓角卡片、發光重點色。版面為「左側導軌 + 全幅內容」。
   詳見 design-system/sucheng-arcade/MASTER.md
   =========================================================================== */

/* ---------- 設計代幣：夜間（預設） ---------- */
:root {
  color-scheme: dark;

  --bg: #0a0b12;
  --surface: #13151f;
  --surface-2: #1a1e2c;
  --raised: #21263a;
  --line: #262a3a;
  --fg: #e8ebf5;
  --muted: #99a1b5;

  --cyan: #22d3ee;
  --pink: #ff2d95;
  --lime: #a3e635;
  --amber: #fbbf24;
  --violet: #a78bfa;
  --danger: #ff5470;

  --on-accent: #06070c;

  /* 光暈前綴：與 --tone 串接成完整 box-shadow */
  --glow-a: 0 0 18px;
  --glow-b: 0 0 34px -6px;
  --glow-text: 0 0 22px;

  /* 字根五大分類 */
  --g-philo: #22d3ee;
  --g-stroke: #fbbf24;
  --g-body: #ff2d95;
  --g-shape: #a3e635;
  --g-special: #a78bfa;
  --g-philo-bg: rgba(34, 211, 238, 0.13);
  --g-stroke-bg: rgba(251, 191, 36, 0.13);
  --g-body-bg: rgba(255, 45, 149, 0.13);
  --g-shape-bg: rgba(163, 230, 53, 0.13);
  --g-special-bg: rgba(167, 139, 250, 0.13);

  --shadow: 0 16px 34px -22px rgba(0, 0, 0, 0.9);
  --shadow-lg: 0 26px 50px -26px rgba(0, 0, 0, 0.95);

  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --rail-w: 264px;

  --s1: 6px;
  --s2: 12px;
  --s3: 18px;
  --s4: 26px;
  --s5: 38px;
  --s6: 56px;

  --font-ui: 'Outfit', 'Noto Sans TC', 'PingFang HK', 'Microsoft JhengHei', system-ui, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', Consolas, monospace;

  --page-glow:
    radial-gradient(920px 460px at 12% -12%, rgba(34, 211, 238, 0.11), transparent 62%),
    radial-gradient(780px 440px at 100% 112%, rgba(255, 45, 149, 0.1), transparent 60%);
}

/* ---------- 日間模式：同一套設計，換成光猛課室睇得清的版本 ---------- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    color-scheme: light;

    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #eef1f8;
    --raised: #e3e8f4;
    --line: #d5dbeb;
    --fg: #10131c;
    --muted: #5b6478;

    --cyan: #0e7490;
    --pink: #be1558;
    --lime: #3f6212;
    --amber: #92400e;
    --violet: #6d28d9;
    --danger: #c81e3c;

    --on-accent: #ffffff;

    --glow-a: 0 6px 16px -8px;
    --glow-b: 0 10px 26px -12px;
    --glow-text: 0 0 0;

    --g-philo: #0e7490;
    --g-stroke: #92400e;
    --g-body: #be1558;
    --g-shape: #3f6212;
    --g-special: #6d28d9;
    --g-philo-bg: rgba(14, 116, 144, 0.1);
    --g-stroke-bg: rgba(146, 64, 14, 0.1);
    --g-body-bg: rgba(190, 21, 88, 0.09);
    --g-shape-bg: rgba(63, 98, 18, 0.1);
    --g-special-bg: rgba(109, 40, 217, 0.09);

    --shadow: 0 14px 30px -22px rgba(16, 19, 28, 0.55);
    --shadow-lg: 0 24px 46px -24px rgba(16, 19, 28, 0.5);

    --page-glow:
      radial-gradient(920px 460px at 12% -12%, rgba(14, 116, 144, 0.09), transparent 62%),
      radial-gradient(780px 440px at 100% 112%, rgba(190, 21, 88, 0.07), transparent 60%);
  }
}

:root[data-theme='light'] {
  color-scheme: light;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --raised: #e3e8f4;
  --line: #d5dbeb;
  --fg: #10131c;
  --muted: #5b6478;

  --cyan: #0e7490;
  --pink: #be1558;
  --lime: #3f6212;
  --amber: #92400e;
  --violet: #6d28d9;
  --danger: #c81e3c;

  --on-accent: #ffffff;

  --glow-a: 0 6px 16px -8px;
  --glow-b: 0 10px 26px -12px;
  --glow-text: 0 0 0;

  --g-philo: #0e7490;
  --g-stroke: #92400e;
  --g-body: #be1558;
  --g-shape: #3f6212;
  --g-special: #6d28d9;
  --g-philo-bg: rgba(14, 116, 144, 0.1);
  --g-stroke-bg: rgba(146, 64, 14, 0.1);
  --g-body-bg: rgba(190, 21, 88, 0.09);
  --g-shape-bg: rgba(63, 98, 18, 0.1);
  --g-special-bg: rgba(109, 40, 217, 0.09);

  --shadow: 0 14px 30px -22px rgba(16, 19, 28, 0.55);
  --shadow-lg: 0 24px 46px -24px rgba(16, 19, 28, 0.5);

  --page-glow:
    radial-gradient(920px 460px at 12% -12%, rgba(14, 116, 144, 0.09), transparent 62%),
    radial-gradient(780px 440px at 100% 112%, rgba(190, 21, 88, 0.07), transparent 60%);
}

/* ---------- 基礎 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.14;
  font-weight: 900;
  letter-spacing: -0.025em;
}

p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.ico {
  flex: none;
  display: block;
}

/* ===========================================================================
   左側導軌
   =========================================================================== */
.rail {
  grid-column: 1;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: var(--s3);
  border-bottom: 1px solid var(--line);
}

.rail-brand .mark {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--cyan), var(--pink));
  color: var(--on-accent);
  box-shadow: var(--glow-b) rgba(34, 211, 238, 0.75);
}

.rail-brand b {
  font-weight: 900;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-shadow: var(--glow-text) rgba(34, 211, 238, 0.35);
}

.rail-brand small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* 進度計 */
.rail-meter {
  padding: var(--s3);
  border-bottom: 1px solid var(--line);
}

.rail-meter .cap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 9px;
}

.meter-blocks {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.meter-blocks i {
  height: 8px;
  border-radius: 999px;
  background: var(--raised);
}

.meter-blocks i.on {
  background: var(--cyan);
  box-shadow: var(--glow-a) rgba(34, 211, 238, 0.85);
}

/* 關卡導航 */
.rail-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--s2) 0;
}

.rnav {
  width: calc(100% - 18px);
  margin: 2px 9px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-md);
  background: none;
  border: 0;
  text-align: left;
  color: var(--fg);
  transition:
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.rnav:hover:not(:disabled) {
  background: var(--surface-2);
}

.rnav[aria-current='true'] {
  background: var(--g-philo-bg);
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.rnav:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.62;
}

.rnav .no {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--raised);
  color: var(--muted);
  font-weight: 900;
  font-size: 13px;
  font-family: var(--font-mono);
}

.rnav[data-state='done'] .no {
  background: var(--g-shape-bg);
  color: var(--lime);
  box-shadow: inset 0 0 0 1px var(--lime);
}

.rnav[aria-current='true'] .no {
  background: var(--cyan);
  color: var(--on-accent);
  box-shadow: var(--glow-a) rgba(34, 211, 238, 0.7);
}

.rnav .t {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 800;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-foot {
  border-top: 1px solid var(--line);
  padding: var(--s2) var(--s3) var(--s3);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.rail-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
}

.rail-user .avatar {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--raised);
  object-fit: cover;
}

.rail-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-actions {
  display: flex;
  gap: 8px;
}

.sqbtn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition:
    border-color 0.16s ease,
    background 0.16s ease;
}

.sqbtn:hover {
  background: var(--raised);
  border-color: var(--cyan);
}

/* ===========================================================================
   內容區
   =========================================================================== */
.view {
  grid-column: 2;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: var(--bg);
  background-image: var(--page-glow);
  background-attachment: local;
}

.wrap {
  width: 100%;
  max-width: 980px;
  padding: var(--s5) var(--s5) var(--s6);
}

.wrap.wide {
  max-width: 1320px;
}

/* 標題 */
.poster-head {
  margin-bottom: var(--s4);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
  text-shadow: var(--glow-text) rgba(34, 211, 238, 0.5);
  margin-bottom: 10px;
}

.eyebrow::before {
  content: '';
  width: 24px;
  height: 2px;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: var(--glow-a) rgba(34, 211, 238, 0.9);
}

.display {
  font-size: clamp(34px, 5.2vw, 54px);
  font-weight: 900;
  letter-spacing: -0.035em;
  text-shadow: var(--glow-text) rgba(34, 211, 238, 0.22);
}

.lede {
  margin-top: 12px;
  max-width: 62ch;
  color: var(--muted);
  font-weight: 600;
}

.block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

/* 按鈕 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--r-md);
  background: var(--cyan);
  color: var(--on-accent);
  border: 1px solid transparent;
  box-shadow: var(--glow-b) rgba(34, 211, 238, 0.8);
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    filter 0.14s ease;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn.pink {
  background: var(--pink);
  box-shadow: var(--glow-b) rgba(255, 45, 149, 0.8);
}

.btn.blue {
  background: var(--violet);
  box-shadow: var(--glow-b) rgba(167, 139, 250, 0.8);
}

.btn.ghost {
  background: var(--surface-2);
  color: var(--fg);
  border-color: var(--line);
  box-shadow: none;
}

.btn.ghost:hover:not(:disabled) {
  border-color: var(--cyan);
  filter: none;
}

.btn.sm {
  min-height: 38px;
  font-size: 13.5px;
  padding: 0 14px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  margin-top: var(--s4);
}

/* ===========================================================================
   登入
   =========================================================================== */
body[data-mode='signin'] {
  grid-template-columns: 1fr;
}

body[data-mode='signin'] .rail {
  display: none;
}

body[data-mode='signin'] .view {
  grid-column: 1;
}

.signin {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 0;
}

.signin-art {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(10, 11, 18, 0.55), rgba(10, 11, 18, 0.85)),
    linear-gradient(135deg, #101a2e, #1b1030);
  color: #eef2ff;
  border-right: 1px solid var(--line);
  padding: var(--s6) var(--s5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s3);
}

.signin-art h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(38px, 5vw, 60px);
  letter-spacing: -0.04em;
  text-shadow: 0 0 40px rgba(34, 211, 238, 0.45);
}

.signin-art p {
  position: relative;
  z-index: 1;
  font-weight: 700;
  max-width: 26ch;
  color: #b9c2da;
}

/* 霓虹構成：兩顆光球 + 網格 */
.signin-art .sq,
.signin-art .ci,
.signin-art .tr {
  position: absolute;
  z-index: 0;
  pointer-events: none;
}

.signin-art .sq {
  right: -90px;
  top: -70px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.55), transparent 66%);
  filter: blur(18px);
}

.signin-art .ci {
  left: -70px;
  bottom: -90px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 45, 149, 0.5), transparent 66%);
  filter: blur(18px);
}

.signin-art .tr {
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(120% 90% at 30% 40%, #000 20%, transparent 78%);
}

.signin-steps {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.signin-steps span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 13px;
  font-weight: 800;
  color: #dbe3f7;
}

.signin-panel {
  padding: var(--s6) var(--s5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s3);
  max-width: 540px;
}

.signin-panel h2 {
  font-size: 26px;
}

.gbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 22px;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-weight: 900;
  font-size: 16px;
  text-decoration: none;
  transition:
    border-color 0.16s ease,
    transform 0.14s ease;
}

.gbtn:hover {
  border-color: var(--cyan);
  transform: translateY(-1px);
}

.notice {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-left: 2px solid var(--cyan);
  padding-left: 13px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 15px;
  border-radius: var(--r-md);
  background: var(--g-body-bg);
  color: var(--fg);
  border: 1px solid var(--pink);
  font-size: 14px;
  font-weight: 700;
}

.alert .ico {
  color: var(--pink);
}

/* ===========================================================================
   關卡首頁
   =========================================================================== */
.lv-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.lv {
  position: relative;
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: stretch;
  width: 100%;
  padding: 0;
  overflow: hidden;
  text-align: left;
  border-radius: var(--r-xl);
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.lv::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--tone);
  box-shadow: var(--glow-a) var(--tone);
}

.lv[data-tone='1'] {
  --tone: var(--cyan);
}
.lv[data-tone='2'] {
  --tone: var(--pink);
}
.lv[data-tone='3'] {
  --tone: var(--amber);
}
.lv[data-tone='4'] {
  --tone: var(--lime);
}

.lv:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: var(--tone);
  box-shadow: var(--shadow-lg);
}

.lv:active:not(:disabled) {
  transform: translateY(0);
}

.lv:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.lv .no {
  display: grid;
  place-items: center;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.05em;
  font-family: var(--font-mono);
  color: var(--tone);
  text-shadow: var(--glow-text) var(--tone);
}

.lv .body {
  padding: var(--s3) var(--s4);
  min-width: 0;
}

.lv .body .ttl {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 21px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.lv .body .desc {
  display: block;
  margin-top: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.lv .meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  padding: var(--s3) var(--s4);
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}

.tagline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.tagline.done {
  background: var(--g-shape-bg);
  color: var(--lime);
  box-shadow: inset 0 0 0 1px var(--lime);
}

.tagline.now {
  background: var(--g-philo-bg);
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.tagline.locked {
  background: var(--raised);
  color: var(--muted);
}

/* ===========================================================================
   難度
   =========================================================================== */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 14px;
}

.mode {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: var(--s4);
  text-align: left;
  border-radius: var(--r-xl);
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.mode:hover {
  transform: translateY(-3px);
  border-color: var(--cyan);
  box-shadow: var(--shadow-lg);
}

.mode.normal:hover {
  border-color: var(--pink);
}

.mode .shape {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: var(--r-lg);
  background: var(--g-philo-bg);
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan);
}

/* 第 2 關的分類練習：用返鍵盤上同一套分類顏色 */
.mode[data-g] .shape {
  background: var(--g-bg);
  color: var(--g-fg);
  box-shadow: inset 0 0 0 1px var(--g-fg);
}

.mode[data-g]:hover {
  border-color: var(--g-fg);
}

.mode[data-g='philo'] {
  --g-fg: var(--g-philo);
  --g-bg: var(--g-philo-bg);
}
.mode[data-g='stroke'] {
  --g-fg: var(--g-stroke);
  --g-bg: var(--g-stroke-bg);
}
.mode[data-g='body'] {
  --g-fg: var(--g-body);
  --g-bg: var(--g-body-bg);
}
.mode[data-g='shape'] {
  --g-fg: var(--g-shape);
  --g-bg: var(--g-shape-bg);
}

.mode.normal .shape {
  border-radius: 50%;
  background: var(--g-body-bg);
  color: var(--pink);
  box-shadow: inset 0 0 0 1px var(--pink);
}

.mode b {
  font-size: 21px;
  font-weight: 900;
}

/* 必修／已達標／額外挑戰 標籤
   注意：卡片闊度細，標籤一定要可以換行，否則長字會爆出卡外 */
.mode-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin-top: 2px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}

.mode-flag.need {
  background: var(--g-stroke-bg);
  color: var(--amber);
  box-shadow: inset 0 0 0 1px var(--amber);
}

.mode-flag.done {
  background: var(--g-shape-bg);
  color: var(--lime);
  box-shadow: inset 0 0 0 1px var(--lime);
}

.mode-flag.extra {
  background: var(--raised);
  color: var(--muted);
}

/* 已達標的模式卡 */
.mode.done {
  border-color: var(--lime);
}

.mode.normal .shape {
  border-radius: 50%;
  background: var(--g-body-bg);
  color: var(--pink);
  box-shadow: inset 0 0 0 1px var(--pink);
}

.mode b {
  font-size: 21px;
  font-weight: 900;
}

/* 標明邊個模式先解鎖下一關 */
.mode-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.mode-flag.key {
  background: var(--g-stroke-bg);
  color: var(--amber);
  box-shadow: inset 0 0 0 1px var(--amber);
}

.mode-flag.practice {
  background: var(--raised);
  color: var(--muted);
}

.mode span.note {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.mode .targets {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 5px;
}

.mode .targets > span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 15px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.mode .targets small {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.mode .targets b {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
}

/* ===========================================================================
   遊戲競技場
   =========================================================================== */
body[data-mode='play'] {
  --rail-w: 76px;
}

body[data-mode='play'] .rail-brand b,
body[data-mode='play'] .rail-brand small,
body[data-mode='play'] .rail-meter,
body[data-mode='play'] .rnav .t,
body[data-mode='play'] .rail-user span,
body[data-mode='play'] .rail-foot .sqbtn span {
  display: none;
}

body[data-mode='play'] .rail-brand,
body[data-mode='play'] .rnav,
body[data-mode='play'] .rail-foot {
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

body[data-mode='play'] .rail-actions {
  flex-direction: column;
}

body[data-mode='play'] .view {
  overflow: hidden;
}

.arena {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

/* HUD */
.hud {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 10px var(--s4);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex: none;
}

.hud .now {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud .spacer {
  flex: 1 1 auto;
}

.hud-lives {
  display: flex;
  gap: 6px;
}

.hud-lives .ico {
  color: var(--pink);
  filter: drop-shadow(0 0 6px rgba(255, 45, 149, 0.8));
}

.hud-lives .ico.gone {
  color: var(--muted);
  opacity: 0.3;
  filter: none;
}

.hud-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.hud-stat small {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.hud-stat b {
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
  text-shadow: var(--glow-text) rgba(34, 211, 238, 0.5);
}

.hud-stat i.tgt {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

/* 超過目標時間：時間轉紅，但唔會結束遊戲 */
.hud-stat.over b {
  color: var(--danger);
  text-shadow: var(--glow-text) rgba(255, 84, 112, 0.5);
}

/* 開場目標說明 */
.brief {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.brief-goals {
  display: flex;
  gap: 12px;
}

.brief-goals > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 22px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.brief-goals small {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.brief-goals b {
  font-family: var(--font-mono);
  font-size: 25px;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: var(--glow-text) rgba(34, 211, 238, 0.5);
}

.brief-note {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.7;
}

/* 落字區 */
.field {
  position: relative;
  flex: 1 1 auto;
  min-height: 150px;
  overflow: hidden;
  background-image:
    linear-gradient(rgba(136, 150, 180, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(136, 150, 180, 0.09) 1px, transparent 1px);
  background-size: 38px 38px;
}

.baseline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 54px; /* 必須與 game.js 的 HIT_LINE_OFFSET 相同 */
  height: 0;
  border-top: 2px dashed var(--danger);
  box-shadow: 0 0 16px rgba(255, 84, 112, 0.55);
  pointer-events: none;
}

.baseline::after {
  content: '危險線';
  position: absolute;
  right: 12px;
  top: -11px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--danger);
  color: var(--on-accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.faller {
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--cyan);
  box-shadow: var(--glow-b) rgba(34, 211, 238, 0.65);
  white-space: nowrap;
}

.faller .glyph {
  font-size: 34px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-shadow: var(--glow-text) rgba(34, 211, 238, 0.45);
}

.faller .tip {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

/* 救命提示彈出時，柔和地淡入，唔好突然彈出嚇親 */
.faller .tip {
  animation: tipIn 0.22s ease;
}

@keyframes tipIn {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
}

.faller.danger {
  border-color: var(--danger);
  background: var(--g-body-bg);
  box-shadow: var(--glow-b) rgba(255, 84, 112, 0.85);
}

.faller.danger .glyph {
  color: var(--danger);
  text-shadow: var(--glow-text) rgba(255, 84, 112, 0.6);
}

.faller.hit {
  animation: pop 0.28s ease forwards;
}

@keyframes pop {
  to {
    transform: translateX(-50%) scale(1.4);
    opacity: 0;
  }
}

.floater {
  position: absolute;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 19px;
  pointer-events: none;
  animation: rise 0.9s ease-out forwards;
}

@keyframes rise {
  to {
    transform: translate(-50%, -46px);
    opacity: 0;
  }
}

.field-msg small {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.75;
}

.field-msg {
  position: absolute;
  inset: auto 0 50% 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transform: translateY(50%);
  padding: 0 var(--s4);
  text-align: center;
  font-weight: 800;
  color: var(--muted);
  pointer-events: none;
}

.combo {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--g-stroke-bg);
  color: var(--amber);
  box-shadow:
    inset 0 0 0 1px var(--amber),
    var(--glow-a) rgba(251, 191, 36, 0.5);
  font-weight: 900;
  font-size: 13px;
}

/* 輸入列 */
.dock {
  flex: none;
  display: flex;
  gap: 10px;
  padding: var(--s2) var(--s4);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.typed {
  flex: 1 1 auto;
  min-width: 0;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
  transition:
    border-color 0.14s ease,
    box-shadow 0.14s ease;
}

.typed .ch {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--cyan);
  color: var(--on-accent);
  box-shadow: var(--glow-a) rgba(34, 211, 238, 0.7);
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
}

.typed .hint {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.typed.bad {
  border-color: var(--danger);
  background: var(--g-body-bg);
  animation: shake 0.24s linear;
}

@keyframes shake {
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.dock .btn {
  min-height: 50px;
}

/* ===========================================================================
   鍵盤圖
   =========================================================================== */
.keyboard {
  flex: none;
  padding: var(--s2) var(--s4) var(--s3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.kb-row {
  display: flex;
  gap: 5px;
}

.key {
  width: 50px;
  height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s linear;
}

.key .letter {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
}

.key .rad {
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.key.g-philo {
  background: var(--g-philo-bg);
  color: var(--g-philo);
}
.key.g-stroke {
  background: var(--g-stroke-bg);
  color: var(--g-stroke);
}
.key.g-body {
  background: var(--g-body-bg);
  color: var(--g-body);
}
.key.g-shape {
  background: var(--g-shape-bg);
  color: var(--g-shape);
}
.key.g-special {
  background: var(--g-special-bg);
  color: var(--g-special);
}

/* Z（重）：速成唔會用到 */
.key.unused {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
  opacity: 0.5;
}

.key.hl {
  background: var(--amber);
  color: var(--on-accent);
  border-color: var(--amber);
  transform: translateY(-3px);
  box-shadow: var(--glow-b) rgba(251, 191, 36, 0.95);
}

.key.hl .letter,
.key.ok .letter {
  color: inherit;
}

.key.ok {
  background: var(--lime);
  color: var(--on-accent);
  border-color: var(--lime);
  transform: translateY(-3px);
  box-shadow: var(--glow-b) rgba(163, 230, 53, 0.95);
}

.kb-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 15px;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.kb-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.kb-legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

/* ===========================================================================
   結算
   =========================================================================== */
.verdict {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: var(--s3) var(--s4);
  border-radius: var(--r-lg);
  font-weight: 800;
  margin-bottom: var(--s4);
}

.verdict.pass {
  background: var(--g-shape-bg);
  color: var(--lime);
  box-shadow:
    inset 0 0 0 1px var(--lime),
    var(--glow-b) rgba(163, 230, 53, 0.35);
}

.verdict.info {
  background: var(--g-philo-bg);
  color: var(--cyan);
  box-shadow:
    inset 0 0 0 1px var(--cyan),
    var(--glow-b) rgba(34, 211, 238, 0.3);
}

.verdict.fail {
  background: var(--g-stroke-bg);
  color: var(--amber);
  box-shadow: inset 0 0 0 1px var(--amber);
}

/* 結算：分數明細 */
.tally {
  padding: var(--s3) var(--s4);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: var(--s3);
}

.tally .row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.tally .row b {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
}

.tally .row.minus b {
  color: var(--danger);
}

.tally .row.total {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  color: var(--fg);
}

.tally .row.total b {
  font-size: 30px;
  color: var(--cyan);
  text-shadow: var(--glow-text) rgba(34, 211, 238, 0.45);
}

.tally .row.target b {
  font-size: 15px;
  color: var(--muted);
}

.tally .bar {
  height: 8px;
  border-radius: 999px;
  background: var(--raised);
  overflow: hidden;
  margin: 10px 0 2px;
}

.tally .fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: var(--glow-a) rgba(251, 191, 36, 0.8);
}

.tally .fill.ok {
  background: var(--lime);
  box-shadow: var(--glow-a) rgba(163, 230, 53, 0.8);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
}

.stat {
  padding: var(--s3) var(--s2);
  text-align: center;
  background: var(--surface);
}

.stat b {
  display: block;
  font-family: var(--font-mono);
  font-size: 29px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
  text-shadow: var(--glow-text) rgba(34, 211, 238, 0.4);
}

.stat.ok b {
  color: var(--lime);
  text-shadow: var(--glow-text) rgba(163, 230, 53, 0.4);
}

.stat.miss b {
  color: var(--danger);
  text-shadow: var(--glow-text) rgba(255, 84, 112, 0.4);
}

.stat span {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.review {
  margin-top: var(--s4);
}

.review h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  margin-bottom: 13px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 17px;
  font-weight: 700;
}

.chip code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--g-philo-bg);
  color: var(--cyan);
}

/* ===========================================================================
   教學畫面
   =========================================================================== */
.sec {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: var(--s5) 0 var(--s3);
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.learn .lead {
  padding: var(--s3) var(--s4);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  box-shadow: var(--shadow);
  font-weight: 600;
  line-height: 1.8;
}

.learn .keyboard {
  padding: 0;
  align-items: flex-start;
}

.group-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--s2);
}

.group-card {
  padding: var(--s3);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--tone);
}

.group-card b {
  font-size: 15px;
  font-weight: 900;
  color: var(--tone);
}

.group-card .rads {
  font-size: 21px;
  font-weight: 700;
  margin: 5px 0;
  letter-spacing: 0.08em;
}

.group-card .keys {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.group-card.g-philo {
  --tone: var(--g-philo);
}
.group-card.g-stroke {
  --tone: var(--g-stroke);
}
.group-card.g-body {
  --tone: var(--g-body);
}
.group-card.g-shape {
  --tone: var(--g-shape);
}
.group-card.g-special {
  --tone: var(--g-special);
}

.rad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 1px;
  padding: 1px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
}

.rad-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--surface);
}

.rad-item .k {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--g-philo-bg);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
}

.rad-item .r {
  display: block;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.1;
}

.rad-item small {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.aux-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--s2);
}

.aux-card {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
}

.aux-card header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 17px;
  font-weight: 900;
}

.aux-card header .k {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--g-philo-bg);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.aux-card header .grp {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.aux-card ul {
  list-style: none;
  margin: 0;
  padding: 9px 13px 12px;
}

.aux-card li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 3px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.aux-card li b {
  font-size: 19px;
  font-weight: 700;
  color: var(--fg);
  min-width: 24px;
}

.rule-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
}

.rule-table th,
.rule-table td {
  padding: 10px 13px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
}

.rule-table tr:last-child td {
  border-bottom: 0;
}

.rule-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rule-table td.big {
  font-size: 24px;
  font-weight: 700;
}

.rule-table td.code {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.rule-table td.code.out {
  color: var(--cyan);
  text-shadow: var(--glow-text) rgba(34, 211, 238, 0.45);
}

/* ===========================================================================
   教師儀表板
   =========================================================================== */
body.teacher {
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
}

body.teacher .tbar {
  grid-column: 1;
  grid-row: 1;
}

body.teacher .view {
  grid-column: 1;
  grid-row: 2;
}

.tbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px var(--s4);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: none;
}

.tbar .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 900;
  font-size: 17px;
}

.tbar .brand .mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  color: var(--on-accent);
  box-shadow: var(--glow-b) rgba(167, 139, 250, 0.7);
}

.tbar nav {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--s2);
  margin-bottom: var(--s4);
}

.tile {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: var(--s3);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.tile .bubble {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
}

.tile b {
  display: block;
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.tile span span {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.panel {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: var(--s4);
}

.panel > header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px var(--s3);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.panel > header h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  letter-spacing: 0;
}

.panel .tools {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
}

.panel select,
.cls-input {
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 13px;
  font-weight: 700;
}

.cls-input {
  width: 92px;
}

.table-wrap {
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

table.data th,
table.data td {
  padding: 10px 13px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

table.data th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

table.data tbody tr:last-child td {
  border-bottom: 0;
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.tag.login {
  background: var(--g-shape-bg);
  color: var(--lime);
  box-shadow: inset 0 0 0 1px var(--lime);
}

.tag.logout {
  background: var(--raised);
  color: var(--muted);
}

.tag.denied {
  background: var(--g-body-bg);
  color: var(--pink);
  box-shadow: inset 0 0 0 1px var(--pink);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  padding: var(--s6) var(--s4);
  color: var(--muted);
  font-weight: 700;
}

/* ===========================================================================
   反應式
   =========================================================================== */
@media (max-width: 999px) {
  body,
  body[data-mode='play'] {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .rail {
    grid-column: 1;
    grid-row: 1;
    flex-direction: row;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-right: var(--s2);
  }

  .rail-brand {
    border-bottom: 0;
    padding: 10px var(--s3);
  }

  .rail-brand small,
  .rail-meter,
  .rail-nav,
  .rail-user span {
    display: none;
  }

  .rail-foot {
    margin-left: auto;
    border-top: 0;
    flex-direction: row;
    align-items: center;
    padding: 8px var(--s2);
  }

  .rail-actions {
    flex-direction: row;
  }

  .view {
    grid-column: 1;
    grid-row: 2;
  }

  body[data-mode='play'] .rail-brand b,
  body[data-mode='play'] .rail-user span,
  body[data-mode='play'] .rail-foot .sqbtn span {
    display: none;
  }

  .signin {
    grid-template-columns: 1fr;
  }

  .signin-art {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: var(--s5) var(--s4);
  }

  .signin-panel {
    padding: var(--s5) var(--s4);
    max-width: none;
  }
}

@media (max-width: 720px) {
  .wrap {
    padding: var(--s4) var(--s3) var(--s5);
  }

  .lv {
    grid-template-columns: 64px 1fr;
  }

  .lv .no {
    font-size: 28px;
  }

  .lv .body {
    padding: var(--s3);
  }

  .lv .meta {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding: 10px var(--s3);
  }

  .hud,
  .dock,
  .keyboard {
    padding-left: var(--s3);
    padding-right: var(--s3);
  }

  .hud .now {
    display: none;
  }

  .key {
    width: 8.6vw;
    height: 40px;
  }

  .key .rad {
    font-size: 13px;
  }
}

/* 矮螢幕（Chromebook） */
@media (max-height: 860px) {
  .key {
    height: 40px;
  }

  .keyboard {
    padding-top: 8px;
    padding-bottom: 10px;
  }

  .faller .glyph {
    font-size: 30px;
  }
}

@media (max-height: 700px) {
  .key {
    width: 44px;
    height: 34px;
  }

  .key .rad {
    font-size: 13px;
  }

  .kb-legend {
    display: none;
  }

  .hud {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .dock {
    padding-top: 8px;
    padding-bottom: 8px;
  }
}

/* 減少動態 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .lv:hover:not(:disabled),
  .mode:hover,
  .btn:hover:not(:disabled),
  .gbtn:hover {
    transform: none;
  }
}
