:root {
  --orange: #ff7420;
  --orange-bright: #ff9533;
  --orange-deep: #e85a00;
  --orange-glow: rgba(255, 116, 32, 0.35);
  --blue: #4a9eff;
  --blue-deep: #2b7fdb;
  --blue-soft: #e3f0ff;
  --cream: #fff6eb;
  --peach: #ffe8d4;
  --ink: #2d2218;
  --ink-soft: #7a6558;
  --card: #ffffff;
  --line: rgba(45, 34, 24, 0.1);
  --shadow: 0 18px 44px rgba(232, 90, 0, 0.12);
  --radius: 22px;
  --font-en: "Nunito", system-ui, sans-serif;
  /* Nunito first so Latin punctuation (esp. ’) isn’t taken from CJK fonts’ wide glyphs */
  --font-zh: "Nunito", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-sc: "Nunito", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-zh-scale: 1;
  --font-jyutping-scale: 1;
  --font-meaning-scale: 1;
  --bg-1: #fff9f2;
  --bg-2: var(--cream);
  --bg-3: var(--peach);
  --header-bg: rgba(255, 246, 235, 0.9);
  --nav-bg: rgba(255, 255, 255, 0.96);
  --surface: #ffffff;
  --surface-soft: rgba(255, 255, 255, 0.92);
  --panel-grad-a: #ffffff;
  --panel-grad-b: #fff4ea;
  --shell-max: 720px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --cream: #1a1612;
  --peach: #241c16;
  --ink: #f5efe8;
  --ink-soft: #c4b3a4;
  --card: #2a221c;
  --line: rgba(255, 230, 210, 0.14);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
  --blue: #7eb6ff;
  --blue-deep: #9ec9ff;
  --blue-soft: #1a2838;
  --orange-deep: #ff9a4d;
  --orange-glow: rgba(255, 116, 32, 0.28);
  --bg-1: #12100e;
  --bg-2: #1a1612;
  --bg-3: #221a14;
  --header-bg: rgba(18, 16, 14, 0.92);
  --nav-bg: rgba(26, 22, 18, 0.96);
  --surface: #2a221c;
  --surface-soft: rgba(42, 34, 28, 0.94);
  --panel-grad-a: #2a221c;
  --panel-grad-b: #352820;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  min-height: var(--app-height, 100dvh);
  color: var(--ink);
  font-family: var(--font-en), var(--font-zh);
}

body {
  overscroll-behavior-y: contain;
}

html.is-inapp,
html.is-inapp body {
  min-height: 0;
  height: auto;
  overflow: visible;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff9f2;
}

html.is-inapp[data-theme="dark"],
html.is-inapp[data-theme="dark"] body {
  background: #12100e;
}

body.onboarding-active .app-shell {
  pointer-events: none;
  user-select: none;
}

body.onboarding-active .app-header {
  pointer-events: auto;
}

.bottom-nav svg,
.app-header svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: block;
  overflow: hidden;
}

.app-header svg path {
  fill: currentColor;
}

.nav-item .nav-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 32px;
  border-radius: 12px;
  font-size: 1.35rem;
  line-height: 1;
  background: transparent;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  /* Keep emoji colorful on all platforms */
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "EmojiOne Color", sans-serif;
}

.nav-item:not(.active) .nav-icon {
  opacity: 0.9;
  transform: scale(0.96);
}

.nav-item.active .nav-icon {
  opacity: 1;
  transform: translateY(-1px) scale(1.08);
}

.nav-item[data-nav="home"].active .nav-icon {
  background: rgba(255, 90, 31, 0.14);
  box-shadow: 0 4px 12px rgba(255, 90, 31, 0.16);
}
.nav-item[data-nav="games"].active .nav-icon {
  background: rgba(91, 75, 232, 0.14);
  box-shadow: 0 4px 12px rgba(91, 75, 232, 0.16);
}
.nav-item[data-nav="community"].active .nav-icon {
  background: rgba(42, 212, 168, 0.16);
  box-shadow: 0 4px 12px rgba(30, 143, 214, 0.14);
}
.nav-item[data-nav="words"].active .nav-icon {
  background: rgba(255, 176, 32, 0.16);
  box-shadow: 0 4px 12px rgba(255, 122, 26, 0.14);
}
.nav-item[data-nav="settings"].active .nav-icon {
  background: rgba(107, 124, 255, 0.14);
  box-shadow: 0 4px 12px rgba(107, 124, 255, 0.16);
}

.nav-item[data-nav="home"].active {
  color: #e04812;
  background: rgba(255, 90, 31, 0.1);
}
.nav-item[data-nav="games"].active {
  color: #4a3cd4;
  background: rgba(91, 75, 232, 0.1);
}
.nav-item[data-nav="community"].active {
  color: #0f8f72;
  background: rgba(42, 212, 168, 0.1);
}
.nav-item[data-nav="words"].active {
  color: #c45f00;
  background: rgba(255, 176, 32, 0.12);
}
.nav-item[data-nav="settings"].active {
  color: #4553d4;
  background: rgba(107, 124, 255, 0.1);
}

html[data-theme="dark"] .nav-item[data-nav="home"].active {
  color: #ffb08a;
  background: rgba(255, 90, 31, 0.18);
}
html[data-theme="dark"] .nav-item[data-nav="games"].active {
  color: #c7bfff;
  background: rgba(91, 75, 232, 0.22);
}
html[data-theme="dark"] .nav-item[data-nav="community"].active {
  color: #7dffd0;
  background: rgba(42, 212, 168, 0.16);
}
html[data-theme="dark"] .nav-item[data-nav="words"].active {
  color: #ffd28a;
  background: rgba(255, 176, 32, 0.16);
}
html[data-theme="dark"] .nav-item[data-nav="settings"].active {
  color: #c3cbff;
  background: rgba(107, 124, 255, 0.2);
}

.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(520px 320px at 95% -5%, rgba(255, 149, 51, 0.45), transparent 60%),
    radial-gradient(480px 300px at -10% 20%, rgba(74, 158, 255, 0.22), transparent 55%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-3) 100%);
}

html[data-theme="dark"] .app-bg {
  background:
    radial-gradient(520px 320px at 95% -5%, rgba(255, 116, 32, 0.2), transparent 60%),
    radial-gradient(480px 300px at -10% 20%, rgba(74, 158, 255, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-3) 100%);
}

.app-shell {
  position: relative;
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  min-height: var(--app-height, 100dvh);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
}

html.is-inapp .app-shell {
  display: block;
  min-height: 0;
  height: auto;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

html.is-inapp .app-header {
  position: relative;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 1.2rem;
}

.brand img {
  border-radius: 50%;
  box-shadow: 0 6px 18px var(--orange-glow);
}

.header-level {
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--orange-bright), var(--orange));
  color: #fff;
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 800;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.auth-slot {
  display: flex;
  align-items: center;
}

.auth-signin-btn {
  white-space: nowrap;
  padding: 6px 10px;
  font-size: 0.72rem;
}

.auth-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 3px 10px 3px 3px;
  cursor: pointer;
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.72rem;
}

.auth-avatar {
  width: var(--avatar-size, 28px);
  height: var(--avatar-size, 28px);
  border-radius: 50%;
  object-fit: cover;
}

.auth-avatar-fallback,
.auth-avatar-emoji {
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-size: calc(var(--avatar-size, 28px) * 0.45);
  flex-shrink: 0;
}

.auth-avatar-emoji {
  background: linear-gradient(145deg, color-mix(in srgb, var(--orange) 18%, var(--surface)), var(--surface));
  border: 1.5px solid color-mix(in srgb, var(--orange) 35%, var(--line));
  font-size: calc(var(--avatar-size, 28px) * 0.55);
  line-height: 1;
}

.avatar-emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
  margin: 4px 0 8px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--orange) 6%, var(--surface));
}

.avatar-picker {
  display: grid;
  gap: 10px;
  margin: 4px 0 10px;
}

.avatar-picker-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-emoji-panel[hidden] {
  display: none !important;
}

.avatar-emoji-btn {
  appearance: none;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--surface);
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: var(--font-en);
  font-weight: 800;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.avatar-emoji-btn[data-emoji]:not([data-emoji=""]) {
  font-size: 1.35rem;
  color: inherit;
}

.avatar-emoji-btn:hover {
  border-color: color-mix(in srgb, var(--orange) 45%, var(--line));
  transform: scale(1.04);
}

.avatar-emoji-btn.active {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 16%, var(--surface));
  box-shadow: 0 4px 12px var(--orange-glow);
}

.cancel-sub-panel {
  text-align: left;
  max-width: 420px;
}

.cancel-sub-lead {
  margin: 0 0 14px;
  color: var(--ink-soft);
  line-height: 1.5;
  font-size: 0.92rem;
}

.cancel-reason-list {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
}

.cancel-reason-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}

.cancel-reason-option:has(input:checked) {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 12%, var(--surface));
}

.cancel-reason-option input {
  margin-top: 2px;
  accent-color: var(--orange);
}

.cancel-reason-other {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  resize: vertical;
  min-height: 72px;
}

.cancel-sub-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

@media (max-width: 420px) {
  .cancel-sub-actions {
    grid-template-columns: 1fr;
  }
}

.auth-user-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.username-gate-overlay .login-panel {
  text-align: left;
}

.username-gate-overlay .login-panel h2,
.username-gate-overlay .login-eyebrow,
.username-gate-overlay .login-copy {
  text-align: center;
}

.username-gate-overlay .login-logo {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.auth-settings-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-profile-compact {
  display: grid;
  gap: 8px;
}

.auth-profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-profile-avatar .auth-avatar,
.auth-profile-avatar .auth-avatar-emoji,
.auth-profile-avatar .auth-avatar-fallback {
  width: 44px;
  height: 44px;
  --avatar-size: 44px;
}

.auth-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.auth-profile-meta {
  display: grid;
  gap: 2px;
  line-height: 1.35;
}

.auth-profile-meta strong {
  font-size: 0.95rem;
  color: var(--ink);
}

.auth-profile-email {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.auth-profile-compact .avatar-emoji-panel {
  margin-top: 4px;
}

.auth-profile-compact .name-edit-panel {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.auth-profile-compact .name-edit-panel[hidden] {
  display: none !important;
}

.auth-settings-user .auth-avatar,
.auth-settings-user .auth-avatar-emoji,
.auth-settings-user .auth-avatar-fallback {
  width: 40px;
  height: 40px;
  --avatar-size: 40px;
}

.identity-fields {
  margin-top: 14px;
  display: grid;
  gap: 6px;
}

.identity-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink);
  margin-top: 6px;
}

.identity-input {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--font-en);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  box-sizing: border-box;
}

.identity-input:focus {
  outline: none;
  border-color: var(--orange, #ff7420);
}

.identity-input-readonly {
  background: color-mix(in srgb, var(--surface) 88%, var(--ink) 12%);
  color: var(--ink-soft);
  font-weight: 800;
}

.user-id-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px;
}

.user-id-at {
  font-weight: 900;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.identity-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.identity-status {
  margin: 4px 0 0;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
}

.identity-status-ok {
  color: #2e7d32;
}

.identity-status-error {
  color: #c62828;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 14, 10, 0.55);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

html.is-inapp .login-overlay {
  place-items: start center;
  padding-top: 32px;
}

.login-panel {
  position: relative;
  width: min(400px, 100%);
  padding: 28px 22px 22px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-grad-a), var(--panel-grad-b));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
  color: var(--ink);
}

.subscribe-perks {
  margin: 0 0 16px;
  padding: 0 0 0 1.15em;
  text-align: left;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
}

.subscribe-perks li {
  margin: 0 0 6px;
}

.plan-compare {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  font-family: var(--font-en);
  font-size: 0.86rem;
}

.plan-compare-head,
.plan-compare-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  align-items: center;
}

.plan-compare-head {
  background: color-mix(in srgb, var(--orange) 10%, var(--surface));
  font-weight: 800;
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.plan-compare-row + .plan-compare-row {
  border-top: 1px solid var(--line);
}

.plan-compare-row span:first-child {
  font-weight: 700;
  color: var(--ink);
}

.plan-compare-row span:nth-child(2) {
  color: var(--ink-soft);
}

.plan-compare-plus {
  color: var(--orange-deep) !important;
  font-weight: 800;
}

.plan-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.plan-option {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 14px 12px 12px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}

.plan-option.is-selected {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange-bright) 14%, var(--surface));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--orange) 18%, transparent);
}

html[data-theme="dark"] .plan-option {
  background: color-mix(in srgb, var(--surface) 92%, #000);
}

html[data-theme="dark"] .plan-option.is-selected {
  background: color-mix(in srgb, var(--orange) 18%, var(--surface));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.plan-badge {
  position: absolute;
  top: -9px;
  right: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
}

.plan-price {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.plan-price small {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-left: 2px;
}

.plan-sub {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink-soft);
}

.plan-sub s {
  opacity: 0.7;
}

@media (max-width: 420px) {
  .plan-picker {
    grid-template-columns: 1fr;
  }
}

.subscribe-pay-methods {
  margin: 10px 0 0;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-align: center;
}

.subscribe-card code,
.subscribe-panel code {
  font-size: 0.78em;
  word-break: break-all;
}

.login-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.login-logo {
  border-radius: 50%;
  box-shadow: 0 10px 28px var(--orange-glow);
  margin-bottom: 10px;
}

.login-eyebrow {
  margin: 0 0 6px;
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange-deep);
}

.login-panel h2 {
  margin: 0 0 10px;
  font-family: var(--font-en);
  font-size: 1.35rem;
}

.login-copy {
  margin: 0 0 18px;
  color: var(--ink-soft);
  line-height: 1.55;
  font-size: 0.92rem;
}

.login-copy-lead {
  margin: 0 0 10px;
  font-size: 0.82rem;
  line-height: 1.4;
}

.login-panel .plan-compare,
.plan-compare.is-compact {
  margin: 0 0 14px;
  text-align: left;
}

.plan-compare.is-compact {
  font-size: 0.74rem;
  border-radius: 12px;
}

.plan-compare.is-compact .plan-compare-head,
.plan-compare.is-compact .plan-compare-row {
  grid-template-columns: 1fr 1.05fr 0.85fr;
  gap: 4px;
  padding: 5px 8px;
}

.plan-compare.is-compact .plan-compare-plus {
  text-align: left;
  font-size: 0.7rem;
}

.plan-compare.is-compact .plan-compare-head {
  font-size: 0.66rem;
  letter-spacing: 0.03em;
}

.quota-gate-panel {
  width: min(440px, 100%);
  text-align: center;
}

.quota-gate-panel h2 {
  margin-bottom: 6px;
}

.quota-used-stat {
  margin: 0 0 4px;
  font-size: 1.28rem;
  font-weight: 900;
  color: var(--orange-deep);
  line-height: 1.25;
}

.quota-used-stat strong {
  font-size: 1.45rem;
}

.quota-tomorrow {
  margin: 0 0 14px;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.35;
}

.quota-plus-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 16px;
  box-shadow: 0 14px 32px var(--orange-glow);
  transform: translateY(0);
}

.quota-plus-btn strong {
  font-size: 1.08rem;
  letter-spacing: 0.01em;
}

.quota-plus-btn small {
  font-size: 0.78rem;
  font-weight: 800;
  opacity: 0.92;
}

.quota-refer-btn {
  width: 100%;
  margin-top: 8px;
  font-weight: 800;
}

.login-google-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.login-google-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  color: #4285f4;
  font-weight: 900;
  font-size: 0.85rem;
}

.login-gate-panel {
  text-align: center;
}

.trial-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--orange) 16%, var(--surface));
  border: 1px solid rgba(255, 116, 32, 0.35);
}

.trial-banner strong {
  display: block;
  font-family: var(--font-en);
  margin-bottom: 4px;
}

.trial-banner p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.45;
}

.free-quota-bar-wrap {
  padding: 0 18px 6px;
}

.free-quota-bar-wrap[hidden] {
  display: none !important;
}

.free-quota-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1.5px solid color-mix(in srgb, var(--orange) 30%, var(--ink) 8%);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--orange) 12%, var(--surface)) 0%,
    color-mix(in srgb, var(--blue) 8%, var(--surface)) 100%
  );
}

.free-quota-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 5px;
  flex: 1 1 160px;
  min-width: 0;
}

.free-quota-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 90%, white);
  border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
  font-family: var(--font-en);
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink-soft);
  white-space: nowrap;
}

.free-quota-chip strong {
  color: var(--ink);
  font-weight: 900;
}

.free-quota-trial {
  flex: 1 1 120px;
  margin: 0;
  min-width: 0;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink-soft);
}

.free-quota-upgrade {
  flex: 0 0 auto;
  margin-left: auto;
  padding-inline: 12px;
  min-height: 32px;
  font-size: 0.78rem;
}

@media (max-width: 520px) {
  .free-quota-bar {
    gap: 6px;
  }

  .free-quota-upgrade {
    width: 100%;
    margin-left: 0;
  }
}

.preview-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(20, 14, 10, 0.72);
  color: #fff;
  font-family: var(--font-en);
  font-size: 0.68rem;
  font-weight: 800;
}

.read-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, #2f9e44 88%, #000);
  color: #fff;
  font-family: var(--font-en);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.read-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, #2f9e44 18%, var(--surface));
  color: #1f7a32;
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 800;
  vertical-align: middle;
}

.news-teaser-source .read-pill {
  margin-left: 6px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  vertical-align: 1px;
}

.video-meta .read-pill {
  margin-left: 0;
}

.sort-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.sort-pill {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--font-en);
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}

.sort-pill.active {
  background: color-mix(in srgb, var(--blue) 18%, var(--surface));
  border-color: color-mix(in srgb, var(--blue) 45%, var(--line));
  color: var(--blue-deep);
}

.news-more-wrap {
  display: flex;
  justify-content: center;
  margin: 12px 0 4px;
}

.news-teaser-img-wrap {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius) - 4px);
  flex-shrink: 0;
}

.news-teaser-img-wrap .news-teaser-img,
.news-hero-link .news-hero-img,
.suggest-news-thumb-wrap .suggest-news-thumb {
  object-fit: cover;
  object-position: var(--crop-x, 50%) var(--crop-y, 50%);
  transform: scale(var(--crop-zoom, 1));
  transform-origin: var(--crop-x, 50%) var(--crop-y, 50%);
}

.news-teaser.is-read,
.video-card.is-read {
  opacity: 0.92;
}

.mini-card.is-locked {
  position: relative;
  overflow: hidden;
}

.mini-card-lock {
  width: 100%;
  border: none;
  background: transparent;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  position: relative;
  min-height: 64px;
}

.mini-card-lock-zh {
  font-family: var(--font-zh);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  filter: blur(5px);
  user-select: none;
}

.mini-card-lock-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--orange-deep);
}

.vocab-card-locked {
  position: relative;
  overflow: hidden;
  min-height: 220px;
}

.vocab-card-locked-zh {
  filter: blur(8px);
  user-select: none;
  opacity: 0.55;
  font-size: 2.4rem !important;
}

.vocab-card-lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.vocab-card-lock-title {
  margin: 0;
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 1.1rem;
}

.vocab-card-lock-copy {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
  font-size: 0.9rem;
  max-width: 28ch;
}

.card-dots .is-locked-dot {
  opacity: 0.35;
}

.linkish {
  border: none;
  background: none;
  padding: 0;
  color: var(--blue-deep);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

.gift-end-wrap {
  margin: 14px 0 0;
  text-align: center;
}

.gift-end-link {
  appearance: none;
  border: none;
  background: none;
  padding: 8px 12px;
  margin: 0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--ink-soft) 75%, transparent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.gift-end-link:hover {
  color: var(--ink-soft);
}

.header-toggles {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.header-toggle,
.jyutping-toggle,
.meaning-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  min-width: 0;
  border-radius: 999px;
  border: 2px solid rgba(74, 158, 255, 0.35);
  background: var(--surface);
  color: var(--blue-deep);
  font-family: var(--font-en);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.header-toggle-tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.7rem;
  height: 0.7rem;
  flex-shrink: 0;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  opacity: 0.55;
  box-sizing: border-box;
}

.header-toggle-tick::before {
  content: "";
  display: block;
  width: 0.28rem;
  height: 0.42rem;
  border: solid transparent;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) translateY(-0.5px);
  box-sizing: border-box;
}

.header-toggle-text {
  white-space: nowrap;
}

.header-toggle.active,
.jyutping-toggle.active,
.meaning-toggle.active {
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  border-color: transparent;
  color: #fff;
}

.header-toggle.active .header-toggle-tick,
.jyutping-toggle.active .header-toggle-tick,
.meaning-toggle.active .header-toggle-tick {
  opacity: 1;
  background: rgba(255, 255, 255, 0.22);
}

.header-toggle.active .header-toggle-tick::before,
.jyutping-toggle.active .header-toggle-tick::before,
.meaning-toggle.active .header-toggle-tick::before {
  border-color: currentColor;
}

html[data-jyutping="off"] .jyutping,
html[data-jyutping="off"] .quiz-sub,
html[data-jyutping="off"] .card-jyutping,
html[data-jyutping="off"] .lego-block-jyutping,
html[data-jyutping="off"] .lego-hint,
html[data-jyutping="off"] .jyutping-hint-btn {
  display: none !important;
}

html[data-gloss="off"] .meaning,
html[data-gloss="off"] .mini-card-meaning,
html[data-gloss="off"] .subtitle-meaning,
html[data-gloss="off"] .lego-meaning,
html[data-gloss="off"] .meaning-lesson-tag,
html[data-gloss="off"] .more-meanings,
html[data-gloss="off"] .chat-teaser-en,
html[data-gloss="off"] .contribute-meaning,
html[data-gloss="off"] .alc-chip-en,
html[data-gloss="off"] .alc-slot-en,
html[data-gloss="off"] .alc-fuse-piece-en,
html[data-gloss="off"] .alc-discover-en,
html[data-gloss="off"] .rpg-choice-en,
html[data-gloss="off"] .rpg-feedback-en,
html[data-gloss="off"] .rpg-word-card-en,
html[data-gloss="off"] .rpg-place-en {
  display: none !important;
}

.app-main {
  flex: 1 1 auto;
  min-height: 12rem;
  padding: 16px 18px calc(110px + var(--safe-bottom));
}

.boot-fallback {
  margin: 32px 0;
  text-align: center;
  font-family: var(--font-en);
  font-weight: 800;
  color: var(--ink-soft);
}

html.is-inapp .app-main {
  display: block;
  flex: none;
  min-height: 0;
  height: auto;
  overflow: visible;
  padding-bottom: calc(110px + var(--safe-bottom));
}

html.is-flutter-app .app-main {
  padding-bottom: 16px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 8px max(4px, env(safe-area-inset-left)) calc(8px + var(--safe-bottom))
    max(4px, env(safe-area-inset-right));
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 30px rgba(232, 90, 0, 0.08);
  z-index: 40;
  overflow: hidden;
  box-sizing: border-box;
}

html.is-inapp .bottom-nav {
  /* Pin like phone Chrome — sticky scrolls away in Instagram WebView */
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html.is-flutter-app .bottom-nav {
  position: sticky;
  left: auto;
  transform: none;
  width: 100%;
  margin-top: 0;
}

html.is-flutter-app,
html.is-flutter-app body {
  width: 100%;
  min-height: var(--app-height, 100dvh);
  height: var(--app-height, 100dvh);
  overflow: hidden;
  touch-action: manipulation;
}

html.is-flutter-app .app-shell {
  min-height: var(--app-height, 100dvh);
  height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
}

html.is-flutter-app .app-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  padding: 6px 0;
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink-soft);
  font-family: var(--font-en);
  font-size: clamp(0.5rem, 2.4vw, 0.66rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.01em;
  transition: color 0.15s ease, background 0.15s ease;
  overflow: hidden;
}

.nav-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.nav-item.active {
  /* per-tab colors below override this fallback */
  color: var(--orange-deep);
  background: rgba(255, 116, 32, 0.1);
}

@media (max-width: 420px) {
  .bottom-nav {
    padding-top: 6px;
    padding-bottom: calc(6px + var(--safe-bottom));
  }

  .nav-item {
    padding: 4px 0;
    gap: 1px;
    font-size: clamp(0.52rem, 2.35vw, 0.62rem);
  }

  .nav-item .nav-icon {
    width: 30px;
    height: 28px;
    font-size: 1.2rem;
    border-radius: 10px;
  }

  .nav-item.active .nav-icon {
    transform: translateY(-1px) scale(1.04);
  }

  .nav-badge {
    top: 0;
    right: calc(50% - 16px);
    min-width: 14px;
    height: 14px;
    font-size: 0.56rem;
  }
}

.hero-banner {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
  padding: 22px;
  border-radius: calc(var(--radius) + 6px);
  background: linear-gradient(145deg, var(--panel-grad-a) 0%, var(--panel-grad-b) 100%);
  box-shadow: var(--shadow);
  border: 2px solid rgba(255, 149, 51, 0.25);
  text-align: center;
}

.hero-banner.hero-compact {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 8px 12px;
  text-align: left;
}

.hero-compact-copy {
  min-width: 0;
}

.hero-compact-copy h1 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.15;
}

.hero-compact-copy p {
  margin: 2px 0 0;
  font-size: 0.75rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-banner.hero-compact .hero-logo {
  width: 42px;
  height: 42px;
  margin: 0;
  animation: none;
  box-shadow: 0 4px 12px var(--orange-glow);
}

.hero-banner.hero-compact .hero-tags {
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

.hero-banner.hero-compact .tag {
  padding: 5px 10px;
  font-size: 0.7rem;
}

@media (max-width: 420px) {
  .hero-banner.hero-compact {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .hero-banner.hero-compact .hero-tags {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

.hero-logo {
  width: 96px;
  height: 96px;
  margin: 0 auto;
  border-radius: 50%;
  box-shadow: 0 14px 36px var(--orange-glow);
  animation: bob 3s ease-in-out infinite;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.hero-banner h1 {
  margin: 0;
  font-family: var(--font-en);
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--orange-deep);
}

.hero-banner p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.hero-tags,
.level-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.tag,
.level-pill {
  padding: 7px 14px;
  border: none;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.level-pill.active {
  background: linear-gradient(135deg, var(--orange-bright), var(--orange));
  color: #fff;
}

.level-pill:not(.active) {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.theme-filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 8px;
  margin: 0 0 4px;
  scrollbar-width: thin;
}

.theme-pill {
  flex: 0 0 auto;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--font-en);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.theme-pill.active {
  background: linear-gradient(135deg, var(--orange-bright), var(--orange));
  border-color: transparent;
  color: #fff;
}

.section-title {
  margin: 0 0 14px;
  font-family: var(--font-en);
  font-size: 0.92rem;
  font-weight: 900;
  color: var(--orange-deep);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.video-grid {
  display: grid;
  gap: 12px;
}

.video-card {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  color: inherit;
  border: 1px solid rgba(255, 149, 51, 0.15);
  transition: transform 0.15s ease;
  cursor: pointer;
}

.video-card:active {
  transform: scale(0.985);
}

.video-card:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.video-icon-wrap {
  position: relative;
  width: 80px;
  height: 106px;
  flex-shrink: 0;
}

.video-thumb {
  width: 80px;
  height: 106px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(232, 90, 0, 0.15);
  background: var(--peach);
}

.video-detail-thumb {
  width: 100%;
  max-height: 200px;
  border-radius: var(--radius);
  object-fit: cover;
  box-shadow: var(--shadow);
}

.level-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--orange-bright), var(--orange-deep));
  color: #fff;
  font-family: var(--font-en);
  font-size: 0.68rem;
  font-weight: 900;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
}

.video-card-body h2 {
  margin: 0 0 4px;
  font-size: 1.02rem;
  line-height: 1.35;
}

.video-card-body p {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-family: var(--font-en);
  font-size: 0.84rem;
}

.video-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--blue-deep);
}

.video-notice-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(180, 83, 9, 0.16);
  border: 1px solid rgba(180, 83, 9, 0.28);
  color: #b45309;
  font-weight: 800;
}

.lesson-notice {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(180, 83, 9, 0.12);
  border: 1px solid rgba(180, 83, 9, 0.28);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.4;
}

.lesson-notice strong {
  color: #b45309;
  font-weight: 850;
}

html[data-theme="dark"] .video-notice-pill {
  background: rgba(251, 191, 36, 0.18);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fbbf24;
}

html[data-theme="dark"] .lesson-notice {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.28);
}

html[data-theme="dark"] .lesson-notice strong {
  color: #fbbf24;
}

.known-pct {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff9533, #ff7420);
  color: #fff;
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  text-transform: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(255, 116, 32, 0.35);
}

.known-pct.is-low {
  background: linear-gradient(135deg, #ffb347, #ff8c33);
}

.known-pct.is-mid {
  background: linear-gradient(135deg, #ff9533, #ff7420);
}

.known-pct.is-high {
  background: linear-gradient(135deg, #4caf50, #2e7d32);
  box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}

.news-teaser-source .known-pct,
.chat-teaser-meta .known-pct {
  margin-left: 6px;
  vertical-align: middle;
  font-size: 0.74rem;
}

.video-meta .card-count {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--ink-soft);
  opacity: 0.85;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--blue-deep);
  text-decoration: none;
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.9rem;
}

.video-detail-header {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--panel-grad-a), var(--panel-grad-b));
  box-shadow: var(--shadow);
}

.video-detail-header.is-compact {
  gap: 0;
  margin-bottom: 12px;
  padding: 10px 14px;
}

.video-detail-meta {
  min-width: 0;
}

.video-detail-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.video-detail-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.level-badge-inline {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin: 0;
  padding: 4px 8px;
  font-size: 0.75rem;
}

.video-detail-icon {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  box-shadow: 0 12px 28px var(--orange-glow);
}

.video-detail-header h1 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-detail-header.is-compact .subtitle {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

.subtitle {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-family: var(--font-en);
}

.video-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.video-detail-header.is-compact .video-actions .btn {
  padding: 7px 12px;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Lesson watch: left video + right subtitle cards */
.lesson-watch {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 16px;
  margin: 0 0 22px;
  align-items: start;
}

.lesson-watch-video {
  position: sticky;
  top: 72px;
}

.yt-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: min(72vh, 640px);
  border-radius: 18px;
  overflow: hidden;
  background: #111;
  box-shadow: var(--shadow);
}

.yt-pip-slot {
  position: relative;
  width: 100%;
}

.yt-frame-wrap iframe,
.yt-frame-wrap #yt-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.yt-pip-close {
  display: none;
}

@media (min-width: 861px) {
  .yt-frame-wrap.is-pip {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(84px, calc(env(safe-area-inset-bottom) + 72px));
    z-index: 90;
    width: min(200px, 22vw);
    max-height: min(56vh, 360px);
    aspect-ratio: 9 / 16;
    border-radius: 14px;
    box-shadow: 0 14px 36px rgba(20, 12, 4, 0.35);
    animation: yt-pip-in 0.28s ease both;
  }

  .yt-frame-wrap.is-pip .yt-pip-close {
    display: grid;
    place-items: center;
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: rgba(20, 12, 4, 0.72);
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
  }

  .yt-frame-wrap.is-pip .yt-pip-close:hover {
    background: rgba(20, 12, 4, 0.9);
  }
}

@keyframes yt-pip-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .yt-frame-wrap.is-pip {
    animation: none;
  }
}

.lesson-watch-hint {
  margin: 10px 2px 0;
  color: var(--ink-soft);
  font-family: var(--font-en);
  font-size: 0.85rem;
}

.lesson-watch-subs {
  min-height: 200px;
  max-height: min(72vh, 640px);
  overflow: auto;
  padding: 4px 2px 8px;
  scroll-behavior: smooth;
}

.lesson-subs-title {
  margin: 0 0 10px;
  font-size: 1rem;
  font-family: var(--font-en);
}

.subtitle-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.subtitle-card {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 14px 16px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 6px 18px rgba(40, 24, 8, 0.06);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.subtitle-card.is-vocab {
  opacity: 0.78;
  background: var(--surface-soft);
}

.subtitle-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 140, 66, 0.35);
}

.subtitle-card.active {
  border-color: var(--orange);
  background: linear-gradient(145deg, var(--panel-grad-a), var(--panel-grad-b));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--orange) 55%, transparent),
    0 8px 20px var(--orange-glow);
  transform: none;
}

.subtitle-zh {
  font-family: var(--font-zh);
  font-size: calc(1.25rem * var(--font-zh-scale, 1));
  font-weight: 800;
  line-height: 1.45;
}

.caption-word {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 3px;
  text-decoration-color: var(--fam-color, #E53935);
  border-radius: 2px;
}

.caption-plain {
  text-decoration: none;
}

.subtitle-card:hover .caption-word {
  text-decoration-thickness: 3.5px;
}

.subtitle-jyutping {
  font-size: calc(0.95rem * var(--font-jyutping-scale, 1));
  color: var(--blue);
}

.subtitle-meaning {
  font-family: var(--font-en);
  font-size: calc(0.9rem * var(--font-meaning-scale, 1));
  color: var(--ink-soft);
}

.subtitle-time,
.subtitle-tag {
  font-family: var(--font-en);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #b0a094;
  text-transform: none;
  opacity: 0.7;
}

.subtitle-card.active .subtitle-time {
  color: #b0a094;
  opacity: 0.65;
}

html[data-theme="dark"] .subtitle-time,
html[data-theme="dark"] .subtitle-tag,
html[data-theme="dark"] .subtitle-card.active .subtitle-time {
  color: #7a6f66;
  opacity: 0.65;
}

@media (max-width: 860px) {
  .lesson-watch {
    grid-template-columns: 1fr;
  }

  .lesson-watch-video {
    position: static;
  }

  .yt-frame-wrap {
    max-height: min(58vh, 520px);
    margin: 0 auto;
  }

  .lesson-watch-subs {
    max-height: min(38vh, 320px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
  }
}

/* Phone landscape: video left, captions right (like desktop) */
@media (max-width: 860px) and (orientation: landscape) {
  .lesson-watch {
    grid-template-columns: minmax(0, 1.05fr) minmax(180px, 0.95fr);
    gap: 12px;
  }

  .lesson-watch-video {
    position: sticky;
    top: 8px;
  }

  .yt-frame-wrap {
    max-height: min(86vh, 520px);
    margin: 0;
  }

  .lesson-watch-subs {
    max-height: min(86vh, 520px);
  }

  .lesson-watch-hint {
    display: none;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 0.88rem;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--orange-bright), var(--orange-deep));
  color: #fff;
  box-shadow: 0 10px 24px var(--orange-glow);
}

.btn-ghost {
  background: var(--surface);
  color: var(--blue-deep);
  border: 2px solid rgba(74, 158, 255, 0.3);
}

.btn-blue {
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  color: #fff;
  box-shadow: 0 10px 24px rgba(74, 158, 255, 0.3);
}

.news-top-actions {
  margin: 0 0 14px;
  justify-content: flex-start;
}

.lesson-games-cta {
  margin: 22px 0 8px;
}

.lesson-games-cta-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  border: none;
  border-radius: 18px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #4aa3ff 0%, #2b7fdb 55%, #1f6ac0 100%);
  box-shadow: 0 14px 32px rgba(43, 127, 219, 0.35);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.lesson-games-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(43, 127, 219, 0.42);
}

.lesson-games-cta-btn:active {
  transform: scale(0.99);
}

.lesson-games-cta-icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.45rem;
}

.lesson-games-cta-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.lesson-games-cta-copy strong {
  font-family: var(--font-en);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.2;
}

.lesson-games-cta-copy small {
  font-family: var(--font-en);
  font-size: 0.8rem;
  opacity: 0.92;
  line-height: 1.3;
}

.lesson-games-cta-arrow {
  flex: 0 0 auto;
  font-size: 1.35rem;
  font-weight: 800;
  opacity: 0.9;
}

.cards-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.cards-toolbar span {
  font-family: var(--font-en);
  font-weight: 800;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.bulk-fam-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.bulk-fam-label {
  font-family: var(--font-en);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.bulk-fam-dots {
  display: flex;
  gap: 6px;
}

.bulk-fam-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--fam-color, #ccc);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 1;
}

.bulk-fam-dot:hover {
  background: var(--fam-color);
  color: #fff;
}

.bulk-fam-hint {
  flex: 1 1 160px;
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.card-nav {
  display: flex;
  gap: 8px;
}

.card-nav button {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--orange-deep);
  box-shadow: 0 4px 12px rgba(232, 90, 0, 0.15);
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 900;
}

.card-stage-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.card-stage {
  min-width: 0;
}

.card-side-nav {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--orange-deep);
  box-shadow: 0 6px 16px rgba(232, 90, 0, 0.16);
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.card-side-nav:hover {
  transform: scale(1.06);
  background: color-mix(in srgb, var(--orange) 12%, var(--surface));
}

.card-side-nav:active {
  transform: scale(0.96);
}

@media (max-width: 420px) {
  .card-side-nav {
    width: 38px;
    height: 38px;
    font-size: 1.25rem;
  }

  .card-stage-wrap {
    gap: 4px;
  }
}

.vocab-card {
  position: relative;
  padding: 28px 22px 24px;
  border-radius: calc(var(--radius) + 8px);
  background:
    radial-gradient(circle at 90% 8%, rgba(74, 158, 255, 0.14), transparent 45%),
    linear-gradient(180deg, var(--panel-grad-a) 0%, var(--panel-grad-b) 100%);
  box-shadow: var(--shadow);
  text-align: center;
  min-height: 290px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  border: 2px solid rgba(255, 149, 51, 0.2);
}

.vocab-flip {
  perspective: 1100px;
  width: 100%;
  outline: none;
}

.vocab-flip-inner {
  position: relative;
  min-height: 168px;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.vocab-flip.is-flipped .vocab-flip-inner {
  transform: rotateY(180deg);
}

.vocab-flip-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.vocab-flip-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
}

.vocab-flip-hint {
  margin: 10px 0 0;
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #b0a094;
}

.vocab-flip-hint kbd {
  display: inline-block;
  padding: 0.1em 0.45em;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.95em;
  font-weight: 800;
  color: var(--ink-soft);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.meaning-flip-main {
  margin: 0;
  font-size: calc(clamp(1.35rem, 5.5vw, 1.85rem) * var(--font-meaning-scale));
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1.45;
  max-width: 28ch;
}

.star-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: #ccc;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
}

.star-btn.starred {
  color: #ffb800;
  background: color-mix(in srgb, #ffb800 18%, var(--surface));
}

.vocab-card .zh {
  margin: 0;
  font-family: var(--font-zh);
  font-size: calc(clamp(2.5rem, 11vw, 3.6rem) * var(--font-zh-scale));
  font-weight: 700;
  line-height: 1.1;
}

.vocab-card .jyutping {
  margin: 0;
  font-family: var(--font-en);
  font-size: calc(1.2rem * var(--font-jyutping-scale));
  font-weight: 800;
  color: var(--blue-deep);
}

.vocab-card .meaning {
  margin: 0;
  font-size: calc(1.05rem * var(--font-meaning-scale));
  color: var(--ink-soft);
  line-height: 1.45;
}

.meaning-lesson-tag {
  margin: -4px 0 0;
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 700;
  color: #b0a094;
  letter-spacing: 0.02em;
}

.more-meanings {
  margin: 4px auto 0;
  width: min(100%, 320px);
  text-align: left;
}

.more-meanings-btn {
  border: none;
  background: transparent;
  color: var(--blue-deep);
  font-family: var(--font-en);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.more-meanings-btn.is-open {
  color: var(--orange-deep);
}

.more-meanings-panel {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.more-meaning-item {
  display: flex;
  width: 100%;
  align-items: center;
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.more-meaning-item:hover {
  border-color: rgba(255, 116, 32, 0.45);
}

.more-meaning-meta {
  font-family: var(--font-en);
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

.more-meaning-meta strong {
  color: var(--ink);
  font-weight: 700;
}

html[data-theme="dark"] .meaning-lesson-tag {
  color: #7a6f66;
}

html[data-theme="dark"] .more-meanings-btn {
  color: var(--blue);
}

.fam-label {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-en);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink);
}

.fam-label-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--fam-color);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--fam-color);
  flex-shrink: 0;
}

.fam-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fam-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--fam-color) 35%, transparent);
  background: var(--fam-color);
  cursor: pointer;
  padding: 0;
  /* All levels visible (dim) so you can tap any level immediately */
  opacity: 0.38;
  filter: saturate(0.75);
  transition: transform 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.fam-dot:hover {
  opacity: 0.7;
  filter: saturate(1);
  transform: scale(1.06);
}

.fam-dot.active {
  opacity: 1;
  filter: saturate(1);
  transform: scale(1.14);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--fam-color);
}

.fam-mini {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--fam-color);
  flex-shrink: 0;
  vertical-align: middle;
}

.vocab-card-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
}

.skipped-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

html[data-meaning="hans"] .vocab-card .meaning,
html[data-meaning="hans"] .meaning-flip-main {
  font-family: var(--font-sc);
}

html[data-meaning="en"] .vocab-card .meaning,
html[data-meaning="en"] .meaning-flip-main {
  font-family: var(--font-en);
}

.speak-btn {
  align-self: center;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  color: #fff;
  box-shadow: 0 10px 24px rgba(74, 158, 255, 0.35);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.speak-btn svg {
  width: 26px;
  height: 26px;
}

.brand img,
.hero-logo,
.video-icon,
.video-detail-icon,
.onboarding-panel img {
  object-fit: cover;
  background: #c4a090;
}

.card-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.card-dots button {
  width: 8px;
  height: 8px;
  border: none;
  border-radius: 50%;
  background: rgba(45, 34, 24, 0.15);
  padding: 0;
  cursor: pointer;
}

.card-dots button.active {
  width: 24px;
  border-radius: 999px;
  background: var(--orange);
}

.card-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.mini-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "main star"
    "fam fam";
  gap: 2px 8px;
  align-items: center;
  padding: 6px 8px 8px 6px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.mini-card-main {
  grid-area: main;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.mini-card .fam-bar {
  grid-area: fam;
  justify-content: flex-start;
  padding: 0 8px 4px;
  gap: 6px;
}

.mini-card .fam-dot {
  width: 22px;
  height: 22px;
}

.mini-star {
  grid-area: star;
  border: none;
  background: none;
  font-size: 1.35rem;
  cursor: pointer;
  color: #ccc;
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1;
  flex-shrink: 0;
}

.mini-card-main:hover {
  background: rgba(255, 149, 51, 0.08);
}

.mini-card strong {
  display: block;
  font-family: var(--font-zh);
  font-size: calc(1.1rem * var(--font-zh-scale));
  margin-bottom: 4px;
}

.mini-card small,
.card-jyutping {
  color: var(--ink-soft);
  font-family: var(--font-en);
  font-size: calc(0.82rem * var(--font-jyutping-scale));
}

.mini-card-meaning {
  font-size: calc(0.9rem * var(--font-meaning-scale));
  color: var(--ink-soft);
}

.mini-card-main .fam-mini {
  display: none;
}

.mini-star:hover {
  background: rgba(255, 184, 0, 0.12);
}

.mini-star.starred {
  color: #ffb800;
}

.settings-panel,
.games-hub,
.stars-page {
  display: grid;
  gap: 16px;
}

.games-hub {
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.games-page {
  display: grid;
  gap: 14px;
}

.games-hero {
  padding: 4px 2px 2px;
}

.games-hero h1 {
  margin: 0 0 4px;
  font-family: var(--font-en);
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--orange-deep);
}

.games-hero p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.battle-spotlight {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px 14px;
  align-items: center;
  padding: 18px 16px;
  min-height: 92px;
  border-radius: 22px;
  text-decoration: none;
  color: #fff;
  border: 2px solid color-mix(in srgb, #ffd54a 55%, var(--orange));
  background:
    linear-gradient(125deg, #ff9533 0%, #ff7420 42%, #e85a00 78%, #c44a00 100%);
  box-shadow:
    0 14px 36px rgba(232, 90, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.battle-spotlight:hover,
.battle-spotlight:focus-visible {
  transform: translateY(-2px) scale(1.01);
  filter: brightness(1.04);
  outline: none;
}

.battle-spotlight:active {
  transform: scale(0.985);
}

.battle-spotlight-glow {
  position: absolute;
  inset: -30% -10% auto;
  height: 140%;
  background: radial-gradient(circle, rgba(255, 230, 120, 0.45), transparent 62%);
  pointer-events: none;
  animation: battle-spotlight-shine 3.6s ease-in-out infinite;
}

@keyframes battle-spotlight-shine {
  0%,
  100% { transform: translateX(-12%) scale(1); opacity: 0.65; }
  50% { transform: translateX(18%) scale(1.1); opacity: 1; }
}

.battle-spotlight-swords {
  position: relative;
  z-index: 1;
  font-size: 2.35rem;
  line-height: 1;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.22));
  animation: battle-swords-pulse 2.2s ease-in-out infinite;
}

@keyframes battle-swords-pulse {
  0%,
  100% { transform: rotate(-6deg) scale(1); }
  50% { transform: rotate(6deg) scale(1.08); }
}

.battle-spotlight-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.battle-spotlight-eyebrow {
  font-family: var(--font-en);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
}

.battle-spotlight-copy strong {
  font-family: var(--font-en);
  font-size: clamp(1.45rem, 5vw, 1.75rem);
  font-weight: 900;
  line-height: 1.05;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.battle-spotlight-copy small {
  font-size: 0.82rem;
  font-weight: 700;
  opacity: 0.92;
}

.battle-spotlight-cta {
  position: relative;
  z-index: 1;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 0.88rem;
  white-space: nowrap;
  backdrop-filter: blur(6px);
}

.alchemy-spotlight {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px 14px;
  align-items: center;
  margin-top: 12px;
  padding: 18px 16px;
  min-height: 96px;
  border-radius: 22px;
  text-decoration: none;
  color: #fff;
  border: 2px solid color-mix(in srgb, #b8f0ff 50%, #5b8cff);
  background: linear-gradient(135deg, #3d2b8c 0%, #5b4cdb 38%, #2bb7ff 78%, #7ef0c3 100%);
  box-shadow: 0 14px 36px rgba(61, 43, 140, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.18s ease, filter 0.18s ease;
  animation: alchemy-spotlight-breathe 3.2s ease-in-out infinite;
}

.alchemy-spotlight:hover,
.alchemy-spotlight:focus-visible {
  transform: translateY(-2px) scale(1.01);
  filter: brightness(1.05);
}

.alchemy-spotlight:active {
  transform: scale(0.99);
}

.alchemy-spotlight-glow {
  position: absolute;
  inset: -40% -20%;
  background: radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.35), transparent 55%);
  pointer-events: none;
  animation: alchemy-spotlight-shine 4s ease-in-out infinite;
}

.alchemy-spotlight-icon {
  position: relative;
  z-index: 1;
  font-size: 2.1rem;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.25));
}

.alchemy-spotlight-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 2px;
}

.alchemy-spotlight-eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.9;
}

.alchemy-spotlight-copy strong {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.15;
}

.alchemy-spotlight-copy small {
  font-size: 0.82rem;
  opacity: 0.92;
  line-height: 1.35;
}

.alchemy-spotlight-cta {
  position: relative;
  z-index: 1;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 0.88rem;
  white-space: nowrap;
}

@keyframes alchemy-spotlight-breathe {
  0%,
  100% {
    box-shadow: 0 14px 36px rgba(61, 43, 140, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  }
  50% {
    box-shadow: 0 18px 42px rgba(43, 183, 255, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.34);
  }
}

@keyframes alchemy-spotlight-shine {
  0%,
  100% {
    transform: translateX(0);
    opacity: 0.7;
  }
  50% {
    transform: translateX(8%);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .alchemy-spotlight,
  .alchemy-spotlight-glow,
  .alc-slot.is-waiting,
  .alc-fuse-btn.is-ready {
    animation: none;
  }
}

.alc-page {
  padding-bottom: 28px;
}

.alc-page-combine .alc-hero {
  margin-bottom: 8px;
}

.alc-page-combine .alc-sub {
  display: none;
}

.alc-page-combine .alc-kind-legend {
  display: none;
}

.alc-hero {
  margin: 8px 0 14px;
}

.alc-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5b4cdb;
}

.alc-hero h1 {
  margin: 4px 0 0;
  font-size: 1.55rem;
}

.alc-sub {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.alc-progress {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid rgba(91, 76, 219, 0.18);
}

.alc-progress-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.alc-progress-row strong {
  font-size: 1.15rem;
  color: var(--ink);
}

.alc-progress-pct {
  margin-left: auto;
  font-weight: 800;
  color: #5b4cdb;
}

.alc-progress-bar {
  margin-top: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(91, 76, 219, 0.12);
  overflow: hidden;
}

.alc-progress-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b4cdb, #2bb7ff);
}

.alc-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 12px 0;
}

.alc-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
}

.alc-tab.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #5b4cdb, #2bb7ff);
}

.alc-panel {
  display: grid;
  gap: 12px;
}

.alc-combine {
  gap: 10px;
}

.alc-combine-board {
  display: grid;
  gap: 10px;
  /* Pot is a sibling of hints + elements so sticky stays pinned while scrolling the board */
  grid-template-areas:
    "fuse"
    "hints"
    "elements";
}

.alc-sticky-pot {
  grid-area: fuse;
}

.alc-col-hints {
  grid-area: hints;
}

.alc-col-elements {
  grid-area: elements;
}

.alc-col-hints,
.alc-col-elements {
  min-width: 0;
}

.alc-lead {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.alc-beginner-tip {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--accent, #5b4cdb) 10%, var(--card, #fff));
  border: 1px solid color-mix(in srgb, var(--accent, #5b4cdb) 18%, transparent);
}

.alc-fuse-bonus {
  margin: 6px 0 0;
  font-size: 0.82rem;
  font-style: normal;
  color: color-mix(in srgb, #1a9b6a 70%, var(--ink-soft));
}

.alc-toast {
  position: fixed;
  left: 50%;
  top: max(72px, calc(env(safe-area-inset-top, 0px) + 64px));
  z-index: 80;
  max-width: min(92vw, 360px);
  padding: 12px 16px;
  border-radius: 16px;
  transform: translate(-50%, -8px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  font-family: var(--font-en);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  color: #14532d;
  background: color-mix(in srgb, #86efac 55%, #fff);
  border: 2px solid color-mix(in srgb, #16a34a 40%, transparent);
  box-shadow: 0 12px 28px rgba(22, 101, 52, 0.18);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.alc-toast.is-in {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.alc-toast.is-out {
  opacity: 0;
  transform: translate(-50%, -6px) scale(0.98);
}

html[data-theme="dark"] .alc-toast {
  color: #bbf7d0;
  background: color-mix(in srgb, #14532d 70%, #0f172a);
  border-color: color-mix(in srgb, #22c55e 35%, transparent);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.alc-sticky-pot {
  position: sticky;
  top: 56px;
  z-index: 15;
  margin: 0 -2px;
  padding: 2px 2px 8px;
  background: linear-gradient(
    180deg,
    var(--bg-1) 70%,
    color-mix(in srgb, var(--bg-1) 55%, transparent)
  );
}

html[data-theme="dark"] .alc-sticky-pot {
  background: linear-gradient(
    180deg,
    var(--bg-1) 55%,
    color-mix(in srgb, var(--bg-1) 70%, transparent)
  );
}

.alc-cauldron {
  position: relative;
  padding: 14px 12px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(126, 240, 195, 0.18), transparent 55%),
    linear-gradient(180deg, color-mix(in srgb, #5b4cdb 10%, var(--card)), var(--card));
  border: 1px solid rgba(91, 76, 219, 0.2);
  box-shadow: var(--shadow);
}

.alc-cauldron-compact {
  padding: 10px 10px 8px;
  border-radius: 16px;
}

.alc-status {
  margin: 0 0 6px;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.alc-status kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface, var(--card));
  font-size: 0.7rem;
  font-weight: 800;
}

.alc-slots {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  align-items: center;
}

.alc-slot {
  min-height: 68px;
  display: grid;
  place-items: center;
  gap: 1px;
  padding: 6px;
  border-radius: 12px;
  border: 2px dashed rgba(91, 76, 219, 0.35);
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

html[data-theme="dark"] .alc-slot {
  background: rgba(255, 255, 255, 0.04);
}

.alc-slot.has-el {
  border-style: solid;
  border-color: #5b4cdb;
  background: color-mix(in srgb, #5b4cdb 12%, var(--card));
  transform: scale(1.02);
}

.alc-slot.is-waiting {
  border-color: #2bb7ff;
  animation: alc-pulse-border 1.2s ease-in-out infinite;
}

@keyframes alc-pulse-border {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(43, 183, 255, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(43, 183, 255, 0);
  }
}

.alc-slot-empty {
  font-size: 1.25rem;
  color: var(--ink-soft);
}

.alc-slot-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.alc-slot-en {
  font-size: 0.62rem;
  color: var(--ink-soft);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alc-slot-emoji {
  font-size: 1.15rem;
}

.alc-plus {
  font-size: 1.15rem;
  font-weight: 900;
  color: #5b4cdb;
}

.alc-fuse-btn {
  margin-top: 8px;
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #5b4cdb, #2bb7ff 60%, #7ef0c3);
  box-shadow: 0 8px 18px rgba(91, 76, 219, 0.3);
}

.alc-fuse-btn.is-ready {
  animation: alc-fuse-glow 1.4s ease-in-out infinite;
}

@keyframes alc-fuse-glow {
  0%,
  100% {
    box-shadow: 0 8px 18px rgba(91, 76, 219, 0.3);
  }
  50% {
    box-shadow: 0 10px 26px rgba(43, 183, 255, 0.5);
  }
}

.alc-fuse-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  animation: none;
}

.alc-fuse-kbd {
  margin-left: 4px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.alc-hints {
  border-radius: 16px;
  border: 1px solid rgba(91, 76, 219, 0.18);
  background: var(--card);
  overflow: hidden;
  height: 100%;
}

.alc-hints > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.88rem;
  user-select: none;
}

.alc-hints > summary::-webkit-details-marker {
  display: none;
}

.alc-hints > summary em {
  margin-left: auto;
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.alc-kind-legend {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 4px;
  max-width: 28rem;
}

.alc-kind-legend li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--ink-soft);
  font-weight: 650;
}

.alc-hints-legend {
  padding: 0 10px 8px;
}

.alc-hints-legend .alc-kind-legend {
  margin: 0;
  max-width: none;
  gap: 3px;
}

.alc-hints-legend .alc-kind-legend li {
  font-size: 0.66rem;
}

.alc-kind-pill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.4;
  border: 1px solid transparent;
}

.alc-kind-word {
  color: #1f5c45;
  background: color-mix(in srgb, #2f9e6f 14%, var(--card, #fff));
  border-color: color-mix(in srgb, #2f9e6f 28%, transparent);
}

.alc-kind-vocab {
  color: #3a4a8a;
  background: color-mix(in srgb, #5b4cdb 12%, var(--card, #fff));
  border-color: color-mix(in srgb, #5b4cdb 26%, transparent);
}

.alc-kind-concept {
  color: #8a4a1a;
  background: color-mix(in srgb, #e09a3e 16%, var(--card, #fff));
  border-color: color-mix(in srgb, #e09a3e 32%, transparent);
}

.alc-kind-compact {
  font-size: 0.58rem;
  padding: 0 6px;
}

.alc-kind-result,
.alc-kind-fuse {
  margin-top: 2px;
}

.alc-hint-list {
  list-style: none;
  margin: 0;
  padding: 0 8px 10px;
  display: grid;
  gap: 5px;
  /* ~3 hints visible, then scroll */
  max-height: 9.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.alc-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--surface, rgba(91, 76, 219, 0.06));
  font-size: 0.78rem;
  line-height: 1.3;
  position: relative;
  border: 1px solid transparent;
  transform-origin: center center;
}

.alc-hint.is-solved {
  z-index: 2;
  border-color: #fbbf24;
  background: color-mix(in srgb, #fde68a 45%, var(--card, #fff));
  box-shadow:
    0 0 0 1px color-mix(in srgb, #f59e0b 55%, transparent),
    0 0 18px color-mix(in srgb, #fbbf24 55%, transparent),
    0 0 34px color-mix(in srgb, #f59e0b 28%, transparent);
  animation: alc-hint-shine 0.72s ease;
}

.alc-hint.is-solved::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    110deg,
    transparent 20%,
    rgba(255, 255, 255, 0.75) 45%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: alc-hint-sheen 0.72s ease;
}

.alc-hint.is-leaving {
  animation: alc-hint-leave 0.55s ease forwards;
  pointer-events: none;
}

@keyframes alc-hint-shine {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  35% {
    transform: scale(1.04);
    filter: brightness(1.18);
  }
  100% {
    transform: scale(1.02);
    filter: brightness(1.08);
  }
}

@keyframes alc-hint-sheen {
  0% {
    background-position: 120% 0;
    opacity: 0;
  }
  25% {
    opacity: 1;
  }
  100% {
    background-position: -40% 0;
    opacity: 0;
  }
}

@keyframes alc-hint-leave {
  0% {
    opacity: 1;
    transform: scale(1.02) translateY(0);
    max-height: 6rem;
    margin: 0;
    padding: 6px 8px;
  }
  55% {
    opacity: 0.55;
    transform: scale(0.96) translateY(-4px);
  }
  100% {
    opacity: 0;
    transform: scale(0.82) translateY(-10px);
    max-height: 0;
    margin: 0;
    padding: 0 8px;
    border-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .alc-hint.is-solved,
  .alc-hint.is-solved::after,
  .alc-hint.is-leaving {
    animation: none;
  }
}

.alc-hint-craftable {
  border: 1px solid rgba(91, 76, 219, 0.22);
  background: color-mix(in srgb, #5b4cdb 7%, var(--card));
}

.alc-hint-nearly {
  opacity: 0.92;
}

.alc-hint-dream {
  opacity: 0.78;
}

.alc-hint-badge {
  flex: 0 0 auto;
}

.alc-hint-riddle {
  flex: 1 1 12rem;
  font-style: italic;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.4;
}

.alc-hint-soft {
  flex: 1 1 100%;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.alc-hint-starter {
  background: color-mix(in srgb, #5b4cdb 6%, var(--card));
}

/* Fuse merge animation */
.alc-cauldron.is-fusing .alc-slots,
.alc-cauldron.is-fusing .alc-fuse-btn,
.alc-cauldron.is-fusing .alc-status,
.alc-cauldron.is-fusing .alc-result {
  opacity: 0.18;
  pointer-events: none;
}

.alc-fuse-stage {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: color-mix(in srgb, var(--card) 72%, transparent);
  backdrop-filter: blur(2px);
  overflow: hidden;
}

.alc-fuse-stage-inner {
  position: relative;
  width: min(100%, 280px);
  height: 150px;
}

.alc-fuse-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  gap: 1px;
  min-width: 72px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--card);
  border: 2px solid #5b4cdb;
  box-shadow: 0 10px 24px rgba(91, 76, 219, 0.28);
  transform: translate(-50%, -50%);
}

.alc-fuse-piece-a {
  animation: alc-fuse-a-in 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.alc-fuse-piece-b {
  animation: alc-fuse-b-in 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.alc-fuse-piece-out {
  opacity: 0;
  border-color: #2e7d32;
  background: color-mix(in srgb, #7ef0c3 22%, var(--card));
  animation: alc-fuse-out-reveal 0.7s cubic-bezier(0.2, 0.85, 0.25, 1) 0.85s forwards;
  z-index: 3;
}

.alc-fuse-burst {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 1.8rem;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4);
  animation: alc-fuse-burst 0.55s ease-out 0.72s forwards;
  z-index: 2;
  pointer-events: none;
}

.alc-fuse-piece-emoji {
  font-size: 1.25rem;
  line-height: 1;
}

.alc-fuse-piece-zh {
  font-family: var(--font-zh);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.1;
}

.alc-fuse-piece-en {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.alc-fuse-banner {
  margin: 4px 0 0;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 800;
  color: #2e7d32;
}

.alc-cauldron.alc-fuse-success {
  animation: alc-fuse-success-glow 0.85s ease;
}

.alc-cauldron.alc-fuse-fail {
  animation: alc-fuse-shake 0.45s ease;
}

@keyframes alc-fuse-a-in {
  0% {
    transform: translate(-130%, -50%) scale(0.9);
    opacity: 0.7;
  }
  55% {
    transform: translate(-50%, -50%) scale(1.05);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0;
  }
}

@keyframes alc-fuse-b-in {
  0% {
    transform: translate(30%, -50%) scale(0.9);
    opacity: 0.7;
  }
  55% {
    transform: translate(-50%, -50%) scale(1.05);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0;
  }
}

@keyframes alc-fuse-out-reveal {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) rotate(-8deg);
  }
  60% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.12) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0);
  }
}

@keyframes alc-fuse-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  40% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.6);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.2);
  }
}

@keyframes alc-fuse-success-glow {
  0%,
  100% {
    box-shadow: var(--shadow);
  }
  40% {
    box-shadow: 0 0 0 3px rgba(126, 240, 195, 0.55), 0 12px 28px rgba(46, 183, 130, 0.35);
  }
}

@keyframes alc-fuse-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  50% {
    transform: translateX(6px);
  }
  75% {
    transform: translateX(-4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .alc-fuse-piece-a,
  .alc-fuse-piece-b,
  .alc-fuse-piece-out,
  .alc-fuse-burst,
  .alc-cauldron.alc-fuse-success,
  .alc-cauldron.alc-fuse-fail {
    animation: none !important;
  }
}

.alc-inventory-wrap {
  display: grid;
  gap: 8px;
  height: 100%;
}

.alc-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 12px;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(91, 76, 219, 0.22);
  background: var(--card);
}

.alc-search-icon {
  flex: 0 0 auto;
  font-size: 0.95rem;
  opacity: 0.85;
}

.alc-search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--ink);
  padding: 10px 0;
}

.alc-search-input::placeholder {
  color: var(--ink-soft);
  font-weight: 600;
}

.alc-search-clear {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.alc-search-clear:hover,
.alc-search-clear:focus-visible {
  color: var(--ink);
  outline: 2px solid #2bb7ff;
  outline-offset: 1px;
}

.alc-search-meta {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.alc-search-empty {
  margin: 8px 2px;
  grid-column: 1 / -1;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--ink-soft);
}

.alc-count {
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.alc-inventory {
  max-height: min(58vh, 560px);
  overflow-y: auto;
  padding: 4px 2px 12px;
  -webkit-overflow-scrolling: touch;
}

.alc-result {
  margin-top: 8px;
  min-height: 44px;
  display: grid;
  place-items: center;
  gap: 1px;
  text-align: center;
}

.alc-result.is-empty {
  display: none;
  min-height: 0;
  margin: 0;
}

.alc-result.has-result {
  padding: 8px;
  border-radius: 12px;
  background: rgba(126, 240, 195, 0.15);
  border: 1px solid rgba(46, 183, 130, 0.35);
}

.alc-result-emoji {
  font-size: 1.4rem;
}

.alc-result em {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 700;
  color: #2e7d32;
}

/* Desktop: ~70% window width, denser rows, no stretched buttons */
@media (min-width: 900px) {
  :root {
    --shell-max: min(70vw, 1200px);
  }

  .app-shell {
    width: min(70vw, 1200px);
    max-width: min(70vw, 1200px);
  }

  .video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .card-list,
  #words-list.card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .games-solo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .games-hub {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .match-mode-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-portals {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .buddy-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* Keep primary CTAs compact — never full-bleed on wide screens */
  .game-play-hero {
    justify-items: start;
  }

  .game-play-cta,
  .game-mistakes-review-btn {
    width: auto;
    max-width: 300px;
    min-width: 200px;
  }

  .game-results-actions {
    justify-content: flex-start;
  }

  .game-results-actions .btn,
  .game-results-actions a.btn,
  .words-practice-actions .btn,
  .video-actions .btn,
  .settings-card > .btn,
  .settings-card > a.btn,
  .subscribe-card .btn,
  .subscribe-card a.btn,
  .words-panel .settings-card .btn,
  .words-panel .settings-card a.btn,
  .onboarding-panel .btn,
  .edu-mode-choices .btn {
    width: auto !important;
    max-width: 280px;
    flex: 0 1 auto;
  }

  .words-practice-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
  }

  .words-practice-actions .btn {
    flex: 0 1 auto;
  }

  .edu-mode-choices {
    grid-template-columns: repeat(2, minmax(0, 220px));
    justify-content: start;
  }

  .edu-landing {
    max-width: min(640px, 100%);
  }

  /* Catch common full-bleed inline button styles */
  .app-main .btn[style*="width:100%"],
  .app-main .btn[style*="width: 100%"],
  .app-main a.btn[style*="width:100%"],
  .app-main a.btn[style*="width: 100%"] {
    width: auto !important;
    max-width: 280px;
  }
}

@media (min-width: 1100px) {
  .video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .card-list,
  #words-list.card-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .games-solo-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Desktop: Alchemy hints | fuse | elements side by side */
@media (min-width: 900px) {
  body:has(.alc-page-combine) .app-shell {
    max-width: min(70vw, 1200px);
    width: min(70vw, 1200px);
  }

  body:has(.alc-page-combine) .bottom-nav {
    width: min(var(--shell-max), 100%);
  }

  .alc-page-combine .alc-hero {
    margin-bottom: 4px;
  }

  .alc-page-combine .alc-hero h1 {
    font-size: 1.35rem;
  }

  .alc-page-combine .alc-progress {
    max-width: 420px;
  }

  .alc-combine-board {
    grid-template-columns: minmax(220px, 0.9fr) minmax(240px, 0.85fr) minmax(280px, 1.25fr);
    grid-template-areas: "hints fuse elements";
    gap: 14px;
    align-items: start;
    min-height: min(70vh, 640px);
  }

  .alc-sticky-pot {
    position: sticky;
    top: 64px;
    margin: 0;
    padding: 0;
    background: transparent;
  }

  .alc-col-hints .alc-hints {
    position: sticky;
    top: 64px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
  }

  .alc-col-hints .alc-hint-list {
    max-height: none;
    flex: 1;
    min-height: 0;
  }

  .alc-col-elements .alc-inventory-wrap {
    position: sticky;
    top: 64px;
    max-height: calc(100vh - 120px);
    display: grid;
    grid-template-rows: auto 1fr;
  }

  .alc-col-elements .alc-inventory {
    max-height: none;
    min-height: 0;
    height: 100%;
  }

  .alc-col-elements .alc-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1100px) {
  .alc-col-elements .alc-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.alc-pop {
  animation: alc-pop 0.45s ease;
}

@keyframes alc-pop {
  0% {
    transform: scale(0.86);
    opacity: 0.4;
  }
  60% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.alc-section-title {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

.alc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.alc-chip {
  position: relative;
  display: grid;
  gap: 2px;
  place-items: center;
  padding: 10px 4px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface, var(--card));
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  width: 100%;
}

.alc-chip-shell {
  position: relative;
  min-width: 0;
  display: grid;
  gap: 4px;
  align-content: start;
}

.alc-chip-tools,
.alc-result-tools {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
}

.alc-chip-tools {
  position: static;
  z-index: auto;
  padding: 0 2px 2px;
}

.alc-result-tools {
  margin-top: 6px;
}

.alc-result-tools .alc-chip-tools {
  padding: 0;
}

.alc-tool-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 88%, #fff);
  font-size: 0.68rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  color: var(--ink-soft);
  flex-shrink: 0;
}

.alc-tool-btn svg {
  width: 12px;
  height: 12px;
  display: block;
}

.alc-tool-btn .alc-icon-bookmark path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linejoin: round;
}

.alc-tool-btn.is-on .alc-icon-bookmark path {
  fill: currentColor;
  stroke: none;
}

.alc-tool-btn:hover,
.alc-tool-btn:focus-visible {
  border-color: color-mix(in srgb, #ff7420 45%, var(--line));
  outline: none;
  color: var(--ink);
}

.alc-tool-btn.is-on {
  border-color: color-mix(in srgb, #2e7d32 40%, var(--line));
  background: rgba(126, 240, 195, 0.28);
  color: #1b5e20;
}

.alc-tool-btn.alc-tool-pen.is-on {
  border-color: color-mix(in srgb, #ff7420 40%, var(--line));
  background: color-mix(in srgb, #ff7420 14%, var(--card));
  color: #b34a00;
}

.alc-link-notice {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(20, 16, 12, 0.45);
  backdrop-filter: blur(4px);
}

.alc-link-notice-card {
  width: min(100%, 360px);
  display: grid;
  gap: 10px;
  padding: 18px 16px 14px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.alc-link-notice-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.alc-link-notice-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.45;
}

.alc-link-notice-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--ink-soft);
}

.alc-link-notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

.write-alchemy-btn {
  margin-top: 8px;
}

.write-alchemy-empty {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.4;
}

.write-alchemy-list {
  margin-top: 14px;
}

.write-alchemy-list-title {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.write-char-chip.is-alchemy {
  border-color: color-mix(in srgb, #ff7420 35%, var(--line));
  background: color-mix(in srgb, #ff7420 8%, var(--card));
}

.alc-chip:active:not(:disabled) {
  transform: scale(0.96);
}

.alc-chip.is-selected {
  border-color: #5b4cdb;
  box-shadow: 0 0 0 2px rgba(91, 76, 219, 0.2);
}

.alc-chip.is-slot-a {
  border-color: #5b4cdb;
  background: color-mix(in srgb, #5b4cdb 14%, var(--card));
}

.alc-chip.is-slot-b {
  border-color: #2bb7ff;
  background: color-mix(in srgb, #2bb7ff 14%, var(--card));
  box-shadow: 0 0 0 2px rgba(43, 183, 255, 0.25);
}

.alc-chip.is-slot-pair {
  border-color: #5b4cdb;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, #5b4cdb 16%, var(--card)),
    color-mix(in srgb, #2bb7ff 16%, var(--card))
  );
  box-shadow: 0 0 0 2px rgba(91, 76, 219, 0.28);
}

.alc-chip-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 900;
  color: #fff;
  background: #5b4cdb;
}

.alc-chip-badge-pair {
  width: auto;
  min-width: 22px;
  padding: 0 5px;
  background: linear-gradient(135deg, #5b4cdb, #2bb7ff);
}

.alc-chip.is-slot-b .alc-chip-badge {
  background: #2bb7ff;
}

.alc-chip.is-locked {
  opacity: 0.55;
  cursor: default;
}

.alc-chip-emoji {
  font-size: 1.15rem;
  line-height: 1;
}

.alc-chip-zh {
  font-family: var(--font-zh);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.1;
}

.alc-chip-jyutping {
  font-size: calc(0.62rem * var(--font-jyutping-scale, 1));
  font-weight: 650;
  color: var(--ink-soft);
  line-height: 1.15;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alc-slot-jyutping,
.alc-result-jyutping,
.alc-fuse-piece-jyutping {
  font-size: calc(0.72rem * var(--font-jyutping-scale, 1));
  font-weight: 650;
  color: var(--ink-soft);
  line-height: 1.2;
}

.alc-chip-en {
  font-size: 0.58rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  padding: 0 2px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.alc-flash {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.alc-flash.soft {
  font-weight: 500;
  color: var(--ink-soft);
}

.alc-explore-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--orange) 28%, var(--line));
  text-align: center;
}

.alc-explore-found {
  display: grid;
  gap: 2px;
  place-items: center;
}

.alc-explore-found strong {
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  line-height: 1.15;
}

.alc-explore-found p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.alc-energy {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, #e3a008 12%, var(--card));
  border: 1px solid color-mix(in srgb, #e3a008 35%, var(--line));
}

.alc-energy-label {
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.alc-energy-pips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}

.alc-energy-pip {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
}

.alc-energy-pip.is-on {
  background: linear-gradient(135deg, #ffb020, #ff7420);
  box-shadow: 0 0 0 1px rgba(255, 116, 32, 0.25);
}

.alc-energy-count {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.alc-explore-flash {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(126, 240, 195, 0.16);
  border: 1px solid rgba(46, 183, 130, 0.3);
  font-weight: 700;
  font-size: 0.9rem;
}

/* Explore discovery moment — centered found-word celebration */
.alc-discover-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 18px max(16px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, #1a120c 52%, transparent);
  opacity: 0;
  transition: opacity 0.28s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.alc-discover-overlay.is-in {
  opacity: 1;
}

.alc-discover-overlay.is-out {
  opacity: 0;
  pointer-events: none;
}

.alc-discover-card {
  position: relative;
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
  width: min(92vw, 340px);
  padding: 28px 22px 22px;
  border: none;
  border-radius: 24px;
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--orange) 22%, transparent), transparent 55%),
    linear-gradient(165deg, #fff9f2, #ffe8d4 70%, #fff);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--orange) 35%, transparent),
    0 18px 48px rgba(26, 18, 12, 0.35);
  color: var(--ink, #2a2118);
  cursor: pointer;
  transform: scale(0.72);
  opacity: 0;
  outline: none;
}

.alc-discover-overlay.is-in .alc-discover-card {
  animation: alc-discover-scale-in 0.55s cubic-bezier(0.22, 1.15, 0.36, 1) forwards;
}

.alc-discover-glow {
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--orange-glow), transparent 68%);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.alc-discover-overlay.is-in .alc-discover-glow {
  animation: alc-discover-glow 1.1s ease 0.12s both;
}

.alc-discover-badge,
.alc-discover-emoji,
.alc-discover-zh,
.alc-discover-jyutping,
.alc-discover-en,
.alc-discover-where,
.alc-discover-hint {
  position: relative;
  z-index: 1;
}

.alc-discover-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--orange-bright), var(--orange));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0;
}

.alc-discover-overlay.is-in .alc-discover-badge {
  animation: alc-discover-settle 0.45s ease 0.28s both;
}

.alc-discover-emoji {
  font-size: 1.8rem;
  line-height: 1;
  margin-top: 4px;
}

.alc-discover-zh {
  font-size: clamp(3.2rem, 14vw, 4.6rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: #2a2118;
}

.alc-discover-jyutping {
  font-size: 1.05rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--orange-deep) 75%, #2a2118);
}

.alc-discover-en {
  font-size: 1.05rem;
  font-weight: 700;
  color: #4a3c2e;
}

.alc-discover-where {
  margin-top: 2px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #7a6a58;
}

.alc-discover-hint {
  margin-top: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #9a8774;
  opacity: 0;
}

.alc-discover-overlay.is-in .alc-discover-hint {
  animation: alc-discover-settle 0.4s ease 0.55s both;
}

@keyframes alc-discover-scale-in {
  0% {
    transform: scale(0.72);
    opacity: 0;
  }
  62% {
    transform: scale(1.06);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes alc-discover-glow {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }
  45% {
    opacity: 0.9;
    transform: scale(1.05);
  }
  100% {
    opacity: 0.35;
    transform: scale(1);
  }
}

@keyframes alc-discover-settle {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alc-discover-overlay.is-reduced,
.alc-discover-overlay.is-reduced.is-in {
  opacity: 1;
  transition: none;
}

.alc-discover-overlay.is-reduced .alc-discover-card,
.alc-discover-overlay.is-reduced.is-in .alc-discover-card,
.alc-discover-overlay.is-reduced .alc-discover-glow,
.alc-discover-overlay.is-reduced .alc-discover-badge,
.alc-discover-overlay.is-reduced .alc-discover-hint {
  animation: none !important;
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .alc-discover-overlay {
    transition: none;
  }

  .alc-discover-overlay.is-in .alc-discover-card,
  .alc-discover-overlay.is-in .alc-discover-glow,
  .alc-discover-overlay.is-in .alc-discover-badge,
  .alc-discover-overlay.is-in .alc-discover-hint {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}

.alc-region-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 720px) {
  .alc-region-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.alc-region {
  display: grid;
  gap: 4px;
  justify-items: start;
  text-align: left;
  padding: 14px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, #2bb7ff 16%, transparent), transparent 55%),
    var(--card);
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.alc-region:hover:not(:disabled),
.alc-region:focus-visible:not(:disabled) {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, #2bb7ff 50%, var(--line));
  outline: none;
}

.alc-region:active:not(:disabled) {
  transform: scale(0.98);
}

.alc-region:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.alc-region-emoji {
  font-size: 1.45rem;
  line-height: 1;
}

.alc-region strong {
  font-size: 1rem;
  font-weight: 900;
}

.alc-region small {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.3;
}

.alc-region-meta {
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #2b7fdb;
}

.alc-split-bonus {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.9;
}

#alc-split {
  display: grid;
  gap: 2px;
  justify-items: center;
  text-align: center;
  width: 100%;
}

@media (max-width: 420px) {
  .alc-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .alchemy-spotlight {
    grid-template-columns: auto 1fr;
  }
  .alchemy-spotlight-cta {
    grid-column: 1 / -1;
    justify-self: stretch;
    text-align: center;
  }
}

.games-solo-block {
  display: grid;
  gap: 10px;
}

.games-solo-block + .games-solo-block {
  margin-top: 6px;
}

.games-section-label {
  margin: 4px 2px 0;
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-deep);
}

.games-solo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 560px) {
  .games-solo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.game-solo-card {
  padding: 12px 8px 14px !important;
  text-align: center;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.game-solo-card h2 {
  margin: 0 0 2px !important;
  font-size: 0.88rem !important;
}

.game-solo-card .game-card-icon {
  font-size: 1.4rem;
  margin-bottom: 2px;
}

.game-solo-card p {
  font-size: 0.72rem;
}

.game-solo-card-sub {
  margin: 0 !important;
  color: var(--ink-soft);
  line-height: 1.3;
}

@media (max-width: 380px) {
  .battle-spotlight {
    grid-template-columns: auto 1fr;
  }
  .battle-spotlight-cta {
    grid-column: 1 / -1;
    text-align: center;
  }
}

.game-switcher {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0 0 14px;
}

.game-switcher.is-compact {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 4px;
  margin: 0 0 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.game-switcher.is-compact::-webkit-scrollbar {
  display: none;
}

@media (max-width: 420px) {
  .game-switcher:not(.is-compact) {
    grid-template-columns: repeat(2, 1fr);
  }
}

.practice-dice-bar {
  display: flex;
  justify-content: center;
  margin: 0 0 12px;
}

.practice-dice-btn {
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 16px;
  background: color-mix(in srgb, var(--orange-bright) 18%, #fff);
  box-shadow: 0 6px 16px rgba(255, 116, 32, 0.18);
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.practice-dice-btn:hover {
  transform: translateY(-1px) rotate(-8deg);
  box-shadow: 0 8px 20px rgba(255, 116, 32, 0.24);
}

.practice-dice-btn:active {
  transform: scale(0.94) rotate(12deg);
}

.practice-mode-bar-label {
  margin: 0 0 8px;
  font-family: var(--font-en);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.practice-mode-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.practice-mode-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 76px;
  padding: 10px 8px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--surface-soft);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.practice-mode-chip.active {
  border-color: var(--orange);
  background: linear-gradient(145deg, var(--panel-grad-a), var(--panel-grad-b));
}

.practice-mode-chip-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.practice-hub h1 {
  margin: 0 0 8px;
}

.practice-hub-chill {
  text-align: center;
}

.chill-eyebrow {
  margin: 0 0 6px;
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.chill-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin: 16px 0 8px;
}

.chill-preview-game {
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.95rem;
}

.chill-mix-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--orange) 16%, var(--surface));
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.88rem;
}

.chill-mix-arrow {
  opacity: 0.55;
}

.practice-mode-bar-chill {
  text-align: center;
  padding: 10px 12px 12px;
}

.practice-mode-bar-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.xp-mini-jar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 0 0 14px;
  min-height: 36px;
}

.xp-chart {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 160px;
  padding: 8px 4px 0;
}

.xp-chart-time.is-day {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.xp-chart-time.is-week {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.xp-chart-time.is-month {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

@media (min-width: 520px) {
  .xp-chart-time.is-month {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
}

.xp-chart-col {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.xp-chart-bar-wrap {
  display: flex;
  align-items: flex-end;
  height: 120px;
  width: 100%;
}

.xp-chart-bar {
  width: 100%;
  max-width: 42px;
  margin: 0 auto;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #ffe566, #f0b429);
  box-shadow: 0 6px 14px color-mix(in srgb, #f0b429 40%, transparent);
}

.xp-chart-time .xp-chart-bar {
  max-width: none;
}

.xp-chart-count {
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.9rem;
}

.xp-chart-time.is-month .xp-chart-count {
  font-size: 0.72rem;
}

.xp-chart-label {
  font-size: 0.72rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.2;
}

.xp-chart-sub {
  font-size: 0.62rem;
  color: var(--ink-soft);
  opacity: 0.8;
}

.word-jar-wrap {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.word-jar {
  position: relative;
  width: min(420px, 92vw);
  aspect-ratio: 3 / 4;
  margin: 0 auto;
  overflow: visible;
  background: transparent;
}

.word-jar-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  z-index: 0;
}

.word-jar-glass {
  position: absolute;
  z-index: 1;
  left: 15%;
  right: 15%;
  top: 16%;
  bottom: 8%;
  min-height: 0;
  padding: 10px 6px 14px;
  border: none;
  border-radius: 10px 10px 42px 42px;
  background: transparent;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.word-jar-mountain {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-end;
  justify-content: center;
  align-items: center;
  gap: 5px 4px;
  flex: 1;
  min-height: 0;
  pointer-events: auto;
}

.word-jar-pebble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: 100%;
  height: auto;
  min-height: 1.5em;
  padding: 0.28em 0.62em;
  border-radius: 999px;
  border: none;
  background: var(--fam, var(--orange));
  color: var(--fam-ink, #fff);
  font-size: clamp(0.62rem, 2.4vw, 0.78rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow:
    0 1px 0 color-mix(in srgb, white 45%, transparent),
    0 2px 4px color-mix(in srgb, var(--fam, var(--orange)) 35%, transparent);
  text-shadow: none;
  overflow: visible;
  transform: none;
  filter: none;
  clip-path: none;
}

.word-jar-pebble.is-drop {
  animation: jar-drop 0.7s var(--ease, ease) both;
  animation-delay: var(--delay, 0ms);
}

.word-jar-empty {
  margin: 0;
  padding: 0 12px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.35;
}

.xp-mini-pebble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fam, var(--orange)) 82%, white);
  color: #2d2218;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.15;
  border: 1.5px solid color-mix(in srgb, var(--fam, var(--orange)) 55%, var(--ink) 12%);
  box-shadow: 0 1px 0 color-mix(in srgb, white 70%, transparent);
  text-shadow: none;
  white-space: nowrap;
}

.xp-mini-pebble.is-drop {
  animation: jar-drop 0.7s var(--ease, ease) both;
  animation-delay: var(--delay, 0ms);
}

@keyframes jar-drop {
  from {
    opacity: 0;
    transform: translateY(-28px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.words-xp-panel {
  margin-bottom: 14px;
}

.words-streak-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.words-streak-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.words-streak-flame {
  font-size: 1.6rem;
  line-height: 1;
}

.words-streak-num {
  display: block;
  font-family: var(--font-en);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.words-streak-label {
  display: block;
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.words-streak-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.words-streak-nudge {
  color: color-mix(in srgb, var(--orange-deep) 75%, var(--ink-soft));
}

.words-achieve {
  display: grid;
  gap: 14px;
  margin-bottom: 4px;
}

.words-achieve-total {
  display: grid;
  justify-items: center;
  gap: 2px;
  text-align: center;
}

.words-achieve-num {
  font-family: var(--font-en);
  font-weight: 900;
  font-size: clamp(2.6rem, 9vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--orange-deep);
}

.words-achieve-label {
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.words-achieve-periods {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.words-achieve-period {
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: 12px 8px 10px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--surface-soft);
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.words-achieve-period:hover {
  border-color: color-mix(in srgb, var(--orange) 45%, var(--line));
}

.words-achieve-period.active {
  border-color: var(--orange);
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--orange) 14%, var(--surface)),
    var(--surface)
  );
  box-shadow: 0 6px 16px var(--orange-glow);
}

.words-achieve-period-num {
  font-family: var(--font-en);
  font-weight: 900;
  font-size: clamp(1.45rem, 5vw, 1.85rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.words-achieve-period.active .words-achieve-period-num {
  color: var(--orange-deep);
}

.words-achieve-period-label {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.words-xp-hint {
  margin: 10px 0 8px;
}

.words-viz-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.words-xp-stage {
  margin-top: 14px;
}

.practice-ladder {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.practice-ladder-item {
  display: grid;
  grid-template-columns: 28px 36px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--surface-soft);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.practice-ladder-item.active {
  border-color: var(--orange);
  background: linear-gradient(145deg, var(--panel-grad-a), var(--panel-grad-b));
  box-shadow: 0 8px 22px var(--orange-glow);
}

.practice-ladder-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 116, 32, 0.14);
  color: var(--orange-deep);
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 0.8rem;
}

.practice-ladder-icon {
  font-size: 1.4rem;
  text-align: center;
}

.practice-ladder-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.practice-ladder-copy strong {
  font-family: var(--font-en);
  font-size: 0.95rem;
}

.practice-ladder-copy small {
  color: var(--ink-soft);
  font-family: var(--font-en);
  font-size: 0.78rem;
  line-height: 1.35;
}

.practice-ladder-default,
.practice-ladder-pick {
  font-family: var(--font-en);
  font-size: 0.68rem;
  font-weight: 900;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.practice-ladder-default {
  background: rgba(67, 160, 71, 0.16);
  color: #2e7d32;
}

.practice-ladder-pick {
  background: rgba(255, 116, 32, 0.16);
  color: var(--orange-deep);
}

html[data-theme="dark"] .practice-ladder-default {
  color: #81c784;
}

html[data-theme="dark"] .practice-mode-chip,
html[data-theme="dark"] .practice-ladder-item {
  background: var(--surface-soft);
}

.game-switch-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 72px;
  padding: 12px 8px;
  border-radius: 16px;
  border: 2px solid transparent;
  background: linear-gradient(145deg, var(--panel-grad-a), var(--panel-grad-b));
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  font-family: var(--font-en);
  font-weight: 800;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.game-switch-btn:active {
  transform: scale(0.97);
}

.game-switch-btn.active {
  border-color: var(--orange);
  box-shadow: 0 10px 24px var(--orange-glow);
  background: linear-gradient(145deg, var(--panel-grad-a), var(--panel-grad-b));
}

.game-switch-icon {
  font-size: 1.55rem;
  line-height: 1;
}

.game-switch-label {
  font-size: 0.92rem;
}

.game-switcher.is-compact .game-switch-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  padding: 5px 2px 4px;
  gap: 1px;
  border-radius: 12px;
  border-width: 1.5px;
  box-shadow: none;
}

.game-switcher.is-compact .game-switch-icon {
  font-size: 1.1rem;
}

.game-switcher.is-compact .game-switch-label {
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.practice-dice-btn.is-compact {
  flex: 0 0 40px;
  width: 40px;
  min-height: 44px;
  height: auto;
  border-radius: 12px;
  font-size: 1.12rem;
  box-shadow: none;
  align-self: stretch;
}

.game-scope-banner {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(47, 128, 237, 0.1);
  color: var(--ink-soft);
  font-family: var(--font-en);
  font-size: 0.9rem;
}

.game-scope-banner strong {
  color: var(--ink);
}

.game-scope-count {
  margin: 0 0 8px;
  font-family: var(--font-en);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.game-filters-card {
  margin: 16px 0;
}

.game-filter-hint {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.game-filter-fam-row {
  align-items: flex-start;
}

.game-fam-range {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.game-fam-range-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.game-fam-range-label select {
  min-width: 120px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 0.88rem;
}

.game-filter-block {
  margin-top: 16px;
}

.game-filter-block > label {
  font-family: var(--font-en);
  font-weight: 800;
  color: var(--ink);
}

.game-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.game-filter-chip {
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease, color 0.12s ease;
}

.game-filter-chip.active,
.game-filter-chip[aria-pressed="true"] {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 22%, var(--surface));
  color: var(--orange-deep);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--orange) 40%, transparent),
    0 4px 12px var(--orange-glow);
  font-weight: 900;
}

.game-filter-lessons-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.game-filter-lesson-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.game-lesson-checklist {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 220px;
  overflow: auto;
  padding: 4px 2px 8px;
}

.game-lesson-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  cursor: pointer;
}

.game-lesson-check input {
  margin-top: 3px;
  accent-color: var(--orange);
}

.game-lesson-check-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.game-lesson-check-title {
  font-family: var(--font-zh);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.game-lesson-check-meta {
  font-family: var(--font-en);
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.game-results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

.game-results-switch-hint {
  text-align: center;
  margin: 12px 0 0;
  font-family: var(--font-en);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.btn-lg {
  padding: 14px 22px;
  font-size: 1.05rem;
}

.settings-card,
.game-card,
.star-card {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 149, 51, 0.12);
}

.settings-card h2,
.game-card h2 {
  margin: 0 0 14px;
  font-family: var(--font-en);
  font-size: 1rem;
  font-weight: 900;
  color: var(--orange-deep);
}

.settings-fold > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-en);
  font-size: 1rem;
  font-weight: 900;
  color: var(--orange-deep);
}

.settings-fold > summary::-webkit-details-marker {
  display: none;
}

.settings-fold > summary::after {
  content: "▸";
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  transition: transform 0.15s ease;
}

.settings-fold[open] > summary::after {
  transform: rotate(90deg);
}

.settings-fold[open] > summary {
  margin-bottom: 12px;
}

.settings-fold-meta {
  margin-left: auto;
  margin-right: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.settings-lead {
  margin: 0 0 12px;
  color: var(--ink-soft);
  line-height: 1.45;
  font-size: 0.88rem;
}

.settings-card .plan-compare {
  margin: 0 0 14px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.setting-row:first-of-type {
  border-top: none;
  padding-top: 0;
}

.setting-row label {
  font-weight: 700;
}

.setting-row p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.45;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--peach);
}

.segmented button {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--ink-soft);
  cursor: pointer;
}

.segmented button.active {
  background: var(--surface);
  color: var(--orange-deep);
  box-shadow: 0 4px 12px rgba(232, 90, 0, 0.15);
}

.font-preview {
  margin-top: 16px;
  padding: 16px;
  border-radius: 16px;
  background: var(--cream);
  text-align: center;
  border: 1px solid var(--line);
}

.font-preview-zh {
  margin: 0;
  font-family: var(--font-zh);
  font-size: calc(2rem * var(--font-zh-scale));
  font-weight: 700;
  line-height: 1.2;
}

.font-preview-jyutping {
  margin: 6px 0 0;
  font-family: var(--font-en);
  font-size: calc(1.05rem * var(--font-jyutping-scale));
  font-weight: 800;
  color: var(--blue-deep);
}

.font-preview-meaning {
  margin: 6px 0 0;
  font-family: var(--font-en);
  font-size: calc(1rem * var(--font-meaning-scale));
  color: var(--ink-soft);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--orange);
}

.speed-value {
  font-family: var(--font-en);
  font-weight: 900;
  color: var(--orange-deep);
}

.game-card {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.star-item {
  width: 100%;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font: inherit;
  text-align: left;
}

.star-item-main {
  width: 100%;
}

.star-item .mini-star {
  pointer-events: auto;
}

.words-panel {
  padding-bottom: 24px;
}

.words-hero {
  margin: 0 0 14px;
}

.words-hero h1 {
  margin: 0 0 6px;
  font-family: var(--font-en);
  font-size: 1.45rem;
  font-weight: 900;
}

.words-hero p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.words-filters h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.words-practice-actions {
  flex-wrap: wrap;
}

.words-practice-actions .btn {
  flex: 1 1 140px;
  justify-content: center;
  text-align: center;
}

.words-fam-ticks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.words-fam-tick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.words-fam-tick input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.words-fam-tick.is-on {
  border-color: var(--fam, var(--orange));
  background: color-mix(in srgb, var(--fam, var(--orange)) 14%, var(--surface));
}

.words-fam-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--fam, #888);
}

.words-filter-block {
  margin-top: 12px;
}

.words-filter-block > label {
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.88rem;
}

.words-recent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.words-recent-chip {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.words-recent-chip:hover:not(.active):not([aria-pressed="true"]) {
  border-color: color-mix(in srgb, var(--orange) 45%, var(--line));
}

.words-recent-chip:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.words-recent-chip.active,
.words-recent-chip[aria-pressed="true"] {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 22%, var(--surface));
  color: var(--orange-deep);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--orange) 40%, transparent),
    0 4px 12px var(--orange-glow);
}

.words-fam-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  font-family: var(--font-en);
  color: #fff;
  background: var(--fam, #888);
  margin-right: 4px;
  vertical-align: middle;
}

.words-item small {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.words-read-recent-sub {
  margin-top: 4px;
}

.words-unread-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  font-family: var(--font-en);
  letter-spacing: 0.02em;
  color: #92400e;
  background: rgba(251, 191, 36, 0.35);
  border: 1px solid rgba(180, 83, 9, 0.22);
}

.words-item.is-unread-word {
  border-color: color-mix(in srgb, #f59e0b 35%, var(--line));
}

.game-card:active {
  transform: scale(0.98);
}

.game-card-icon {
  font-size: 1.55rem;
  margin-bottom: 4px;
}

.game-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.35;
}

.games-hub .game-card {
  padding: 12px 12px 14px;
  text-align: center;
}

.games-hub .game-card h2 {
  margin: 0 0 4px;
  font-size: 0.92rem;
}

.game-card-featured {
  border: 2px solid var(--orange-bright);
  background: linear-gradient(145deg, var(--panel-grad-a), var(--panel-grad-b));
}

.game-tag {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-family: var(--font-en);
  font-size: 0.65rem;
  font-weight: 900;
}

/* Fill the blanks — 活字印刷 HK heritage theme */
.teng-setup .teng-eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #92400e;
}

.teng-setup-lead {
  margin: 0 0 4px;
  color: var(--ink-soft);
  line-height: 1.45;
  font-size: 0.92rem;
}

.teng-screen {
  gap: 12px;
}

.teng-round {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-soft);
  font-family: var(--font-en);
}

/* Wooden type case + composing stick */
.teng-typecase {
  position: relative;
  padding: 14px 14px 12px;
  border-radius: 12px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(120, 72, 32, 0.08) 0,
      rgba(120, 72, 32, 0.08) 1px,
      transparent 1px,
      transparent 18px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(90, 52, 24, 0.06) 0,
      rgba(90, 52, 24, 0.06) 1px,
      transparent 1px,
      transparent 18px
    ),
    linear-gradient(165deg, #c4956a 0%, #a0714a 38%, #8b5e3c 100%);
  border: 3px solid #6b4423;
  box-shadow:
    inset 0 2px 0 rgba(255, 220, 170, 0.35),
    inset 0 -3px 6px rgba(0, 0, 0, 0.18),
    0 8px 0 #5c3a1f,
    var(--shadow);
  color: #3f2a14;
}

html[data-theme="dark"] .teng-typecase {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.12) 0,
      rgba(0, 0, 0, 0.12) 1px,
      transparent 1px,
      transparent 18px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.1) 0,
      rgba(0, 0, 0, 0.1) 1px,
      transparent 1px,
      transparent 18px
    ),
    linear-gradient(165deg, #4a3528 0%, #362820 38%, #2a1f18 100%);
  border-color: #3d2a1c;
  color: #f5e6c8;
  box-shadow:
    inset 0 2px 0 rgba(255, 220, 170, 0.08),
    inset 0 -3px 6px rgba(0, 0, 0, 0.35),
    0 8px 0 #1a120c,
    var(--shadow);
}

.teng-typecase-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px dashed rgba(63, 42, 20, 0.28);
  font-family: var(--font-zh);
  font-weight: 800;
  font-size: 0.98rem;
  letter-spacing: 0.08em;
}

html[data-theme="dark"] .teng-typecase-head {
  border-bottom-color: rgba(245, 230, 200, 0.18);
}

.teng-typecase-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.teng-typecase-note {
  margin: -2px 0 10px;
  text-align: center;
  font-size: 0.76rem;
  line-height: 1.25;
  color: rgba(63, 42, 20, 0.78);
}

.teng-typecase-no {
  font-family: var(--font-en);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  opacity: 0.75;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

html[data-theme="dark"] .teng-typecase-no {
  background: rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .teng-typecase-note {
  color: rgba(245, 230, 200, 0.78);
}

.teng-paper {
  position: relative;
  overflow: hidden;
  padding: 12px 10px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 252, 245, 0.96) 0%, rgba(248, 240, 225, 0.94) 100%);
  border: 1px solid rgba(120, 72, 32, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

html[data-theme="dark"] .teng-paper {
  background: linear-gradient(180deg, rgba(58, 48, 38, 0.92) 0%, rgba(42, 34, 28, 0.94) 100%);
  border-color: rgba(245, 230, 200, 0.12);
}

.teng-sentence {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
  z-index: 1;
  gap: 8px;
  min-height: 56px;
  align-items: center;
  font-family: var(--font-zh);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.35;
}

.teng-print-burst {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%) scale(0.82);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(31, 122, 56, 0.92);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 10px rgba(31, 122, 56, 0.22);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

.teng-typecase.is-printed .teng-paper::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(31, 122, 56, 0.16) 50%, transparent 100%);
  animation: teng-print-sweep 0.42s ease;
  pointer-events: none;
}

.teng-typecase.is-printed .teng-print-burst {
  animation: teng-print-burst 0.42s ease;
}

/* Metal type blocks */
.teng-type-face {
  display: block;
  line-height: 1;
}

.teng-chip {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 6px;
  background:
    linear-gradient(180deg, #e8edf2 0%, #b8c0c8 42%, #8a939c 100%);
  border: 1px solid #5c6570;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.75),
    inset 0 -2px 0 rgba(0, 0, 0, 0.12),
    0 3px 0 #4a525a,
    0 4px 6px rgba(0, 0, 0, 0.15);
  color: #1a1f24;
  transform: translateY(0);
}

html[data-theme="dark"] .teng-chip {
  background: linear-gradient(180deg, #9aa3ad 0%, #6f7882 42%, #525a63 100%);
  border-color: #3d444c;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.25),
    inset 0 -2px 0 rgba(0, 0, 0, 0.25),
    0 3px 0 #2a3036,
    0 4px 6px rgba(0, 0, 0, 0.35);
  color: #0f1216;
}

.teng-chip.is-filled {
  background:
    linear-gradient(180deg, #d4f5dc 0%, #7ecf8e 42%, #3d9f55 100%);
  border-color: #1f7a38;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 0 rgba(0, 0, 0, 0.1),
    0 3px 0 #1a5c2e,
    0 4px 8px rgba(22, 163, 74, 0.25);
  animation: teng-stamp 0.45s ease;
}

html[data-theme="dark"] .teng-chip.is-filled {
  background: linear-gradient(180deg, #6ecf88 0%, #3d9f55 42%, #2a7a3f 100%);
  border-color: #1f7a38;
}

.teng-blank {
  display: inline-grid;
  place-items: center;
  min-width: 52px;
  min-height: 44px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 2px dashed #5c6570;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(200, 205, 210, 0.25) 100%);
  color: #5c6570;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
  animation: teng-pulse 1.4s ease-in-out infinite;
}

.teng-blank-slot {
  font-size: 1.1rem;
  opacity: 0.55;
  letter-spacing: 0;
}

html[data-theme="dark"] .teng-blank {
  border-color: #8a939c;
  color: #b8c0c8;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.12) 100%);
}

.teng-hint-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 4px;
}

.teng-hint-flash {
  margin: 6px 0 0;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  color: #5c3a1f;
  animation: teng-fade 1s ease;
}

.teng-hint-jp {
  font-family: var(--font-en);
  letter-spacing: 0.02em;
}

html[data-theme="dark"] .teng-hint-flash {
  color: #e8c9a0;
}

.teng-tray-label {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  font-family: var(--font-zh);
}

/* Character tray — type case grid */
.teng-tray {
  padding: 10px;
  border-radius: 12px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(120, 72, 32, 0.1) 0,
      rgba(120, 72, 32, 0.1) 1px,
      transparent 1px,
      transparent 14px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(90, 52, 24, 0.08) 0,
      rgba(90, 52, 24, 0.08) 1px,
      transparent 1px,
      transparent 14px
    ),
    linear-gradient(165deg, #b8895c 0%, #966842 100%);
  border: 2px solid #6b4423;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.12);
}

html[data-theme="dark"] .teng-tray {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.15) 0,
      rgba(0, 0, 0, 0.15) 1px,
      transparent 1px,
      transparent 14px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.12) 0,
      rgba(0, 0, 0, 0.12) 1px,
      transparent 1px,
      transparent 14px
    ),
    linear-gradient(165deg, #3d2e22 0%, #2a2118 100%);
  border-color: #3d2a1c;
}

.teng-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.teng-choice {
  min-height: 56px;
  border-radius: 8px;
  border: 1px solid #5c6570;
  background:
    linear-gradient(180deg, #eef2f5 0%, #b8c0c8 45%, #8a939c 100%);
  font-family: var(--font-zh);
  font-size: 1.25rem;
  font-weight: 800;
  color: #1a1f24;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.8),
    inset 0 -2px 0 rgba(0, 0, 0, 0.1),
    0 4px 0 #4a525a,
    0 5px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

html[data-theme="dark"] .teng-choice {
  background: linear-gradient(180deg, #9aa3ad 0%, #6f7882 45%, #525a63 100%);
  border-color: #3d444c;
  color: #0f1216;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.22),
    inset 0 -2px 0 rgba(0, 0, 0, 0.22),
    0 4px 0 #2a3036,
    0 5px 8px rgba(0, 0, 0, 0.3);
}

.teng-choice:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    0 1px 0 #4a525a;
}

.teng-choice.is-correct {
  border-color: #1f7a38;
  background: linear-gradient(180deg, #d4f5dc 0%, #7ecf8e 45%, #3d9f55 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    0 4px 0 #1a5c2e;
}

.teng-choice.is-wrong {
  border-color: #b91c1c;
  background: linear-gradient(180deg, #fecaca 0%, #f87171 45%, #dc2626 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    0 4px 0 #991b1b;
  opacity: 0.9;
}

.teng-choice:disabled {
  cursor: default;
}

.teng-feedback {
  margin: 4px 0 0;
  text-align: center;
  min-height: 1.3em;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.teng-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ─── Comprehension game ─── */
.comp-screen {
  gap: 14px;
}

.comp-round {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-soft);
  font-family: var(--font-en);
}

.comp-passage {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
}

.comp-passage-hidden {
  text-align: center;
  min-height: 72px;
  display: grid;
  place-items: center;
}

.comp-passage-hint {
  margin: 0;
  font-family: var(--font-en);
  font-weight: 700;
  color: var(--ink-soft);
}

.comp-passage-source {
  margin: 0 0 10px;
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.comp-passage-line {
  margin: 0 0 8px;
  font-family: var(--font-zh);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.45;
}

.comp-passage-line:last-child {
  margin-bottom: 0;
}

.comp-passage-jp {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  font-family: var(--font-en);
}

html[data-jyutping="off"] .comp-passage-jp {
  display: none;
}

.comp-question-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  border: 2px solid color-mix(in srgb, var(--brand) 25%, var(--line));
}

.comp-question-label {
  margin: 0 0 6px;
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}

.comp-question {
  margin: 0;
  font-family: var(--font-en);
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
}

.comp-question-hint {
  margin: 8px 0 0;
  font-family: var(--font-en);
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.comp-choices {
  display: grid;
  gap: 8px;
}

.comp-choice {
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--surface);
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.35;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}

.comp-choice:active:not(:disabled) {
  transform: scale(0.99);
}

.comp-choice.is-correct {
  border-color: #16a34a;
  background: color-mix(in srgb, #16a34a 12%, var(--surface));
}

.comp-choice.is-wrong {
  border-color: #dc2626;
  background: color-mix(in srgb, #dc2626 10%, var(--surface));
}

.comp-choice:disabled {
  cursor: default;
}

.comp-feedback {
  margin: 0;
  text-align: center;
  min-height: 1.3em;
  font-family: var(--font-en);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.comp-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.comp-setup-block {
  margin-top: 16px;
}

.comp-level-row,
.comp-mode-row {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.comp-level-btn {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font-en);
  color: var(--ink);
}

.comp-level-btn strong {
  font-size: 0.92rem;
}

.comp-level-btn small {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.35;
}

.comp-level-btn.active,
.comp-mode-btn.active {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 35%, transparent);
}

.comp-mode-row {
  grid-template-columns: 1fr 1fr;
}

.comp-mode-btn {
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--surface);
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--ink);
}

@keyframes teng-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.03);
    opacity: 0.85;
  }
}

@keyframes teng-stamp {
  0% {
    transform: scale(1.15) translateY(-4px);
    opacity: 0.6;
  }
  55% {
    transform: scale(0.94) translateY(2px);
    opacity: 1;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

@keyframes teng-print-sweep {
  0% {
    transform: translateX(-105%);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translateX(105%);
    opacity: 0;
  }
}

@keyframes teng-print-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.82);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -58%) scale(1.04);
  }
}

@keyframes teng-pop {
  from {
    transform: scale(0.86);
  }
  to {
    transform: scale(1);
  }
}

@keyframes teng-fade {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }
  15% {
    opacity: 1;
    transform: translateY(0);
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Connect the MTR — sentence builder */
.lego-screen {
  gap: 14px;
}

.mtr-screen {
  --mtr-silver: var(--surface);
  --mtr-silver-light: var(--surface);
  --mtr-red: #e53935;
  --mtr-red-deep: #c62828;
  --mtr-blue: #1e4db7;
  --mtr-blue-soft: #e8f0ff;
  --mtr-rail: #1e4db7;
  --mtr-platform: var(--surface);
  --mtr-platform-mid: #d6e4ff;
  --mtr-rail-gap: #fff;
}

html[data-theme="dark"] .mtr-screen {
  --mtr-blue: #5b8def;
  --mtr-blue-soft: #1a2838;
  --mtr-rail: #5b8def;
  --mtr-platform-mid: #243248;
  --mtr-rail-gap: #3a4658;
}

.mtr-platform {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, var(--surface) 0%, var(--mtr-blue-soft) 55%, var(--mtr-platform-mid) 100%);
  box-shadow: inset 0 0 0 2px rgba(30, 77, 183, 0.15), var(--shadow);
  padding: 18px 12px 10px;
  min-height: 120px;
}

.mtr-platform-roof {
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 10px;
  background: linear-gradient(90deg, transparent, rgba(30, 77, 183, 0.18), transparent);
  border-radius: 0 0 8px 8px;
  opacity: 0.9;
}

.mtr-train.mtr-connected .mtr-car {
  box-shadow: 0 6px 14px rgba(30, 77, 183, 0.22);
}

.mtr-train.mtr-connected .mtr-car.is-cab::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff 0 22%, var(--mtr-red) 23% 100%);
  box-shadow: 0 0 0 1px rgba(198, 40, 40, 0.35);
  z-index: 3;
}

.mtr-train.mtr-departing {
  animation: mtr-depart-left 0.85s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes mtr-depart-left {
  0% {
    transform: translateX(0);
    filter: blur(0);
  }
  35% {
    transform: translateX(-8%);
  }
  100% {
    transform: translateX(-120vw);
    filter: blur(1px);
  }
}

.mtr-rails {
  height: 6px;
  margin: 0 4px;
  background:
    repeating-linear-gradient(
      90deg,
      var(--mtr-blue) 0 10px,
      var(--mtr-rail-gap) 10px 18px
    ),
    linear-gradient(180deg, var(--mtr-blue), #163a8f);
  border-radius: 2px;
  box-shadow: 0 2px 0 rgba(30, 77, 183, 0.35);
}

.mtr-platform-edge {
  height: 10px;
  margin-top: 4px;
  border-radius: 0 0 10px 10px;
  background: var(--surface);
  border-top: 3px solid #f5c518;
  box-shadow: inset 0 0 0 1px rgba(30, 77, 183, 0.12);
}

.lego-block-inner,
.mtr-car-inner {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  line-height: 1.15;
  min-height: 58px;
  border-radius: 10px 10px 6px 6px;
  overflow: hidden;
  background: var(--surface);
  border: 2px solid var(--mtr-blue);
  box-shadow: 0 4px 10px rgba(30, 77, 183, 0.15);
}

.mtr-door {
  width: 9px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--mtr-red) 0%, var(--mtr-red-deep) 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.mtr-window {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 12px;
  min-width: 56px;
  background: linear-gradient(180deg, var(--mtr-blue-soft), var(--surface));
}

.lego-block-zh {
  font-family: var(--font-zh);
  color: var(--ink);
  font-weight: 800;
  font-size: calc(1.2rem * var(--font-zh-scale));
  line-height: 1.15;
}

.lego-block-jyutping {
  font-size: calc(0.78rem * var(--font-jyutping-scale));
  font-family: var(--font-en);
  font-weight: 800;
  letter-spacing: 0.02em;
  opacity: 0.95;
  color: var(--mtr-blue);
  line-height: 1.2;
}

.mtr-nose {
  width: 14px;
  flex-shrink: 0;
  background: linear-gradient(90deg, var(--mtr-blue), var(--mtr-rail-gap));
  border-radius: 12px 0 0 6px;
  position: relative;
}

.mtr-nose::after {
  content: "";
  position: absolute;
  inset: 10px 3px 10px 2px;
  border-radius: 8px 2px 2px 4px;
  background: var(--mtr-blue);
  opacity: 0.9;
}

.mtr-coupler {
  position: absolute;
  right: -5px;
  top: 50%;
  width: 8px;
  height: 10px;
  margin-top: -5px;
  background: var(--mtr-red);
  border-radius: 1px;
  opacity: 0.7;
  z-index: 2;
}

.mtr-car.is-cab .mtr-car-inner::after {
  content: "";
  position: absolute;
  left: 22px;
  bottom: 0;
  width: 28px;
  height: 8px;
  background: var(--mtr-blue);
  border-radius: 8px 8px 0 0;
  opacity: 0.95;
  z-index: 1;
}

.mtr-depart-btn {
  background: linear-gradient(135deg, var(--mtr-red), var(--mtr-red-deep)) !important;
  box-shadow: 0 10px 24px rgba(229, 57, 53, 0.35) !important;
}

.lego-built-empty {
  color: var(--mtr-blue);
  font-family: var(--font-en);
  font-size: 0.9rem;
  text-align: center;
  width: 100%;
  padding: 18px 8px;
  font-weight: 700;
}

.lego-round {
  text-align: center;
  font-family: var(--font-en);
  font-weight: 800;
  color: var(--ink-soft);
  margin: 0;
}

.lego-prompt,
.mtr-prompt {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
  color: var(--ink);
}

.lego-label {
  margin: 0 0 8px;
  font-family: var(--font-en);
  font-weight: 800;
  color: var(--mtr-blue, #1e4db7);
  font-size: 0.88rem;
}

.lego-meaning {
  margin: 0 0 12px;
  font-size: calc(1.25rem * var(--font-meaning-scale));
  font-weight: 700;
  line-height: 1.4;
}

.lego-hint {
  margin: 8px 0 0;
  font-family: var(--font-en);
  font-weight: 700;
  color: var(--mtr-blue);
  font-size: calc(0.95rem * var(--font-jyutping-scale));
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.82rem;
}

.lego-built,
.mtr-track {
  min-height: 78px;
  padding: 10px 8px 14px;
  border-radius: 0;
  background: transparent;
  border: none;
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  align-items: flex-end;
  justify-content: center;
  overflow: visible;
  position: relative;
  z-index: 2;
}

.mtr-train {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 10px;
  transition: gap 0.4s cubic-bezier(0.2, 0.9, 0.2, 1);
  will-change: transform;
}

.mtr-train.mtr-connected {
  gap: 0;
}

.mtr-train.mtr-connected .mtr-coupler {
  opacity: 0;
}

.mtr-platform.mtr-wrong {
  animation: match-shake 0.35s ease;
}

.lego-bank,
.mtr-yard {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 10px 4px;
}

.lego-block,
.mtr-car {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  border-radius: 10px 10px 6px 6px;
  font-size: 1.2rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease;
  background: transparent;
  overflow: visible;
}

.mtr-car-face {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1;
}

.mtr-car.is-cab .mtr-car-inner {
  border-radius: 16px 10px 6px 6px;
}

.lego-block-bank:active:not(:disabled) {
  transform: scale(0.96);
}

.lego-block-bank:disabled {
  opacity: 0.28;
  cursor: default;
}

.lego-block-placed {
  cursor: pointer;
}

.lego-block-placed:active {
  transform: translateY(1px);
}

.lego-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 12px;
}

.lego-feedback {
  text-align: center;
  font-family: var(--font-en);
  font-weight: 800;
  margin: 0;
  min-height: 1.4em;
}

.lego-feedback-ok {
  color: #16a34a;
}

.lego-feedback-bad {
  color: var(--mtr-red-deep, #c62828);
}

/* MTR Navigator game */
.mtr-nav-screen {
  max-width: 520px;
  margin: 0 auto;
}

.mtr-nav-mission {
  padding: 14px 16px;
  margin: 0 0 14px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.mtr-nav-mission-row {
  margin: 0 0 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-en);
}

.mtr-nav-mission-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
}

.mtr-nav-mission-you {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}

.mtr-nav-mission-go {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.mtr-nav-mission-zh {
  font-size: 1.05rem;
}

.mtr-nav-mission-spot {
  margin: 0 0 10px 0;
  padding-left: 4px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

.mtr-nav-subprompt {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.mtr-nav-mission-arrow {
  text-align: center;
  margin: 4px 0;
  font-size: 1.2rem;
  opacity: 0.5;
}

.mtr-nav-map-wrap {
  margin: 0 0 14px;
  padding: 10px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #e8f4fc 0%, #f5f0e8 55%, #ebe4dc 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

html[data-theme="dark"] .mtr-nav-map-wrap {
  background: linear-gradient(180deg, #1a2838 0%, #252018 55%, #1e1c18 100%);
}

.mtr-nav-map-svg {
  width: 100%;
  height: auto;
  display: block;
}

.mtr-nav-harbour {
  fill: rgba(0, 125, 197, 0.18);
}

.mtr-nav-harbour-label {
  fill: rgba(0, 90, 150, 0.55);
  font-size: 9px;
  font-family: var(--font-en);
  font-weight: 700;
}

.mtr-nav-station-dot {
  fill: #fff;
  stroke: #555;
  stroke-width: 2;
}

.mtr-nav-station-dot.is-from {
  stroke: #16a34a;
  stroke-width: 3;
}

.mtr-nav-station-dot.is-to {
  stroke: #dc2626;
  stroke-width: 3;
}

.mtr-nav-station-label {
  fill: var(--ink);
  font-size: 8px;
  font-family: var(--font-en);
  font-weight: 700;
}

.mtr-nav-line {
  opacity: 0.85;
}

.mtr-nav-pin {
  font-size: 14px;
}

.mtr-nav-map-hidden {
  text-align: center;
  padding: 24px 12px;
  margin: 0 0 14px;
  border-radius: var(--radius);
  background: var(--card);
  font-family: var(--font-en);
  font-weight: 700;
  color: var(--ink-soft);
}

.mtr-nav-prompt {
  text-align: center;
  font-family: var(--font-en);
  font-weight: 700;
  margin: 0 0 12px;
}

.mtr-nav-plan-btn {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 0 auto 12px;
}

.mtr-nav-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.mtr-nav-choice {
  text-align: left;
  white-space: normal;
  line-height: 1.35;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mtr-nav-choice-sub {
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 700;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

.mtr-nav-choice.is-correct {
  border-color: #16a34a;
  background: rgba(34, 197, 94, 0.1);
}

.mtr-nav-choice.is-wrong {
  opacity: 0.55;
}

.mtr-nav-feedback {
  text-align: center;
  font-family: var(--font-en);
  font-weight: 800;
  margin: 0 0 12px;
}

.mtr-nav-feedback.is-ok {
  color: #16a34a;
}

.mtr-nav-feedback.is-bad {
  color: #dc2626;
}

.mtr-nav-memory-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-family: var(--font-en);
  font-size: 0.9rem;
  cursor: pointer;
}

.mtr-nav-lines {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
}

.mtr-nav-line-card {
  padding: 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 88%, var(--surface));
  box-shadow: var(--shadow);
}

.mtr-nav-line-title {
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-en);
  font-weight: 800;
}

.mtr-nav-line-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex-shrink: 0;
}

.mtr-nav-station-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mtr-nav-station-pill {
  padding: 6px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 86%, var(--line));
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: baseline;
}

.mtr-nav-station-pill.is-on-route {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--orange) 34%, var(--line));
}

.mtr-nav-station-pill.is-transfer {
  background: color-mix(in srgb, var(--orange) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--orange) 45%, var(--line));
  color: var(--orange-deep);
}

@media (max-width: 860px) and (orientation: landscape) {
  .mtr-nav-screen {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 12px 16px;
    align-items: start;
  }

  .mtr-nav-screen .lego-round,
  .mtr-nav-screen .game-nav,
  .mtr-nav-screen .mtr-nav-feedback,
  .mtr-nav-screen .mtr-nav-prompt,
  .mtr-nav-screen .mtr-nav-plan-btn,
  .mtr-nav-screen #mtr-next,
  .mtr-nav-screen .mtr-nav-choices {
    grid-column: 1 / -1;
  }

  .mtr-nav-mission {
    grid-column: 2;
    margin: 0;
  }

  .mtr-nav-map-wrap,
  .mtr-nav-map-hidden {
    grid-column: 1;
    grid-row: 2 / span 4;
    margin: 0;
  }
}

@media (min-width: 1100px) {
  .mtr-nav-screen {
    max-width: min(1220px, calc(100vw - 32px));
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
    gap: 14px 20px;
    align-items: start;
  }

  .mtr-nav-screen .lego-round,
  .mtr-nav-screen .mtr-nav-lines {
    grid-column: 1 / -1;
  }

  .mtr-nav-map-wrap,
  .mtr-nav-map-hidden {
    grid-column: 1;
    grid-row: 2 / span 5;
    margin: 0;
  }

  .mtr-nav-mission,
  .mtr-nav-prompt,
  .mtr-nav-choices,
  .mtr-nav-feedback,
  .mtr-nav-plan-btn,
  .mtr-nav-screen #mtr-next {
    grid-column: 2;
    margin-left: 0;
    margin-right: 0;
  }

  .mtr-nav-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .mtr-nav-choice {
    min-height: 88px;
  }

  .mtr-nav-map-svg {
    min-height: 440px;
  }
}

/* Confirm dialog */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(45, 34, 24, 0.45);
  backdrop-filter: blur(4px);
}

.confirm-panel {
  width: min(360px, 100%);
  padding: 24px;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.confirm-panel h2 {
  margin: 0 0 10px;
  font-family: var(--font-en);
  color: var(--orange-deep);
}

.confirm-panel p {
  margin: 0 0 20px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.quiz-screen {
  display: grid;
  gap: 16px;
}

.quiz-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--peach);
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange-bright), var(--orange-deep));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.quiz-card {
  padding: 28px 20px;
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: center;
  border: 2px solid rgba(255, 149, 51, 0.2);
}

.quiz-prompt {
  margin: 0 0 8px;
  font-size: clamp(2rem, 9vw, 2.8rem);
  font-weight: 700;
}

.quiz-sub {
  margin: 0 0 20px;
  font-family: var(--font-en);
  font-weight: 800;
  color: var(--blue-deep);
  font-size: calc(1rem * var(--font-jyutping-scale));
}

.quiz-options {
  display: grid;
  gap: 10px;
}

.quiz-option {
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.quiz-option:hover {
  border-color: var(--orange-bright);
}

.quiz-option.correct {
  border-color: #22c55e;
  background: color-mix(in srgb, #22c55e 18%, var(--surface));
  color: var(--ink);
}

.quiz-option.wrong {
  border-color: #ef4444;
  background: color-mix(in srgb, #ef4444 18%, var(--surface));
  color: var(--ink);
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-score {
  text-align: center;
  padding: 32px 20px;
}

.quiz-score h2 {
  margin: 0 0 8px;
  font-family: var(--font-en);
  font-size: 1.8rem;
  color: var(--orange-deep);
}

.quiz-score p {
  margin: 0 0 20px;
  color: var(--ink-soft);
}

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: max(24px, env(safe-area-inset-top, 0px)) 24px 40px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 149, 51, 0.35), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--peach));
}

html.is-inapp .onboarding {
  position: absolute;
  inset: auto;
  top: 0;
  left: 0;
  right: 0;
  min-height: 100%;
  height: auto;
}

.onboarding[hidden] {
  display: none !important;
}

.onboarding-panel {
  width: min(420px, 100%);
  padding: 28px 24px;
  border-radius: calc(var(--radius) + 8px);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(232, 90, 0, 0.2);
  text-align: center;
  border: 2px solid rgba(255, 149, 51, 0.25);
}

.onboarding-panel img {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  margin-bottom: 16px;
  box-shadow: 0 16px 40px var(--orange-glow);
}

.onboarding-panel h1 {
  margin: 0 0 10px;
  font-family: var(--font-en);
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--orange-deep);
}

.onboarding-panel p {
  margin: 0 0 20px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.onboarding-steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}

.onboarding-steps span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--peach);
}

.onboarding-steps span.active {
  width: 28px;
  border-radius: 999px;
  background: var(--orange);
}

.placement-level {
  display: inline-block;
  margin-bottom: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 0.82rem;
}

.empty-state {
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-soft);
}

.empty-state img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 16px;
  opacity: 0.85;
}

/* Match pairs game */
.match-setup h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.game-setup {
  display: grid;
  gap: 18px;
}

.game-play-hero {
  display: grid;
  gap: 10px;
  justify-items: stretch;
  padding: 4px 0 2px;
}

.game-play-hero .game-play-cta {
  margin-bottom: 2px;
}

.game-play-hero h1 {
  margin: 4px 0 0;
}

.game-play-lead {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
  font-size: 0.92rem;
}

.game-play-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 16px 20px;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(145deg, #ffb35a 0%, #ff7a2f 55%, #f2551a 100%);
  box-shadow:
    0 10px 24px rgba(255, 122, 47, 0.35),
    0 2px 0 rgba(255, 255, 255, 0.25) inset;
  font: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  animation: game-play-pulse 2.4s ease-in-out infinite;
}

.game-play-cta:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.01);
  box-shadow:
    0 14px 28px rgba(255, 122, 47, 0.42),
    0 2px 0 rgba(255, 255, 255, 0.28) inset;
}

.game-play-cta:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
  animation: none;
}

.game-play-cta:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  animation: none;
  filter: grayscale(0.25);
}

.game-play-cta-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.95rem;
  line-height: 1;
}

.game-play-cta-copy {
  display: grid;
  gap: 2px;
  text-align: left;
}

.game-play-cta-copy strong {
  font-family: var(--font-en);
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.game-play-cta-copy small {
  font-size: 0.78rem;
  opacity: 0.92;
  line-height: 1.2;
}

.game-platform-pool-btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 4px 8px;
  margin: 0 auto;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.game-platform-pool-btn:hover {
  color: var(--ink);
}

.game-mistakes-review-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1.5px solid color-mix(in srgb, var(--orange) 35%, var(--line));
  background: color-mix(in srgb, var(--orange) 10%, var(--surface));
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.game-mistakes-review-btn strong {
  font-size: 0.95rem;
  font-weight: 850;
  color: var(--orange-deep);
}
.game-mistakes-review-btn small {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.game-mistakes-review-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--orange);
}
.game-mistakes-review-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.game-mistakes-banner {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--orange) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--orange) 28%, var(--line));
  color: var(--orange-deep);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.words-play-all-wrap {
  margin: -6px 0 12px;
  text-align: center;
}

.game-play-need {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.45;
}

.game-setup-settings {
  display: grid;
  gap: 12px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 149, 51, 0.16);
}

.game-setup-settings-title {
  margin: 8px 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.game-setup-card {
  margin: 0;
}

.game-setup-card h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

@keyframes game-play-pulse {
  0%,
  100% {
    box-shadow:
      0 10px 24px rgba(255, 122, 47, 0.35),
      0 2px 0 rgba(255, 255, 255, 0.25) inset;
  }
  50% {
    box-shadow:
      0 14px 30px rgba(255, 122, 47, 0.48),
      0 2px 0 rgba(255, 255, 255, 0.28) inset;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-play-cta {
    animation: none;
  }
}

.match-setup-desc {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.match-mode-grid {
  display: grid;
  gap: 10px;
}

.match-mode-btn {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: var(--card);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.match-mode-btn strong {
  font-family: var(--font-en);
  font-size: 0.92rem;
}

.match-mode-btn span {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.match-mode-btn.active,
.match-mode-btn[aria-pressed="true"] {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 18%, var(--card));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--orange) 45%, transparent),
    0 6px 16px var(--orange-glow);
  color: var(--ink);
}

.match-mode-btn.active strong,
.match-mode-btn[aria-pressed="true"] strong {
  color: var(--orange-deep);
}

.match-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.match-col-title {
  margin: 0 0 8px;
  font-family: var(--font-en);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  text-align: center;
}

.match-col {
  display: grid;
  gap: 8px;
  align-content: start;
}

.match-tile {
  padding: 14px 10px;
  border-radius: 14px;
  border: 2px solid rgba(255, 149, 51, 0.25);
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  line-height: 1.35;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}

.match-tile-b {
  font-family: var(--font-zh);
  font-size: 1.15rem;
}

.match-tile.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: scale(1.02);
}

.match-tile.matched {
  opacity: 0.45;
  border-color: #43a047;
  background: color-mix(in srgb, #43a047 18%, var(--surface));
  cursor: default;
}

.match-tile.wrong {
  border-color: #e53935;
  background: color-mix(in srgb, #e53935 18%, var(--surface));
  animation: match-shake 0.35s ease;
}

@keyframes match-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.match-hint {
  text-align: center;
  font-family: var(--font-en);
  font-weight: 800;
  color: var(--orange-deep);
  min-height: 1.4em;
  margin: 12px 0 0;
}

/* Word Rain */
.rain-screen {
  gap: 12px;
}

.rain-score {
  text-align: center;
  margin: 0;
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.rain-arena {
  position: relative;
  height: min(42vh, 320px);
  border-radius: var(--radius);
  overflow: hidden;
  background:
    linear-gradient(180deg, #9ec9ff 0%, #cfe6ff 35%, #e8f4ff 70%, #d7ebe0 100%);
  box-shadow: var(--shadow);
  border: 2px solid rgba(74, 158, 255, 0.25);
}

.rain-sky {
  position: absolute;
  inset: 0 0 18%;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.55), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.4), transparent 35%);
  pointer-events: none;
}

.rain-drop {
  position: absolute;
  top: 0;
  left: var(--lane, 40%);
  transform: translateX(-50%);
  z-index: 2;
  box-sizing: border-box;
  min-width: 72px;
  max-width: calc(100% - 24px);
  padding: 12px 16px;
  border-radius: 16px;
  background: linear-gradient(160deg, var(--panel-grad-a), var(--panel-grad-b));
  border: 2px solid rgba(255, 116, 32, 0.35);
  box-shadow: 0 10px 24px rgba(45, 34, 24, 0.15);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  color: var(--ink);
}

.rain-drop-zh {
  font-family: var(--font-zh);
  font-size: calc(1.55rem * var(--font-zh-scale));
  font-weight: 700;
  line-height: 1.1;
  max-width: 100%;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.rain-drop-jyutping {
  font-family: var(--font-en);
  font-size: calc(0.85rem * var(--font-jyutping-scale));
  font-weight: 800;
  color: var(--blue-deep);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.rain-drop.falling {
  animation: rain-fall var(--fall-ms, 4200ms) linear forwards;
}

@keyframes rain-fall {
  0% {
    top: var(--rain-pad-top, 10px);
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    top: calc(100% - var(--rain-drop-h, 64px) - var(--rain-ground-h, 42px));
    opacity: 0.95;
  }
}

.rain-drop.rain-caught {
  animation: rain-pop 0.45s ease forwards;
  border-color: #43a047;
  background: color-mix(in srgb, #43a047 22%, var(--surface));
  color: var(--ink);
}

.rain-drop.rain-missed {
  animation: rain-splat 0.4s ease forwards;
  border-color: #e53935;
  background: color-mix(in srgb, #e53935 22%, var(--surface));
  color: var(--ink);
}

@keyframes rain-pop {
  0% { transform: translateX(-50%) scale(1); opacity: 1; }
  50% { transform: translateX(-50%) scale(1.18); }
  100% { transform: translateX(-50%) scale(0.4); opacity: 0; }
}

@keyframes rain-splat {
  0% { transform: translateX(-50%) scale(1); }
  100% { transform: translateX(-50%) scale(0.85) translateY(8px); opacity: 0.35; }
}

.rain-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #8fbc8f, #5d8a5d);
  border-top: 3px solid #f5c518;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-en);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.rain-feedback {
  text-align: center;
  margin: 0;
  min-height: 1.4em;
  font-family: var(--font-en);
  font-weight: 800;
  color: var(--ink-soft);
}

.rain-feedback.ok {
  color: #2e7d32;
}

.rain-feedback.bad {
  color: #c62828;
}

.rain-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rain-choice {
  padding: 14px 12px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--card);
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  color: var(--ink);
  line-height: 1.3;
}

.rain-choice:active:not(:disabled) {
  transform: scale(0.98);
}

.rain-choice.is-correct {
  border-color: #43a047;
  background: color-mix(in srgb, #43a047 18%, var(--surface));
  color: var(--ink);
}

.rain-choice.is-wrong {
  border-color: #e53935;
  background: color-mix(in srgb, #e53935 18%, var(--surface));
  color: var(--ink);
}

.rain-choice:disabled {
  cursor: default;
}

/* Game results / familiarity review */
.game-results h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.game-results-sub {
  margin: 0 0 18px;
  color: var(--ink-soft);
}

.game-results-section {
  margin-bottom: 18px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.game-results-section h2 {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.game-results-up h2 {
  color: #2e7d32;
}

.game-results-down h2 {
  color: #c62828;
}

.game-result-row {
  display: grid;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.game-result-row:last-child {
  border-bottom: none;
}

.game-result-main {
  display: grid;
  gap: 4px;
}

.game-result-zh {
  font-family: var(--font-zh);
  font-size: calc(1.2rem * var(--font-zh-scale));
}

.game-result-jyutping {
  font-family: var(--font-en);
  font-size: calc(0.9rem * var(--font-jyutping-scale));
  font-weight: 700;
  color: var(--blue-deep);
}

.game-result-shift {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.game-results-none,
.game-results-hint {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Dark mode surfaces / text */
html[data-theme="dark"] body,
html[data-theme="dark"] .app-main,
html[data-theme="dark"] .app-shell {
  color: var(--ink);
  background: transparent;
}

html[data-theme="dark"] .btn-ghost,
html[data-theme="dark"] .card-nav button,
html[data-theme="dark"] .card-side-nav,
html[data-theme="dark"] .bulk-fam-bar,
html[data-theme="dark"] .bulk-fam-dot,
html[data-theme="dark"] .game-switch-btn,
html[data-theme="dark"] .match-tile,
html[data-theme="dark"] .match-mode-btn:not(.active):not([aria-pressed="true"]),
html[data-theme="dark"] .rain-choice,
html[data-theme="dark"] .rain-drop,
html[data-theme="dark"] .lego-block,
html[data-theme="dark"] .lego-block-inner,
html[data-theme="dark"] .mtr-car,
html[data-theme="dark"] .mtr-car-inner,
html[data-theme="dark"] .mtr-platform-edge,
html[data-theme="dark"] .quiz-screen,
html[data-theme="dark"] .quiz-card,
html[data-theme="dark"] .quiz-option,
html[data-theme="dark"] .panel-style,
html[data-theme="dark"] .match-setup,
html[data-theme="dark"] .game-card,
html[data-theme="dark"] .settings-card,
html[data-theme="dark"] .star-card,
html[data-theme="dark"] .star-btn,
html[data-theme="dark"] .speak-btn,
html[data-theme="dark"] .star-item,
html[data-theme="dark"] .mini-card,
html[data-theme="dark"] .more-meaning-item,
html[data-theme="dark"] .onboarding-panel,
html[data-theme="dark"] .confirm-panel,
html[data-theme="dark"] .lego-prompt,
html[data-theme="dark"] .mtr-prompt,
html[data-theme="dark"] .game-results-section,
html[data-theme="dark"] .video-card,
html[data-theme="dark"] .vocab-card,
html[data-theme="dark"] .header-toggle,
html[data-theme="dark"] .jyutping-toggle,
html[data-theme="dark"] .meaning-toggle,
html[data-theme="dark"] .level-pill:not(.active),
html[data-theme="dark"] .theme-pill:not(.active),
html[data-theme="dark"] .practice-mode-chip,
html[data-theme="dark"] .practice-ladder-item {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .subtitle-card {
  background: var(--surface);
  color: var(--ink);
  border-color: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .star-item,
html[data-theme="dark"] .mini-card,
html[data-theme="dark"] .bulk-fam-bar,
html[data-theme="dark"] .subtitle-card.is-vocab {
  background: var(--surface-soft);
}

html[data-theme="dark"] .game-card-featured,
html[data-theme="dark"] .game-switch-btn,
html[data-theme="dark"] .game-switch-btn.active,
html[data-theme="dark"] .hero-banner,
html[data-theme="dark"] .vocab-card {
  background: linear-gradient(145deg, var(--panel-grad-a), var(--panel-grad-b));
  color: var(--ink);
}

html[data-theme="dark"] .subtitle-card.active,
html[data-theme="dark"] .subtitle-card.is-vocab.active {
  background: color-mix(in srgb, var(--orange) 18%, var(--surface));
  border-color: var(--orange-bright);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--orange-bright) 45%, transparent);
  transform: none;
  color: var(--ink);
}

html[data-theme="dark"] .nav-item.active {
  /* per-tab dark colors set above; keep a soft fallback */
  background: rgba(255, 116, 32, 0.16);
}

html[data-theme="dark"] .btn-ghost {
  border-color: var(--line);
  color: var(--blue-deep);
}

html[data-theme="dark"] .bulk-fam-dot:hover {
  color: #fff;
}

html[data-theme="dark"] .onboarding {
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 149, 51, 0.18), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--peach));
}

html[data-theme="dark"] .placement-level {
  background: var(--blue-soft);
  color: var(--blue-deep);
}

html[data-theme="dark"] .mtr-window {
  background: linear-gradient(180deg, var(--mtr-blue-soft, #1a2838), var(--surface));
  color: var(--ink);
}

html[data-theme="dark"] .lego-block-zh,
html[data-theme="dark"] .lego-block-jyutping,
html[data-theme="dark"] .mtr-car-face,
html[data-theme="dark"] .quiz-prompt,
html[data-theme="dark"] .quiz-sub,
html[data-theme="dark"] .match-mode-btn:not(.active):not([aria-pressed="true"]) strong,
html[data-theme="dark"] .game-result-zh,
html[data-theme="dark"] .vocab-card .zh,
html[data-theme="dark"] .vocab-card .jyutping,
html[data-theme="dark"] .vocab-card .meaning,
html[data-theme="dark"] .vocab-flip-hint,
html[data-theme="dark"] .meaning-flip-main,
html[data-theme="dark"] .subtitle-zh,
html[data-theme="dark"] .subtitle-jyutping,
html[data-theme="dark"] .subtitle-meaning {
  color: var(--ink);
}

html[data-theme="dark"] .xp-mini-pebble {
  background: color-mix(in srgb, white 92%, var(--fam, var(--orange)));
  color: #2d2218;
}

html[data-theme="dark"] .word-jar-pebble {
  background: var(--fam, var(--orange));
  color: var(--fam-ink, #fff);
}

html[data-theme="dark"] .words-achieve-period-num {
  color: var(--ink);
}

html[data-theme="dark"] .words-achieve-period.active .words-achieve-period-num {
  color: var(--orange-deep);
}

html[data-theme="dark"] .subtitle-jyutping,
html[data-theme="dark"] .quiz-sub,
html[data-theme="dark"] .card-jyutping,
html[data-theme="dark"] .game-result-jyutping {
  color: var(--blue-deep);
}

html[data-theme="dark"] .subtitle-meaning,
html[data-theme="dark"] .mini-card-meaning,
html[data-theme="dark"] .match-mode-btn span,
html[data-theme="dark"] .ink-soft,
html[data-theme="dark"] .game-results-hint,
html[data-theme="dark"] .game-results-sub {
  color: var(--ink-soft);
}

html[data-theme="dark"] .star-btn {
  color: #9a8b7c;
}

html[data-theme="dark"] .star-btn.starred {
  color: #ffb800;
  background: color-mix(in srgb, #ffb800 22%, var(--surface));
}

html[data-theme="dark"] .mini-star {
  color: #6e6258;
}

html[data-theme="dark"] .mini-star.starred {
  color: #ffb800;
}

html[data-theme="dark"] .rain-feedback.ok,
html[data-theme="dark"] .game-results-up h2,
html[data-theme="dark"] .lego-feedback-ok,
html[data-theme="dark"] .practice-ladder-default {
  color: #81c784;
}

html[data-theme="dark"] .rain-feedback.bad,
html[data-theme="dark"] .game-results-down h2,
html[data-theme="dark"] .lego-feedback-bad {
  color: #ef9a9a;
}

html[data-theme="dark"] .login-panel,
html[data-theme="dark"] .trial-banner,
html[data-theme="dark"] .auth-user-btn {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .identity-input {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .identity-input-readonly {
  background: color-mix(in srgb, var(--surface) 75%, #000 25%);
}

html[data-theme="dark"] .identity-status-ok {
  color: #81c784;
}

html[data-theme="dark"] .identity-status-error {
  color: #ef9a9a;
}

html[data-theme="dark"] .game-filter-chip:not(.active):not([aria-pressed="true"]),
html[data-theme="dark"] .game-lesson-check,
html[data-theme="dark"] .game-fam-range-label select {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .game-filter-chip.active,
html[data-theme="dark"] .game-filter-chip[aria-pressed="true"],
html[data-theme="dark"] .words-recent-chip.active,
html[data-theme="dark"] .words-recent-chip[aria-pressed="true"] {
  border-color: var(--orange-bright);
  background: color-mix(in srgb, var(--orange) 28%, var(--surface));
  color: var(--orange-bright);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--orange-bright) 50%, transparent),
    0 4px 14px var(--orange-glow);
}

html[data-theme="dark"] .match-mode-btn.active,
html[data-theme="dark"] .match-mode-btn[aria-pressed="true"] {
  border-color: var(--orange-bright);
  background: color-mix(in srgb, var(--orange) 26%, var(--surface));
  color: var(--ink);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--orange-bright) 50%, transparent),
    0 6px 18px var(--orange-glow);
}

html[data-theme="dark"] .match-mode-btn.active strong,
html[data-theme="dark"] .match-mode-btn[aria-pressed="true"] strong {
  color: var(--orange-bright);
}

/* ─── Community Language Buddy ─── */
.community-panel {
  display: grid;
  gap: 14px;
  padding-bottom: 8px;
}

.community-hero {
  padding: 8px 2px 4px;
}

.community-eyebrow {
  margin: 0 0 4px;
  font-family: var(--font-en);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange-deep);
}

.community-hero h1 {
  margin: 0 0 8px;
  font-family: var(--font-en);
  font-size: clamp(1.6rem, 5vw, 2rem);
  font-weight: 900;
  line-height: 1.15;
}

.community-lead {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
  font-size: 0.95rem;
}

/* Buddy landing — vision & offerings */
.buddy-landing {
  display: grid;
  gap: 14px;
}

.buddy-landing-hero {
  position: relative;
  padding: clamp(22px, 5vw, 36px) clamp(16px, 4vw, 28px);
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 75% 55% at 12% 20%, color-mix(in srgb, var(--orange) 32%, transparent), transparent 58%),
    radial-gradient(ellipse 65% 50% at 88% 75%, color-mix(in srgb, var(--blue) 16%, transparent), transparent 52%),
    linear-gradient(155deg, var(--bg-1), var(--bg-2) 50%, var(--peach));
  border: 1px solid var(--line);
  animation: contribute-fade-in 0.55s ease both;
}

.buddy-landing-tagline {
  margin: 0 0 4px;
  font-family: var(--font-en);
  font-size: clamp(1.55rem, 5.5vw, 2.25rem);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.buddy-landing-tagline-zh {
  margin: 0 0 14px;
  font-family: var(--font-zh);
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  font-weight: 700;
  color: var(--orange-deep);
  letter-spacing: 0.04em;
}

.buddy-landing-vision {
  margin: 0 0 10px;
  font-family: var(--font-zh);
  font-size: clamp(0.92rem, 2.8vw, 1.02rem);
  line-height: 1.7;
  color: var(--ink);
  max-width: 42rem;
}

.buddy-landing-vision-en {
  margin: 0;
  font-family: var(--font-en);
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 40rem;
}

.buddy-offering-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.buddy-offering-card {
  display: grid;
  gap: 8px;
  padding: 18px 16px 16px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 6%, transparent);
}

.buddy-offering-card-accent {
  border-color: color-mix(in srgb, var(--orange) 35%, var(--line));
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--orange) 10%, var(--surface)),
    var(--surface) 55%
  );
}

.buddy-offering-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.buddy-offering-card h2 {
  margin: 0;
  font-family: var(--font-zh);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.25;
}

.buddy-offering-sub {
  margin: -4px 0 0;
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--orange-deep);
}

.buddy-offering-copy {
  margin: 0;
  font-family: var(--font-zh);
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--ink-soft);
  flex: 1;
}

.buddy-offering-card .btn {
  width: fit-content;
  margin-top: 4px;
}

.buddy-vision-intro h2 {
  margin: 0 0 10px;
  font-family: var(--font-zh);
  font-size: 1.05rem;
  font-weight: 800;
}

.buddy-vision-intro p {
  margin: 0;
  font-family: var(--font-zh);
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.buddy-pillar-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.buddy-pillar-card {
  position: relative;
  padding: 16px 14px 14px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.buddy-pillar-num {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--orange) 70%, var(--ink-soft));
}

.buddy-pillar-card h3 {
  margin: 0 0 2px;
  font-family: var(--font-zh);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.3;
}

.buddy-pillar-en {
  margin: 0 0 8px;
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--orange-deep);
}

.buddy-pillar-card p:last-child {
  margin: 0;
  font-family: var(--font-zh);
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

#buddy-list-wrap {
  scroll-margin-top: 72px;
}

.community-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.buddy-chat-room,
.buddy-chat-compose,
.buddy-chat-settings {
  display: grid;
  gap: 10px;
}

.buddy-chat-list {
  display: grid;
  gap: 10px;
  max-height: 56vh;
  overflow: auto;
}

.buddy-chat-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.buddy-chat-item.is-own {
  border-color: color-mix(in srgb, var(--orange) 35%, var(--line));
  background: color-mix(in srgb, var(--orange) 8%, var(--surface));
}

.buddy-chat-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.buddy-chat-meta strong {
  font-family: var(--font-en);
  font-size: 0.95rem;
}

.buddy-chat-meta small,
.buddy-chat-ref {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.buddy-chat-ref {
  margin: 0;
  font-weight: 700;
}

.buddy-chat-quote {
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid color-mix(in srgb, var(--blue) 40%, var(--line));
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
  border-radius: 0 10px 10px 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.buddy-chat-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
}

.buddy-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.buddy-chat-pill {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--orange) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--orange) 25%, var(--line));
}

.buddy-chat-mentions,
.buddy-chat-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.buddy-chat-mention-chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--blue) 28%, transparent);
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
  color: var(--blue-deep);
  font-weight: 800;
}

/* ─── Learner Forum ─── */
.forum-panel {
  display: grid;
  gap: 12px;
}

.forum-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.forum-new-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 999px;
  font-size: 1.35rem;
  line-height: 1;
  display: grid;
  place-items: center;
}

.forum-post-list {
  display: grid;
  gap: 10px;
}

.forum-post-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.forum-post-card:hover {
  border-color: color-mix(in srgb, var(--orange) 35%, var(--line));
}

.forum-post-title {
  margin: 0;
  font-family: var(--font-en);
  font-size: 1.05rem;
  line-height: 1.35;
}

.forum-post-preview {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.45;
}

.forum-post-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.forum-profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.forum-profile-card.is-compact .forum-profile-meta {
  font-size: 0.72rem;
}

.forum-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--orange) 12%, var(--surface));
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.forum-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.forum-avatar-emoji,
.forum-avatar-letter {
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 800;
}

.forum-profile-copy strong {
  display: block;
  font-family: var(--font-en);
  font-size: 0.95rem;
}

.forum-profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.35;
}

.forum-post-open,
.forum-compose {
  display: grid;
  gap: 10px;
}

.forum-open-title {
  margin: 0;
  font-family: var(--font-en);
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  line-height: 1.3;
}

.forum-open-body {
  margin: 0;
  line-height: 1.55;
}

.forum-open-meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.forum-comments-wrap {
  display: grid;
  gap: 10px;
}

.forum-comments-title {
  margin: 0;
  font-family: var(--font-en);
  font-size: 1rem;
}

.forum-comment-list {
  display: grid;
  gap: 10px;
}

.forum-comment {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-left: calc(var(--reply-depth, 0) * 14px);
}

.forum-comment.is-own {
  border-color: color-mix(in srgb, var(--orange) 30%, var(--line));
}

.forum-comment-ref {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.forum-comment-text {
  margin: 0;
  line-height: 1.5;
}

.forum-comment-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.forum-comment-foot small {
  color: var(--ink-soft);
}

.forum-reply-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--orange) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--orange) 20%, var(--line));
  font-size: 0.88rem;
}

.community-flow-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1.5px solid color-mix(in srgb, var(--orange) 28%, var(--ink) 10%);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--orange) 10%, var(--surface)) 0%,
    color-mix(in srgb, var(--blue) 8%, var(--surface)) 100%
  );
}

.community-flow-step {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 88%, white);
}

.community-flow-icon {
  flex: 0 0 auto;
  font-size: 1.05rem;
  line-height: 1;
}

.community-flow-label {
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--ink);
  min-width: 0;
}

.community-flow-label .flow-short {
  display: none;
}

.community-flow-arrow {
  flex: 0 0 auto;
  align-self: center;
  font-family: var(--font-en);
  font-size: 0.85rem;
  font-weight: 900;
  color: color-mix(in srgb, var(--orange-deep) 70%, var(--ink));
  opacity: 0.65;
  line-height: 1;
}

@media (max-width: 640px) {
  .community-flow-bar {
    flex-direction: row;
    align-items: stretch;
    gap: 2px;
    padding: 6px 6px;
    border-radius: 12px;
  }

  .community-flow-step {
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 3px;
    padding: 6px 4px 5px;
    text-align: center;
    background: color-mix(in srgb, var(--surface) 92%, white);
  }

  .community-flow-icon {
    font-size: 0.95rem;
  }

  .community-flow-label {
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
  }

  .community-flow-label .flow-full {
    display: none;
  }

  .community-flow-label .flow-short {
    display: block;
  }

  .community-flow-arrow {
    font-size: 0.72rem;
    opacity: 0.55;
    transform: none;
    padding: 0 1px;
  }
}

.community-steps {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink);
  line-height: 1.65;
}

.community-note,
.community-loading {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.5;
}

.community-how h2,
.buddy-profile h1.buddy-name {
  margin-top: 0;
}

.buddy-grid {
  display: grid;
  gap: 10px;
}

.buddy-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.buddy-card-link {
  display: grid;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.buddy-card:hover {
  border-color: var(--orange);
  transform: translateY(-1px);
}

.buddy-fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, white);
  color: var(--ink-soft);
  font-size: 1.05rem;
  cursor: pointer;
}

.buddy-fav-btn.is-on {
  color: var(--orange-deep);
  border-color: color-mix(in srgb, var(--orange) 35%, transparent);
  background: color-mix(in srgb, var(--orange) 14%, var(--surface));
}

.buddy-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.buddy-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.buddy-avatar-lg {
  width: 64px;
  height: 64px;
}

.buddy-avatar-fallback {
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-family: var(--font-en);
  font-weight: 900;
}

.buddy-avatar-emoji {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--orange) 18%, white), color-mix(in srgb, var(--blue) 12%, white));
  font-size: 1.6rem;
}

.buddy-rate,
.buddy-rate-lg {
  display: block;
  color: var(--orange-deep);
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.85rem;
}

.buddy-rate-lg {
  font-size: 1.05rem;
  margin: 4px 0 0;
}

.buddy-headline {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

.buddy-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.buddy-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--orange) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--orange) 22%, transparent);
  color: var(--orange-deep);
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 800;
}

.buddy-bio {
  margin: 10px 0 0;
  line-height: 1.55;
  white-space: pre-wrap;
}

.buddy-section-title {
  margin: 16px 0 6px;
  font-family: var(--font-en);
  font-size: 0.95rem;
  font-weight: 800;
}

.buddy-lang-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}

.buddy-lang-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--blue) 14%, var(--surface));
  color: var(--blue-deep);
  border: 1px solid color-mix(in srgb, var(--blue) 28%, transparent);
}

.buddy-lang-chip.is-native {
  background: color-mix(in srgb, var(--orange) 14%, var(--surface));
  color: var(--orange-deep);
  border-color: color-mix(in srgb, var(--orange) 35%, transparent);
}

.buddy-materials {
  margin: 8px 0 12px;
  padding-left: 1.1rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.buddy-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

@media (max-width: 560px) {
  .buddy-filter-row {
    grid-template-columns: 1fr;
  }
}

.buddy-lang-editor {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.buddy-lang-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.buddy-materials-checks {
  display: grid;
  gap: 8px;
}

.buddy-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-family: var(--font-en);
  font-size: 0.9rem;
  line-height: 1.35;
}

.buddy-check.is-locked {
  background: color-mix(in srgb, var(--orange) 8%, var(--surface));
}

.word-count-hint.is-ok {
  color: #2e7d32;
}

.word-count-hint.is-short {
  color: var(--orange-deep);
}

.buddy-handle {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.buddy-name {
  margin: 0;
  font-size: 1.35rem;
}

.buddy-video {
  margin-top: 12px;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #111;
}

.buddy-video iframe,
.call-frame {
  width: 100%;
  height: 100%;
  border: 0;
}

.identity-textarea {
  resize: vertical;
  min-height: 96px;
  font-weight: 600;
  line-height: 1.45;
}

.community-fee-box {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--orange) 12%, var(--surface));
  border: 1px solid var(--line);
  line-height: 1.5;
}

.community-fee-box p {
  margin: 0;
}

.community-fee-box p + p {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.buddy-slot-days {
  display: grid;
  gap: 10px;
}

.buddy-slot-day {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--blue) 5%, var(--surface));
}

.buddy-slot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.buddy-slot-btn {
  min-width: 88px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-en);
  font-weight: 800;
  cursor: pointer;
}

.buddy-slot-btn.active {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 14%, var(--surface));
  color: var(--orange-deep);
}

.buddy-availability-card {
  margin-top: 14px;
}

.buddy-availability-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.buddy-legend-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 800;
}

.buddy-legend-pill.is-available {
  background: #dff6df;
  color: #1d6e2d;
}

.buddy-legend-pill.is-occupied {
  background: #ffe0e0;
  color: #a32727;
}

.buddy-legend-pill.is-off {
  background: #eceef2;
  color: #5d6472;
}

.buddy-availability-scroll {
  overflow-x: auto;
  padding-bottom: 6px;
}

.buddy-availability-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 6px;
}

.buddy-availability-table th {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 84px;
  padding: 8px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--font-en);
  font-size: 0.78rem;
  text-align: left;
}

.buddy-availability-table thead th {
  top: 0;
  z-index: 2;
}

.buddy-availability-table td {
  padding: 0;
}

.buddy-cal-cell {
  min-width: 86px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--font-en);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.buddy-cal-cell.is-available {
  background: #dff6df;
  color: #1d6e2d;
  border-color: #8fd19a;
}

.buddy-cal-cell.is-occupied {
  background: #ffe0e0;
  color: #a32727;
  border-color: #e49c9c;
  cursor: not-allowed;
}

.buddy-cal-cell.is-off {
  background: #eceef2;
  color: #5d6472;
  border-color: #d2d7e0;
}

.buddy-reject-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 12, 8, 0.45);
}

.buddy-reject-modal[hidden] {
  display: none !important;
}

.buddy-reject-dialog {
  width: min(440px, 100%);
  padding: 20px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.buddy-reject-dialog h3 {
  margin: 0 0 6px;
  font-family: var(--font-en);
}

.buddy-reject-presets {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.buddy-reject-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  cursor: pointer;
  font-family: var(--font-en);
  font-size: 0.9rem;
  line-height: 1.35;
}

.buddy-reject-option:has(input:checked) {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 10%, var(--surface));
}

.buddy-reject-option input {
  margin-top: 2px;
}

.session-list,
.review-item {
  display: grid;
  gap: 12px;
}

.session-item,
.review-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.session-item:first-child,
.review-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.session-item p,
.review-item p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.4;
}

.session-meta {
  font-size: 0.8rem !important;
}

.review-item {
  flex-direction: column;
}

.back-link {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 800;
  font-family: var(--font-en);
  font-size: 0.88rem;
}

.back-link:hover {
  color: var(--orange-deep);
}

.call-frame-wrap {
  min-height: min(62vh, 520px);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #1a1a1a;
}

.community-call-panel .app-main,
body:has(.community-call-panel) .app-main {
  padding-bottom: 24px;
}

html[data-theme="dark"] .buddy-card,
html[data-theme="dark"] .community-fee-box,
html[data-theme="dark"] .call-frame-wrap {
  background: var(--surface);
  border-color: var(--line);
}

/* ─── Contribute (crowd content) ─── */
.contribute-spotlight {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 14px;
  padding: 18px 18px 18px 20px;
  border-radius: 20px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--orange) 16%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--orange) 35%, transparent);
  box-shadow: 0 10px 28px var(--orange-glow);
  transition: transform 0.2s ease;
}

.contribute-spotlight:hover {
  transform: translateY(-2px);
}

.contribute-spotlight-glow {
  position: absolute;
  inset: -40% auto auto -20%;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--orange) 45%, transparent), transparent 70%);
  pointer-events: none;
}

.contribute-spotlight-copy {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
  position: relative;
}

.contribute-spotlight-copy strong {
  font-family: var(--font-en);
  font-size: 1.15rem;
  font-weight: 900;
}

.contribute-spotlight-copy small {
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.4;
}

.contribute-spotlight-cta {
  font-family: var(--font-en);
  font-weight: 800;
  color: var(--orange-deep);
  white-space: nowrap;
  position: relative;
}

.contribute-hero {
  position: relative;
  min-height: min(52vh, 420px);
  border-radius: 24px;
  overflow: hidden;
  margin: 0 0 14px;
  background:
    radial-gradient(ellipse 80% 60% at 20% 30%, color-mix(in srgb, var(--orange) 28%, transparent), transparent 55%),
    radial-gradient(ellipse 70% 50% at 80% 70%, color-mix(in srgb, var(--blue) 18%, transparent), transparent 50%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 55%, var(--peach));
  border: 1px solid var(--line);
}

.word-pool {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.word-pool-chip {
  position: absolute;
  font-family: var(--font-zh);
  font-weight: 700;
  font-size: clamp(0.85rem, 2.8vw, 1.15rem);
  color: color-mix(in srgb, var(--ink) 55%, transparent);
  opacity: 0.55;
  white-space: nowrap;
  animation: word-pool-drift 10s ease-in-out infinite alternate;
  text-shadow: 0 1px 0 color-mix(in srgb, var(--card) 40%, transparent);
}

@keyframes word-pool-drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(8px, -14px, 0) scale(1.06);
  }
}

.contribute-hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  padding: clamp(28px, 6vw, 48px) clamp(18px, 4vw, 36px);
  max-width: 34rem;
  animation: contribute-fade-in 0.55s ease both;
}

@keyframes contribute-fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.contribute-hero-copy h1 {
  margin: 0;
  font-family: var(--font-en);
  font-size: clamp(1.55rem, 5.2vw, 2.15rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.contribute-support {
  margin: 0;
  font-family: var(--font-en);
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.contribute-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.contribute-mine-link {
  margin-top: 4px;
  font-family: var(--font-en);
  font-weight: 700;
  width: fit-content;
}

.contribute-review-note {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--ink) 4%, var(--surface));
  border: 1px solid var(--line);
}

.contribute-guide-list {
  margin: 0;
  padding-left: 1.2rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.contribute-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.contribute-gallery-compact {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.contribute-gallery-card {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}

.contribute-gallery-img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: color-mix(in srgb, var(--orange) 10%, var(--surface));
}

.contribute-gallery-img-empty {
  display: grid;
  place-items: center;
  font-family: var(--font-zh);
  font-size: 2rem;
  font-weight: 800;
  color: color-mix(in srgb, var(--orange) 55%, var(--ink-soft));
}

.contribute-gallery-body {
  padding: 12px 14px 14px;
  display: grid;
  gap: 4px;
}

.contribute-type-pill {
  font-family: var(--font-en);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--orange-deep);
}

.contribute-zh {
  font-family: var(--font-zh);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.25;
}

.contribute-jyutping {
  margin: 0;
  font-family: var(--font-en);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--blue-deep);
}

.contribute-meaning,
.contribute-story-snip,
.contribute-by {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

.contribute-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.contribute-tag {
  font-family: var(--font-en);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
  color: var(--blue-deep);
}

.contribute-tag-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contribute-tag-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: var(--font-en);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.contribute-tag-pick:has(input:checked) {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 12%, var(--surface));
}

.contribute-tag-pick input {
  margin: 0;
}

.contribute-form-panel .settings-card {
  animation: contribute-fade-in 0.45s ease both;
}

.contribute-submit-btn.is-success {
  animation: contribute-pulse 0.55s ease;
}

@keyframes contribute-pulse {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

.contribute-status-pill {
  flex-shrink: 0;
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
  background: color-mix(in srgb, var(--ink) 8%, var(--surface));
  color: var(--ink-soft);
}

.contribute-status-pill.status-approved {
  background: color-mix(in srgb, #43a047 18%, var(--surface));
  color: #2e7d32;
}

.contribute-status-pill.status-pending {
  background: color-mix(in srgb, var(--orange) 16%, var(--surface));
  color: var(--orange-deep);
}

.contribute-status-pill.status-needs_changes,
.contribute-status-pill.status-rejected {
  background: color-mix(in srgb, #e53935 12%, var(--surface));
  color: #c62828;
}

.contribute-mine-item {
  align-items: center;
}

.contribute-gate-note {
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--orange) 12%, var(--surface));
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

.contribute-pron-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 2px 0 6px;
}

.quiz-q {
  margin: 12px 0;
  padding: 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--ink) 4%, var(--surface));
}

.quiz-q-zh {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
}

.quiz-options {
  display: grid;
  gap: 6px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font-en);
  font-size: 0.9rem;
}

.quiz-option:has(input:checked) {
  background: color-mix(in srgb, var(--orange) 18%, var(--surface));
  font-weight: 700;
}

.quiz-option input {
  accent-color: var(--orange-deep);
}

/* ─── Battle ─── */
.battle-panel {
  display: grid;
  gap: 14px;
}

.battle-matchmaking {
  min-height: min(70vh, 520px);
  display: grid;
  place-items: center;
}

.mm-stage {
  position: relative;
  width: min(280px, 80vw);
  height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
}

.mm-rings {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mm-rings span {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--orange) 45%, transparent);
  animation: mm-pulse 1.4s ease-out infinite;
}

.mm-rings span:nth-child(2) {
  inset: 8%;
  animation-delay: 0.35s;
  border-color: color-mix(in srgb, #ffd54a 50%, transparent);
}

.mm-rings span:nth-child(3) {
  inset: 0;
  animation-delay: 0.7s;
  border-color: color-mix(in srgb, var(--blue) 40%, transparent);
}

@keyframes mm-pulse {
  0% { transform: scale(0.72); opacity: 0.95; }
  100% { transform: scale(1.18); opacity: 0; }
}

.mm-swords {
  position: relative;
  z-index: 1;
  font-size: 3.2rem;
  line-height: 1;
  filter: drop-shadow(0 10px 20px var(--orange-glow));
  animation: mm-swords 1.1s ease-in-out infinite;
}

@keyframes mm-swords {
  0%,
  100% { transform: scale(1) rotate(-8deg); }
  50% { transform: scale(1.12) rotate(8deg); }
}

.battle-match-found {
  text-align: center;
  padding: 28px 16px;
}

.mm-found-label {
  margin: 0 0 18px;
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--orange-deep);
  animation: mm-found-pop 0.55s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.mm-found-vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  max-width: 420px;
  margin: 0 auto 16px;
}

.mm-found-fighter {
  display: grid;
  justify-items: center;
  gap: 8px;
  animation: mm-found-rise 0.6s ease-out both;
}

.mm-found-fighter.is-rival {
  animation-delay: 0.12s;
}

.mm-found-avatar {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  font-size: 2.2rem;
  background: color-mix(in srgb, var(--orange) 16%, var(--surface));
  border: 3px solid color-mix(in srgb, var(--orange) 45%, var(--line));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--orange) 25%, transparent);
}

.mm-found-fighter.is-rival .mm-found-avatar {
  border-color: #e6b422;
  animation: mm-rival-glow 1.2s ease-in-out infinite;
}

.mm-found-fighter strong {
  font-size: 0.95rem;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mm-found-mid {
  display: grid;
  gap: 4px;
  justify-items: center;
  font-family: var(--font-en);
  font-weight: 900;
  color: var(--orange-deep);
}

.mm-found-swords {
  font-size: 1.8rem;
  animation: mm-swords 1.1s ease-in-out infinite;
}

@keyframes mm-found-pop {
  from {
    opacity: 0;
    transform: scale(0.7) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes mm-found-rise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes mm-rival-glow {
  0%,
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, #ffd54a 0%, transparent); }
  50% { box-shadow: 0 0 0 8px color-mix(in srgb, #ffd54a 28%, transparent); }
}

.leaderboard-rule-hint {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.mm-level {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  margin: 0;
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 0.95rem;
  color: var(--orange-deep);
}

.battle-fighter.is-pending-rival {
  opacity: 0.75;
  animation: mm-pending 1.2s ease-in-out infinite;
}

@keyframes mm-pending {
  0%,
  100% { opacity: 0.55; }
  50% { opacity: 1; }
}

html[data-theme="dark"] .mm-level {
  color: var(--orange-bright);
}

.battle-quota-line span {
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.battle-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.battle-code-lg {
  margin: 0 0 8px;
  font-family: var(--font-en);
  font-size: 1.15rem;
}

.battle-vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.battle-fighter {
  text-align: center;
  padding: 12px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  justify-items: center;
  gap: 4px;
}

.battle-fighter .battle-sb-avatar {
  margin-bottom: 2px;
}

.battle-fighter strong {
  display: block;
  margin-bottom: 0;
}

.battle-fighter span {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.battle-vs-label {
  font-family: var(--font-en);
  font-weight: 900;
  color: var(--orange-deep);
}

.battle-scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--orange) 18%, var(--surface)), var(--surface));
  border: 1px solid var(--line);
  text-align: center;
}

.battle-scoreboard-side {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.battle-sb-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.35rem;
  background: color-mix(in srgb, var(--orange) 14%, var(--surface));
  border: 2px solid color-mix(in srgb, var(--orange) 35%, var(--line));
  line-height: 1;
}

.battle-sb-avatar.is-mystery {
  opacity: 0.7;
  animation: mm-pending 1.2s ease-in-out infinite;
}

.battle-scoreboard strong {
  display: block;
  font-size: 0.82rem;
}

.battle-score {
  display: block;
  font-family: var(--font-en);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--orange-deep);
}

.battle-scoreboard-mid {
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.battle-question {
  text-align: center;
}

.battle-q-zh {
  margin: 0;
  font-size: clamp(2rem, 8vw, 2.6rem);
  font-weight: 800;
  line-height: 1.2;
}

.battle-q-jp {
  margin: 6px 0 12px;
}

.battle-choices {
  display: grid;
  gap: 8px;
}

.battle-choice {
  width: 100%;
  justify-content: center;
  padding: 12px 14px;
  font-weight: 800;
}

.battle-choice-ok {
  border-color: #43a047 !important;
  background: color-mix(in srgb, #43a047 18%, var(--surface)) !important;
}

.battle-choice-bad {
  border-color: #e53935 !important;
  background: color-mix(in srgb, #e53935 14%, var(--surface)) !important;
}

.battle-quick-btn {
  width: 100%;
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  min-height: 76px;
  padding: 16px 18px !important;
  border-radius: 18px !important;
  font-size: 1.05rem !important;
  box-shadow: 0 10px 28px var(--orange-glow);
  border: 2px solid color-mix(in srgb, var(--orange) 55%, transparent) !important;
}

.battle-quick-btn:hover,
.battle-quick-btn:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.battle-quick-icon {
  font-size: 1.7rem;
  line-height: 1;
}

.battle-quick-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
}

.battle-quick-text strong {
  font-size: 1.15rem;
  font-weight: 900;
}

.battle-quick-text small {
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.92;
}

.battle-play-card {
  padding-top: 16px;
}

.battle-mode-grid {
  display: grid;
  gap: 8px;
}

.battle-mode-card {
  appearance: none;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  text-align: left;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.battle-mode-card.active {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 14%, var(--surface));
  box-shadow: 0 6px 16px var(--orange-glow);
}

.battle-mode-icon {
  grid-row: 1 / span 2;
  font-size: 1.5rem;
}

.battle-mode-card strong {
  font-family: var(--font-en);
  font-weight: 900;
}

.battle-mode-card small {
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.35;
}

.battle-rain-arena {
  margin: 0;
  min-height: 0;
}

.battle-match-screen {
  padding: 8px 0 0;
}

.battle-level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.battle-level-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.battle-level-chip {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 0;
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 1rem;
  cursor: pointer;
}

.battle-level-chip small {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  opacity: 0.75;
  margin-top: 2px;
}

.battle-level-chip.active {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 22%, var(--surface));
  color: var(--orange-deep);
  box-shadow: 0 6px 16px var(--orange-glow);
}

/* Word Rain live: score + arena + choices fit one screen */
.battle-rain-fit {
  display: grid;
  grid-template-rows: auto auto minmax(72px, 1fr) auto auto;
  gap: 6px;
  height: calc(100dvh - 128px - var(--safe-bottom));
  max-height: calc(100dvh - 128px - var(--safe-bottom));
  overflow: hidden;
  align-content: stretch;
}

.battle-rain-fit .battle-scoreboard {
  padding: 8px 10px;
  border-radius: 12px;
}

.battle-rain-fit .battle-score {
  font-size: 1.25rem;
}

.battle-rain-fit .battle-scoreboard strong {
  font-size: 0.72rem;
}

.battle-rain-fit .battle-scoreboard small {
  font-size: 0.7rem;
}

.battle-rain-fit .battle-round-timer {
  font-size: 1.2rem;
}

.battle-rain-fit .battle-timer-track {
  height: 4px;
}

.battle-rain-fit .rain-arena,
.battle-rain-fit .battle-rain-arena {
  height: 100%;
  min-height: 0;
  max-height: none;
}

.battle-rain-fit .rain-drop {
  padding: 8px 12px;
  min-width: 64px;
  max-width: calc(100% - 20px);
}

.battle-rain-fit .rain-drop-zh {
  font-size: calc(1.25rem * var(--font-zh-scale));
}

.battle-rain-fit .rain-drop-jyutping {
  font-size: calc(0.72rem * var(--font-jyutping-scale));
}

.battle-rain-fit .rain-ground {
  height: 28px;
  font-size: 0.58rem;
}

.battle-rain-fit .rain-feedback {
  min-height: 1.1em;
  font-size: 0.78rem;
  margin: 0;
}

.battle-rain-fit .rain-choices {
  gap: 6px;
  flex-shrink: 0;
}

.battle-rain-fit .rain-choice {
  padding: 10px 8px;
  font-size: 0.82rem;
  border-radius: 12px;
}

.battle-rain-fit .battle-countdown-wrap {
  padding: 24px 12px;
  align-self: center;
}

body:has(.battle-rain-fit) .app-main {
  padding-top: 8px;
  padding-bottom: calc(96px + var(--safe-bottom));
  overflow: hidden;
}

@media (min-width: 720px) {
  .battle-rain-fit {
    height: calc(100dvh - 120px - var(--safe-bottom));
    max-height: calc(100dvh - 120px - var(--safe-bottom));
  }
  .battle-rain-fit .rain-choice {
    padding: 12px 10px;
    font-size: 0.9rem;
  }
}

@media (max-height: 700px) {
  .battle-rain-fit {
    height: calc(100dvh - 118px - var(--safe-bottom));
    max-height: calc(100dvh - 118px - var(--safe-bottom));
    gap: 4px;
  }
  .battle-rain-fit .rain-choice {
    padding: 8px 6px;
    font-size: 0.78rem;
  }
  .battle-rain-fit .battle-score {
    font-size: 1.1rem;
  }
}

.battle-preview {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--orange) 8%, var(--surface));
}

.battle-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  font-family: var(--font-en);
}

.battle-preview-head span {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.battle-preview-desc {
  margin: 4px 0 8px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.35;
}

.battle-mix-bars {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
}

.battle-mix-seg {
  min-width: 2px;
}

.battle-preview-mix-note {
  margin: 5px 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
  font-family: var(--font-en);
}

.battle-preview-samples-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.battle-demo-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--orange) 18%, var(--surface));
  color: var(--orange-deep);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.battle-preview-samples {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.battle-preview-card {
  display: grid;
  grid-template-columns: auto auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 0;
  align-items: baseline;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.battle-preview-card .battle-band-pill {
  grid-row: 1 / span 2;
  align-self: center;
  margin: 0;
  font-size: 0.6rem;
  padding: 2px 6px;
}

.battle-preview-card strong {
  font-size: 1rem;
  line-height: 1.2;
}

.battle-preview-card .card-jyutping {
  grid-column: 3;
  font-size: 0.72rem;
  opacity: 0.85;
}

.battle-preview-card span:last-child {
  grid-column: 2 / span 2;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.25;
}

@media (min-width: 640px) {
  .battle-preview-samples {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .battle-preview-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 2px;
    padding: 8px 10px;
  }

  .battle-preview-card .battle-band-pill {
    grid-row: auto;
  }

  .battle-preview-card .card-jyutping,
  .battle-preview-card span:last-child {
    grid-column: auto;
  }

  .battle-preview-card strong {
    font-size: 1.05rem;
  }
}

.battle-band-pill {
  display: inline-block;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  font-family: var(--font-en);
  color: #fff;
  background: var(--band, #888);
  margin-bottom: 6px;
}

.battle-content-badge {
  margin: 0 0 8px;
  font-family: var(--font-en);
  font-weight: 800;
}

.battle-countdown-wrap {
  text-align: center;
  padding: 48px 16px;
  border-radius: 18px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--orange) 25%, var(--surface)), var(--surface));
  border: 1px solid var(--line);
}

.battle-countdown-num {
  margin: 0;
  font-family: var(--font-en);
  font-size: clamp(4rem, 18vw, 6rem);
  font-weight: 900;
  line-height: 1;
  color: var(--orange-deep);
}

.battle-round-timer {
  display: block;
  font-family: var(--font-en);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--orange-deep);
}

.battle-timer-urgent {
  color: #e53935 !important;
  animation: battle-pulse 0.5s ease infinite alternate;
}

@keyframes battle-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

.battle-timer-track {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.battle-timer-bar {
  height: 100%;
  background: linear-gradient(90deg, #43a047, #66bb6a);
  transition: width 0.2s linear, background 0.2s linear;
}

.battle-wait-next {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 700;
}

.leaderboard-page {
  gap: 16px;
}

.leaderboard-hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 22px 18px 20px;
  border-radius: 22px;
  border: 2px solid color-mix(in srgb, #f5c518 55%, var(--orange));
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 215, 64, 0.45), transparent 55%),
    radial-gradient(ellipse at 85% 20%, rgba(255, 116, 32, 0.28), transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(74, 158, 255, 0.18), transparent 45%),
    linear-gradient(160deg, color-mix(in srgb, var(--orange) 16%, var(--surface)), var(--surface));
  box-shadow: 0 14px 36px var(--orange-glow);
}

.leaderboard-hero-glow {
  position: absolute;
  inset: -40% -20% auto;
  height: 120%;
  background: radial-gradient(circle, rgba(255, 215, 64, 0.22), transparent 60%);
  pointer-events: none;
  animation: lb-shine 4.5s ease-in-out infinite;
}

@keyframes lb-shine {
  0%,
  100% { transform: translateX(-8%) scale(1); opacity: 0.7; }
  50% { transform: translateX(8%) scale(1.08); opacity: 1; }
}

.leaderboard-hero-emoji {
  margin: 0;
  font-size: 2.2rem;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(232, 90, 0, 0.35));
  animation: lb-bob 2.8s ease-in-out infinite;
}

@keyframes lb-bob {
  0%,
  100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.leaderboard-hero h1 {
  position: relative;
  margin: 8px 0 6px;
  font-family: var(--font-en);
  font-size: clamp(1.45rem, 5vw, 1.85rem);
  font-weight: 900;
  color: var(--orange-deep);
}

.leaderboard-hero p {
  position: relative;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 700;
}

.leaderboard-empty {
  margin: 0;
  padding: 22px;
  text-align: center;
  border-radius: 16px;
  border: 1px dashed var(--line);
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--orange) 8%, var(--surface));
}

.leaderboard-podium {
  display: grid;
  grid-template-columns: 1fr 1.12fr 1fr;
  gap: 8px;
  align-items: end;
  margin: 4px 0 14px;
}

.podium-slot {
  display: grid;
  gap: 2px;
  justify-items: center;
  text-align: center;
  padding: 14px 8px 16px;
  border-radius: 18px;
  border: 2px solid transparent;
  min-height: 148px;
  position: relative;
}

.podium-slot.is-champion {
  min-height: 178px;
  padding-top: 18px;
  transform: translateY(-6px);
}

.podium-avatar {
  font-size: 1.45rem;
  line-height: 1;
  margin: 2px 0;
}

.lb-emoji {
  margin-right: 6px;
}

.podium-slot.is-champion .podium-crown {
  font-size: 1.9rem;
  animation: lb-bob 2.4s ease-in-out infinite;
}

.podium-rank {
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.podium-name {
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-handle {
  font-size: 0.7rem;
  opacity: 0.8;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-pts {
  margin-top: 4px;
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 800;
}

.podium-pts b {
  font-size: 1.25rem;
  font-weight: 900;
}

.podium-record {
  font-size: 0.68rem;
  opacity: 0.75;
  font-weight: 700;
}

.podium-gold {
  background: linear-gradient(165deg, #fff4c2 0%, #ffd54a 42%, #f0a500 100%);
  border-color: #e6a800;
  color: #5c3d00;
  box-shadow: 0 12px 28px rgba(230, 168, 0, 0.35);
}

.podium-silver {
  background: linear-gradient(165deg, #f4f7fb 0%, #cfd8e6 45%, #9eacc0 100%);
  border-color: #8a9bb0;
  color: #2c3a4a;
  box-shadow: 0 10px 22px rgba(110, 130, 155, 0.28);
}

.podium-bronze {
  background: linear-gradient(165deg, #ffe0c2 0%, #e8a06a 45%, #c8753a 100%);
  border-color: #b86328;
  color: #4a2a12;
  box-shadow: 0 10px 22px rgba(184, 99, 40, 0.3);
}

.podium-slot.is-me {
  outline: 3px solid var(--orange-bright);
  outline-offset: 2px;
}

.leaderboard-list {
  display: grid;
  gap: 8px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--surface);
  transition: transform 0.15s ease;
}

.leaderboard-row.rank-tier-1 {
  background: linear-gradient(90deg, color-mix(in srgb, #4a9eff 14%, var(--surface)), var(--surface));
  border-color: color-mix(in srgb, #4a9eff 35%, var(--line));
}

.leaderboard-row.rank-tier-2 {
  background: linear-gradient(90deg, color-mix(in srgb, #43a047 12%, var(--surface)), var(--surface));
  border-color: color-mix(in srgb, #43a047 30%, var(--line));
}

.leaderboard-row.rank-tier-3 {
  background: linear-gradient(90deg, color-mix(in srgb, #fb8c00 12%, var(--surface)), var(--surface));
  border-color: color-mix(in srgb, #fb8c00 32%, var(--line));
}

.leaderboard-row.rank-tier-4 {
  background: linear-gradient(90deg, color-mix(in srgb, #e53935 10%, var(--surface)), var(--surface));
  border-color: color-mix(in srgb, #e53935 28%, var(--line));
}

.leaderboard-row.is-me {
  border-color: var(--orange);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--orange) 35%, transparent);
}

.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-family: var(--font-en);
  font-weight: 900;
  background: color-mix(in srgb, var(--ink) 8%, var(--surface));
  color: var(--ink);
}

.rank-tier-1 .leaderboard-rank {
  background: linear-gradient(145deg, #6bb6ff, #2b7fdb);
  color: #fff;
}

.rank-tier-2 .leaderboard-rank {
  background: linear-gradient(145deg, #66bb6a, #2e7d32);
  color: #fff;
}

.rank-tier-3 .leaderboard-rank {
  background: linear-gradient(145deg, #ffb74d, #ef6c00);
  color: #fff;
}

.rank-tier-4 .leaderboard-rank {
  background: linear-gradient(145deg, #ef5350, #c62828);
  color: #fff;
}

.leaderboard-rank-num {
  font-size: 0.85rem;
  letter-spacing: -0.02em;
}

.leaderboard-who strong {
  display: block;
  font-size: 0.98rem;
}

.leaderboard-who small {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.leaderboard-pts {
  text-align: right;
  font-family: var(--font-en);
}

.leaderboard-pts strong {
  display: block;
  font-size: 1.2rem;
  color: var(--orange-deep);
}

.leaderboard-pts small {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
}

html[data-theme="dark"] .leaderboard-hero {
  border-color: color-mix(in srgb, #f5c518 40%, var(--line));
}

html[data-theme="dark"] .podium-gold {
  color: #fff3c4;
  background: linear-gradient(165deg, #6b5200 0%, #c99700 50%, #8a6200 100%);
  border-color: #f0c14a;
}

html[data-theme="dark"] .podium-silver {
  color: #e8eef6;
  background: linear-gradient(165deg, #3a4554 0%, #6d7d92 50%, #4a586a 100%);
  border-color: #a8b8cc;
}

html[data-theme="dark"] .podium-bronze {
  color: #ffe2c8;
  background: linear-gradient(165deg, #5a3218 0%, #a85e2a 50%, #7a4018 100%);
  border-color: #e09050;
}

@media (max-width: 420px) {
  .leaderboard-podium {
    gap: 6px;
  }
  .podium-name {
    font-size: 0.8rem;
  }
  .podium-pts b {
    font-size: 1.05rem;
  }
  .podium-slot.is-champion {
    transform: translateY(-4px);
  }
}

.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.notif-head h2 {
  margin: 0;
}

.notif-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-size: 0.72rem;
  font-family: var(--font-en);
  vertical-align: middle;
}

.notif-list {
  display: grid;
  gap: 8px;
}

.notif-item {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  align-items: start;
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.notif-item.is-unread {
  border-color: color-mix(in srgb, var(--orange) 50%, var(--line));
  background: color-mix(in srgb, var(--orange) 10%, var(--surface));
}

.notif-item.is-read {
  opacity: 0.78;
}

.notif-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: transparent;
}

.notif-item.is-unread .notif-dot {
  background: var(--orange);
}

.notif-body {
  display: grid;
  gap: 2px;
}

.notif-body span {
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.4;
}

.notif-body small {
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.nav-item {
  position: relative;
}

.nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 22px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e53935;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
  font-family: var(--font-en);
  display: grid;
  place-items: center;
  line-height: 1;
}

.nav-item.has-unread > span:not(.nav-badge):not(.nav-icon) {
  color: var(--orange-deep);
}

.battle-hub-card {
  border-color: color-mix(in srgb, var(--orange) 45%, var(--line));
}

html[data-theme="dark"] .battle-spotlight {
  border-color: color-mix(in srgb, #ffd54a 40%, var(--orange));
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .game-solo-card {
  background: var(--surface);
  border-color: var(--line);
}

.battle-results h2 {
  margin: 4px 0 8px;
  font-family: var(--font-en);
  font-weight: 900;
}

.battle-results-arena {
  overflow: visible;
}

.battle-verdict {
  text-align: center;
  font-size: clamp(1.45rem, 4vw, 1.9rem);
  letter-spacing: -0.02em;
}

.battle-verdict-win {
  color: color-mix(in srgb, #1f8f4e 70%, var(--ink));
}

.battle-verdict-lose {
  color: color-mix(in srgb, var(--orange-deep) 55%, var(--ink));
}

.battle-verdict-await {
  color: var(--orange-deep);
}

.battle-encourage {
  margin: 0 0 16px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.4;
}

.battle-arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: end;
  margin: 8px 0 14px;
  padding: 18px 8px 10px;
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--orange) 22%, transparent), transparent 62%),
    linear-gradient(180deg, color-mix(in srgb, var(--orange) 8%, var(--surface)), var(--surface));
  border: 1px solid var(--line);
  min-height: 190px;
}

.battle-arena-vs {
  display: grid;
  gap: 4px;
  justify-items: center;
  align-self: center;
  font-family: var(--font-en);
  font-weight: 900;
  color: var(--orange-deep);
  padding-bottom: 28px;
}

.battle-arena-vs span {
  font-size: 1.05rem;
}

.battle-arena-vs small {
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 800;
}

.battle-fighter-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
  padding: 12px 8px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.45s ease;
}

.battle-fighter-card.is-elevated {
  transform: translateY(-22px) scale(1.06);
  box-shadow: 0 16px 28px color-mix(in srgb, var(--orange) 28%, transparent);
  border-color: color-mix(in srgb, var(--orange) 55%, var(--line));
  z-index: 2;
}

.battle-fighter-side {
  font-family: var(--font-en);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.battle-avatar-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 4px 0 2px;
}

.battle-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 2rem;
  background: color-mix(in srgb, var(--orange) 14%, var(--surface));
  border: 3px solid color-mix(in srgb, var(--orange) 40%, var(--line));
  line-height: 1;
}

.battle-fighter-card.is-crowned .battle-avatar {
  border-color: #e6b422;
  box-shadow: 0 0 0 3px color-mix(in srgb, #ffd54a 45%, transparent);
}

.battle-crown {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.45rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
  animation: battle-crown-drop 0.7s cubic-bezier(0.34, 1.4, 0.64, 1) both;
  z-index: 3;
}

@keyframes battle-crown-drop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-28px) scale(0.6) rotate(-18deg);
  }
  60% {
    opacity: 1;
    transform: translateX(-50%) translateY(2px) scale(1.12) rotate(6deg);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1) rotate(0deg);
  }
}

.battle-fighter-name {
  font-size: 0.95rem;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-fighter-handle {
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-family: var(--font-en);
  font-weight: 700;
}

.battle-fighter-card .battle-score {
  margin-top: 2px;
  font-size: 1.45rem;
}

.battle-await-note {
  margin: 0 0 12px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.battle-review {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.battle-review-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.battle-review-head h3 {
  margin: 0;
  font-family: var(--font-en);
  font-size: 0.95rem;
  font-weight: 900;
}

.battle-review-head span {
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--orange-deep);
}

.battle-review-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.battle-review-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.battle-review-row.is-hit {
  border-color: color-mix(in srgb, #1f8f4e 35%, var(--line));
  background: color-mix(in srgb, #1f8f4e 8%, var(--surface));
}

.battle-review-row.is-miss {
  border-color: color-mix(in srgb, #c62828 28%, var(--line));
  background: color-mix(in srgb, #c62828 6%, var(--surface));
}

.battle-review-mark {
  font-weight: 900;
  font-family: var(--font-en);
  text-align: center;
}

.battle-review-row.is-hit .battle-review-mark {
  color: #1f8f4e;
}

.battle-review-row.is-miss .battle-review-mark {
  color: #c62828;
}

.battle-review-main {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.battle-review-main strong {
  font-size: 1.05rem;
  line-height: 1.2;
}

.battle-review-ans {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.battle-review-tag {
  font-family: var(--font-en);
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.battle-result-actions {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.battle-again-btn {
  width: 100%;
  font-weight: 900;
}

.battle-result-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
  font-family: var(--font-en);
  font-size: 0.82rem;
  font-weight: 800;
}

.battle-result-links a {
  color: var(--ink-soft);
  text-decoration: none;
}

.battle-result-links a:hover {
  color: var(--orange-deep);
}

@media (min-width: 640px) {
  .battle-result-actions {
    grid-template-columns: 1fr 1fr;
  }

  .battle-arena {
    padding: 22px 16px 12px;
  }

  .battle-avatar-wrap,
  .battle-avatar {
    width: 72px;
    height: 72px;
  }

  .battle-avatar {
    font-size: 2.25rem;
  }
}

html[data-theme="dark"] .battle-fighter,
html[data-theme="dark"] .battle-scoreboard,
html[data-theme="dark"] .battle-fighter-card,
html[data-theme="dark"] .battle-review-row {
  background: var(--surface);
}

html[data-theme="dark"] .battle-verdict-win {
  color: #7dcea0;
}

@media (min-width: 640px) {
  .video-grid {
    grid-template-columns: 1fr 1fr;
  }

  .buddy-grid {
    grid-template-columns: 1fr 1fr;
  }

  .video-detail-header {
    grid-template-columns: 140px 1fr;
    align-items: start;
  }

  .video-detail-header.is-compact {
    grid-template-columns: 1fr;
  }

  .video-detail-thumb {
    max-height: none;
    height: 186px;
  }
}

/* --- Home portals (Video · Lessons · News) --- */
.home-portals {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0 18px;
}

@media (min-width: 720px) {
  .home-portals {
    grid-template-columns: repeat(4, 1fr);
  }
}

.home-portal {
  --portal-accent: var(--orange);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-height: 132px;
  padding: 14px 12px 12px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--portal-accent) 28%, transparent), transparent 55%),
    linear-gradient(165deg, var(--surface) 0%, color-mix(in srgb, var(--portal-accent) 10%, var(--panel-grad-b)) 100%);
  border: 1px solid color-mix(in srgb, var(--portal-accent) 28%, var(--line));
  box-shadow:
    0 10px 24px color-mix(in srgb, var(--portal-accent) 18%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.home-portal.home-portal-enter {
  animation: home-portal-in 0.45s ease both;
  animation-delay: calc(var(--portal-i, 0) * 70ms);
}

.home-portal-video {
  --portal-accent: #ff7420;
}

.home-portal-lessons {
  --portal-accent: #2b7fdb;
}

.home-portal-news {
  --portal-accent: #e3a008;
}

.home-portal-songs {
  --portal-accent: #c45ad3;
}

.home-portal:hover,
.home-portal:focus-visible {
  transform: translateY(-3px) scale(1.02);
  border-color: color-mix(in srgb, var(--portal-accent) 55%, var(--line));
  box-shadow:
    0 16px 32px color-mix(in srgb, var(--portal-accent) 26%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  outline: none;
}

.home-portal:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--portal-accent) 16%, transparent);
}

.home-portal-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 1.45rem;
  background: color-mix(in srgb, var(--portal-accent) 16%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--portal-accent) 22%, transparent);
  animation: home-portal-icon-bob 2.8s ease-in-out infinite;
  animation-delay: calc(var(--portal-i, 0) * 120ms);
}

.home-portal-copy {
  display: grid;
  gap: 2px;
  margin-top: auto;
}

.home-portal-copy strong {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.home-portal-copy small {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1.3;
}

.home-portal-go {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, var(--portal-accent), color-mix(in srgb, var(--portal-accent) 65%, #fff));
  box-shadow: 0 6px 14px color-mix(in srgb, var(--portal-accent) 35%, transparent);
}

@keyframes home-portal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes home-portal-icon-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@media (max-width: 420px) {
  .home-portals {
    gap: 8px;
  }

  .home-portal {
    min-height: 120px;
    padding: 12px 10px 10px;
    border-radius: 16px;
  }

  .home-portal-copy strong {
    font-size: 0.95rem;
  }

  .home-portal-copy small {
    font-size: 0.66rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-portal.home-portal-enter,
  .home-portal-icon {
    animation: none;
  }

  .home-portal:hover,
  .home-portal:focus-visible {
    transform: none;
  }
}

html[data-theme="dark"] .home-portal {
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* --- Home suggestions (lessons | news) --- */
.suggest-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 10px 0 16px;
}

.suggest-col {
  min-width: 0;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid rgba(255, 149, 51, 0.16);
  box-shadow: var(--shadow);
}

.suggest-col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  text-decoration: none;
  color: inherit;
}

.suggest-col-head h2 {
  margin: 0;
  font-family: var(--font-en);
  font-size: 1.12rem;
  font-weight: 800;
}

.suggest-col-more {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--orange-deep);
  white-space: nowrap;
}

.suggest-col-body {
  display: grid;
  gap: 8px;
}

.suggest-empty {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.suggest-video-card,
.suggest-news-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 8px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
  padding: 4px;
  margin: -4px;
}

.suggest-video-card:active,
.suggest-news-card:active {
  background: color-mix(in srgb, var(--orange-bright) 10%, transparent);
}

.suggest-video-thumb-wrap,
.suggest-news-thumb-wrap {
  position: relative;
  width: 64px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
}

.suggest-video-thumb,
.suggest-news-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.suggest-video-thumb-wrap .level-badge,
.suggest-video-thumb-wrap .preview-badge {
  transform: scale(0.75);
  transform-origin: top left;
}

.suggest-news-thumb {
  border-radius: 0;
  background: transparent;
}

.suggest-video-copy,
.suggest-news-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.suggest-video-copy strong,
.suggest-news-copy strong {
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.suggest-news-copy strong {
  font-family: var(--font-zh);
  color: var(--orange-deep);
}

.suggest-video-copy span,
.suggest-news-meta {
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.25;
}

.home-lessons-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 10px;
}

@media (max-width: 520px) {
  .suggest-split {
    grid-template-columns: 1fr;
  }
}

/* --- Easy HK News --- */
.news-home {
  margin: 8px 0 18px;
}

.news-home-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.news-home-sub {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.4;
}

.news-teaser-row,
.news-list {
  display: grid;
  gap: 12px;
}

.news-teaser {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid rgba(255, 149, 51, 0.15);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.news-teaser:active {
  transform: scale(0.99);
}

.news-teaser-img {
  width: 108px;
  height: 80px;
  object-fit: cover;
  border-radius: 0;
  background: var(--surface);
  display: block;
}

.news-teaser-source {
  margin: 0 0 5px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #a89a90;
}

.news-teaser-easy {
  margin: 0;
  font-family: var(--font-zh);
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.4;
  color: var(--orange-deep);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-hero-link {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 149, 51, 0.18);
}

.news-hero-img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  background: var(--surface);
}

.news-source-line {
  margin: 10px 0 6px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.news-original-title {
  margin: 0 0 16px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.news-easy-block {
  margin: 0 0 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid rgba(255, 149, 51, 0.15);
  box-shadow: var(--shadow);
}

.news-easy-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.news-vocab-hint {
  margin: 0;
  flex: 1 1 12rem;
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink-soft);
  text-align: right;
}

@media (max-width: 520px) {
  .news-vocab-hint {
    text-align: left;
    flex-basis: 100%;
  }
}

.news-easy-para {
  margin: 0;
  font-family: var(--font-zh);
  font-size: calc(1.42rem * var(--font-zh-scale, 1));
  font-weight: 700;
  line-height: 2.15;
  color: var(--ink);
  text-wrap: pretty;
}

/* Near-word vocab bubble (news + chat lessons) */
.vocab-bubble {
  position: fixed;
  z-index: 80;
  width: min(292px, calc(100vw - 20px));
  padding: 16px 14px 14px;
  border-radius: 14px;
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--orange-bright) 10%, var(--surface)) 0%, var(--surface) 42%),
    var(--surface);
  border: 1.5px solid color-mix(in srgb, var(--orange) 32%, var(--line));
  box-shadow:
    0 14px 36px rgba(45, 34, 24, 0.16),
    0 2px 0 color-mix(in srgb, var(--orange) 18%, transparent);
  text-align: center;
  color: var(--ink);
  animation: vocab-bubble-in 0.16s ease-out;
}

.vocab-bubble[data-place="above"] {
  transform-origin: bottom center;
}

.vocab-bubble[data-place="below"] {
  transform-origin: top center;
}

@keyframes vocab-bubble-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.vocab-bubble-close {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.vocab-bubble-close:hover,
.vocab-bubble-close:focus-visible {
  background: color-mix(in srgb, var(--orange) 12%, var(--surface));
  color: var(--orange-deep);
}

.vocab-bubble-star.star-btn {
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.vocab-bubble .fam-label {
  margin: 6px 28px 0;
  font-size: 0.78rem;
}

.vocab-bubble .fam-bar {
  margin: 6px auto 2px;
  justify-content: center;
}

.vocab-bubble-zh {
  margin: 8px 0 0;
  font-family: var(--font-zh);
  font-size: calc(1.7rem * var(--font-zh-scale, 1));
  font-weight: 800;
  line-height: 1.15;
}

.vocab-bubble-jp {
  margin: 4px 0 0;
  font-family: var(--font-en);
  font-size: calc(0.92rem * var(--font-jyutping-scale, 1));
  font-weight: 700;
  color: var(--ink-soft);
}

.vocab-bubble-en {
  margin: 8px 0 0;
  font-size: calc(0.95rem * var(--font-meaning-scale, 1));
  color: var(--ink-soft);
  line-height: 1.4;
}

.vocab-bubble-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.vocab-bubble-speak.speak-btn {
  width: 44px;
  height: 44px;
  box-shadow: 0 6px 16px rgba(74, 158, 255, 0.28);
}

.vocab-bubble-speak.speak-btn svg {
  width: 20px;
  height: 20px;
}

.vocab-bubble.is-skipped {
  opacity: 0.72;
  border-style: dashed;
}

.news-word.is-skipped {
  opacity: 0.42;
}

.news-word.is-skipped .news-word-zh {
  text-decoration-style: dashed;
  text-decoration-thickness: 2px;
}

.mini-card.is-skipped {
  opacity: 0.55;
}

html[data-theme="dark"] .vocab-bubble {
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.45),
    0 0 0 1px color-mix(in srgb, var(--orange) 22%, transparent);
}

/* HK Daily Chat */
.suggest-chats {
  margin: 14px 0 18px;
  padding: 12px 14px 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid rgba(255, 149, 51, 0.14);
  box-shadow: var(--shadow);
}

.suggest-chats .suggest-col-head {
  margin-bottom: 10px;
}

.suggest-chats-body {
  display: grid;
  gap: 8px;
}

.suggest-chat-card .suggest-news-copy {
  padding: 10px 12px;
}

.chat-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.chat-teaser {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid rgba(255, 149, 51, 0.14);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}

.chat-teaser:active {
  transform: scale(0.99);
}

.chat-teaser.is-read {
  opacity: 0.78;
}

.chat-teaser-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ffb35a, #ff7a2f);
  font-size: 1.25rem;
}

.chat-teaser-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 0 0 4px;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.chat-teaser-title {
  margin: 0;
  font-family: var(--font-zh);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.25;
}

.chat-teaser-en {
  margin: 2px 0 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.chat-teaser-who {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.chat-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0 8px;
}

.chat-theme-pill {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.chat-detail-title {
  margin: 0;
  font-family: var(--font-zh);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.2;
}

.chat-detail-who {
  margin: 4px 0 12px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.chat-easy-block {
  background: linear-gradient(180deg, rgba(255, 179, 90, 0.08), transparent 48%), var(--card);
}

.chat-dialogue {
  display: grid;
  gap: 12px;
}

.chat-turn {
  display: grid;
  gap: 4px;
}

.chat-who {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--orange, #ff8a2b);
  letter-spacing: 0.02em;
}

.chat-bubble {
  font-family: var(--font-zh);
  font-size: calc(1.28rem * var(--font-zh-scale, 1));
  font-weight: 700;
  line-height: 2.05;
  color: var(--ink);
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 149, 51, 0.12);
}

html[data-theme="dark"] .chat-bubble {
  background: rgba(255, 255, 255, 0.04);
}

html[data-jyutping="off"] .chat-dialogue {
  line-height: 1.7;
}

.news-word {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: baseline;
  margin: 0 0.12em;
  max-width: 100%;
}

.news-word-jp,
.news-word-zh {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: center;
  max-width: 100%;
}

.news-word-jp {
  font-family: var(--font-en, inherit);
  font-size: calc(0.58em * var(--font-jyutping-scale, 1));
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--ink-soft) 35%, transparent);
  text-underline-offset: 2px;
  margin-bottom: 1px;
  white-space: nowrap;
}

.news-word-zh {
  font-family: var(--font-zh);
  font-weight: 800;
  line-height: 1.2;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
  text-decoration-color: var(--fam-color, color-mix(in srgb, var(--orange) 55%, var(--line)));
}

.news-word:hover .news-word-zh,
.news-word.is-focus .news-word-zh {
  color: color-mix(in srgb, var(--fam-color, var(--orange-deep)) 55%, var(--ink));
  text-decoration-color: var(--fam-color, var(--orange));
}

.news-word.is-open .news-word-zh {
  text-decoration-color: var(--fam-color, var(--orange));
}

.news-word.is-speaking .news-word-zh {
  background: color-mix(in srgb, var(--fam-color, var(--orange-bright)) 22%, transparent);
  border-radius: 6px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fam-color, var(--orange-bright)) 16%, transparent);
  color: var(--ink);
  text-decoration-color: var(--fam-color, color-mix(in srgb, var(--orange) 45%, var(--line)));
}

.news-word.is-speaking .news-word-jp {
  color: color-mix(in srgb, var(--orange-deep) 55%, var(--ink-soft));
}

.news-listen-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.news-listen-icon {
  font-size: 0.95em;
  line-height: 1;
}

.news-listen-btn.is-listening {
  background: color-mix(in srgb, var(--orange) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--orange) 40%, var(--line));
  color: var(--orange-deep);
}

.news-listen-btn.is-listening .news-listen-icon {
  animation: news-listen-pulse 1s ease-in-out infinite;
}

@keyframes news-listen-pulse {
  50% {
    opacity: 0.55;
  }
}

.news-word-jp:hover,
.news-word-jp:focus-visible {
  color: var(--orange-deep);
  text-decoration-color: var(--orange);
}

.news-word-zh:focus-visible,
.news-word-jp:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--orange) 55%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}

.news-sent-end,
.news-punct {
  margin-left: 0.02em;
  margin-right: 0.06em;
  color: var(--ink);
  font-weight: 600;
}

.news-gap {
  white-space: pre;
}

html[data-jyutping="off"] .news-easy-para {
  line-height: 1.7;
}

.news-card-stage {
  margin: 0 0 14px;
}

.news-card-placeholder {
  padding: 22px 16px;
  text-align: center;
  color: var(--ink-soft);
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  background: var(--surface);
}

.news-card-placeholder p {
  margin: 0;
}

.mini-card.is-active-mini {
  outline: 2px solid color-mix(in srgb, var(--orange) 55%, transparent);
  outline-offset: 1px;
}

@media (min-width: 720px) {
  .news-teaser-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .news-hero-img {
    max-height: 280px;
  }
}

/* ─── Write session ─── */
.write-page {
  padding: 4px 0 28px;
  max-width: 520px;
  margin: 0 auto;
}

.write-hero h1 {
  margin: 0 0 8px;
  font-family: var(--font-en);
  font-size: clamp(1.8rem, 6vw, 2.35rem);
  font-weight: 900;
  color: var(--ink);
}

.write-eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange-deep, #c2410c);
}

.write-lead {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
  font-size: 0.95rem;
}

.write-progress-card {
  margin: 18px 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--orange-bright, #ff9533) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--orange) 22%, transparent);
}

.write-progress-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.write-progress-row strong {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--orange-deep, #c2410c);
}

.write-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  overflow: hidden;
}

.write-progress-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), #ffb347);
}

.write-progress-hint {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.write-start-btn {
  margin: 4px 0 12px;
}

.write-setup-settings {
  margin-bottom: 8px;
}

.write-setup-settings .write-progress-card {
  margin: 0;
}

.write-hint {
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.write-gallery {
  margin-top: 28px;
}

.write-gallery h2 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.write-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.write-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.write-stat strong {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--orange-deep, #c2410c);
  line-height: 1.1;
}

.write-stat span {
  font-size: 0.68rem;
  color: var(--ink-soft);
  line-height: 1.2;
}

.write-roadmap {
  margin-top: 22px;
}

.write-roadmap-head {
  margin-bottom: 12px;
}

.write-roadmap-head h2 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.write-roadmap-head p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.write-road-list {
  display: grid;
  gap: 10px;
}

.write-road-stage {
  border: 1px solid color-mix(in srgb, var(--orange) 18%, var(--line));
  border-radius: var(--radius, 14px);
  background: color-mix(in srgb, var(--orange-bright, #ff9533) 5%, var(--surface, var(--card)));
  padding: 10px 12px 12px;
}

.write-road-stage.is-locked {
  opacity: 0.92;
  background: color-mix(in srgb, var(--ink) 3%, var(--surface, var(--card)));
  border-color: var(--line);
}

.write-road-stage.is-done {
  border-color: color-mix(in srgb, #2f9e44 28%, var(--line));
  background: color-mix(in srgb, #2f9e44 7%, var(--surface, var(--card)));
}

.write-road-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.write-road-mark {
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
}

.write-road-stage.is-done .write-road-mark {
  background: color-mix(in srgb, #2f9e44 18%, transparent);
  color: #1b6b2a;
}

.write-road-stage.is-progress .write-road-mark {
  background: color-mix(in srgb, var(--orange) 22%, transparent);
  color: var(--orange-deep, #c2410c);
}

.write-road-stage.is-locked .write-road-mark {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.write-road-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.write-road-copy strong {
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.25;
}

.write-road-copy small {
  font-size: 0.72rem;
  color: var(--ink-soft);
  line-height: 1.3;
}

.write-road-count {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-soft);
  white-space: nowrap;
}

.write-road-blurb,
.write-road-how,
.write-road-preview {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

.write-road-how {
  color: color-mix(in srgb, var(--orange-deep, #c2410c) 70%, var(--ink-soft));
}

.write-road-preview {
  font-family: var(--font-zh, inherit);
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.write-road-body {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
}

.write-road-empty {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.write-phrase-list {
  display: grid;
  gap: 6px;
}

.write-phrase-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 6px 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--ink) 3%, transparent);
  font-size: 0.8rem;
}

.write-phrase-zh {
  font-family: var(--font-zh, inherit);
  font-weight: 700;
  font-size: 0.95rem;
}

.write-phrase-en {
  color: var(--ink-soft);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.write-phrase-state {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
}

.write-phrase-row.is-done .write-phrase-state {
  color: #1b6b2a;
}

.write-phrase-row.is-ready .write-phrase-state {
  color: var(--orange-deep, #c2410c);
}

.write-phrase-row.is-locked {
  opacity: 0.72;
}

@media (max-width: 420px) {
  .write-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .write-phrase-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .write-phrase-state {
    white-space: normal;
  }
}

.write-char-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.write-char-chip {
  display: grid;
  gap: 2px;
  place-items: center;
  padding: 10px 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.write-char-chip.is-learned {
  border-color: color-mix(in srgb, var(--orange) 45%, var(--line));
  background: color-mix(in srgb, var(--orange-bright, #ff9533) 12%, var(--surface));
}

.write-char-glyph {
  font-family: var(--font-zh);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
}

.write-char-en {
  font-size: 0.62rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.2;
}

.write-session-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.write-session-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.write-phrase-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 12px;
}

.write-phrase-progress span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-family: var(--font-zh);
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--line);
  opacity: 0.45;
}

.write-phrase-progress span.is-active {
  opacity: 1;
  border-color: var(--orange);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--orange) 25%, transparent);
}

.write-phrase-progress span.is-done {
  opacity: 0.85;
  background: color-mix(in srgb, var(--orange) 14%, var(--surface));
}

.write-meet,
.write-stage,
.write-complete {
  text-align: center;
}

.write-char-emoji {
  font-size: 1.05rem;
  line-height: 1;
}

.write-picto {
  margin: 0 0 2px;
  font-size: clamp(2.4rem, 12vw, 3.2rem);
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(255, 122, 47, 0.2));
}

.write-from {
  margin: 8px 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.write-from strong {
  color: var(--orange-deep, #c2410c);
  font-family: var(--font-zh);
}

.write-big-char {
  margin: 12px 0 6px;
  font-family: var(--font-zh);
  font-size: clamp(4.2rem, 22vw, 5.6rem);
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}

.write-jp {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--orange-deep, #c2410c);
}

.write-en {
  margin: 4px 0 0;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.write-phrase-break {
  margin: 12px 0 0;
  font-family: var(--font-zh);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.write-tip {
  margin: 16px auto 0;
  max-width: 34ch;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink);
}

.write-story {
  margin: 14px auto 0;
  max-width: 36ch;
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 12px;
}

.write-story summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--orange-deep, #c2410c);
  list-style: none;
}

.write-story summary::-webkit-details-marker {
  display: none;
}

.write-story p {
  margin: 8px 0 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.write-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.write-step-label {
  margin: 0 0 4px;
  font-weight: 800;
  font-size: 1.02rem;
}

.write-step-sub {
  margin: 0 0 12px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.write-pad-frame {
  width: min(320px, 72vw);
  margin: 0 auto;
  aspect-ratio: 1;
  border-radius: 18px;
  background:
    linear-gradient(color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px) 0 0 / 25% 25%,
    linear-gradient(90deg, color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px) 0 0 / 25% 25%,
    color-mix(in srgb, #f5efe6 80%, var(--surface));
  border: 2px solid color-mix(in srgb, var(--ink) 12%, transparent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  touch-action: none;
  user-select: none;
  overflow: hidden;
  display: grid;
  place-items: center;
  position: relative;
  box-sizing: border-box;
}

.write-pad-frame.is-interactive {
  cursor: crosshair;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 0 0 3px color-mix(in srgb, var(--orange) 22%, transparent);
}

.write-pad-frame.is-free {
  background:
    linear-gradient(color-mix(in srgb, var(--ink) 5%, transparent) 1px, transparent 1px) 0 0 / 25% 25%,
    linear-gradient(90deg, color-mix(in srgb, var(--ink) 5%, transparent) 1px, transparent 1px) 0 0 / 25% 25%,
    var(--surface);
}

.write-pad-target {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/*
 * Do NOT force SVG to width/height 100% — that stretches Hanzi Writer’s
 * fixed pixel canvas and can shove the glyph into a corner on phones.
 * Keep the SVG at the size Hanzi Writer created and center it.
 */
.write-pad-target svg {
  display: block;
  margin: 0 auto;
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  max-height: 100%;
  overflow: visible;
  touch-action: none;
  vertical-align: top;
}

/*
 * Global `svg path { fill: currentColor }` turns Hanzi Writer pen paths into
 * filled polygons between points. Animation/user strokes live in <g> and must
 * stay unfilled. Clip masks live in <defs> and MUST stay filled — otherwise
 * the stroke demo and grey hint clip to nothing and disappear.
 */
.write-pad-target svg g path {
  fill: none !important;
}

.write-pad-target svg defs path,
.write-pad-target svg clipPath path {
  fill: #000 !important;
}

.write-feedback {
  margin: 12px 0 0;
  min-height: 1.2em;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.write-feedback.is-ok {
  color: #15803d;
}

.write-complete h1 {
  margin: 28px 0 8px;
  font-size: 1.8rem;
}

html[data-theme="dark"] .write-pad-frame {
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 25% 25%,
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 25% 25%,
    #1c1814;
  border-color: rgba(255, 240, 220, 0.22);
}

html[data-theme="dark"] .write-pad-frame.is-free {
  background:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px) 0 0 / 25% 25%,
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px) 0 0 / 25% 25%,
    #221c18;
}

html[data-theme="dark"] .write-feedback.is-ok {
  color: #7ef0c3;
}

/* Admin review mode chrome */
.admin-review-bar,
.admin-preview-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, #1c1917 92%, #ea580c);
  color: #fff7ed;
  border-top: 1px solid rgba(255, 237, 213, 0.28);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.22);
  font-size: 0.82rem;
}

.admin-preview-bar {
  background: color-mix(in srgb, #1c1917 88%, #dc2626);
  border-top-color: rgba(254, 202, 202, 0.35);
}

.admin-review-bar-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  min-width: 0;
}

.admin-review-bar-main strong {
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.admin-review-bar-meta,
.admin-review-bar-item {
  opacity: 0.88;
}

.admin-review-bar-item {
  max-width: 42ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-review-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-review-bar .btn,
.admin-preview-bar .btn {
  border-color: rgba(255, 237, 213, 0.35);
  color: #fff7ed;
}

.admin-review-bar .btn-primary {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fff7ed;
}

.admin-review-bar .btn-ghost:hover,
.admin-preview-bar .btn-ghost:hover {
  background: rgba(255, 247, 237, 0.12);
}

body.is-admin-review,
body.is-admin-preview {
  padding-bottom: 72px;
}

body.is-admin-review .bottom-nav,
body.is-admin-preview .bottom-nav {
  bottom: 56px;
}

.review-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #9a3412;
  color: #fff7ed;
  vertical-align: middle;
}

/* ─── Explore HK (adventure RPG) ─── */
.rpg-page {
  display: grid;
  gap: 14px;
  max-width: 540px;
  margin: 0 auto;
}

.rpg-hub-hero {
  position: relative;
  padding: 22px 16px 18px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 10% 0%, rgba(43, 183, 255, 0.28), transparent 55%),
    radial-gradient(100% 70% at 100% 20%, rgba(255, 116, 32, 0.22), transparent 50%),
    linear-gradient(165deg, color-mix(in srgb, #1a3a5c 8%, var(--card)), var(--card));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
}

.rpg-hub-hero h1 {
  margin: 4px 0 0;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.rpg-hub-en {
  margin: 2px 0 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--orange-deep);
}

.rpg-eyebrow {
  margin: 8px 0 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-deep);
}

.rpg-title-jp {
  margin: 2px 0 0;
  font-size: calc(0.85rem * var(--font-jyutping-scale));
  color: var(--ink-soft);
}

.rpg-lead {
  margin: 10px 0 0;
  color: var(--ink-soft);
  line-height: 1.45;
  font-size: 0.95rem;
}

.rpg-hub-card {
  padding: 14px 16px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--card) 92%, #2bb7ff);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.rpg-hub-card p {
  margin: 0 0 8px;
  color: var(--ink-soft);
  line-height: 1.45;
  font-size: 0.92rem;
}

.rpg-hub-card p:last-child {
  margin-bottom: 0;
}

.rpg-hub-meta {
  font-size: 0.82rem !important;
  opacity: 0.9;
}

.rpg-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rpg-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.rpg-top-btn,
.rpg-skip-btn {
  border: 1px solid var(--line);
  background: color-mix(in srgb, #ff7420 14%, var(--card));
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.rpg-top-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.rpg-top-btn:hover:not(:disabled),
.rpg-top-btn:focus-visible:not(:disabled),
.rpg-skip-btn:hover,
.rpg-skip-btn:focus-visible {
  border-color: rgba(255, 116, 32, 0.5);
  outline: none;
}

.rpg-start-btn.is-secondary {
  margin-top: 10px;
  background: color-mix(in srgb, var(--card) 88%, #ff7420);
  border-style: dashed;
}

.rpg-revise-cta {
  margin-top: 10px;
}

.rpg-revise-cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.rpg-step {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-soft);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
}

.rpg-play {
  --rpg-glow-a: rgba(43, 183, 255, 0.22);
  --rpg-glow-b: rgba(255, 116, 32, 0.18);
  --rpg-stage: color-mix(in srgb, #2bb7ff 6%, var(--card));
}

.rpg-play.mood-sky {
  --rpg-glow-a: rgba(90, 180, 255, 0.35);
  --rpg-glow-b: rgba(255, 200, 120, 0.25);
}
.rpg-play.mood-map {
  --rpg-glow-a: rgba(126, 240, 195, 0.28);
  --rpg-glow-b: rgba(43, 183, 255, 0.22);
}
.rpg-play.mood-metro {
  --rpg-glow-a: rgba(255, 90, 90, 0.2);
  --rpg-glow-b: rgba(80, 80, 100, 0.12);
  --rpg-stage: color-mix(in srgb, #c45 5%, var(--card));
}
.rpg-play.mood-cafe {
  --rpg-glow-a: rgba(255, 180, 80, 0.32);
  --rpg-glow-b: rgba(180, 100, 40, 0.12);
}
.rpg-play.mood-market {
  --rpg-glow-a: rgba(255, 100, 140, 0.25);
  --rpg-glow-b: rgba(255, 200, 60, 0.22);
}
.rpg-play.mood-street {
  --rpg-glow-a: rgba(120, 200, 120, 0.22);
  --rpg-glow-b: rgba(255, 160, 60, 0.18);
}
.rpg-play.mood-harbour {
  --rpg-glow-a: rgba(40, 140, 255, 0.32);
  --rpg-glow-b: rgba(20, 60, 120, 0.14);
}
.rpg-play.mood-temple {
  --rpg-glow-a: rgba(220, 160, 60, 0.28);
  --rpg-glow-b: rgba(120, 60, 20, 0.12);
}
.rpg-play.mood-park {
  --rpg-glow-a: rgba(80, 200, 120, 0.3);
  --rpg-glow-b: rgba(180, 220, 100, 0.18);
}
.rpg-play.mood-night {
  --rpg-glow-a: rgba(180, 80, 255, 0.22);
  --rpg-glow-b: rgba(255, 80, 120, 0.18);
  --rpg-stage: color-mix(in srgb, #3a1a50 10%, var(--card));
}

.rpg-stage {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 18px 16px 20px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(120% 70% at 0% 0%, var(--rpg-glow-a), transparent 55%),
    radial-gradient(100% 60% at 100% 10%, var(--rpg-glow-b), transparent 50%),
    var(--rpg-stage);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* Compact landscape scene vignette (≈4:3) — mood plate only */
.rpg-art {
  display: flex;
  justify-content: center;
  margin: 0 auto 6px;
  width: 100%;
  max-width: 248px;
}

.rpg-art-hero {
  max-width: 268px;
  margin-bottom: 10px;
}

.rpg-art-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--orange) 28%, var(--line));
  box-shadow:
    0 8px 20px rgba(20, 24, 40, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.35) inset;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--rpg-glow-a, rgba(43, 183, 255, 0.25)) 70%, #8ec8e8), color-mix(in srgb, var(--rpg-glow-b, rgba(255, 116, 32, 0.2)) 60%, #f0c090));
}

.rpg-art-plate {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.rpg-art-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 42%, rgba(12, 18, 28, 0.22) 100%),
    radial-gradient(80% 60% at 50% 0%, transparent 40%, rgba(0, 0, 0, 0.06) 100%);
}

@media (max-width: 420px) {
  .rpg-art {
    max-width: 200px;
  }
  .rpg-art-hero {
    max-width: 220px;
  }
}

.rpg-scene-head {
  text-align: center;
}

.rpg-place {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 900;
  font-family: var(--font-zh);
  color: var(--ink);
}

.rpg-place-en {
  margin: 2px 0 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.rpg-story-stack {
  display: grid;
  gap: 10px;
}

.rpg-story-line {
  margin: 0;
  line-height: 1.55;
  color: var(--ink);
  font-size: 1.02rem;
  opacity: 0.92;
}

.rpg-story-line.is-in {
  animation: rpg-fade-in 0.45s ease;
  opacity: 1;
}

@keyframes rpg-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.rpg-word {
  display: inline;
  margin: 0;
  padding: 0 1px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 116, 32, 0.7);
}

.rpg-word:hover,
.rpg-word:focus-visible {
  background: color-mix(in srgb, #ff7420 18%, transparent);
  outline: none;
}

.rpg-word.is-open {
  background: color-mix(in srgb, #ff7420 14%, transparent);
}

.rpg-word-zh {
  font-family: var(--font-zh);
  font-weight: 800;
  white-space: nowrap;
}

.rpg-word-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(20, 16, 12, 0.48);
  backdrop-filter: blur(5px);
}

.rpg-word-card {
  width: min(100%, 340px);
  display: grid;
  gap: 6px;
  padding: 20px 18px 16px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
  justify-items: center;
}

.rpg-word-card-tag {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange-deep);
}

.rpg-word-card-zh {
  margin: 4px 0 0;
  font-size: calc(2rem * var(--font-zh-scale, 1));
  font-weight: 900;
  font-family: var(--font-zh);
  line-height: 1.15;
}

.rpg-word-card-jp {
  margin: 0;
  font-size: calc(1rem * var(--font-jyutping-scale, 1));
  color: var(--ink-soft);
}

.rpg-word-card-en {
  margin: 0;
  font-size: calc(1rem * var(--font-meaning-scale, 1));
  color: var(--ink-soft);
}

.rpg-word-card-fam-label {
  margin: 6px 0 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--fam-color, var(--orange-deep));
}

.rpg-word-card-fam {
  margin: 4px 0 8px;
}

.rpg-word-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
  margin-top: 4px;
}

.rpg-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(74, 158, 255, 0.14);
  color: var(--blue-deep, #1a4a8a);
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: 650;
}

.rpg-continue-btn {
  justify-self: center;
  margin-top: 4px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px dashed color-mix(in srgb, #ff7420 45%, var(--line));
  background: rgba(255, 255, 255, 0.35);
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
}

.rpg-prompt {
  margin: 6px 0 0;
  font-weight: 900;
  color: var(--ink);
  font-size: 1rem;
  text-align: center;
}

.rpg-choices {
  display: grid;
  gap: 10px;
}

.rpg-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1.5px solid color-mix(in srgb, #ff7420 22%, var(--line));
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), transparent 55%),
    var(--surface, var(--card));
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.rpg-choice:hover {
  border-color: rgba(255, 116, 32, 0.55);
  box-shadow: 0 10px 24px rgba(232, 90, 0, 0.12);
  transform: translateY(-2px);
}

.rpg-choice:active {
  transform: translateY(1px);
}

.rpg-choice-emoji {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 1.25rem;
  background: color-mix(in srgb, #ff7420 14%, var(--card));
  border: 1px solid var(--line);
}

.rpg-choice-body {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.rpg-choice-zh {
  font-size: calc(1.12rem * var(--font-zh-scale));
  font-weight: 800;
  font-family: var(--font-zh);
  line-height: 1.35;
}

.rpg-choice-zh .rpg-word {
  font-weight: 800;
  text-decoration-style: solid;
  text-underline-offset: 4px;
}

.rpg-zh-punct {
  font-weight: 800;
}

.rpg-choice-jp {
  font-size: calc(0.78rem * var(--font-jyutping-scale));
  color: var(--ink-soft);
}

.rpg-choice-en {
  font-size: calc(0.8rem * var(--font-meaning-scale));
  color: var(--ink-soft);
}

.rpg-feedback {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  padding: 14px 12px 12px;
  border-radius: 18px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  animation: rpg-fade-in 0.35s ease;
}

.rpg-feedback-badge {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 900;
}

.rpg-feedback-badge.is-correct {
  background: color-mix(in srgb, #2bbf6a 22%, var(--card));
  color: #0f6b3a;
  border: 1px solid color-mix(in srgb, #2bbf6a 40%, var(--line));
}

.rpg-feedback-badge.is-ok {
  background: color-mix(in srgb, #4a9eff 18%, var(--card));
  color: var(--blue-deep, #1a4a8a);
  border: 1px solid color-mix(in srgb, #4a9eff 35%, var(--line));
}

.rpg-feedback-badge.is-retry {
  background: color-mix(in srgb, #ff7420 16%, var(--card));
  color: var(--orange-deep, #c45a00);
  border: 1px solid color-mix(in srgb, #ff7420 35%, var(--line));
}

.rpg-feedback-listen {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.rpg-feedback-line {
  font-size: calc(1.35rem * var(--font-zh-scale, 1));
  font-family: var(--font-zh);
  font-weight: 900;
  line-height: 1.45;
}

.rpg-feedback-line .rpg-word {
  font-size: inherit;
  font-weight: 900;
  text-decoration-style: solid;
  text-underline-offset: 4px;
}

.rpg-feedback-jp {
  margin: 0;
}

.rpg-feedback-en {
  margin: 0;
  font-size: calc(0.92rem * var(--font-meaning-scale, 1));
  color: var(--ink-soft);
}

.rpg-feedback-continue {
  margin-top: 6px;
  min-width: 10rem;
}

.rpg-hint-bar {
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.rpg-revise .rpg-stage {
  justify-items: center;
  text-align: center;
}

.rpg-end {
  text-align: center;
  justify-items: center;
}

.rpg-end h1 {
  margin: 4px 0 0;
  font-size: 1.55rem;
  font-weight: 900;
}

.rpg-end-stat {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.rpg-vocab-wrap {
  width: 100%;
  margin-top: 4px;
}

.rpg-vocab-label {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.rpg-vocab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.rpg-vocab-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, #ff7420 14%, var(--card));
  border: 1px solid var(--line);
  font-weight: 700;
  font-family: var(--font-zh);
  font-size: 0.95rem;
}

.rpg-end-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}

html[data-theme="dark"] .rpg-art-frame {
  border-color: color-mix(in srgb, var(--orange) 35%, rgba(255, 255, 255, 0.12));
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

html[data-theme="dark"] .rpg-choice,
html[data-theme="dark"] .rpg-continue-btn,
html[data-theme="dark"] .rpg-feedback,
html[data-theme="dark"] .rpg-top-btn,
html[data-theme="dark"] .rpg-skip-btn {
  background: color-mix(in srgb, var(--card) 80%, #000);
}

html[data-theme="dark"] .rpg-step {
  background: rgba(255, 149, 51, 0.12);
}

html[data-theme="dark"] .rpg-feedback-badge.is-correct {
  color: #7dffb0;
}

html[data-theme="dark"] .rpg-feedback-badge.is-ok {
  color: #9ec8ff;
}

html[data-theme="dark"] .rpg-feedback-badge.is-retry {
  color: #ffb070;
}

@media (prefers-reduced-motion: reduce) {
  .rpg-story-line.is-in {
    animation: none;
  }
}

/* --- CantoBoo Edu --- */
body.edu-mode .brand span {
  letter-spacing: -0.02em;
}
.edu-mode-gate .edu-mode-choices {
  display: grid;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.edu-landing {
  text-align: left;
  max-width: min(440px, 100%);
}

.edu-landing > img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.edu-landing-eyebrow {
  margin: 0 0 4px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--orange-deep);
}

.edu-landing > h1 {
  text-align: center;
}

.edu-landing-lead {
  margin: 0 0 14px;
  text-align: center;
  color: var(--ink-soft);
  line-height: 1.5;
  font-size: 0.95rem;
}

.edu-landing-benefits {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.edu-landing-benefits li {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--orange) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--orange) 18%, var(--line));
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink);
}

.edu-landing-benefits strong {
  color: var(--orange-deep);
}

.edu-mode-gate .edu-mode-choices .btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.2;
}

.edu-mode-gate .edu-mode-choices .btn small {
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.9;
}

.edu-mode-hint,
.edu-muted {
  color: var(--ink-soft);
  font-size: 0.85rem;
  margin: 12px 0 0;
}
.edu-back-mode {
  margin-top: 14px;
  width: 100%;
}
.edu-panel {
  padding: 8px 4px 28px;
  max-width: 720px;
  margin: 0 auto;
}
.edu-header h1 {
  margin: 0 0 6px;
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--ink);
}
.edu-header p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.edu-subnav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.edu-subnav a {
  text-decoration: none;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  color: var(--ink-soft);
  background: var(--surface);
}
.edu-subnav a.active {
  border-color: var(--orange);
  color: var(--orange-deep);
  background: color-mix(in srgb, var(--orange) 12%, var(--surface));
}
.edu-subnav a.edu-to-learn {
  margin-left: auto;
}
.edu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.edu-class-list {
  display: grid;
  gap: 10px;
}
.edu-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-grad-a), var(--panel-grad-b));
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow);
}
.edu-card h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 800;
}
.edu-card.edi-done,
.edu-card.edu-done {
  border-color: color-mix(in srgb, #43a047 45%, var(--line));
}
.edu-meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.edu-code {
  font-family: ui-monospace, monospace;
  letter-spacing: 0.08em;
  color: var(--orange-deep);
}
.edu-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.edu-section-title {
  margin: 22px 0 10px;
  font-size: 1rem;
  font-weight: 800;
}
.edu-simple-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.edu-simple-list li {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.edu-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.edu-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
}
.edu-form input,
.edu-form select {
  font: inherit;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.edu-range-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.edu-fieldset {
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin: 0;
}
.edu-fieldset legend {
  font-weight: 800;
  padding: 0 6px;
}
.edu-check-grid {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}
.edu-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.88rem;
}
.edu-chart {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1.5px solid var(--line);
}
.edu-chart-row {
  display: grid;
  grid-template-columns: 64px 1fr 44px;
  gap: 8px;
  align-items: center;
}
.edu-chart-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
}
.edu-chart-track {
  height: 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--orange) 10%, var(--cream));
  overflow: hidden;
}
.edu-chart-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--orange-bright), var(--orange));
  min-width: 2px;
}
.edu-chart-bar-b {
  background: linear-gradient(90deg, var(--blue), var(--blue-deep));
}
.edu-chart-val {
  font-size: 0.8rem;
  font-weight: 800;
  text-align: right;
}
.edu-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.edu-big-stat {
  font-size: 2rem;
  font-weight: 900;
  margin: 8px 0;
  color: var(--orange-deep);
}
.edu-custom-card {
  align-items: flex-start;
}
.edu-custom-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
}
.edu-loading {
  color: var(--ink-soft);
  font-weight: 700;
}
.edu-header-link {
  margin-right: 4px;
}

/* ── Referral invite (compact) ── */
#settings-referral.settings-card {
  padding: 14px 14px 12px;
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--orange) 18%, transparent), transparent 55%),
    linear-gradient(180deg, color-mix(in srgb, var(--peach) 55%, var(--card)), var(--card));
}
html[data-theme="dark"] #settings-referral.settings-card {
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--orange) 14%, transparent), transparent 50%),
    var(--surface);
}
#settings-referral.is-spotlight {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--orange) 55%, transparent), var(--shadow);
  animation: ref-spotlight 1.2s ease;
}
@keyframes ref-spotlight {
  0%,
  100% {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--orange) 35%, transparent), var(--shadow);
  }
  40% {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 70%, transparent), var(--shadow);
  }
}
.ref-compact h2,
#settings-referral.settings-card h2 {
  margin: 0;
}
.ref-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.ref-lede-sm {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.35;
}
.ref-top-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.ref-earn {
  margin: 0 0 12px;
  padding: 10px 12px 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--orange) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--orange) 20%, var(--line));
}
.ref-earn-labels {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.ref-earn-labels strong {
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--orange-deep);
}
.ref-earn-labels span {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--ink-soft);
  text-align: right;
}
.ref-earn-track {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--ink) 8%, var(--surface));
}
.ref-earn-fill {
  height: 100%;
  min-width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff9a62 0%, #ff7420 28%, #f5b942 62%, #3dcc8a 100%);
  background-size: 100% 100%;
  box-shadow: 0 0 12px color-mix(in srgb, #3dcc8a 28%, transparent);
  transition: width 0.45s ease;
}
.ref-earn-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.ref-code-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}
.ref-code {
  margin: 0;
  font-family: var(--font-en);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--orange-deep);
  padding: 4px 0;
}
.ref-banner-sm {
  margin: 0 0 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--orange) 10%, var(--surface));
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--ink);
}
.ref-banner-sm.is-ok {
  background: color-mix(in srgb, #1a9b6a 12%, var(--surface));
}
.ref-friends {
  display: grid;
  gap: 6px;
  margin: 0 0 8px;
}
.ref-friend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.ref-friend-row:first-child {
  border-top: 0;
  padding-top: 0;
}
.ref-friend-name {
  font-size: 0.82rem;
  font-weight: 800;
  min-width: 4.5rem;
  color: var(--ink);
}
.ref-friend-wait {
  font-size: 0.75rem;
  color: var(--ink-soft);
}
.ref-friend-meters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}
.ref-meter {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, var(--surface));
  color: var(--ink-soft);
  white-space: nowrap;
}
.ref-meter.is-on {
  background: color-mix(in srgb, #f5b942 22%, var(--surface));
  color: var(--ink);
}
.ref-friend-row.is-complete .ref-friend-name {
  color: #1a9b6a;
}
.ref-help-sm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--ink-soft);
}
.ref-apply-sm {
  display: flex;
  gap: 6px;
  margin: 0 0 4px;
}
.ref-apply-sm .identity-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-size: 0.88rem;
}
.ref-rules-sm {
  margin: 8px 0 0;
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--ink-soft);
  opacity: 0.92;
}

/* Home promo strip */
.ref-home-promo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(
    105deg,
    color-mix(in srgb, var(--orange) 16%, var(--surface)),
    color-mix(in srgb, var(--peach) 40%, var(--surface))
  );
  border: 1.5px solid color-mix(in srgb, var(--orange) 32%, var(--line));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--orange) 12%, transparent);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ref-home-promo:hover,
.ref-home-promo:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--orange) 18%, transparent);
  outline: none;
}
.ref-home-promo-bar {
  flex-shrink: 0;
  width: 42px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--ink) 10%, var(--surface));
}
.ref-home-promo-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff9a62, #ff7420, #f5b942, #3dcc8a);
}
.ref-home-promo-copy {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 1px;
}
.ref-home-promo-copy strong {
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--ink);
}
.ref-home-promo-copy small {
  font-size: 0.72rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ref-home-promo-go {
  flex-shrink: 0;
  font-weight: 900;
  color: var(--orange-deep);
}
html[data-theme="dark"] .ref-home-promo {
  background: linear-gradient(
    105deg,
    color-mix(in srgb, var(--orange) 18%, var(--surface)),
    var(--surface)
  );
}
@media (prefers-reduced-motion: reduce) {
  .ref-earn-fill,
  .ref-home-promo,
  #settings-referral.is-spotlight {
    animation: none;
    transition: none;
  }
}
@media (max-width: 560px) {
  .edu-range-row,
  .edu-compare-grid {
    grid-template-columns: 1fr;
  }
  .edu-card {
    flex-direction: column;
    align-items: stretch;
  }
  .ref-top {
    flex-direction: column;
  }
  .ref-top-actions {
    width: 100%;
  }
  .ref-top-actions .btn {
    flex: 1;
  }
  .ref-earn-labels {
    flex-direction: column;
    align-items: flex-start;
  }
  .ref-earn-labels span {
    text-align: left;
  }
}

/* ─── Cha Chaan Teng Boss (茶餐廳) ─── */

/* ─── Wet Market ─── */

.wm-screen {
  max-width: 760px;
  margin: 0 auto;
  gap: 12px;
}

.wm-mission {
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff8e8 0%, #ffe9bf 100%);
  border: 2px solid color-mix(in srgb, #f59e0b 38%, var(--line));
  box-shadow: var(--shadow);
  text-align: center;
}

.wm-top-tag {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #b45309;
}

.wm-mission h2 {
  margin: 0 0 6px;
  font-size: 1.45rem;
}

.wm-mission-copy {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 700;
}

.wm-market-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.wm-stall-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 18px 14px 14px;
  border-radius: 18px;
  border: 2px solid var(--line);
  background: linear-gradient(180deg, #fffdf6 0%, #f8efe3 100%);
  text-align: left;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.wm-stall-awning {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 16px;
  background: repeating-linear-gradient(90deg, #ef4444 0 18px, #fff7ed 18px 36px);
}

.wm-stall-name {
  padding-top: 6px;
  font-size: 1.02rem;
  font-weight: 900;
  color: var(--ink);
}

.wm-stall-emoji {
  display: flex;
  gap: 8px;
  font-size: 1.7rem;
}

.wm-stall-seller,
.wm-stall-mood {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.wm-stall-cheap {
  border-color: color-mix(in srgb, #22c55e 45%, var(--line));
}

.wm-stall-pricey {
  border-color: color-mix(in srgb, #f59e0b 45%, var(--line));
}

.wm-stall-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.wm-stall-head h3 {
  margin: 0;
  font-size: 1.2rem;
}

.wm-stall-head-tag {
  margin: 0 0 4px;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.wm-sentence-box,
.wm-wallet-panel,
.wm-result-card,
.wm-wallet-closed {
  padding: 14px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.wm-sentence-label,
.wm-wallet-title,
.wm-seller-line {
  margin: 0 0 8px;
  font-weight: 800;
}

.wm-built-line,
.wm-word-bank,
.wm-payment-picked {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wm-built-line {
  min-height: 56px;
  padding: 10px;
  border-radius: 14px;
  border: 2px dashed color-mix(in srgb, var(--orange) 45%, var(--line));
  background: color-mix(in srgb, var(--orange) 8%, var(--surface));
}

.wm-empty-line {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 700;
}

.wm-jyutping-hint {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-family: var(--font-en);
}

.wm-word,
.wm-built-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.wm-word {
  flex-direction: column;
  align-items: start;
  text-align: left;
}

.wm-word strong {
  font-size: 1rem;
}

.wm-word small {
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-family: var(--font-en);
}

.wm-word-item {
  background: color-mix(in srgb, #86efac 14%, var(--surface));
}

.wm-word-emoji {
  font-size: 1.15rem;
  line-height: 1;
}

.wm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.wm-price-bubble {
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, #fde68a 35%, var(--surface));
  font-weight: 900;
  white-space: nowrap;
}

.wm-tray-label {
  margin: 10px 0 6px;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.wm-tray-label:first-of-type {
  margin-top: 0;
}

.wm-coin-tray,
.wm-note-tray {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, color-mix(in srgb, #5b3a24 88%, #1a0f0a) 0%, #3a2418 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -8px 16px rgba(0, 0, 0, 0.28);
}

.wm-note-tray {
  align-items: stretch;
}

.wm-cash {
  border: 0;
  cursor: pointer;
  font-family: var(--font-en);
  color: inherit;
  background: transparent;
}

.wm-cash:hover .wm-coin-face,
.wm-cash:hover .wm-note-inner {
  filter: brightness(1.06);
}

.wm-cash:active {
  transform: scale(0.96);
}

.wm-cash-coin {
  --wm-coin-size: 1;
  width: calc(58px * var(--wm-coin-size));
  height: calc(58px * var(--wm-coin-size));
  padding: 0;
  flex: 0 0 auto;
}

.wm-coin-face {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.55),
    inset 0 -3px 5px rgba(0, 0, 0, 0.28),
    0 3px 6px rgba(0, 0, 0, 0.28);
}

.wm-coin-face strong {
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1;
  z-index: 1;
}

.wm-coin-face small {
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  opacity: 0.82;
  z-index: 1;
}

.wm-bauhinia {
  position: absolute;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #fff6 0 28%, transparent 30%),
    conic-gradient(from 18deg, #c9b49a 0 14%, transparent 15% 20%, #c9b49a 21% 34%, transparent 35% 40%, #c9b49a 41% 54%, transparent 55% 60%, #c9b49a 61% 74%, transparent 75% 80%, #c9b49a 81% 94%, transparent 95% 100%);
  opacity: 0.85;
}

.wm-coin-50 .wm-coin-face {
  background: radial-gradient(circle at 32% 28%, #ffe08a 0%, #d4a017 52%, #8a6412 100%);
  color: #5b3b08;
}

.wm-coin-1 .wm-coin-face,
.wm-coin-2 .wm-coin-face,
.wm-coin-5 .wm-coin-face {
  background: radial-gradient(circle at 32% 28%, #f7f9fb 0%, #c5ccd3 48%, #8a929a 100%);
  color: #334155;
}

.wm-coin-5 .wm-coin-face {
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.55),
    inset 0 -4px 6px rgba(0, 0, 0, 0.32),
    0 0 0 2px color-mix(in srgb, #94a3b8 70%, #fff),
    0 4px 7px rgba(0, 0, 0, 0.3);
}

.wm-coin-scallop .wm-coin-face {
  clip-path: polygon(50.0% 1.0%, 60.5% 10.9%, 74.5% 7.6%, 78.6% 21.4%, 92.4% 25.5%, 89.1% 39.5%, 99.0% 50.0%, 89.1% 60.5%, 92.4% 74.5%, 78.6% 78.6%, 74.5% 92.4%, 60.5% 89.1%, 50.0% 99.0%, 39.5% 89.1%, 25.5% 92.4%, 21.4% 78.6%, 7.6% 74.5%, 10.9% 60.5%, 1.0% 50.0%, 10.9% 39.5%, 7.6% 25.5%, 21.4% 21.4%, 25.5% 7.6%, 39.5% 10.9%);
}

.wm-coin-10 .wm-coin-face {
  background:
    radial-gradient(circle at 50% 50%, #d6a31b 0 36%, transparent 37%),
    radial-gradient(circle at 32% 28%, #f4f6f8 0%, #c5ccd3 48%, #8a929a 100%);
  color: #3f2a08;
}

.wm-cash-note {
  flex: 1 1 72px;
  min-width: 72px;
  max-width: 110px;
  min-height: 54px;
  padding: 0;
}

.wm-note-inner {
  display: grid;
  align-content: center;
  gap: 1px;
  width: 100%;
  min-height: 54px;
  padding: 6px 7px 7px;
  border-radius: 6px;
  text-align: left;
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 3px 8px rgba(0, 0, 0, 0.28);
}

.wm-note-place {
  font-size: 0.46rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  opacity: 0.9;
}

.wm-note-inner strong {
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
}

.wm-note-inner small {
  font-size: 0.58rem;
  font-weight: 800;
  opacity: 0.92;
}

.wm-note-purple .wm-note-inner {
  background:
    linear-gradient(135deg, #c4a0d8 0%, #7b4b9a 42%, #5a3378 100%);
}

.wm-note-blue .wm-note-inner {
  background:
    linear-gradient(135deg, #7eb3e8 0%, #3b6fbf 45%, #244f96 100%);
}

.wm-note-green .wm-note-inner {
  background:
    linear-gradient(135deg, #7dcaa8 0%, #3d8b6e 46%, #24624c 100%);
}

.wm-note-red .wm-note-inner {
  background:
    linear-gradient(135deg, #e3897e 0%, #c4453c 46%, #8f2b24 100%);
}

.wm-payment-row {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.wm-payment-picked {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.wm-cash.is-picked {
  width: auto;
  height: auto;
  min-height: 0;
  min-width: 0;
  max-width: none;
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  color: #1f2937;
  box-shadow: none;
}

.wm-cash-coin.is-picked {
  background: radial-gradient(circle at 30% 30%, #fff3, transparent 55%), #d6dbe0;
}

.wm-coin-50.is-picked {
  background: #e4b84a;
  color: #5b3b08;
}

.wm-coin-10.is-picked {
  background: linear-gradient(90deg, #d6dbe0 0 40%, #d6a31b 41% 100%);
}

.wm-note-purple.is-picked { background: #7b4b9a; color: #fff; }
.wm-note-blue.is-picked { background: #3b6fbf; color: #fff; }
.wm-note-green.is-picked { background: #3d8b6e; color: #fff; }
.wm-note-red.is-picked { background: #c4453c; color: #fff; }

.wm-payment-total {
  font-weight: 800;
  color: var(--ink-soft);
}

.wm-wallet-empty {
  margin: 0;
  color: var(--ink-soft);
}

.wm-feedback {
  margin: 0;
  text-align: center;
  font-weight: 800;
  color: var(--ink-soft);
}

.wm-feedback-ok {
  color: #15803d;
}

html[data-theme="dark"] .wm-mission {
  background: linear-gradient(180deg, #3f2f1b 0%, #2d2215 100%);
}

@media (min-width: 860px) {
  .wm-market-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.ct-page {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 4px 24px;
}

.ct-venue-grid {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
}

.ct-venue-card {
  appearance: none;
  display: grid;
  gap: 6px;
  text-align: left;
  padding: 14px 14px 12px;
  border-radius: 16px;
  border: 2px solid color-mix(in srgb, var(--orange) 28%, var(--line));
  background: color-mix(in srgb, var(--orange) 6%, var(--surface));
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ct-venue-card:hover,
.ct-venue-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--orange);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--orange) 18%, transparent);
  outline: none;
}

.ct-venue-eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--orange);
}

.ct-venue-title {
  font-size: 1.35rem;
  font-weight: 850;
}

.ct-venue-en {
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.ct-venue-blurb {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.ct-venue-meta {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.ct-venue-cta {
  margin-top: 4px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--orange-deep, var(--orange));
}

.ct-dish-emoji,
.ct-mini-dish.ct-dish-emoji {
  display: inline-grid;
  place-items: center;
  width: 1.6em;
  height: 1.6em;
  font-size: 1.35rem;
  line-height: 1;
}

.ct-dish .ct-dish-emoji {
  font-size: 2.1rem;
  width: auto;
  height: auto;
}

.ct-drag-dish .ct-dish-emoji {
  font-size: 2.4rem;
}

.ct-order-mods {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--orange-deep, var(--orange));
}

.ct-hero h1 {
  margin: 4px 0 8px;
  font-size: 1.65rem;
}

.ct-eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange);
}

.ct-blurb {
  margin: 0 0 14px;
  color: var(--ink-soft);
  line-height: 1.55;
  font-size: 0.92rem;
}

.ct-menu-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.ct-menu-chip {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--orange) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--orange) 28%, var(--line));
}

.ct-rules {
  margin: 0 0 16px;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.55;
}

.ct-stats {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.ct-play {
  padding-bottom: 8px;
}

.ct-hud {
  display: grid;
  grid-template-columns: 72px 1fr 56px;
  gap: 6px;
  margin-bottom: 10px;
  align-items: stretch;
}

.ct-level-badge {
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--orange);
}

.ct-level-dishes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.ct-level-dishes .ct-menu-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--orange) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--orange) 28%, var(--line));
}

.ct-level-dishes .ct-mini-dish {
  width: 28px;
  height: 28px;
  aspect-ratio: 1 / 1;
}

.ct-menu-jp {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  font-family: var(--font-en);
  color: var(--ink-soft);
}

html[data-jyutping="off"] .ct-menu-jp {
  display: none;
}

.ct-hud-item {
  text-align: center;
  padding: 8px 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.ct-hud-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.ct-hud-item strong {
  font-size: 1.1rem;
}

.ct-hud-earn {
  padding: 6px 10px 8px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, #f5b942 40%, var(--line));
  min-width: 0;
}

.ct-hud-earn.is-ka-ching {
  animation: ct-ka-ching 0.45s ease;
}

@keyframes ct-ka-ching {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.ct-hud-earn-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.ct-hud-coin {
  flex: 0 0 auto;
  pointer-events: none;
}

.ct-hud-coin .wm-coin-face small {
  display: none;
}

.ct-hud-earn-row strong {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--orange-deep);
}

.ct-hud-goal {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.ct-earn-track {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--ink) 8%, var(--surface));
}

.ct-earn-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff9a62 0%, #ff7420 32%, #f5b942 68%, #3dcc8a 100%);
  transition: width 0.35s ease;
}

.ct-fly-coin {
  position: fixed;
  z-index: 12000;
  --wm-coin-size: 0.5;
  width: calc(58px * var(--wm-coin-size));
  height: calc(58px * var(--wm-coin-size));
  padding: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  transition: transform 0.75s cubic-bezier(0.15, 0.75, 0.25, 1), opacity 0.75s ease;
}

.ct-fly-coin .wm-coin-face small {
  display: none;
}

.ct-toast {
  margin: 0 0 8px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  animation: ct-toast-in 0.25s ease;
}

@keyframes ct-toast-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.ct-toast-ok {
  background: color-mix(in srgb, #2ecc71 18%, var(--surface));
  color: #1a7a42;
  border: 1px solid color-mix(in srgb, #2ecc71 35%, var(--line));
}

.ct-toast-bad {
  background: color-mix(in srgb, #e74c3c 14%, var(--surface));
  color: #a93226;
  border: 1px solid color-mix(in srgb, #e74c3c 30%, var(--line));
}

.ct-toast-info {
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--blue) 28%, var(--line));
}

.ct-hub-preview {
  height: 140px;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  margin-bottom: 14px;
  border: 2px solid var(--line);
}

.ct-scene {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 10px;
  border: 2px solid var(--line);
  touch-action: none;
  aspect-ratio: 3 / 2;
  background: #3d2818;
}

.ct-room-bg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.ct-scene-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ct-scene-overlay > * {
  pointer-events: auto;
}

.ct-queue {
  position: absolute;
  left: 2%;
  bottom: 3%;
  width: 96%;
  padding: 6px 8px;
  border-radius: 12px;
  background: color-mix(in srgb, #fff 88%, transparent);
  border: 2px solid color-mix(in srgb, var(--orange) 45%, var(--line));
  backdrop-filter: blur(4px);
}

html[data-theme="dark"] .ct-queue {
  background: color-mix(in srgb, #1a1a1a 88%, transparent);
}

.ct-queue-label {
  margin: 0 0 6px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.ct-queue-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.ct-queue-person {
  appearance: none;
  position: relative;
  padding: 6px 4px 10px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--surface);
  cursor: grab;
  touch-action: none;
}

.ct-queue-person.is-urgent {
  border-color: #e74c3c;
  animation: ct-hand-pulse 1s ease infinite;
}

.ct-queue-face {
  font-size: 1.5rem;
  line-height: 1;
  display: block;
}

.ct-queue-patience {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 10%, transparent);
  overflow: hidden;
}

.ct-queue-patience span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2ecc71, #f1c40f);
  transition: width 0.1s linear;
}

.ct-queue-slot-empty {
  min-height: 44px;
  border-radius: 10px;
  border: 2px dashed color-mix(in srgb, var(--ink) 12%, var(--line));
}

.ct-table-zone {
  position: absolute;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, #fff 70%, var(--orange));
  background: color-mix(in srgb, #fff 25%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.ct-table-zone.has-space {
  border-style: dashed;
}

.ct-table-zone.is-full {
  border-style: solid;
}

.ct-table-zone.is-drag-over {
  border-color: #2ecc71;
  box-shadow: 0 0 0 3px color-mix(in srgb, #2ecc71 45%, transparent);
  transform: scale(1.02);
}

.ct-table-handup {
  border-color: var(--orange);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--orange) 40%, transparent);
  animation: ct-hand-pulse 1.2s ease infinite;
}

.ct-table-ordered {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--line));
}

.ct-table-cap {
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--ink-soft);
  background: color-mix(in srgb, #fff 85%, transparent);
  padding: 1px 5px;
  border-radius: 999px;
}

.ct-seated-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
}

.ct-seated-face {
  font-size: 1.2rem;
  line-height: 1;
}

.ct-table-empty-label {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--ink-soft);
  font-family: var(--font-zh);
}

.ct-table-badge {
  font-size: 1rem;
  line-height: 1;
}

.ct-badge-hand {
  animation: ct-wave 0.8s ease infinite alternate;
}

.ct-mini-dish,
.ct-dish-art,
.ct-dish-img,
.ct-drag-dish {
  display: block;
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 36px;
  height: auto;
  aspect-ratio: 1 / 1;
  background-repeat: no-repeat;
  background-position: 50% 50%;
  overflow: hidden;
  border-radius: 8px;
}

.ct-dish-img {
  width: auto;
  max-width: 112px;
  height: 88px;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  object-position: center bottom;
  margin: 0 auto;
  background: transparent !important;
}

.ct-dish-img--food {
  aspect-ratio: 4 / 3;
  height: 80px;
}

.ct-dish .ct-dish-img {
  height: 96px;
  max-width: 100%;
}

.ct-dish .ct-dish-img--food {
  height: 88px;
}

.ct-drag-dish .ct-dish-img {
  height: 88px;
  width: auto;
  max-width: 88px;
}

.ct-belt-wrap .ct-dish-img {
  width: auto;
  max-width: 112px;
  height: 88px;
  aspect-ratio: 4 / 5;
}

.ct-dish-art {
  width: 86%;
  max-width: 112px;
  margin: 0 auto;
}

.ct-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
}

.ct-drag-person {
  font-size: 2rem;
  line-height: 1;
}

.ct-drag-dish {
  width: 88px;
  max-width: 88px;
}

@keyframes ct-hand-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes ct-wave {
  from { transform: rotate(-8deg); }
  to { transform: rotate(12deg); }
}

.ct-order-jp {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font-en);
  color: var(--ink-soft);
  margin-top: 1px;
}

.ct-dish-jp {
  font-size: 0.62rem;
  font-weight: 700;
  font-family: var(--font-en);
  color: var(--ink-soft);
}

html[data-jyutping="off"] .ct-dish-jp,
html[data-jyutping="off"] .ct-order-jp {
  display: none;
}

.ct-patience {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 4px;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  overflow: hidden;
}

.ct-patience-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2ecc71, #f1c40f);
  transition: width 0.1s linear;
}

.ct-patience-fill.is-urgent {
  background: linear-gradient(90deg, #e67e22, #e74c3c);
}

.ct-floor {
  margin-top: 0;
}

.ct-belt-wrap {
  margin-bottom: 8px;
  padding: 10px;
  border-radius: 14px;
  background: var(--surface);
  border: 2px solid color-mix(in srgb, var(--orange) 35%, var(--line));
}

.ct-belt-label {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  color: var(--ink-soft);
}

.ct-belt {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.ct-dish-slot-empty {
  aspect-ratio: 1 / 1;
  min-height: 0;
  border-radius: 12px;
  border: 2px dashed color-mix(in srgb, var(--ink) 14%, var(--line));
  background: color-mix(in srgb, var(--ink) 4%, var(--surface));
}

.ct-dish {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  aspect-ratio: 1 / 1;
  min-height: 0;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--surface);
  cursor: grab;
  touch-action: none;
  animation: ct-dish-pop 0.28s ease;
}

.ct-dish.is-visible:active {
  cursor: grabbing;
}

@keyframes ct-dish-pop {
  from { opacity: 0; transform: scale(0.88); }
  to { opacity: 1; transform: scale(1); }
}

.ct-dish-zh {
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-zh);
}

.ct-dish-en {
  display: none;
}

.ct-hint {
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

@media (min-width: 1100px) {
  .ct-page.ct-play {
    max-width: min(1380px, calc(100vw - 28px));
    padding: 0 4px 12px;
    display: grid;
    grid-template-columns: minmax(230px, 0.9fr) minmax(0, 2.2fr) minmax(230px, 0.95fr);
    grid-template-areas:
      "hud hud hud"
      "orders scene belt"
      "queue scene belt"
      "hint scene belt";
    gap: 10px 14px;
    align-items: start;
  }

  .ct-page.ct-play .ct-hud {
    grid-area: hud;
    margin-bottom: 0;
    grid-template-columns: 96px 1fr 76px;
  }

  .ct-page.ct-play .ct-orders-ticket {
    grid-area: orders;
    margin-bottom: 0;
  }

  .ct-page.ct-play .ct-scene {
    grid-area: scene;
    margin-bottom: 0;
    /* Match room-2d.png (1536×1024 = 3:2). Prior 16/10 + cover cropped the front counter. */
    aspect-ratio: 3 / 2;
    min-height: 0;
    width: min(100%, calc(min(72vh, 760px) * 3 / 2));
    max-height: min(72vh, 760px);
    justify-self: center;
  }

  .ct-page.ct-play .ct-room-bg {
    object-fit: cover;
    object-position: center bottom;
  }

  .ct-page.ct-play .ct-queue-bar {
    grid-area: queue;
    margin-bottom: 0;
  }

  .ct-page.ct-play .ct-belt-wrap {
    grid-area: belt;
    margin-bottom: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .ct-page.ct-play .ct-belt {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: auto;
    margin-bottom: auto;
  }

  .ct-page.ct-play .ct-hint {
    grid-area: hint;
    margin: 0;
    text-align: left;
  }

  .ct-page.ct-play .ct-order-line {
    padding: 8px 0;
  }

  .ct-page.ct-play .ct-order-zh {
    font-size: 0.96rem;
  }
}

.ct-orders-ticket {
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--orange) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--orange) 28%, var(--line));
}

.ct-orders-label {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.ct-order-line {
  display: grid;
  gap: 2px;
  padding: 6px 0;
  border-top: 1px dashed color-mix(in srgb, var(--ink) 10%, transparent);
}

.ct-order-line:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.ct-badge-order.ct-badge-zh {
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-zh);
  padding: 2px 6px;
  border-radius: 8px;
  background: color-mix(in srgb, #fff 90%, transparent);
  color: var(--ink);
  max-width: 100%;
  text-align: center;
  line-height: 1.2;
}

.ct-order-zh {
  font-size: 0.92rem;
  font-weight: 800;
  font-family: var(--font-zh);
  line-height: 1.45;
}

.ct-order-line .ct-order-jp {
  font-size: 0.78rem;
}

.ct-results-money {
  text-align: center;
  margin: 0 0 16px;
  padding: 16px 12px;
  border-radius: 16px;
  background: color-mix(in srgb, #f5b942 14%, var(--surface));
  border: 1px solid color-mix(in srgb, #f5b942 40%, var(--line));
}

.ct-results-money span {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.ct-results-money strong {
  display: block;
  font-size: 2.1rem;
  font-weight: 900;
  color: var(--orange-deep);
  line-height: 1.15;
}

.ct-results-money em {
  display: block;
  font-style: normal;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.ct-results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.ct-result-card {
  text-align: center;
  padding: 12px 8px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.ct-result-card span {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.ct-result-card strong {
  font-size: 1.25rem;
}

.ct-page .btn-lg {
  width: 100%;
  margin-bottom: 8px;
}

.ct-page .btn + .btn {
  width: 100%;
}

/* legacy ct-room removed — use .ct-scene */
.ct-room,
.ct-tables,
.ct-table,
.ct-floor,
.ct-pass,
.ct-pass-btn,
.ct-waiter,
.ct-customer,
.ct-hand,
.ct-order-bubble,
.ct-seat-dots,
.ct-menu-preview,
.ct-menu-chip {
  /* deprecated */
}

.ct-scene-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.ct-scene-layer > * {
  pointer-events: auto;
}

.ct-seat-marker {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--orange) 55%, #fff);
  background: color-mix(in srgb, #fff 40%, transparent);
  pointer-events: none;
  z-index: 2;
  opacity: 0.55;
}

.ct-seat-marker.is-filled {
  border-color: #2ecc71;
  background: color-mix(in srgb, #2ecc71 25%, transparent);
}

.ct-guest {
  position: absolute;
  transform: translate(-50%, -92%);
  font-size: 1.28rem;
  line-height: 1;
  z-index: 4;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
  pointer-events: none;
  transition: filter 0.2s ease;
}

.ct-guest.is-eating {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.25));
}

.ct-guest.is-leaving {
  z-index: 8;
  animation: ct-walk-out var(--leave-ms, 3.2s) cubic-bezier(0.42, 0.02, 0.58, 1) forwards;
  animation-delay: var(--leave-delay, 0s);
}

.ct-guest.is-angry.is-leaving {
  animation-name: ct-walk-out-angry;
}

@keyframes ct-walk-out {
  0% {
    left: var(--from-left, 50%);
    top: var(--from-top, 40%);
    opacity: 1;
    transform: translate(-50%, -92%) translateY(0) scale(1);
  }
  10% {
    transform: translate(-50%, -92%) translateY(-7px) scale(1);
  }
  20% {
    transform: translate(-50%, -92%) translateY(0) scale(0.99);
  }
  38% {
    left: var(--mid-left, 46%);
    top: var(--mid-top, 40%);
    transform: translate(-50%, -92%) translateY(-6px) scale(0.96);
  }
  50% {
    transform: translate(-50%, -92%) translateY(0) scale(0.94);
  }
  62% {
    transform: translate(-50%, -92%) translateY(-6px) scale(0.92);
  }
  78% {
    transform: translate(-50%, -92%) translateY(0) scale(0.88);
  }
  100% {
    left: var(--exit-left, 12%);
    top: var(--exit-top, 11%);
    opacity: 0;
    transform: translate(-50%, -92%) translateY(0) scale(0.7);
  }
}

@keyframes ct-walk-out-angry {
  0% {
    left: var(--from-left, 50%);
    top: var(--from-top, 40%);
    opacity: 1;
    transform: translate(-50%, -92%) scale(1);
  }
  18% {
    transform: translate(-50%, -92%) scale(1.08) rotate(-8deg);
  }
  40% {
    left: var(--mid-left, 46%);
    top: var(--mid-top, 40%);
  }
  100% {
    left: var(--exit-left, 12%);
    top: var(--exit-top, 11%);
    opacity: 0;
    transform: translate(-50%, -92%) scale(0.72) rotate(6deg);
  }
}

.ct-guest-hand,
.ct-guest-bill {
  position: absolute;
  top: -8px;
  right: -4px;
  font-size: 1.08rem;
  animation: ct-wave 0.8s ease infinite alternate;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.ct-table-hit {
  position: absolute;
  appearance: none;
  border: 2px dashed color-mix(in srgb, #fff 55%, var(--orange));
  background: color-mix(in srgb, #fff 12%, transparent);
  cursor: pointer;
  z-index: 3;
  border-radius: 12px;
}

.ct-scene.is-seating .ct-table-hit.is-empty {
  border-color: #2ecc71;
  background: color-mix(in srgb, #2ecc71 18%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, #2ecc71 35%, transparent);
}

.ct-table-hit.ct-table-handup {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--orange) 70%, transparent);
  animation: ct-hand-pulse 1.2s ease infinite;
}

.ct-table-hit.is-drag-over {
  box-shadow: inset 0 0 0 3px color-mix(in srgb, #2ecc71 65%, transparent);
}

.ct-table-patience {
  position: absolute;
  width: 30%;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: color-mix(in srgb, #000 20%, transparent);
  overflow: hidden;
  z-index: 5;
  pointer-events: none;
}

.ct-order-tag,
.ct-think-tag,
.ct-bill-tag,
.ct-eat-tag {
  position: absolute;
  transform: translate(-50%, 0);
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-zh);
  padding: 2px 8px;
  border-radius: 8px;
  background: color-mix(in srgb, #fff 92%, var(--orange));
  border: 1px solid color-mix(in srgb, var(--orange) 40%, var(--line));
  z-index: 5;
  white-space: nowrap;
}

.ct-bill-tag {
  background: color-mix(in srgb, #fff 88%, #ffd966);
  border-color: color-mix(in srgb, #e6a800 55%, var(--line));
  animation: ct-hand-pulse 1.1s ease infinite;
  pointer-events: auto;
  cursor: pointer;
  appearance: none;
}

.ct-order-tag,
.ct-think-tag,
.ct-eat-tag {
  pointer-events: none;
}

.ct-eat-tag {
  background: color-mix(in srgb, #fff 90%, #7ef0c3);
  border-color: color-mix(in srgb, #15803d 35%, var(--line));
  color: var(--ink-soft);
}

html[data-theme="dark"] .ct-order-tag,
html[data-theme="dark"] .ct-think-tag,
html[data-theme="dark"] .ct-bill-tag,
html[data-theme="dark"] .ct-eat-tag {
  background: rgba(24, 20, 16, 0.92);
  border-color: rgba(255, 220, 180, 0.28);
  color: #fff7ed;
}

html[data-theme="dark"] .ct-bill-tag {
  background: rgba(64, 46, 14, 0.95);
  border-color: rgba(255, 214, 102, 0.45);
  color: #fff7ed;
}

html[data-theme="dark"] .ct-eat-tag {
  background: rgba(18, 54, 38, 0.94);
  border-color: rgba(126, 240, 195, 0.32);
  color: #f3fffa;
}

.ct-table-hit.ct-table-want_bill {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, #ffd966 75%, transparent);
  animation: ct-hand-pulse 1.2s ease infinite;
}

.ct-queue-bar {
  position: relative;
  left: auto;
  bottom: auto;
  width: 100%;
  margin: 0 0 10px;
  padding: 8px;
  border-radius: 12px;
  background: color-mix(in srgb, #fff 82%, var(--orange));
  border: 2px solid color-mix(in srgb, var(--orange) 45%, var(--line));
  z-index: 6;
}

.ct-queue-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ct-party-chip {
  appearance: none;
  position: relative;
  padding: 8px 6px 12px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--surface);
  cursor: grab;
  touch-action: none;
  text-align: center;
}

.ct-party-chip.is-selected {
  border-color: #2ecc71;
  box-shadow: 0 0 0 2px color-mix(in srgb, #2ecc71 40%, transparent);
}

.ct-party-tag {
  display: block;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.ct-party-faces {
  font-size: 1.25rem;
  line-height: 1.2;
}

.ct-drag-party {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 14px;
  background: color-mix(in srgb, #fff 90%, var(--orange));
  border: 2px solid var(--orange);
}

.ct-party-label {
  width: 100%;
  font-size: 0.65rem;
  font-weight: 800;
  text-align: center;
}

.ct-drag-face {
  font-size: 1.4rem;
  line-height: 1;
}

.ct-belt-wrap {
  background: linear-gradient(180deg, #5c4030 0%, #3d2818 100%) !important;
  border: 2px solid #7a5538 !important;
}

.ct-belt-wrap .ct-belt-label {
  color: #ffe8c8;
}

.ct-belt-wrap .ct-dish-slot-empty {
  background: color-mix(in srgb, #000 25%, #5c4030);
  border: 2px dashed color-mix(in srgb, #ffe8c8 35%, #7a5538);
}

.ct-belt-wrap .ct-dish {
  background: transparent !important;
  border: none !important;
  box-shadow: none;
}

.ct-belt-wrap .ct-dish-art {
  width: 86%;
  max-width: 112px;
  height: auto;
  aspect-ratio: 1 / 1;
  background-color: transparent;
}

.ct-drag-dish {
  width: 88px;
  max-width: 88px;
  height: auto;
  aspect-ratio: 1 / 1;
  background-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
  .ct-guest.is-leaving,
  .ct-hud-earn.is-ka-ching,
  .ct-fly-coin,
  .ct-earn-fill {
    animation: none;
    transition: none;
  }
}

/* --- Tone Lab --- */
.game-testing-badge,
.tone-testing-badge,
.uc-badge {
  display: inline-block;
  margin-left: 0.25em;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #b45309;
  background: rgba(251, 191, 36, 0.28);
  border: 1px solid rgba(180, 83, 9, 0.28);
  border-radius: 6px;
  padding: 0.12em 0.45em;
  vertical-align: middle;
  text-transform: lowercase;
}

.uc-badge-on-btn {
  margin-left: 0.35em;
  color: #92400e;
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(146, 64, 14, 0.25);
}

.game-solo-card.is-testing {
  border-color: rgba(180, 83, 9, 0.35);
}

.tone-page {
  max-width: min(640px, 100%);
  margin: 0 auto;
  padding: 0 0 28px;
}

.tone-hero {
  margin: 4px 0 10px;
}

.tone-eyebrow {
  margin: 0 0 2px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.tone-hero h1 {
  margin: 0;
  font-size: clamp(1.2rem, 3.5vw, 1.45rem);
  font-weight: 850;
  letter-spacing: -0.02em;
  color: var(--ink, #2a211c);
}

.tone-lead {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
  font-size: 0.98rem;
}

.tone-card {
  padding: 12px 12px 14px;
  border-radius: 16px;
}

.tone-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.tone-progress {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 0;
  flex-shrink: 0;
}

.tone-phrase-zh {
  font-size: clamp(1.55rem, 5vw, 1.9rem);
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: 0.04em;
  color: var(--ink, #2a211c);
  text-align: center;
}

.tone-phrase-en {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  text-align: right;
  flex: 1;
  min-width: 0;
}

.tone-word-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.tone-word-bar-main {
  display: grid;
  gap: 6px;
  justify-items: center;
  min-width: 0;
}

.tone-nav-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 12px;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
}

.tone-syl-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
  justify-content: center;
}

.tone-syl {
  appearance: none;
  border: 1.5px solid color-mix(in srgb, var(--tone-c, #e85a00) 45%, transparent);
  background: color-mix(in srgb, var(--tone-c, #e85a00) 10%, #fff);
  border-radius: 12px;
  padding: 6px 10px;
  min-width: 64px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tone-syl.is-active {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--tone-c, #e85a00) 28%, transparent);
  border-color: var(--tone-c, #e85a00);
}

.tone-syl-zh {
  display: block;
  font-size: 1.3rem;
  font-weight: 850;
  color: var(--ink, #2a211c);
}

.tone-syl-jp {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--tone-c, #e85a00);
  margin-top: 1px;
}

.tone-syl-tone {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 1px;
}

.tone-chart-wrap {
  margin: 0 0 8px;
  padding: 4px 2px 2px;
  border-radius: 12px;
  background:
    linear-gradient(165deg, rgba(255, 244, 230, 0.95), rgba(255, 255, 255, 0.55)),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 10px,
      rgba(232, 90, 0, 0.03) 10px,
      rgba(232, 90, 0, 0.03) 11px
    );
  border: 1px solid rgba(42, 33, 28, 0.08);
}

.tone-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 140px;
}

.tone-chart-frame {
  fill: rgba(255, 255, 255, 0.55);
  stroke: rgba(42, 33, 28, 0.12);
  stroke-width: 1.25;
}

.tone-chart-grid {
  stroke: rgba(42, 33, 28, 0.1);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.tone-chart-ylab {
  font-size: 9px;
  font-weight: 700;
  fill: #8a7568;
  font-family: inherit;
}

.tone-chart-lane {
  fill: transparent;
  stroke: none;
}

.tone-chart-syl.is-active .tone-chart-lane {
  fill: rgba(232, 90, 0, 0.07);
}

.tone-chart-line {
  fill: none;
  stroke-width: 3.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.tone-chart-syl.is-active .tone-chart-line {
  stroke-width: 4.25;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
}

.tone-chart-wrap.is-playing .tone-chart-syl.is-active .tone-chart-line {
  animation: tone-line-glow 0.9s ease-in-out infinite alternate;
}

.tone-chart-num {
  font-size: 12px;
  font-weight: 850;
  font-family: inherit;
}

.tone-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.tone-btn {
  flex: 1 1 auto;
  min-width: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 10px;
  font-size: 0.88rem;
}

.tone-btn.is-recording {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
  animation: tone-pulse 1.1s ease-in-out infinite;
}

.tone-btn.is-playing {
  background: color-mix(in srgb, var(--orange, #e85a00) 14%, var(--surface, #fff));
  border-color: color-mix(in srgb, var(--orange, #e85a00) 42%, var(--line, #e8ddd4));
  color: var(--orange-deep, #c44a00);
}

.tone-btn.is-playing .tone-play-icon {
  display: inline-block;
  animation: tone-play-pulse 0.9s ease-in-out infinite;
}

.tone-phrase-zh.is-speaking {
  animation: tone-phrase-speak 1.15s ease-in-out infinite;
}

.tone-syl.is-speaking {
  animation: tone-syl-speak 0.85s ease-in-out infinite;
}

.tone-chart-wrap.is-playing {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--orange, #e85a00) 22%, transparent);
}

.tone-turtle-icon {
  font-size: 1.15em;
  line-height: 1;
}

.tone-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

.tone-nav {
  display: none;
}

.tone-pickers {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 0 10px;
  padding: 8px 10px 8px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-soft, #f6f1eb) 94%, #fff);
  border: 1px solid var(--line, rgba(42, 33, 28, 0.08));
  backdrop-filter: blur(8px);
}

.tone-picker-row {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.tone-picker-row:last-of-type {
  margin-bottom: 4px;
}

.tone-picker-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.tone-anchor-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tone-anchor-chip {
  appearance: none;
  border: 1.5px solid color-mix(in srgb, var(--tone-c, #c4b5a8) 40%, transparent);
  background: color-mix(in srgb, var(--tone-c, #e85a00) 8%, #fff);
  border-radius: 10px;
  padding: 4px 7px;
  min-width: 42px;
  cursor: pointer;
  text-align: center;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.tone-anchor-chip.tone-anchor-all {
  --tone-c: #8a7568;
  min-width: 36px;
  font-weight: 750;
  font-size: 0.78rem;
}

.tone-anchor-chip.is-on {
  border-color: var(--tone-c, #e85a00);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--tone-c, #e85a00) 22%, transparent);
  transform: translateY(-1px);
}

.tone-anchor-num {
  display: block;
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--tone-c, #e85a00);
}

.tone-anchor-zh {
  display: block;
  font-size: 1.05rem;
  font-weight: 850;
  line-height: 1.05;
}

.tone-anchor-jp {
  display: block;
  font-size: 0.62rem;
  font-weight: 650;
  color: var(--ink-soft);
}

.tone-picker-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--ink-soft);
  line-height: 1.3;
}

@keyframes tone-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
}

@keyframes tone-play-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.18);
    opacity: 0.6;
  }
}

@keyframes tone-phrase-speak {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.78;
  }
}

@keyframes tone-syl-speak {
  0%,
  100% {
    transform: translateY(-2px) scale(1);
  }
  50% {
    transform: translateY(-3px) scale(1.03);
  }
}

@keyframes tone-line-glow {
  0% {
    stroke-width: 4.25;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
  }
  100% {
    stroke-width: 5;
    filter: drop-shadow(0 2px 6px color-mix(in srgb, var(--orange, #e85a00) 35%, transparent));
  }
}

.tone-compare {
  margin-top: 14px;
  padding: 12px 12px 10px;
  border-radius: 14px;
}

.tone-compare-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.tone-compare-head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 850;
}

.tone-compare-lead {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.tone-compare-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.tone-compare-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line, rgba(42, 33, 28, 0.1));
  background: var(--surface, #fff);
}

.tone-compare-zh {
  display: block;
  font-size: 1.55rem;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.tone-compare-meta {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-top: 2px;
}

.tone-compare-en {
  display: block;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

.tone-compare-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tone-compare-actions .btn.is-recording {
  border-color: #c62828;
  color: #c62828;
}

html[data-theme="dark"] .tone-pickers {
  background: color-mix(in srgb, #2a241f 92%, #000);
}

html[data-theme="dark"] .tone-compare-item {
  background: #1e1814;
}

html[data-theme="dark"] .tone-chart-wrap {
  background: linear-gradient(165deg, rgba(60, 48, 40, 0.9), rgba(36, 30, 26, 0.85));
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .tone-chart-frame {
  fill: rgba(255, 255, 255, 0.06);
  stroke: rgba(255, 255, 255, 0.18);
}

html[data-theme="dark"] .tone-testing-badge,
html[data-theme="dark"] .game-testing-badge {
  color: #fbbf24;
  background: rgba(180, 83, 9, 0.35);
}

html[data-theme="dark"] .tone-phrase-zh,
html[data-theme="dark"] .tone-syl-zh,
html[data-theme="dark"] .tone-anchor-zh,
html[data-theme="dark"] .tone-compare-zh {
  color: #fff8f0;
}

html[data-theme="dark"] .tone-eyebrow,
html[data-theme="dark"] .tone-lead,
html[data-theme="dark"] .tone-progress,
html[data-theme="dark"] .tone-phrase-en,
html[data-theme="dark"] .tone-syl-tone,
html[data-theme="dark"] .tone-hint,
html[data-theme="dark"] .tone-picker-label,
html[data-theme="dark"] .tone-picker-hint,
html[data-theme="dark"] .tone-anchor-jp,
html[data-theme="dark"] .tone-compare-lead,
html[data-theme="dark"] .tone-compare-meta,
html[data-theme="dark"] .tone-compare-en {
  color: #e4d5c6;
}

html[data-theme="dark"] .tone-syl,
html[data-theme="dark"] .tone-anchor-chip {
  background: color-mix(in srgb, var(--tone-c, #e85a00) 24%, #3f362e);
  color: #fff8f0;
}

html[data-theme="dark"] .tone-chart-ylab {
  fill: #d7c6b6;
}

html[data-theme="dark"] .tone-chart-grid {
  stroke: rgba(255, 248, 240, 0.18);
}


/* --- Word network (card panel + explore page) --- */
.word-network-panel {
  margin: 8px auto 0;
  width: min(100%, 340px);
  text-align: left;
}

.word-network-panel.is-compact {
  width: 100%;
}

.word-network-block {
  margin-top: 8px;
}

.word-network-toggle {
  border: none;
  background: transparent;
  color: var(--blue-deep);
  font-family: var(--font-en);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.word-network-label {
  margin: 0 0 6px;
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #7a6558);
}

.word-network-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.word-network-chip {
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  max-width: 100%;
}

.word-network-chip-zh {
  display: block;
  font-family: var(--font-zh);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
}

.word-network-chip-mean {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

.word-network-explore {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--font-en);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--orange-deep);
  text-decoration: none;
}

.word-network-explore:hover {
  text-decoration: underline;
}

.word-network-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.word-network-link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.word-network-link-meta strong {
  display: block;
  font-size: 0.88rem;
}

.word-network-link-meta small {
  display: block;
  color: var(--ink-soft);
  font-size: 0.78rem;
  margin-top: 2px;
}

.word-network-page {
  padding-bottom: 32px;
}

.word-network-header h1 {
  margin: 8px 0 4px;
  font-family: var(--font-zh);
  font-size: clamp(2rem, 8vw, 2.6rem);
  font-weight: 850;
}

.word-network-sub {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.45;
}

.word-network-fam-pill {
  display: inline-block;
  margin: 6px 0 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--fam, var(--orange-deep));
  background: color-mix(in srgb, var(--fam, var(--orange)) 14%, var(--surface));
}

.wn-mindmap {
  position: relative;
  margin: 0 0 22px;
  padding: 16px 8px 24px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 42%, rgba(74, 158, 255, 0.1), transparent 55%),
    linear-gradient(180deg, var(--panel-grad-a), var(--panel-grad-b));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.wn-mindmap-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.wn-line {
  stroke: color-mix(in srgb, var(--orange) 35%, var(--line));
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.85;
}

.wn-line-related {
  stroke: color-mix(in srgb, var(--orange) 55%, #fff);
}

.wn-line-meaning {
  stroke: color-mix(in srgb, var(--blue) 50%, #fff);
  stroke-dasharray: 5 4;
}

.wn-mindmap-stage {
  position: relative;
  z-index: 1;
  min-height: min(52vw, 300px);
  max-height: 360px;
}

.wn-node {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
}

.wn-node-center {
  z-index: 2;
  width: min(46vw, 200px);
  padding: 16px 14px;
  border-radius: 18px;
  background: var(--surface);
  border: 2px solid color-mix(in srgb, var(--orange) 40%, var(--line));
  box-shadow: 0 12px 28px rgba(232, 90, 0, 0.12);
  text-align: center;
}

.wn-center-zh {
  font-size: clamp(1.8rem, 7vw, 2.4rem);
}

.wn-node-branch {
  z-index: 1;
  width: min(34vw, 148px);
  padding: 10px 10px 9px;
  border-radius: 14px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
  text-align: center;
  cursor: pointer;
  transform: translate(-50%, -50%) translate(var(--dx, 0), var(--dy, 0));
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.wn-node-branch:hover,
.wn-node-branch:focus-visible {
  transform: translate(-50%, -50%) translate(var(--dx, 0), var(--dy, 0)) scale(1.04);
  border-color: color-mix(in srgb, var(--orange) 45%, var(--line));
  box-shadow: 0 10px 22px rgba(232, 90, 0, 0.14);
}

.wn-node-meaning {
  border-color: color-mix(in srgb, var(--blue) 35%, var(--line));
}

.wn-node-tag {
  display: block;
  font-family: var(--font-en);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.wn-node-zh {
  display: block;
  font-family: var(--font-zh);
  font-size: 1.25rem;
  font-weight: 850;
  line-height: 1.1;
  color: var(--ink);
}

.wn-node-jp {
  display: block;
  font-size: 0.72rem;
  margin-top: 2px;
  color: var(--blue-deep);
}

.wn-node-mean {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-top: 3px;
  line-height: 1.3;
}

.wn-mindmap-empty {
  position: relative;
  z-index: 1;
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.wn-examples {
  margin-top: 8px;
}

.wn-examples-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.wn-examples-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 850;
}

.wn-examples-count {
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}

.wn-example-list {
  display: grid;
  gap: 10px;
}

.wn-example {
  padding: 14px 14px 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.wn-example-zh {
  margin: 0;
  font-family: var(--font-zh);
  font-size: calc(1.15rem * var(--font-zh-scale));
  font-weight: 700;
  line-height: 1.55;
  color: var(--ink);
}

.wn-hit {
  background: color-mix(in srgb, var(--orange) 28%, transparent);
  color: var(--ink);
  border-radius: 4px;
  padding: 0 0.12em;
  font-weight: 850;
}

.wn-example-jp {
  margin: 6px 0 0;
  font-size: calc(0.82rem * var(--font-jyutping-scale));
}

.wn-example-en {
  margin: 4px 0 0;
  font-size: calc(0.88rem * var(--font-meaning-scale));
  color: var(--ink-soft);
  line-height: 1.45;
}

.wn-example-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 0.76rem;
}

.wn-example-src {
  color: var(--ink-soft);
  font-weight: 700;
}

.wn-example-open {
  color: var(--blue-deep);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.wn-example-open:hover {
  text-decoration: underline;
}

.wn-examples-empty {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.word-network-jump-lesson {
  margin: 18px 0 0;
  text-align: center;
}

@media (max-width: 420px) {
  .wn-mindmap-stage {
    min-height: 280px;
  }

  .wn-node-branch {
    width: min(38vw, 132px);
    padding: 8px 8px 7px;
  }

  .wn-node-zh {
    font-size: 1.1rem;
  }
}

html[data-theme="dark"] .wn-mindmap,
html[data-theme="dark"] .wn-example,
html[data-theme="dark"] .wn-node-center,
html[data-theme="dark"] .wn-node-branch,
html[data-theme="dark"] .word-network-chip,
html[data-theme="dark"] .word-network-link {
  background: var(--surface);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ─── Vocab World (top-down pixel RPG) ─── */
.house-panel {
  display: grid;
  gap: 12px;
  padding-bottom: 10px;
}

.house-hub-hero-compact {
  margin-bottom: 4px;
}

.house-hub-hero-compact .house-hub-lead {
  margin-top: 6px;
}

.house-start-cta,
.house-practice-cta {
  width: 100%;
  max-width: min(100%, 420px);
  margin-inline: auto;
}

.house-hub-meta {
  text-align: center;
  margin: 0;
}

.house-vocab-face {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.house-vocab-face .zh {
  margin: 0;
  font-family: var(--font-zh);
  font-size: clamp(1.45rem, 5vw, 1.85rem);
  font-weight: 800;
  line-height: 1.2;
}

.house-vocab-face .jyutping {
  margin: 0;
}

.house-vocab-meaning {
  margin: 4px 0 0;
  font-family: var(--font-en);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.house-vocab-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.house-vocab-card .vocab-bubble-actions {
  margin-top: 6px;
}

.house-hub-hero h1 {
  margin: 0 0 4px;
  font-family: var(--font-zh);
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 900;
}

.house-hub-lead {
  margin: 8px 0 0;
  color: var(--ink-soft);
  line-height: 1.55;
  font-family: var(--font-en);
  font-size: 0.94rem;
}

.house-hub-rooms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.house-hub-rooms-wide {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 132px), 1fr));
}

.house-hub-room {
  display: grid;
  gap: 2px;
  padding: 14px 12px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
}

.house-hub-room-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.house-hub-room strong {
  font-family: var(--font-zh);
  font-size: 1.05rem;
}

.house-hub-how {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  font-family: var(--font-en);
  font-size: 0.88rem;
  line-height: 1.55;
}

.house-top {
  display: grid;
  gap: 8px;
}

.house-room-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 118px;
  overflow-y: auto;
}

.house-room-tab {
  flex: 1 1 auto;
  min-width: 4.8rem;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-zh);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

.house-room-tab.active {
  border-color: color-mix(in srgb, var(--orange) 45%, var(--line));
  background: color-mix(in srgb, var(--orange) 12%, var(--surface));
  color: var(--orange-deep);
}

.house-room-card {
  padding: 12px 10px 10px;
  border-radius: 22px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--house-wall) 12%, var(--surface)), var(--surface));
  border: 1px solid var(--line);
}

.house-room-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.house-room-label strong {
  font-family: var(--font-zh);
  font-size: 1.05rem;
}

.house-room-card-pixel {
  padding: 10px 8px 8px;
  border-radius: 12px;
  background: var(--surface);
  border: 3px solid #2a2a3a;
  box-shadow: 4px 4px 0 color-mix(in srgb, #000 18%, transparent);
}

.house-stage {
  padding: 6px 0 4px;
  touch-action: manipulation;
}

.house-map-frame {
  max-width: min(100%, 380px);
  margin: 0 auto;
  padding: 6px;
  background: #12121f;
  border: 4px solid #3d3d55;
  box-shadow:
    inset 0 0 0 2px #0a0a12,
    4px 4px 0 #0a0a12;
  image-rendering: pixelated;
  overflow: visible;
  position: relative;
}

.house-map-frame::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 0;
  background-image: var(--house-room-bg);
  /* Match outline SVG 0–100 space 1:1 (cover was cropping / drifting frames). */
  background-size: 100% 100%;
  background-position: center;
  opacity: 0.82;
  pointer-events: none;
  z-index: 0;
}

.house-map-frame .house-scene {
  position: relative;
  z-index: 1;
}

.house-scene {
  display: grid;
  grid-template-columns: repeat(var(--grid, 8), 1fr);
  grid-template-rows: repeat(var(--grid, 8), 1fr);
  aspect-ratio: 1;
  overflow: visible;
}

.house-map-frame .house-floor-grid {
  position: relative;
  z-index: 1;
}

.house-floor-grid {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  display: grid;
  grid-template-columns: repeat(var(--grid, 8), 1fr);
  grid-template-rows: repeat(var(--grid, 8), 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.house-obj-layer,
.house-player-layer {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  display: grid;
  grid-template-columns: repeat(var(--grid, 8), 1fr);
  grid-template-rows: repeat(var(--grid, 8), 1fr);
  pointer-events: none;
}

.house-obj-layer {
  z-index: 3;
}

.house-obj-layer-scene {
  z-index: 3;
}

.house-outline-layer {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.house-outline-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.house-outline {
  fill: none;
  stroke: #ffe066;
  stroke-width: 1.35;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  pointer-events: auto;
  cursor: pointer;
  filter: none;
  transition:
    stroke 0.15s ease,
    stroke-width 0.15s ease;
}

.house-outline:hover,
.house-outline:focus-visible {
  fill: none;
  stroke: #fff3a8;
  stroke-width: 1.7;
  outline: none;
}

.house-outline.is-found {
  fill: none;
  stroke: #6dff9a;
}

.house-outline.is-task-target {
  fill: none;
  stroke: #ffb020;
  stroke-width: 1.7;
  animation: house-outline-pulse 1.4s ease-in-out infinite;
}

.house-outline-exit {
  fill: none;
  stroke: #9ec5ff;
  stroke-width: 1.25;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
}

.house-outline-label.is-exit {
  fill: #dcecff;
  font-size: 2.8px;
}

.house-outline-label {
  fill: #fff8e7;
  stroke: rgba(30, 20, 10, 0.85);
  stroke-width: 0.35;
  paint-order: stroke fill;
  font-size: 3.2px;
  font-weight: 800;
  font-family: "Noto Sans TC", "PingFang TC", system-ui, sans-serif;
  pointer-events: none;
  user-select: none;
}

@keyframes house-outline-pulse {
  0%,
  100% {
    stroke-opacity: 0.72;
    stroke-width: 1.45;
  }
  50% {
    stroke-opacity: 1;
    stroke-width: 1.85;
  }
}

.house-player-layer {
  z-index: 4;
}

.house-cell {
  position: relative;
  min-height: 0;
  aspect-ratio: 1;
  border-radius: 0;
  image-rendering: auto;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  touch-action: manipulation;
  overflow: visible;
}

.house-map-frame.house-map-scene::before {
  opacity: 1;
}

/* Painted rooms: kill all tile chrome (hedge/plaster inset lines were leaking through). */
.house-map-scene .house-cell,
.house-map-scene .house-cell-wall,
.house-map-scene .house-cell-wall-obj,
.house-map-scene .house-cell-exit,
.house-map-scene .house-cell-blocked,
.house-map-scene .house-cell-floor,
.house-map-scene .house-wall-hedge.house-cell-wall,
.house-map-scene .house-wall-hedge.house-cell-wall-obj,
.house-map-scene .house-wall-plaster.house-cell-wall,
.house-map-scene .house-wall-plaster.house-cell-wall-obj,
.house-map-scene .house-wall-building.house-cell-wall,
.house-map-scene .house-wall-building.house-cell-wall-obj,
.house-map-scene .house-wall-shop.house-cell-wall,
.house-map-scene .house-wall-shop.house-cell-wall-obj,
.house-map-scene .house-cell-floor.house-lane,
.house-map-frame[style*="--house-room-bg"] .house-cell,
.house-map-frame[style*="--house-room-bg"] .house-cell-floor,
.house-map-frame[style*="--house-room-bg"] .house-cell-floor.house-lane,
.house-map-frame[style*="--house-room-bg"] .house-cell-blocked,
.house-map-frame[style*="--house-room-bg"] .house-cell-wall,
.house-map-frame[style*="--house-room-bg"] .house-cell-wall-obj,
.house-map-frame[style*="--house-room-bg"] .house-cell-exit {
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  border: none !important;
}

.house-cell-has-obj,
.house-cell-blocked {
  cursor: pointer;
}

.house-cell-blocked {
  box-shadow: none;
}

.house-obj-hotspot-btn {
  background: transparent !important;
}

.house-obj-hotspot {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
  border-radius: 4px;
  pointer-events: none;
}

.house-obj-on-scene .house-obj-img {
  width: 92%;
  height: 92%;
  max-width: 92%;
  max-height: 92%;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

.house-obj-chip {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 2px);
  transform: translateX(-50%);
  z-index: 2;
  max-width: 140%;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(20, 14, 8, 0.82);
  color: #fff6e8;
  font-size: clamp(0.58rem, 2.4vw, 0.72rem);
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.house-obj.is-found .house-obj-chip {
  background: rgba(20, 90, 45, 0.9);
}

.house-obj.is-task-target .house-obj-chip {
  background: rgba(170, 90, 0, 0.95);
}

.house-obj-hotspot-btn:hover .house-obj-hotspot,
.house-obj-hotspot-btn:focus-visible .house-obj-hotspot {
  box-shadow: none;
  background: transparent;
}

.house-obj-hotspot-btn.is-found .house-obj-hotspot {
  box-shadow: none;
  background: transparent;
}

@media (hover: hover) and (pointer: fine) {
  .house-obj-hotspot-btn:hover .house-obj-hotspot,
  .house-obj-hotspot-btn:focus-visible .house-obj-hotspot {
    box-shadow: none;
  }
}

.house-cell-floor:not(.house-cell-wall):not(.house-cell-wall-obj) {
  cursor: pointer;
}

/* ── Floor tiles ── */
.house-tile-wood-a {
  background: #c4a574;
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0,
    transparent 38%,
    rgba(0, 0, 0, 0.08) 38%,
    rgba(0, 0, 0, 0.08) 40%
  );
}

.house-tile-wood-b {
  background: #b89563;
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0,
    transparent 38%,
    rgba(0, 0, 0, 0.1) 38%,
    rgba(0, 0, 0, 0.1) 40%
  );
}

.house-tile-grass-a {
  background: #5fa84e;
  background-image:
    radial-gradient(circle at 22% 28%, rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    radial-gradient(circle at 72% 68%, rgba(0, 0, 0, 0.08) 1px, transparent 1px);
}

.house-tile-grass-b {
  background: #549644;
  background-image:
    radial-gradient(circle at 55% 35%, rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    radial-gradient(circle at 18% 78%, rgba(0, 0, 0, 0.07) 1px, transparent 1px);
}

.house-tile-street-a {
  background: #7a828c;
}

.house-tile-street-b {
  background: #6e7680;
}

.house-cell-floor.house-lane {
  background: #949ba6 !important;
  background-image: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 44%,
    #e8c840 44%,
    #e8c840 56%,
    transparent 56%,
    transparent 100%
  ) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.house-tile-shop-a {
  background: #d4b896;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 48%,
    rgba(0, 0, 0, 0.05) 48%,
    rgba(0, 0, 0, 0.05) 52%
  );
}

.house-tile-shop-b {
  background: #c9ab88;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 48%,
    rgba(0, 0, 0, 0.06) 48%,
    rgba(0, 0, 0, 0.06) 52%
  );
}

/* ── Walls (RPG border tiles) ── */
.house-cell-wall,
.house-cell-wall-obj {
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.12), inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}

.house-wall-plaster.house-cell-wall,
.house-wall-plaster.house-cell-wall-obj {
  background: #6eb86e;
  box-shadow:
    inset 0 4px 0 #8ed48e,
    inset 0 -4px 0 #3a7a3a,
    inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.house-wall-hedge.house-cell-wall,
.house-wall-hedge.house-cell-wall-obj {
  background: #3d7a38;
  box-shadow: inset 0 2px 0 #5faa58, inset 0 -2px 0 #245522;
}

.house-wall-building.house-cell-wall,
.house-wall-building.house-cell-wall-obj {
  background: #5c4a3a;
  box-shadow: inset 0 2px 0 #8a7058, inset 0 -2px 0 #3a2e24;
}

.house-wall-shop.house-cell-wall,
.house-wall-shop.house-cell-wall-obj {
  background: #8b5a3c;
  box-shadow: inset 0 2px 0 #b07850, inset 0 -2px 0 #5c3824;
}

.house-cell-exit {
  background: #8b4518 !important;
  background-image: repeating-linear-gradient(
    90deg,
    #8b4518 0,
    #8b4518 40%,
    #6b3410 40%,
    #6b3410 60%,
    #8b4518 60%,
    #8b4518 100%
  ) !important;
  box-shadow: inset 0 0 0 2px #3d2010 !important;
}

.house-cell-wall-obj .house-obj {
  align-items: flex-end;
  padding-bottom: 4%;
}

/* ── Props & player ── */
.house-obj {
  grid-column: var(--gc, 1) / span var(--obj-span-w, 1);
  grid-row: var(--gr, 1) / span var(--obj-span-h, 1);
  position: relative;
  z-index: var(--obj-depth, 4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transform: none;
  transition: transform 0.08s ease;
  overflow: visible;
  min-width: 0;
  min-height: 0;
}

.house-obj:active {
  transform: scale(0.97);
}

.house-obj.is-found .house-obj-pixel {
  filter: contrast(1.06);
}

.house-obj-pixel {
  display: block;
  font-size: clamp(1rem, 4.2vw, 1.35rem);
  line-height: 1;
  image-rendering: pixelated;
  filter: contrast(1.05);
  user-select: none;
}

.house-obj-sprite,
.house-obj-img {
  display: block;
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  background: transparent !important;
  mix-blend-mode: normal;
}

.house-obj-large .house-obj-img,
.house-obj-large .house-obj-sprite,
.house-obj-huge .house-obj-img,
.house-obj-huge .house-obj-sprite {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.house-cell-exit .house-obj {
  align-items: flex-end;
  padding-bottom: 4%;
}

.house-obj-img-wall {
  object-position: center bottom;
  height: 94%;
  max-height: 94%;
}

@media (min-width: 520px) {
  .house-map-frame {
    max-width: min(100%, 500px);
  }

  .house-obj-img,
  .house-obj-sprite {
    max-width: 100%;
    max-height: 100%;
  }
}

.house-obj-large .house-obj-pixel {
  font-size: clamp(1.35rem, 5vw, 1.85rem);
}

.house-obj-huge .house-obj-pixel {
  font-size: clamp(1.7rem, 6.5vw, 2.35rem);
}

.house-player {
  grid-column: var(--pc, 1);
  grid-row: var(--pr, 1);
  position: relative;
  z-index: calc(10 + var(--py, 0));
  display: grid;
  place-items: end center;
  padding-bottom: 8%;
  pointer-events: none;
}

.house-cartoon {
  position: relative;
  display: block;
  width: 28px;
  height: 40px;
  animation: house-cartoon-bob 1.1s ease-in-out infinite;
}

.house-cartoon-hair {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 4;
  width: 22px;
  height: 11px;
  margin-left: -11px;
  border-radius: 11px 11px 5px 5px;
  background: #6b4423;
  border: 2px solid #3d2818;
}

.house-cartoon-head {
  position: absolute;
  top: 5px;
  left: 50%;
  z-index: 3;
  width: 20px;
  height: 18px;
  margin-left: -10px;
  border-radius: 50%;
  background: #ffdfc8;
  border: 2px solid #3d2818;
}

.house-cartoon-eye {
  position: absolute;
  top: 7px;
  width: 3px;
  height: 4px;
  border-radius: 50%;
  background: #2a2018;
}

.house-cartoon-eye-l {
  left: 5px;
}

.house-cartoon-eye-r {
  right: 5px;
}

.house-cartoon-mouth {
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 6px;
  height: 3px;
  margin-left: -3px;
  border-bottom: 2px solid #c45c5c;
  border-radius: 0 0 6px 6px;
}

.house-cartoon-body {
  position: absolute;
  bottom: 15px;
  left: 50%;
  z-index: 3;
  width: 16px;
  height: 10px;
  margin-left: -8px;
  border-radius: 6px 6px 4px 4px;
  background: #e85d4a;
  border: 2px solid #3d2818;
}

.house-cartoon-arm {
  position: absolute;
  bottom: 19px;
  z-index: 2;
  width: 4px;
  height: 7px;
  border-radius: 3px;
  background: #ffdfc8;
  border: 2px solid #3d2818;
}

.house-cartoon-arm-l {
  left: 3px;
  transform: rotate(22deg);
}

.house-cartoon-arm-r {
  right: 3px;
  transform: rotate(-22deg);
}

.house-cartoon-leg {
  position: absolute;
  bottom: 5px;
  z-index: 2;
  width: 5px;
  height: 10px;
  border-radius: 2px;
  background: #3d6b8c;
  border: 2px solid #3d2818;
}

.house-cartoon-leg-l {
  left: 7px;
  transform: rotate(-6deg);
}

.house-cartoon-leg-r {
  right: 7px;
  transform: rotate(6deg);
}

.house-cartoon-shoe {
  position: absolute;
  bottom: 0;
  z-index: 3;
  width: 6px;
  height: 4px;
  border-radius: 2px 2px 3px 3px;
  background: #2a2018;
  border: 1px solid #3d2818;
}

.house-cartoon-shoe-l {
  left: 6px;
}

.house-cartoon-shoe-r {
  right: 6px;
}

@keyframes house-cartoon-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

.house-progress {
  margin: 8px 4px 0;
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.house-task-card {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 2px solid color-mix(in srgb, var(--orange) 35%, var(--line));
  box-shadow: 0 4px 0 color-mix(in srgb, var(--orange) 12%, transparent);
}

.house-task-card-idle {
  border-color: var(--line);
  box-shadow: none;
}

.house-task-card-success {
  border-color: color-mix(in srgb, #5cb85c 45%, var(--line));
  background: color-mix(in srgb, #5cb85c 8%, var(--surface));
  box-shadow: 0 4px 0 color-mix(in srgb, #5cb85c 15%, transparent);
}

.house-task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.house-task-eyebrow {
  margin: 0;
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange-deep);
}

.house-task-score {
  font-family: var(--font-en);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.house-task-lead {
  margin: 0 0 4px;
  font-family: var(--font-en);
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.house-task-zh {
  margin: 0;
  font-family: var(--font-zh);
  font-size: clamp(1.6rem, 6vw, 2rem);
  font-weight: 900;
  line-height: 1.15;
}

.house-task-jp {
  margin: 4px 0 0;
}

.house-task-en {
  margin: 4px 0 0;
}

.house-task-room-hint {
  margin: 10px 0 0;
  font-family: var(--font-en);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.house-task-room-hint-here {
  color: color-mix(in srgb, var(--orange) 70%, var(--ink-soft));
}

.house-task-listen {
  margin-top: 10px;
}

.house-obj-hotspot-btn.is-task-target .house-obj-hotspot {
  box-shadow: none;
  background: transparent;
  animation: none;
}

@keyframes house-task-pulse {
  0%,
  100% {
    background: rgba(255, 190, 50, 0.1);
  }
  50% {
    background: rgba(255, 190, 50, 0.22);
  }
}

.house-object-panel {
  padding: 14px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  min-height: 88px;
}

.house-object-panel-empty p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

.house-object-panel-empty p + p {
  margin-top: 6px;
}

.house-object-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.house-object-emoji {
  font-size: 2rem;
  line-height: 1;
}

.house-object-zh {
  display: block;
  font-family: var(--font-zh);
  font-size: 1.35rem;
  font-weight: 800;
}

.house-object-jp {
  display: block;
  margin-top: 2px;
}

.house-object-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.house-object-en {
  margin: 0;
  font-family: var(--font-en);
  font-size: 1rem;
}

.house-controls {
  display: grid;
  gap: 4px;
  width: fit-content;
  margin: 0 auto;
}

.house-pad-mid {
  display: flex;
  gap: 4px;
  align-items: center;
}

.house-pad-btn {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--ink) 8%, transparent);
}

.house-pad-btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: none;
}

.house-pad-center {
  opacity: 0.35;
}

.house-hint {
  text-align: center;
  margin: 0;
}

.house-vocab-card {
  position: fixed;
  z-index: 1200;
  width: min(92vw, 320px);
  max-height: min(78vh, 520px);
  overflow: auto;
  padding-top: 34px;
}

@media (min-width: 520px) {
  .house-vocab-card {
    width: min(280px, 30vw);
    max-height: min(68vh, 440px);
  }

  .house-vocab-card[data-place="right"]::before,
  .house-vocab-card[data-place="left"]::before {
    content: "";
    position: absolute;
    top: clamp(28px, 18%, 72px);
    width: 0;
    height: 0;
    border: 7px solid transparent;
    pointer-events: none;
  }

  .house-vocab-card[data-place="right"]::before {
    left: -13px;
    border-right-color: var(--surface, #fff);
    filter: drop-shadow(-1px 0 0 rgba(0, 0, 0, 0.08));
  }

  .house-vocab-card[data-place="left"]::before {
    right: -13px;
    border-left-color: var(--surface, #fff);
    filter: drop-shadow(1px 0 0 rgba(0, 0, 0, 0.08));
  }
}

.house-vocab-card .word-network-panel {
  margin-top: 4px;
}

@media (min-width: 520px) {
  .house-controls {
    display: none;
  }
}



/* Bottom nav: always fit 5 colorful emoji tabs */
.nav-item .nav-icon {
  color: unset;
}
.nav-item .nav-icon svg {
  display: none;
}
.nav-item {
  overflow: hidden;
}
.nav-label {
  font-size: clamp(0.5rem, 2.4vw, 0.66rem);
}
