:root,
html[data-theme="light"] {
  --bg: #f5fbff;
  --panel: #ffffff;
  --accent: #39a845;
  --danger: #d9534f;
  --text: #1f2937;
  --app-page-bg-top: #e7f9ff;
  --app-page-bg-bottom: #f5fbff;
  --app-panel-quiz-bg: rgba(255, 255, 255, 0.55);
  --app-panel-quiz-border: #dbeafe;
  --app-card-bg: #ffffff;
  --app-card-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
  --app-heading: #0f172a;
  --app-muted: #4b5563;
  --app-border: #e5e7eb;
  --app-input-bg: #ffffff;
  --app-input-border: #d1d5db;
  --app-input-text: #1f2937;
  --app-status-bg: #eef2ff;
  --app-meta-theme: #39a845;
  --app-repeat-bg: #eff6ff;
  --app-repeat-text: #1d4ed8;
  --app-repeat-border: #bfdbfe;
  --app-quiz-opt-bg: #ffffff;
  --app-quiz-opt-border: #d1d5db;
  --app-word-item-bg: #ecfdf3;
  --app-word-item-border: #b7f0c2;
  --app-hint-line: #475569;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --bg: #0f172a;
    --panel: #1e293b;
    --text: #e5e7eb;
    --app-page-bg-top: #0f172a;
    --app-page-bg-bottom: #1e293b;
    --app-panel-quiz-bg: rgba(30, 41, 59, 0.85);
    --app-panel-quiz-border: #334155;
    --app-card-bg: #1e293b;
    --app-card-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    --app-heading: #f1f5f9;
    --app-muted: #cbd5e1;
    --app-border: #334155;
    --app-input-bg: #334155;
    --app-input-border: #475569;
    --app-input-text: #f1f5f9;
    --app-status-bg: #312e81;
    --app-meta-theme: #4ade80;
    --app-repeat-bg: rgba(30, 58, 138, 0.45);
    --app-repeat-text: #93c5fd;
    --app-repeat-border: #3b82f6;
    --app-quiz-opt-bg: #334155;
    --app-quiz-opt-border: #475569;
    --app-word-item-bg: rgba(22, 101, 52, 0.35);
    --app-word-item-border: #22c55e;
    --app-hint-line: #94a3b8;
  }
}

/* 后台页标题随主题 */
body:not(.app-page) .card h2,
body:not(.app-page) .card h3 {
  color: var(--app-heading);
}

.theme-toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-top: 10px;
}
.theme-toggle-row label {
  margin: 0 0 4px;
}
.theme-toggle-btn {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  background: var(--app-input-bg);
  color: var(--app-input-text);
  border: 2px solid var(--app-input-border);
}

html[data-theme="dark"] .panel--quiz .level-hint-toggle {
  background: linear-gradient(180deg, #334155 0%, #475569 100%);
  border-color: #64748b;
  color: #f1f5f9;
  box-shadow: 0 3px 0 #475569;
}
html[data-theme="dark"] .panel--quiz .level-hint-toggle:active {
  box-shadow: 0 1px 0 #475569;
}

html[data-theme="dark"] .panel--quiz .quiz-rules-hint-btn {
  background: linear-gradient(180deg, #334155 0%, #475569 100%);
  border-color: #64748b;
  color: #f1f5f9;
  box-shadow: 0 3px 0 #475569;
}
html[data-theme="dark"] .panel--quiz .quiz-rules-hint-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #475569;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .panel--quiz .level-hint-toggle {
    background: linear-gradient(180deg, #334155 0%, #475569 100%);
    border-color: #64748b;
    color: #f1f5f9;
    box-shadow: 0 3px 0 #475569;
  }
  html:not([data-theme]) .panel--quiz .level-hint-toggle:active {
    box-shadow: 0 1px 0 #475569;
  }
  html:not([data-theme]) .panel--quiz .quiz-rules-hint-btn {
    background: linear-gradient(180deg, #334155 0%, #475569 100%);
    border-color: #64748b;
    color: #f1f5f9;
    box-shadow: 0 3px 0 #475569;
  }
  html:not([data-theme]) .panel--quiz .quiz-rules-hint-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #475569;
  }
}

html[data-theme="dark"] {
  --bg: #0f172a;
  --panel: #1e293b;
  --text: #e5e7eb;
  --app-page-bg-top: #0f172a;
  --app-page-bg-bottom: #1e293b;
  --app-panel-quiz-bg: rgba(30, 41, 59, 0.85);
  --app-panel-quiz-border: #334155;
  --app-card-bg: #1e293b;
  --app-card-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --app-heading: #f1f5f9;
  --app-muted: #cbd5e1;
  --app-border: #334155;
  --app-input-bg: #334155;
  --app-input-border: #475569;
  --app-input-text: #f1f5f9;
  --app-status-bg: #312e81;
  --app-meta-theme: #4ade80;
  --app-repeat-bg: rgba(30, 58, 138, 0.45);
  --app-repeat-text: #93c5fd;
  --app-repeat-border: #3b82f6;
  --app-quiz-opt-bg: #334155;
  --app-quiz-opt-border: #475569;
  --app-word-item-bg: rgba(22, 101, 52, 0.35);
  --app-word-item-border: #22c55e;
  --app-hint-line: #94a3b8;
}
* { box-sizing: border-box; }
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}
html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', sans-serif;
  background: linear-gradient(180deg, var(--app-page-bg-top) 0%, var(--app-page-bg-bottom) 100%);
  background-attachment: fixed;
  color: var(--text);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* 学生端：整屏左右分栏，内部各自滚动（iPad 横竖屏均保持左右） */
html.app-layout,
body.app-page {
  height: 100%;
  overflow: hidden;
}
body.app-page {
  min-height: 100dvh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

/** 顶栏：账号 / 新游戏 / 云存档（跨左右栏全宽，置于分栏之上） */
.app-page-top {
  flex: 0 0 auto;
  padding: var(--safe-top) var(--safe-right) 0 var(--safe-left);
  background: linear-gradient(180deg, var(--app-page-bg-top) 0%, var(--app-page-bg-bottom) 100%);
  z-index: 8;
}
.app-page-top .auth-entry-card {
  margin: 0 0 8px;
  padding: 8px 12px;
  border-radius: 12px;
}
.app-page-top .quiz-auth-compact-row {
  margin-top: 2px;
  padding: 8px 10px;
}
.app-page-top .quiz-auth-compact-btn {
  padding: 4px 10px;
  font-size: 0.8rem;
}

/* 左右分栏：约 25% / 75%，占满剩余视口高度 */
.app-shell {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-width: none;
  width: 100%;
  margin: 0;
  gap: 0;
}
.panel--quiz {
  flex: 0 0 25%;
  max-width: 28%;
  min-width: 280px;
  padding: 12px 14px;
  padding-bottom: calc(12px + var(--safe-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-right: 1px solid var(--app-panel-quiz-border);
  background: var(--app-panel-quiz-bg);
}
.panel--quiz h2,
.panel--quiz h3 {
  color: var(--app-heading);
}
/* 游戏区固定浅色，不随系统 / 手动深浅色变化 */
.panel--game.theme-locked-light {
  flex: 1 1 75%;
  min-width: 0;
  min-height: 0;
  padding: 12px 14px;
  padding-bottom: calc(12px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(240, 253, 244, 0.35);
  color: #1f2937;
  border-left: 0;
}
.panel--game.theme-locked-light .card {
  background: #ffffff;
  color: #1f2937;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}
.panel--game.theme-locked-light h2,
.panel--game.theme-locked-light h3 {
  color: #0f172a;
}
.panel--game.theme-locked-light .game-help {
  color: #4b5563;
}
.card {
  background: var(--app-card-bg);
  box-shadow: var(--app-card-shadow);
  color: var(--text);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }

.quiz-auth-compact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--app-repeat-bg);
  border: 1px solid var(--app-repeat-border);
  position: relative;
  z-index: 7;
}
.quiz-auth-compact-row__status {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--app-repeat-text);
  flex: 1 1 140px;
  min-width: 0;
}
.quiz-auth-compact-btn {
  flex: 0 0 auto;
  font-size: 0.85rem;
  padding: 6px 12px;
}
.auth-modal-user-line {
  margin: 0 0 8px;
  text-align: left;
}
.auth-modal-dialog {
  max-width: 420px;
  width: 100%;
  text-align: left;
}
.auth-modal-dialog--wide {
  max-width: min(440px, 100vw - 32px);
}
.auth-modal-dialog .game-confirm-title {
  text-align: center;
}
.auth-modal-logged {
  margin-bottom: 12px;
}
.auth-modal-footer {
  margin-top: 16px;
  justify-content: center;
}
.game-confirm-overlay--auth {
  z-index: 100003;
}
.game-confirm-overlay--game-save {
  z-index: 100004;
}
/** 避免其它样式覆盖导致带 hidden 仍占位/可穿透 */
.game-confirm-overlay--auth[hidden],
.game-confirm-overlay--game-save[hidden] {
  display: none !important;
}
.game-confirm-overlay--playtime-password {
  z-index: 100005;
}
.game-confirm-overlay--playtime-password[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/** 云存档弹窗：原版 PvZ 墓碑档案风（纯 CSS 质感） */
.pvz-save-dialog {
  width: min(100%, 400px);
  max-height: none;
  min-height: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
}
.pvz-save-dialog__stone {
  width: 100%;
  max-height: min(88vh, 720px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 28px 20px 22px;
  border-radius: 18px 18px 14px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, transparent 42%),
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.04) 0 1px,
      transparent 1px 5px
    ),
    linear-gradient(165deg, #9ca3af 0%, #6b7280 35%, #57534e 100%);
  border: 4px solid #4b5563;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    inset 0 -6px 12px rgba(0, 0, 0, 0.25),
    0 16px 40px rgba(0, 0, 0, 0.45);
  position: relative;
}
.pvz-save-dialog__skull {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}
.pvz-save-dialog__skull-svg {
  display: block;
}
.pvz-save-dialog__title {
  margin: 8px 0 10px;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #facc15;
  text-shadow:
    0 1px 0 #854d0e,
    0 2px 0 #713f12,
    0 3px 4px rgba(0, 0, 0, 0.45);
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.pvz-save-dialog__message {
  min-height: 1.2em;
  margin: 0 0 8px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: #fbbf24;
}
.pvz-save-dialog__message.auth-message--error {
  color: #fca5a5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.pvz-save-dialog__hint {
  margin: 0 0 10px;
  padding: 0 6px;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.45;
  color: rgba(243, 244, 246, 0.85);
}
.pvz-save-dialog__hint--short {
  font-size: 0.8rem;
  line-height: 1.5;
  color: #e5e7eb;
}
.pvz-save-dialog__details {
  margin: 0 0 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.pvz-save-dialog__details-summary {
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fde68a;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.pvz-save-dialog__details-summary::-webkit-details-marker {
  display: none;
}
.pvz-save-dialog__details-body {
  padding: 0 12px 10px;
  font-size: 0.72rem;
  line-height: 1.5;
  color: #d1d5db;
}
.pvz-save-dialog__details-body p {
  margin: 0 0 6px;
}
.pvz-save-dialog__details-body p:last-child {
  margin-bottom: 0;
}
.pvz-save-dialog__section-label {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fde68a;
  opacity: 0.95;
}
.pvz-save-auto-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.pvz-save-auto-row__label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #e5e7eb;
  cursor: pointer;
  user-select: none;
}
.pvz-save-auto-row__label input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #22c55e;
}
.pvz-save-auto-row__slot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #d1d5db;
}
.pvz-save-auto-row__slot-lbl {
  white-space: nowrap;
}
.pvz-save-auto-row__slot select {
  min-width: 3.2rem;
  padding: 6px 8px;
  border-radius: 6px;
  border: 2px solid #4b5563;
  background: #1f2937;
  color: #f9fafb;
  font-weight: 700;
  font-size: 0.85rem;
}
.pvz-save-auto-row__hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: #a7f3d0;
  text-align: right;
}
@media (min-width: 360px) {
  .pvz-save-auto-row__hint {
    flex: 0 1 auto;
    text-align: right;
  }
}
.pvz-save-dialog__list {
  margin: 0 0 10px;
  padding: 8px 6px;
  min-height: 120px;
  max-height: min(36vh, 260px);
  overflow-y: auto;
  border-radius: 8px;
  background: #141414;
  border: 3px solid #1f2937;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.65);
}
.pvz-save-slot {
  display: block;
  width: 100%;
  margin: 0 0 6px;
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #f9fafb;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: "Comic Sans MS", "Chalkboard SE", "Trebuchet MS", ui-sans-serif, sans-serif;
  text-align: left;
  cursor: pointer;
  line-height: 1.25;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease, transform 0.08s ease;
}
.pvz-save-slot:last-child {
  margin-bottom: 0;
}
.pvz-save-slot:hover {
  background: rgba(255, 255, 255, 0.06);
}
.pvz-save-slot:active {
  transform: scale(0.99);
}
.pvz-save-slot--selected {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 55%, #16a34a 100%);
  color: #052e16;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 2px 0 #14532d;
}
.pvz-save-slot--selected:hover {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 55%, #16a34a 100%);
}
.pvz-save-slot__sub {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.88;
}
.pvz-save-slot__garden {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fde68a;
}
.pvz-save-slot__time {
  display: block;
  margin-top: 2px;
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.88;
}
.pvz-save-slot--selected .pvz-save-slot__sub {
  color: #14532d;
  opacity: 0.95;
}
.pvz-save-slot--selected .pvz-save-slot__garden {
  color: #422006;
}
.pvz-save-slot--selected .pvz-save-slot__time {
  color: #14532d;
  opacity: 0.92;
}
.pvz-save-dialog__actions-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
  margin: 0 0 14px;
}
.pvz-save-dialog__link-btn {
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: #fde68a;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.pvz-save-dialog__link-btn:hover {
  color: #fef08a;
}
.pvz-save-dialog__link-btn--danger {
  color: #fca5a5;
}
.pvz-save-dialog__link-btn--danger:hover {
  color: #fecaca;
}
.pvz-save-dialog__primary-actions {
  margin: 0 0 12px;
}
.pvz-save-dialog__save-wide {
  display: block;
  width: 100%;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 3px solid #3f6212;
  background: linear-gradient(180deg, #86efac 0%, #4ade80 45%, #22c55e 100%);
  color: #14532d;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    0 3px 0 #166534,
    0 6px 12px rgba(0, 0, 0, 0.25);
  -webkit-tap-highlight-color: transparent;
}
.pvz-save-dialog__save-wide:last-child {
  margin-bottom: 0;
}
.pvz-save-dialog__save-wide:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    0 2px 0 #166534;
}
.pvz-save-dialog__save-wide--secondary {
  border-color: #365314;
  background: linear-gradient(180deg, #bbf7d0 0%, #86efac 45%, #4ade80 100%);
  color: #14532d;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    0 3px 0 #166534,
    0 6px 12px rgba(0, 0, 0, 0.22);
}
.pvz-save-dialog__footer {
  display: flex;
  justify-content: center;
  padding-top: 4px;
  border-top: 1px solid rgba(0, 0, 0, 0.2);
}
.pvz-save-dialog__footer-btn {
  min-width: 8rem;
  padding: 10px 20px;
  border-radius: 10px;
  border: 3px solid #4b5563;
  background: linear-gradient(180deg, #d6d3d1 0%, #a8a29e 45%, #78716c 100%);
  color: #1c1917;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    0 2px 0 #292524;
  -webkit-tap-highlight-color: transparent;
}
.pvz-save-dialog__footer-btn:hover {
  filter: brightness(1.04);
}
.pvz-save-dialog__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pvz-save-dialog__stone-btn {
  padding: 12px 10px;
  border-radius: 10px;
  border: 3px solid #4b5563;
  background: linear-gradient(180deg, #a8a29e 0%, #78716c 40%, #57534e 100%);
  color: #bbf7d0;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 0 #1c1917;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.28),
    0 3px 0 #292524,
    0 5px 10px rgba(0, 0, 0, 0.3);
  -webkit-tap-highlight-color: transparent;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.pvz-save-dialog__stone-btn:hover {
  filter: brightness(1.05);
}
.pvz-save-dialog__stone-btn:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    0 1px 0 #292524;
}
.pvz-save-dialog__stone-btn--danger {
  color: #fecaca;
}
.auth-entry-card {
  padding: 12px 16px;
}
.auth-modal-dialog .auth-message {
  margin-bottom: 12px;
}
.auth-user-line {
  margin: 0 0 8px;
}
.auth-message {
  min-height: 1.25em;
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--accent);
}
.auth-message--error {
  color: var(--danger);
}
.auth-form-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}
.auth-field-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--app-muted);
}
.auth-field input,
.auth-field select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--app-input-border);
  background: var(--app-input-bg);
  color: var(--app-input-text);
  font-size: 1rem;
}
.auth-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}
.auth-logged-row {
  margin-bottom: 8px;
}
.auth-divider {
  border: 0;
  border-top: 1px solid var(--app-border);
  margin: 14px 0;
}
.auth-saves-title {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--app-heading);
}
.auth-saves-hint {
  margin: 0 0 10px;
}
.auth-saves-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 10px;
}
.auth-field--inline {
  flex: 0 0 auto;
  min-width: 140px;
}
.auth-field--grow {
  flex: 1 1 200px;
  min-width: 0;
}
.auth-saves-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.auth-btn-danger {
  border-color: #b91c1c;
  color: #991b1b;
}

.game-scene {
  position: relative;
  overflow: hidden;
}
/** 听音选词主卡：底部设置区含账号按钮，勿裁切；子层 #quizCard 仍可用内部叠层 */
#scene.quiz-hub-card.game-scene {
  overflow: visible;
}
.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #fef9c3 0%, #fde68a 100%);
  border-radius: 12px;
  font-weight: 700;
  border: 2px solid #facc15;
}
.game-hud .sun-val {
  font-size: 1.35rem;
  color: #ca8a04;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* 游戏页顶部「种子栏」：左阳光 → 右可购道具卡（参考 PvZ 种子包） */
.game-seed-bank {
  width: min(100%, calc(56vh * 2100 / 900));
  max-width: 100%;
  margin: 0 auto 8px;
  align-self: stretch;
}
.game-seed-bank__bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px 12px;
  padding: 8px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  background: linear-gradient(180deg, #c4a574 0%, #8b6914 8%, #6b4f2a 100%);
  border-radius: 14px;
  border: 3px solid #4a3728;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 4px 12px rgba(0,0,0,.15);
}
/** 种子栏右侧：双行（上：关卡+波次；下：时间/难度/速度+再玩一次+?），不抬高整条栏 */
.game-seed-bank__right {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
}
.game-seed-bank__row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.game-seed-bank__row--top {
  justify-content: flex-start;
}
.game-seed-bank__row--bottom {
  justify-content: flex-end;
  flex-wrap: wrap;
  row-gap: 4px;
}
.game-seed-bank__row--bottom .game-bar-controls {
  flex: 0 1 auto;
  min-width: 0;
  justify-content: flex-end;
}
.game-sun-block {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 6px 10px 8px;
  background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
  border-radius: 10px;
  border: 2px solid #b45309;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.game-sun-block__icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
  margin-bottom: 2px;
  pointer-events: none;
  image-rendering: auto;
}
.game-sun-block__label {
  font-size: 11px;
  font-weight: 800;
  color: #78350f;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.game-sun-block .sun-val {
  font-size: 1.5rem;
  line-height: 1.2;
  color: #ca8a04;
}
.game-seed-slots {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}
.game-seed-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 76px;
  min-height: 92px;
  padding: 6px 6px 22px;
  margin: 0;
  border: 3px solid #3f6212;
  border-radius: 10px;
  background: linear-gradient(180deg, #ecfccb 0%, #bbf7d0 45%, #86efac 100%);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 2px 6px rgba(0,0,0,.12);
  transition: transform 0.12s ease, filter 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.game-seed-card:hover:not(:disabled) {
  filter: brightness(1.05);
}
.game-seed-card:active:not(:disabled) {
  transform: scale(0.97);
}
.game-seed-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.35);
}
.game-seed-card--place {
  outline: 3px solid #facc15;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.5);
}
.game-seed-card__icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
  min-height: 52px;
}
.game-seed-card__icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
  image-rendering: auto;
  pointer-events: none;
}
.game-seed-card__cost {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 800;
  color: #1c1917;
  background: rgba(255,255,255,.92);
  border-radius: 6px;
  border: 1px solid #d6d3d1;
  line-height: 1.2;
}
.game-seed-card__cost-num {
  font-variant-numeric: tabular-nums;
}
.game-seed-card__sun {
  font-size: 11px;
  opacity: 0.9;
}
/** 种子栏右侧：展开「简易花园守卫」规则说明 */
.game-rules-toggle-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  min-width: 36px;
  margin-left: auto;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #4a3728;
  background: linear-gradient(180deg, #a16207 0%, #713f12 100%);
  color: #fef9c3;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 2px 6px rgba(0,0,0,.2);
  -webkit-tap-highlight-color: transparent;
  align-self: center;
}
.game-rules-toggle-btn:active {
  transform: scale(0.96);
}
/* 游戏画面固定 2100:900 等比；宽度不超过父级且不超过「56vh 对应宽度」避免竖屏过高 */
.game-canvas-wrap {
  position: relative;
  width: min(100%, calc(56vh * 2100 / 900));
  max-width: 100%;
  margin: 0 auto;
  aspect-ratio: 2100 / 900;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  background: #86efac;
  flex: 0 0 auto;
  touch-action: none;
}
/** 1-5 坚果保龄球：传送带预览条 + 左侧行槽（高于前景 Canvas 的局部可点区，其余穿透） */
.game-bowling-ui {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.game-bowling-conveyor {
  pointer-events: auto;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  /* 与 Canvas 草坪网格 `LAWN_NORM` + `bgDraw` 一致，由 `pvz-game.js` 写 `--bowling-conveyor-h-pct` */
  height: var(--bowling-conveyor-h-pct, 13%);
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 10px;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(45, 35, 25, 0.88) 0%, rgba(30, 22, 16, 0.75) 100%);
  border-bottom: 2px solid rgba(0, 0, 0, 0.35);
}
.game-bowling-conveyor__label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  color: #fde68a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.02em;
}
.game-bowling-conveyor__track-wrap {
  flex: 1 1 auto;
  position: relative;
  min-height: 44px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35);
}
/** 履带纹理横向循环滚动（瓦片宽与 `conveyor-belt-tile.webp` 导出一致 280px） */
.game-bowling-conveyor__belt {
  --bowling-belt-tile-w: 280px;
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: #3d2f22;
  background-image: var(--bowling-belt-tile, none);
  background-repeat: repeat-x;
  background-size: var(--bowling-belt-tile-w) 100%;
  background-position: 0 50%;
  animation: game-bowling-belt-scroll 5.5s linear infinite;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .game-bowling-conveyor__belt {
    animation: none;
  }
}
@keyframes game-bowling-belt-scroll {
  from {
    background-position: 0 50%;
  }
  to {
    background-position: calc(-1 * var(--bowling-belt-tile-w)) 50%;
  }
}
.game-bowling-conveyor__track {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 6px;
  min-height: 44px;
  -webkit-overflow-scrolling: touch;
}
.game-bowling-conveyor__chip {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid rgba(74, 55, 40, 0.85);
  /* 半透明底：露出下层履带横向滚动，更接近原版「在传送带上移动」观感 */
  background: linear-gradient(145deg, rgba(254, 249, 195, 0.42) 0%, rgba(234, 179, 8, 0.38) 55%, rgba(202, 138, 4, 0.4) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.game-bowling-conveyor__chip img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.game-bowling-conveyor__chip--next {
  outline: 3px solid #22c55e;
  outline-offset: 1px;
}
.game-bowling-lanes {
  position: absolute;
  left: 0;
  /* 与草坪 5 行区域同高、同起点（`--bowling-lanes-*` 由 JS 按 cellMetrics 写入） */
  top: var(--bowling-lanes-top-pct, 13%);
  height: var(--bowling-lanes-h-pct, 87%);
  bottom: auto;
  width: clamp(40px, 10.5%, 100px);
  min-width: 40px;
  display: block;
  pointer-events: none;
}
.game-bowling-lane-btn {
  pointer-events: auto;
  position: absolute;
  left: 0;
  right: 0;
  width: auto;
  box-sizing: border-box;
  margin: 0 4px;
  min-height: 0;
  padding: 0;
  border-radius: 8px;
  border: 2px solid rgba(74, 55, 40, 0.65);
  background: linear-gradient(90deg, rgba(254, 252, 232, 0.35) 0%, rgba(253, 224, 71, 0.2) 100%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.game-bowling-lane-btn:hover {
  background: linear-gradient(90deg, rgba(253, 224, 71, 0.45) 0%, rgba(234, 179, 8, 0.35) 100%);
}
.game-bowling-lane-btn:active {
  transform: scale(0.97);
}
.game-bowling-lane-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}
#gameCanvasBg {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
/* 叠在背景 Canvas 上、低于前景 Canvas；隐藏 img 供 Safari 解码动态 WebP（内联 opacity 与回归锚点一致） */
.game-sprite-anim-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
/** iPad/iPhone：动态 WebP 在 Canvas drawImage 不翻帧，植物/僵尸用 DOM transform 叠在背景与前景 Canvas 之间 */
.game-dom-sprite-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.game-dom-sprite-layer--zombies {
  z-index: 0;
}
.game-dom-sprite {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
}
.game-dom-sprite > img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}
.game-dom-sprite .game-dom-sprite-overlay {
  opacity: 0;
  visibility: hidden;
}
.game-dom-sprite .game-dom-sprite-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}
/** 波次条右侧：游戏时间 + 难度 + 速度（种子栏第二行内紧凑排列） */
.game-bar-controls {
  flex: 0 1 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  justify-content: flex-end;
}
.game-speed-block,
.game-difficulty-block,
.game-playtime-block {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}
.game-playtime-remaining {
  font-size: 11px;
  font-weight: 800;
  color: #fef9c3;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  min-width: 3.9em;
  user-select: none;
}
.theme-locked-light .game-playtime-remaining {
  color: #fef9c3;
}
.game-bar-control-label {
  font-size: 10px;
  font-weight: 700;
  color: #fef9c3;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  line-height: 1.1;
  user-select: none;
  white-space: nowrap;
}
.theme-locked-light .game-bar-control-label {
  color: #fef9c3;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
.game-speed-btn {
  flex: 0 0 auto;
  min-width: 48px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 800;
  border-radius: 8px;
  border: 2px solid #4a3728;
  background: linear-gradient(180deg, #fef9c3 0%, #fde047 100%);
  color: #713f12;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.game-speed-btn:active {
  transform: scale(0.97);
}
.game-new-game-btn {
  flex: 0 0 auto;
  min-width: 64px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 800;
  border-radius: 8px;
  border: 2px solid #4a3728;
  background: linear-gradient(180deg, #fed7aa 0%, #fdba74 100%);
  color: #9a3412;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
  white-space: nowrap;
}
.game-new-game-btn:active {
  transform: scale(0.97);
}
.game-confirm-overlay[hidden] {
  display: none !important;
  pointer-events: none;
}
.game-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  padding: 20px;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.game-confirm-dialog {
  position: relative;
  z-index: 1;
  max-width: 400px;
  padding: 24px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  text-align: center;
  pointer-events: auto;
}
.game-confirm-title {
  margin: 0 0 10px;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}
.game-confirm-hint {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.55;
  color: #4b5563;
  text-align: left;
}
.game-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.game-confirm-btn {
  flex: 1 1 120px;
  min-width: 0;
}

/* 关卡彩蛋：波次条 10 连点打开 */
.game-confirm-overlay--level-picker {
  z-index: 100002;
}
.level-picker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 0 0 16px;
  max-height: min(50vh, 280px);
  overflow-y: auto;
  padding: 4px 0;
}
.level-picker-btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: 2px solid #22c55e;
  background: #ecfdf5;
  color: #065f46;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.level-picker-btn:hover {
  background: #d1fae5;
}
.level-picker-btn:active {
  transform: scale(0.97);
}

.level-picker-sun-debug {
  margin: 0 0 16px;
  padding: 12px 0 4px;
  border-top: 1px dashed #cbd5e1;
  text-align: center;
}
.level-picker-sun-debug__label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 8px;
}
.level-picker-sun-debug__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.level-picker-sun-btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: 2px solid #f59e0b;
  background: #fffbeb;
  color: #92400e;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.level-picker-sun-btn:hover {
  background: #fef3c7;
}
.level-picker-sun-btn:active {
  transform: scale(0.97);
}
/* [hidden] 必须压过本类的 display:flex，否则 HTML hidden 无效，一进页就挡住全屏 */
.game-over-overlay[hidden] {
  display: none !important;
  pointer-events: none;
}
.game-over-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  padding: 20px;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
/** 时长到点：仅提示卡拦截点击，不挡住顶栏「游戏时间」切换 */
.game-over-overlay--playtime {
  pointer-events: none;
}
.game-over-overlay--playtime .game-over-dialog {
  pointer-events: auto;
}
.game-over-dialog {
  position: relative;
  z-index: 1;
  max-width: 360px;
  padding: 24px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  text-align: center;
  pointer-events: auto;
}
.game-over-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 800;
  color: #b91c1c;
}
.game-over-hint {
  margin: 0 0 18px;
  font-size: 14px;
  color: #4b5563;
}
.game-over-dialog button {
  width: 100%;
}
#gameCanvas {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 1;
  cursor: crosshair;
  touch-action: none;
}
#gameCanvas.plant-cursor,
#gameCanvasBg.plant-cursor {
  cursor: cell;
}
.game-help {
  font-size: 13px;
  color: var(--app-muted);
  line-height: 1.5;
}
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.col { flex: 1 1 200px; }
button {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  min-height: 48px;
  font-size: 16px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  background: #1f7af8;
  color: #fff;
}
button.secondary { background: #6b7280; }
button.danger { background: var(--danger); }
button.success { background: var(--accent); }
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
select, input, textarea {
  width: 100%;
  padding: 12px;
  min-height: 48px;
  font-size: 16px;
  border: 1px solid var(--app-input-border);
  border-radius: 8px;
  background: var(--app-input-bg);
  color: var(--app-input-text);
}
textarea { min-height: auto; }
label { display: block; margin: 8px 0 4px; font-weight: 600; }
.status {
  padding: 8px;
  border-radius: 8px;
  background: var(--app-status-bg);
  color: var(--text);
  margin-top: 8px;
  white-space: pre-line; /* 答对状态可换行展示词库英文例句 */
}
.words { display: grid; grid-template-columns: repeat(2, minmax(100px,1fr)); gap: 10px; }
.word-item {
  background: var(--app-word-item-bg);
  border: 1px solid var(--app-word-item-border);
  padding: 12px 10px;
  border-radius: 12px;
  text-align: center;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}
.api-detail {
  margin-top: 10px;
  padding: 10px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow: auto;
}
.svg-sprite { display: none; }

.level-hint-card {
  position: relative;
}
.level-hint-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  font-size: 1.1rem;
  font-weight: 800;
  border-radius: 999px;
  border: 3px solid #94a3b8;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  color: #334155;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 3px 0 #94a3b8;
}
.level-hint-toggle:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #94a3b8;
}
.level-hint-toggle:disabled,
.level-hint-toggle.level-hint-toggle--exhausted {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}
.hint-opens-line {
  margin: 8px 0 0;
  font-size: 0.95rem;
  color: var(--app-hint-line);
}
.quiz-reset-accumulated-row {
  margin: 10px 0 0;
}
.quiz-reset-accumulated-btn {
  width: 100%;
  max-width: 100%;
  font-weight: 700;
  min-height: 44px;
}
.level-hint-content {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--app-border);
}
.level-hint-progress {
  margin-top: 0;
  margin-bottom: 14px;
}
.level-hint-content[hidden] {
  display: none !important;
}
.quiz-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}
.quiz-block:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.quiz-qtext {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 15px;
}
.quiz-headline {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--app-heading);
  margin: 0 0 8px;
}
.quiz-headline-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  min-width: 0;
}
/* 标题 + ? +「再听一遍」同一行；再听一遍靠右 */
.quiz-headline-row--toolbar .quiz-headline-row__replay {
  flex: 0 0 auto;
  margin-left: auto;
}
.quiz-headline-row--toolbar .quiz-replay-btn {
  min-height: 40px;
  font-size: 0.95rem !important;
}
.quiz-headline--inline {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 与「提示 ?」同系：胶囊 + 渐变 + 底边阴影（尺寸略小，仅「?」） */
.quiz-rules-hint-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 2.5rem;
  min-height: 40px;
  padding: 0 14px;
  margin: 0;
  border-radius: 999px;
  border: 3px solid #94a3b8;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  color: #334155;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 3px 0 #94a3b8;
}
.quiz-rules-hint-btn:hover {
  filter: brightness(1.02);
}
.quiz-rules-hint-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #94a3b8;
}
.quiz-rules-hint-btn:focus-visible {
  outline: 2px solid var(--app-heading);
  outline-offset: 2px;
}
.quiz-rules-wrap {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--app-panel-quiz-border);
  background: rgba(255, 255, 255, 0.35);
}
html[data-theme="dark"] .quiz-rules-wrap {
  background: rgba(15, 23, 42, 0.45);
}
.quiz-rules-wrap__text {
  margin: 0 !important;
}
.quiz-hint-large {
  font-size: 1.05rem !important;
  line-height: 1.55 !important;
  color: var(--app-muted) !important;
}
/* 提示文案与「再听一遍」同一行（窄屏自动换行） */
.quiz-hint-replay-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 4px;
}
.quiz-hint-replay-row__hint {
  flex: 1 1 180px;
  margin: 0 !important;
  min-width: 0;
}
.quiz-hint-replay-row__replay {
  flex: 0 0 auto;
  align-self: center;
}
.quiz-actions-row {
  margin-top: 8px;
}
.quiz-replay-btn {
  font-size: 1rem !important;
  min-height: 44px !important;
}
.quiz-replay-btn__inner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.quiz-replay-btn__icon {
  display: inline-flex;
  flex-shrink: 0;
  color: #fff;
}
.quiz-replay-btn .quiz-speaker-svg {
  display: block;
  vertical-align: middle;
}
/* 朗读中：声波弧线脉动 */
.quiz-replay-btn--playing .quiz-speaker-wave {
  animation: quiz-speaker-pulse 0.85s ease-in-out infinite;
  opacity: 0.35;
}
.quiz-replay-btn--playing .quiz-speaker-wave--1 {
  animation-delay: 0s;
}
.quiz-replay-btn--playing .quiz-speaker-wave--2 {
  animation-delay: 0.12s;
}
.quiz-replay-btn--playing .quiz-speaker-wave--3 {
  animation-delay: 0.24s;
}
@keyframes quiz-speaker-pulse {
  0%, 100% {
    opacity: 0.2;
  }
  50% {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .quiz-replay-btn--playing .quiz-speaker-wave {
    animation: none;
    opacity: 0.9;
  }
}
.quiz-replay-btn:disabled:not(.quiz-replay-btn--playing) .quiz-speaker-wave {
  opacity: 0.35;
}
/* 听音选词：顶栏卡内为首块时无上分隔线；规则说明在「提示」下方独立卡 */
.quiz-hub-intro {
  margin-bottom: 0;
}
.quiz-listen-module--top {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.quiz-accuracy-line {
  margin: 10px 0 0;
  font-size: 0.95rem;
}

.quiz-wrong-words-card {
  margin-top: 12px;
}

.quiz-wrong-words-title {
  margin: 0 0 6px;
  font-size: 1rem;
}

.quiz-wrong-words-hint {
  margin: 0 0 8px;
}

.quiz-wrong-words-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 8px;
}

.quiz-wrong-word-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.12));
  background: var(--surface-2, rgba(0, 0, 0, 0.04));
  font-size: 0.9rem;
  cursor: pointer;
  color: inherit;
}

.quiz-wrong-word-tag:hover,
.quiz-wrong-word-tag:focus-visible {
  outline: 2px solid var(--accent, #39a845);
  outline-offset: 2px;
}

html[data-theme="dark"] .quiz-wrong-word-tag {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
}

.quiz-about-card {
  margin-top: 0;
}
.quiz-about-title {
  margin: 0 0 10px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--app-heading);
}
.quiz-listen-module {
  position: relative;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--app-border);
}
.quiz-hub-settings {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--app-border);
  position: relative;
  z-index: 6;
}
#quizCard {
  position: relative;
}
.quiz-correct-toast {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 12px;
  background: rgba(15, 23, 42, 0.12);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.quiz-correct-toast--visible {
  opacity: 1;
}
.quiz-correct-toast__card {
  transform: scale(0.35);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
  filter: drop-shadow(0 12px 28px rgba(15, 23, 42, 0.25));
}
.quiz-correct-toast--visible .quiz-correct-toast__card {
  transform: scale(1);
  opacity: 1;
}
.quiz-correct-toast__img {
  display: block;
  width: min(72vw, 220px);
  height: auto;
  max-height: min(48vh, 260px);
  border-radius: 20px;
}
@media (prefers-reduced-motion: reduce) {
  .quiz-correct-toast {
    transition: none;
  }
  .quiz-correct-toast__card {
    transition: none;
    transform: scale(1);
    opacity: 1;
  }
}
.quiz-area-kid {
  margin-top: 14px;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quiz-options--kid {
  gap: 14px;
}
.quiz-opt {
  text-align: left;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid var(--app-quiz-opt-border);
  background: var(--app-quiz-opt-bg);
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
  transition: border-color .15s, background .15s, transform .1s;
}
.quiz-opt--kid {
  text-align: center;
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 22px 18px;
  min-height: 72px;
  border-radius: 18px;
  border-width: 3px;
  box-shadow: 0 4px 0 #cbd5e1, 0 6px 16px rgba(15, 23, 42, 0.08);
  line-height: 1.2;
}
.quiz-opt--kid:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #cbd5e1;
}
.quiz-opt--kid.quiz-opt--locked {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}
.quiz-opt:hover:not(:disabled) {
  border-color: #3b82f6;
  filter: brightness(1.03);
}
.quiz-opt--kid:hover:not(:disabled) {
  border-color: #2563eb;
  filter: brightness(1.04);
}
.quiz-opt:disabled { cursor: default; opacity: 0.85; }
.quiz-opt.correct {
  border-color: var(--accent);
  background: #ecfdf3;
  box-shadow: 0 4px 0 #86efac;
}
.quiz-opt.wrong-pick {
  border-color: var(--danger);
  background: #fef2f2;
  box-shadow: 0 4px 0 #fecaca;
}
.quiz-solved-note { font-size: 13px; color: #059669; margin-top: 6px; }
.quiz-solved-note--kid {
  font-size: 1.2rem !important;
  font-weight: 800;
  text-align: center;
  padding: 14px;
  border-radius: 14px;
  margin-top: 16px !important;
}
.quiz-solved-note--ok {
  background: #f0fdf4;
  color: #166534 !important;
}
.quiz-solved-note--wrong {
  background: #fef2f2;
  color: #b91c1c !important;
}
.quiz-all-done { font-size: 16px; padding: 12px; text-align: center; }
.repeat-target-line {
  font-size: 16px;
  font-weight: 700;
  color: var(--app-repeat-text);
  margin: 10px 0 0;
  padding: 10px 12px;
  background: var(--app-repeat-bg);
  border-radius: 10px;
  border: 1px solid var(--app-repeat-border);
}
/* 仅极窄屏（手机竖屏）改为上下布局；iPad 宽度通常 >520，保持左右分栏 */
@media (max-width: 520px) {
  html.app-layout,
  body.app-page {
    height: auto;
    overflow: auto;
  }
  .app-shell {
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
  }
  .panel--quiz {
    flex: 1 1 auto;
    max-width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--app-panel-quiz-border);
  }
  .panel--game {
    flex: 1 1 auto;
    min-height: 320px;
  }
  button { width: 100%; }
}

/* iPad 主屏幕与浏览器统一卡片内边距，避免「添加到主屏幕」后与 PC 观感不一致 */
html.app-standalone .panel--game .card {
  padding: 16px;
}

/* ========== 通关 topic（画布内，3 秒后自动下一关或再来一局）========== */
.game-victory-toast {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.game-victory-toast[hidden] {
  display: none !important;
}
.game-victory-toast--visible {
  opacity: 1;
}
.game-victory-toast__card {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 3px solid #f59e0b;
  border-radius: 14px;
  padding: 16px 20px;
  text-align: center;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  max-width: min(92%, 360px);
  transform: scale(0.92);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
}
.game-victory-toast--visible .game-victory-toast__card {
  transform: scale(1);
  opacity: 1;
}
.game-victory-toast__title {
  font-size: clamp(1.15rem, 3.8vw, 1.65rem);
  font-weight: 800;
  color: #92400e;
  margin: 0 0 6px;
}
.game-victory-toast__hint {
  font-size: clamp(0.85rem, 2.6vw, 1rem);
  color: #78350f;
  margin: 0 0 4px;
  line-height: 1.35;
}
.game-victory-toast__reward {
  font-size: clamp(0.9rem, 2.8vw, 1.05rem);
  font-weight: 700;
  color: #d97706;
  margin: 0;
  line-height: 1.35;
  white-space: pre-line;
}
@media (prefers-reduced-motion: reduce) {
  .game-victory-toast,
  .game-victory-toast__card {
    transition: none;
  }
  .game-victory-toast__card {
    transform: scale(1);
    opacity: 1;
  }
}

.game-level-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #1e40af;
  white-space: nowrap;
  padding: 1px 6px;
  background: rgba(219, 234, 254, 0.8);
  border-radius: 5px;
  flex: 0 0 auto;
}

.game-conveyor-hint {
  font-size: 0.72rem;
  font-weight: 600;
  color: #92400e;
  max-width: 140px;
  line-height: 1.25;
  padding: 4px 8px;
  background: rgba(254, 243, 199, 0.95);
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.45);
}

/* ========== 波次进度条 ========== */
.game-seed-bank__row--top .game-wave-progress {
  flex: 1 1 auto;
  max-width: none;
}
.game-wave-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 100px;
  flex: 0 1 auto;
  max-width: min(220px, 40vw);
}
.game-wave-progress__text {
  font-size: 0.68rem;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}
.game-wave-progress__track {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  min-width: 48px;
}
.game-wave-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #16a34a);
  border-radius: 4px;
  transition: width 0.5s ease;
}
