:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #657386;
  --line: #d9e1ea;
  --panel: #ffffff;
  --panel-soft: #f7fafc;
  --bg: #eef3f8;
  --nav: #17202a;
  --nav-soft: #223042;
  --teal: #0f8b8d;
  --blue: #2d5bd1;
  --amber: #c98510;
  --coral: #d65a3a;
  --green: #15803d;
  --red: #ba2f2f;
  --shadow: 0 14px 34px rgba(23, 32, 42, 0.09);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Inter", "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 139, 141, 0.08) 0 25%, transparent 25% 50%, rgba(45, 91, 209, 0.06) 50% 75%, transparent 75%) 0 0 / 36px 36px,
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 18px;
  color: #eef6fb;
  background: var(--nav);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand span {
  margin-top: 2px;
  color: #a9b7c6;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #ced9e5;
  background: transparent;
  text-align: left;
}

.nav-item svg,
.icon-button svg,
.search-box svg,
.small-icon svg,
.mode-card svg,
.stat-card svg,
.action-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: var(--nav-soft);
  border-color: rgba(255, 255, 255, 0.1);
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.mini-stat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.mini-stat span {
  color: #b8c4d1;
  font-size: 13px;
}

.mini-stat strong {
  color: #fff;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.16;
}

h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.24;
}

h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(430px, 44vw);
}

.search-box {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  max-width: 180px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.user-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip svg {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  color: var(--teal);
}

.icon-button:hover,
.action-button:hover,
.ghost-button:hover {
  border-color: #aab8c7;
  transform: translateY(-1px);
}

.view-shell {
  min-height: calc(100vh - 120px);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat-card,
.mode-card,
.panel,
.question-card,
.record-card,
.topic-row,
.import-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-card {
  display: grid;
  gap: 12px;
  min-height: 130px;
  padding: 18px;
}

.stat-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  font-size: 32px;
  line-height: 1;
}

.stat-card small {
  color: var(--muted);
}

.stat-teal svg {
  color: var(--teal);
}

.stat-blue svg {
  color: var(--blue);
}

.stat-amber svg {
  color: var(--amber);
}

.stat-coral svg {
  color: var(--coral);
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.95fr);
  gap: 16px;
}

.panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-header p,
.muted {
  color: var(--muted);
}

.panel-header p {
  margin: 4px 0 0;
  font-size: 13px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mode-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 116px;
  padding: 14px;
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.mode-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.mode-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #e9f7f7;
  color: var(--teal);
}

.mode-card:nth-child(2) .mode-icon {
  background: #eef3ff;
  color: var(--blue);
}

.mode-card:nth-child(3) .mode-icon {
  background: #fff6e5;
  color: var(--amber);
}

.mode-card:nth-child(4) .mode-icon {
  background: #fff0eb;
  color: var(--coral);
}

.mode-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.topic-list {
  display: grid;
  gap: 10px;
}

.topic-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(110px, 2fr) 58px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  box-shadow: none;
}

.progress-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6edf4;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--value, 0%);
  border-radius: inherit;
  background: var(--teal);
}

.topic-row:nth-child(2n) .progress-fill {
  background: var(--blue);
}

.topic-row:nth-child(3n) .progress-fill {
  background: var(--amber);
}

.topic-row small {
  color: var(--muted);
  text-align: right;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.select,
.text-input,
.number-input,
.textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.select,
.text-input,
.number-input {
  min-height: 42px;
  padding: 0 12px;
}

.textarea {
  display: block;
  width: 100%;
  min-height: 168px;
  padding: 12px;
  resize: vertical;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segmented button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.segmented button.active {
  color: #fff;
  background: var(--ink);
}

.action-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  white-space: nowrap;
}

.action-button {
  border: 1px solid var(--ink);
  color: #fff;
  background: var(--ink);
}

.action-button.teal {
  border-color: var(--teal);
  background: var(--teal);
}

.action-button.blue {
  border-color: var(--blue);
  background: var(--blue);
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.danger-button {
  border: 1px solid #f1b2b2;
  color: var(--red);
  background: #fff7f7;
}

.question-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 288px;
  gap: 16px;
}

.question-card {
  overflow: hidden;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.topic {
  border-color: rgba(15, 139, 141, 0.28);
  color: var(--teal);
  background: #eefafa;
}

.pill.diff {
  border-color: rgba(201, 133, 16, 0.28);
  color: var(--amber);
  background: #fff8eb;
}

.question-body {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.question-stem {
  min-height: 110px;
  font-size: 20px;
  line-height: 1.62;
}

.diagram-box {
  display: grid;
  place-items: center;
  min-height: 168px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.diagram-box svg {
  max-width: 100%;
  height: auto;
}

.options-grid {
  display: grid;
  gap: 10px;
}

.option-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.option-button:hover {
  border-color: #97a8ba;
}

.option-button.selected {
  border-color: var(--blue);
  background: #eff4ff;
}

.option-button.correct {
  border-color: rgba(21, 128, 61, 0.55);
  background: #edfff4;
}

.option-button.wrong {
  border-color: rgba(186, 47, 47, 0.55);
  background: #fff1f1;
}

.option-letter {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-weight: 800;
}

.option-button.correct .option-letter {
  background: var(--green);
}

.option-button.wrong .option-letter {
  background: var(--red);
}

.explanation {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: #f1fbfb;
  line-height: 1.62;
}

.explanation strong {
  color: var(--teal);
}

.question-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}

.question-side {
  display: grid;
  align-content: start;
  gap: 14px;
}

.progress-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 14px;
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.jump-button {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
}

.jump-button.answered {
  border-color: rgba(15, 139, 141, 0.36);
  color: var(--teal);
  background: #eefafa;
}

.jump-button.current {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.jump-button.flagged::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--amber);
}

.result-number {
  margin: 8px 0 4px;
  font-size: 42px;
  font-weight: 850;
  line-height: 1;
}

.record-list {
  display: grid;
  gap: 12px;
}

.record-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  box-shadow: none;
}

.record-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.record-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px dashed #b9c7d6;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  text-align: center;
  padding: 24px;
}

.empty-state h3 {
  margin-bottom: 8px;
}

.empty-state p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 140px);
  padding: 24px;
}

.auth-panel {
  width: min(480px, 100%);
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-brand {
  color: var(--ink);
}

.auth-brand span {
  color: var(--muted);
}

.auth-tabs {
  width: fit-content;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
}

.auth-form label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-message {
  padding: 10px 12px;
  border: 1px solid rgba(214, 90, 58, 0.28);
  border-radius: 8px;
  background: #fff3ef;
  color: var(--coral);
  font-size: 13px;
  line-height: 1.45;
}

.auth-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.import-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
}

.import-box {
  padding: 18px;
}

.file-zone {
  display: grid;
  gap: 12px;
  place-items: center;
  min-height: 142px;
  margin: 14px 0;
  border: 1px dashed #aebccc;
  border-radius: 8px;
  background: #fbfdff;
  text-align: center;
}

.file-zone input {
  max-width: 100%;
}

.schema-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.schema-table th,
.schema-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.schema-table tr:last-child td {
  border-bottom: 0;
}

.schema-table th {
  background: var(--panel-soft);
  color: var(--muted);
}

.chart-wrap {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 10px;
}

.bar-row strong {
  font-size: 13px;
}

.bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6edf4;
}

.bar span {
  display: block;
  width: var(--value, 0%);
  height: 100%;
  background: var(--blue);
}

.bar-row:nth-child(3n) .bar span {
  background: var(--teal);
}

.bar-row:nth-child(4n) .bar span {
  background: var(--amber);
}

.mission-grid,
.badge-grid,
.store-grid,
.habit-list {
  display: grid;
  gap: 12px;
}

.mission-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.badge-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.store-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mission-card,
.badge-card,
.store-card,
.habit-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

.mission-card,
.store-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.mission-card.done {
  border-color: rgba(21, 128, 61, 0.28);
  background: #f0fff5;
}

.mission-top,
.store-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mission-card p,
.store-card p,
.habit-card p,
.badge-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mission-card small {
  color: var(--muted);
}

.habit-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 14px;
}

.badge-card {
  display: grid;
  justify-items: start;
  gap: 8px;
  min-height: 152px;
  padding: 14px;
}

.badge-card.locked {
  color: #7a8797;
  background: #f7fafc;
}

.badge-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #eef3ff;
  color: var(--blue);
}

.badge-card.locked .badge-icon {
  background: #e8eef5;
  color: #8290a0;
}

.badge-icon svg {
  width: 20px;
  height: 20px;
}

.reward-earned {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(15, 139, 141, 0.24);
  border-radius: 8px;
  background: #eefafa;
}

.reward-earned strong {
  color: var(--teal);
  font-size: 18px;
}

.reward-earned span {
  color: var(--muted);
  font-size: 13px;
}

.reward-log {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.reward-event {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.reward-event strong {
  color: var(--teal);
  white-space: nowrap;
}

.game-shell {
  display: grid;
  gap: 14px;
  min-height: 260px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.game-shell.idle {
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.game-shell.idle h3 {
  color: var(--ink);
  margin-bottom: 6px;
}

.game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.game-head > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rocket-track {
  position: relative;
  height: 54px;
  overflow: hidden;
  border: 1px solid #c9d6e5;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 139, 141, 0.12), rgba(45, 91, 209, 0.12)),
    #eef6ff;
}

.rocket-track::after {
  content: "";
  position: absolute;
  inset: auto 12px 12px 12px;
  height: 2px;
  background: rgba(23, 32, 42, 0.18);
}

.rocket {
  position: absolute;
  top: 8px;
  transform: translateX(-50%);
  font-size: 26px;
  transition: left 0.18s ease;
}

.game-question {
  display: grid;
  gap: 12px;
}

.game-question h3 {
  font-size: 28px;
  text-align: center;
}

.game-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.game-message {
  padding: 10px 12px;
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: #eefafa;
  color: var(--teal);
  font-weight: 800;
}

.memory-shell {
  min-height: 360px;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.memory-card {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 850;
  font-size: 24px;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.memory-card:hover {
  transform: translateY(-1px);
}

.memory-card.open {
  border-color: rgba(45, 91, 209, 0.35);
  background: #eff4ff;
  color: var(--blue);
}

.memory-card.matched {
  border-color: rgba(21, 128, 61, 0.38);
  background: #edfff4;
  color: var(--green);
}

.adventure-shell {
  min-height: 420px;
  background:
    linear-gradient(135deg, rgba(15, 139, 141, 0.08), rgba(229, 107, 111, 0.08)),
    #fbfdff;
}

.adventure-idle {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 720px;
  text-align: left;
}

.avatar-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  flex: 0 0 auto;
  border: 1px solid rgba(45, 91, 209, 0.3);
  border-radius: 8px;
  background: #eff4ff;
  color: var(--blue);
  font-size: 24px;
  font-weight: 900;
}

.avatar-frame span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(23, 32, 42, 0.82);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

.adventure-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.battle-field {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
  overflow: hidden;
  isolation: isolate;
  border-radius: 8px;
}

.combatant-card {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.combatant-card h3 {
  font-size: 18px;
}

.combatant-avatar {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 86px;
  border-radius: 8px;
  background: #eaf8f8;
  color: var(--teal);
  font-size: 24px;
  font-weight: 900;
}

.adventure-portrait {
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(23, 32, 42, 0.08);
}

.combatant-avatar.adventure-portrait {
  min-height: 180px;
}

.avatar-frame.adventure-portrait {
  background-size: cover;
  background-position: center;
}

.avatar-frame.adventure-portrait span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(23, 32, 42, 0.78);
  color: #fff;
  font-size: 13px;
  line-height: 1;
}

.portrait-hero {
  background-image: url("assets/adventure/hero.png");
}

.portrait-slime {
  background-image: url("assets/adventure/slime.png");
}

.portrait-guard {
  background-image: url("assets/adventure/guardian.png");
}

.portrait-wizard {
  background-image: url("assets/adventure/wizard.png");
}

.portrait-beast {
  background-image: url("assets/adventure/beast.png");
}

.portrait-boss {
  background-image: url("assets/adventure/boss.png");
}

.combatant-avatar.enemy {
  background-color: #fff0f0;
  color: var(--coral);
}

.skill-effect {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  border-radius: 8px;
}

.strike-effect span {
  position: absolute;
  left: 28%;
  top: 42%;
  width: 28%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 210, 76, 0.96), rgba(45, 91, 209, 0));
  box-shadow: 0 0 18px rgba(255, 210, 76, 0.82);
  transform: translateX(-18%) rotate(-12deg) scaleX(0.3);
  transform-origin: left center;
  animation: strike-sweep 520ms cubic-bezier(0.2, 0.9, 0.24, 1) both;
}

.guard-effect {
  inset: 0 auto 0 0;
  width: calc((100% - 124px) / 2);
  min-width: 180px;
  display: grid;
  place-items: center;
}

.guard-effect span {
  position: absolute;
  width: min(76%, 220px);
  aspect-ratio: 1;
  border: 2px solid rgba(15, 139, 141, 0.7);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 139, 141, 0.16), rgba(15, 139, 141, 0.02) 64%, rgba(15, 139, 141, 0));
  box-shadow: 0 0 26px rgba(15, 139, 141, 0.28);
  animation: guard-ring 620ms ease-out both;
}

.guard-effect span + span {
  width: min(62%, 178px);
  animation-delay: 80ms;
}

.burst-effect {
  inset: 0 0 0 auto;
  width: calc((100% - 124px) / 2);
  min-width: 180px;
  display: grid;
  place-items: center;
}

.burst-effect span {
  position: absolute;
  width: min(54%, 150px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(229, 107, 111, 0.55), rgba(255, 210, 76, 0.24) 48%, rgba(229, 107, 111, 0) 70%);
  box-shadow: 0 0 30px rgba(229, 107, 111, 0.35);
  animation: burst-pop 660ms cubic-bezier(0.18, 0.82, 0.26, 1) both;
}

.burst-effect span:nth-child(2) {
  width: min(72%, 210px);
  animation-delay: 70ms;
}

.burst-effect span:nth-child(3) {
  width: min(36%, 110px);
  animation-delay: 130ms;
}

.skill-strike .enemy-card,
.skill-burst .enemy-card {
  animation: enemy-hit 360ms ease-out both;
}

.skill-strike .hero-card {
  animation: hero-lunge 360ms ease-out both;
}

.skill-guard .hero-card {
  animation: hero-guard 520ms ease-out both;
}

@keyframes strike-sweep {
  0% {
    opacity: 0;
    transform: translateX(-24%) rotate(-12deg) scaleX(0.25);
  }
  28% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(142%) rotate(-12deg) scaleX(1);
  }
}

@keyframes guard-ring {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

@keyframes burst-pop {
  0% {
    opacity: 0;
    transform: scale(0.28);
  }
  38% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.15);
  }
}

@keyframes enemy-hit {
  0%, 100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(7px);
  }
  65% {
    transform: translateX(-3px);
  }
}

@keyframes hero-lunge {
  0%, 100% {
    transform: translateX(0);
  }
  45% {
    transform: translateX(6px);
  }
}

@keyframes hero-guard {
  0%, 100% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.015);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skill-effect,
  .skill-effect span,
  .skill-strike .enemy-card,
  .skill-burst .enemy-card,
  .skill-strike .hero-card,
  .skill-guard .hero-card {
    animation: none !important;
  }
}

.battle-vs {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 96px;
  text-align: center;
  color: var(--muted);
}

.battle-vs span {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.battle-vs small {
  max-width: 130px;
}

.meter-row {
  display: grid;
  gap: 6px;
}

.meter-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.meter-row strong {
  color: var(--ink);
}

.meter-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f5;
}

.meter-track span {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.18s ease;
}

.meter-row.mana .meter-track span {
  background: var(--blue);
}

.meter-row.enemy .meter-track span {
  background: var(--coral);
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.skill-grid small {
  color: var(--muted);
  font-weight: 650;
}

.quest-log {
  display: grid;
  gap: 6px;
  min-height: 94px;
  padding: 12px;
  border: 1px solid rgba(23, 32, 42, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.quest-log p {
  color: var(--muted);
  font-size: 13px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none !important;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid rgba(23, 32, 42, 0.16);
  border-radius: 8px;
  background: #17202a;
  color: #fff;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-grid,
  .question-layout,
  .import-grid {
    grid-template-columns: 1fr;
  }

  .badge-grid,
  .mission-grid,
  .store-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .question-side {
    order: -1;
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .brand {
    min-height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 4px;
    min-height: 58px;
    padding: 7px;
    text-align: center;
  }

  .nav-item span {
    font-size: 12px;
  }

  .sidebar-footer {
    grid-template-columns: repeat(2, 1fr);
  }

  .main {
    padding: 16px;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    min-width: 0;
    width: 100%;
  }

  .dashboard-grid,
  .mode-grid,
  .mission-grid,
  .badge-grid,
  .store-grid,
  .game-options,
  .memory-grid,
  .battle-field,
  .skill-grid {
    grid-template-columns: 1fr;
  }

  .adventure-idle {
    display: grid;
    justify-items: start;
  }

  .battle-vs {
    min-width: 0;
  }

  .guard-effect,
  .burst-effect {
    width: 100%;
    min-width: 0;
    height: 34%;
  }

  .guard-effect {
    inset: 0 0 auto 0;
  }

  .burst-effect {
    inset: auto 0 0 0;
  }

  .strike-effect span {
    left: 16%;
    top: 50%;
    width: 48%;
  }

  .topic-row {
    grid-template-columns: 1fr;
  }

  .topic-row small {
    text-align: left;
  }

  .question-stem {
    font-size: 18px;
  }

  .question-actions {
    align-items: stretch;
  }

  .action-button,
  .ghost-button,
  .danger-button {
    flex: 1 1 140px;
  }
}
