:root {
  color-scheme: light;
  --bg: #f4f7f2;
  --surface: #ffffff;
  --surface-soft: #edf3ee;
  --surface-strong: #dce9df;
  --text: #172019;
  --muted: #667269;
  --line: #d7e0d9;
  --brand: #245c43;
  --brand-strong: #174530;
  --brand-soft: #dfece3;
  --accent: #b55c25;
  --accent-soft: #fae9dc;
  --danger: #a33b3b;
  --danger-soft: #f9e5e3;
  --success: #25704e;
  --success-soft: #e1f1e8;
  --warning: #8c5c13;
  --warning-soft: #f7edcf;
  --shadow: 0 12px 32px rgba(22, 55, 39, 0.08);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --content-max: 760px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111713;
  --surface: #19221c;
  --surface-soft: #202d25;
  --surface-strong: #2b3b30;
  --text: #f1f5f2;
  --muted: #aab6ad;
  --line: #334238;
  --brand: #76bc91;
  --brand-strong: #9bd2ad;
  --brand-soft: #243c2d;
  --accent: #e29a67;
  --accent-soft: #492d20;
  --danger: #ef9893;
  --danger-soft: #442424;
  --success: #83d1a6;
  --success-soft: #203b2d;
  --warning: #e5c16d;
  --warning-soft: #40371f;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

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

button,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 50%, transparent);
  outline-offset: 2px;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 7vw, 2.2rem);
  line-height: 1.25;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.1rem;
}

.is-hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(62px + var(--safe-top));
  padding: calc(8px + var(--safe-top)) 16px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.brand-button {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: 46px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.brand-button > span:last-child {
  display: grid;
}

.brand-button strong {
  font-size: 0.96rem;
  line-height: 1.3;
}

.brand-button small {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.brand-mark,
.entry-icon,
.login-symbol,
.empty-symbol {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 13px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

:root[data-theme="dark"] .brand-mark,
:root[data-theme="dark"] .entry-icon,
:root[data-theme="dark"] .login-symbol,
:root[data-theme="dark"] .empty-symbol {
  color: #102218;
}

.brand-mark {
  width: 38px;
  height: 38px;
  margin-right: 9px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.network-pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.network-pill::before {
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.network-pill.offline {
  background: var(--warning-soft);
  color: var(--warning);
}

.network-pill.pending {
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-button,
.back-button,
.quiet-button,
.nav-button,
.secondary-button,
.primary-button,
.uncertain-button {
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.icon-button {
  min-width: 42px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.78rem;
}

.back-button {
  width: 46px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 1.8rem;
  line-height: 1;
}

.quiet-button {
  padding: 0 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.84rem;
}

.primary-button,
.secondary-button,
.nav-button,
.uncertain-button {
  border: 1px solid transparent;
  padding: 11px 17px;
}

.primary-button {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--brand) 22%, transparent);
}

:root[data-theme="dark"] .primary-button {
  color: #102218;
}

.secondary-button,
.nav-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.uncertain-button {
  border-color: var(--warning);
  background: var(--surface);
  color: var(--warning);
}

.uncertain-button[aria-pressed="true"] {
  background: var(--warning-soft);
}

#main-content {
  width: 100%;
}

#main-content:focus {
  outline: none;
}

.view {
  width: min(100%, var(--content-max));
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  padding: 22px 16px calc(102px + var(--safe-bottom));
}

.view.practice-view {
  padding-top: 10px;
  padding-bottom: calc(126px + var(--safe-bottom));
}

.login-view {
  display: grid;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  place-items: center;
  padding: calc(28px + var(--safe-top)) 18px calc(28px + var(--safe-bottom));
  background:
    radial-gradient(circle at 12% 12%, color-mix(in srgb, var(--brand) 15%, transparent), transparent 34%),
    radial-gradient(circle at 88% 86%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 36%),
    var(--bg);
}

.login-card {
  width: min(100%, 420px);
  padding: 32px 24px 24px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-symbol {
  width: 58px;
  height: 58px;
  margin-bottom: 24px;
  border-radius: 18px;
  font-size: 1.65rem;
}

.login-card h1 {
  margin-bottom: 12px;
}

.login-card > .muted {
  margin-bottom: 24px;
}

.login-footnote {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.muted,
.empty-inline {
  color: var(--muted);
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-heading,
.section-heading-row,
.practice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-heading {
  margin: 4px 0 20px;
}

.page-heading .back-button + div {
  flex: 1;
}

.home-heading {
  align-items: flex-end;
}

.section-heading-row {
  align-items: baseline;
}

.section-heading-row small {
  color: var(--muted);
}

.section-title {
  margin: 24px 0 12px;
}

.section-heading-row .section-title {
  margin-bottom: 12px;
}

.today-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 138px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 15px 30px color-mix(in srgb, var(--brand) 22%, transparent);
}

:root[data-theme="dark"] .today-card {
  color: #102218;
}

.today-copy {
  display: grid;
  max-width: calc(100% - 100px);
}

.today-copy span {
  font-size: 0.82rem;
  opacity: 0.8;
}

.today-copy strong {
  margin: 2px 0 4px;
  font-size: 1.55rem;
  line-height: 1.25;
}

.today-copy small {
  opacity: 0.82;
}

.progress-ring {
  --progress: 0deg;
  display: grid;
  width: 78px;
  height: 78px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(#fff var(--progress), rgba(255, 255, 255, 0.22) 0);
}

.progress-ring::before {
  grid-area: 1 / 1;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--brand);
  content: "";
}

.progress-ring span {
  z-index: 1;
  grid-area: 1 / 1;
  font-size: 0.88rem;
  font-weight: 800;
}

.metric-grid,
.stats-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.metric-card,
.stat-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.metric-card span,
.stat-card span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card strong,
.stat-card strong {
  display: block;
  margin-top: 2px;
  font-size: 1.36rem;
  line-height: 1.3;
}

.qbank-update-card {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--surface), var(--surface-soft));
}

.qbank-update-card .section-heading-row {
  align-items: flex-start;
  margin-bottom: 12px;
}

.qbank-update-card .section-title {
  margin: 0;
}

.qbank-update-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.qbank-update-summary > div {
  min-width: 0;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.qbank-update-summary span,
.qbank-update-summary strong {
  display: block;
}

.qbank-update-summary span {
  color: var(--muted);
  font-size: 0.72rem;
}

.qbank-update-summary strong {
  margin-top: 2px;
  font-size: 1.08rem;
}

.qbank-release-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-soft) 78%, transparent);
}

.qbank-release-status div {
  min-width: 0;
}

.qbank-release-status span,
.qbank-release-status strong {
  display: block;
}

.qbank-release-status span {
  color: var(--muted);
  font-size: 0.68rem;
}

.qbank-release-status strong {
  margin-top: 2px;
  font-size: 0.98rem;
}

.qbank-release-status small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.qbank-update-topics {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.qbank-overview-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.qbank-overview-summary > div {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.qbank-overview-summary span,
.qbank-overview-summary strong {
  display: block;
}

.qbank-overview-summary span {
  color: var(--muted);
  font-size: 0.72rem;
}

.qbank-overview-summary strong {
  margin-top: 2px;
  font-size: 1.08rem;
}

.qbank-subject-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.qbank-subject-row {
  display: grid;
  gap: 5px;
}

.qbank-subject-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.qbank-subject-heading span,
.qbank-subject-row small {
  color: var(--muted);
  font-size: 0.76rem;
}

.qbank-subject-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.qbank-subject-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.qbank-today-panel {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
}

.qbank-today-panel > .section-heading-row > strong {
  color: var(--brand-strong);
  font-size: 1.2rem;
}

.qbank-today-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.qbank-today-subjects span {
  padding: 7px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 0.8rem;
}

.qbank-today-subjects strong {
  color: var(--brand-strong);
}

.qbank-distribution {
  max-height: 360px;
  margin-top: 12px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.qbank-today-button {
  width: 100%;
  margin-top: 12px;
}

.qbank-distribution-label {
  margin: 16px 0 0;
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 650;
}

.qbank-distribution-empty {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.qbank-subject,
.qbank-chapter {
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.qbank-subject > summary,
.qbank-chapter > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  cursor: pointer;
  list-style: none;
}

.qbank-subject > summary::-webkit-details-marker,
.qbank-chapter > summary::-webkit-details-marker {
  display: none;
}

.qbank-subject > summary span,
.qbank-chapter > summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qbank-subject > summary strong,
.qbank-chapter > summary strong {
  flex: 0 0 auto;
  font-size: 0.82rem;
}

.qbank-chapter {
  margin-left: 10px;
}

.qbank-chapter > summary {
  min-height: 36px;
  color: var(--muted-strong);
  font-size: 0.86rem;
}

.qbank-chapter ul {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
  padding: 0 0 0 12px;
  list-style: none;
}

.qbank-chapter li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.qbank-chapter li span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.qbank-chapter li strong {
  flex: 0 0 auto;
}

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

.target-editor {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.target-editor > label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.target-editor > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.target-editor input {
  width: 68px;
  min-height: 42px;
  text-align: center;
}

.account-summary {
  display: grid;
  gap: 12px;
}

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

.account-status-grid > div {
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.account-status-grid span,
.account-status-grid strong {
  display: block;
}

.account-status-grid span {
  color: var(--muted);
  font-size: 0.72rem;
}

.account-status-grid strong {
  min-width: 0;
  margin-top: 3px;
  overflow: hidden;
  font-size: 0.98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.entry-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.entry-card > span:nth-child(2) {
  display: grid;
  min-width: 0;
  padding: 0 12px;
}

.entry-card strong {
  font-size: 1rem;
}

.entry-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-card > span:last-child {
  color: var(--muted);
  font-size: 1.5rem;
}

.entry-icon {
  width: 44px;
  height: 44px;
  background: var(--brand-soft);
  color: var(--brand);
}

.entry-card.entry-primary {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
  background: linear-gradient(135deg, var(--brand-soft), var(--surface));
}

.entry-card.entry-primary .entry-icon {
  background: var(--brand);
  color: #fff;
}

.weak-section {
  margin-top: 6px;
}

.weak-list {
  display: grid;
  gap: 9px;
}

.weak-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.weak-rank {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

.weak-item > span:nth-child(2) {
  display: grid;
  min-width: 0;
}

.weak-item strong,
.weak-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weak-item small {
  color: var(--muted);
}

.weak-item > strong:last-child {
  color: var(--danger);
}

.panel,
.filter-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 14px;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.form-stack label,
.filter-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 50px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

.form-error {
  min-height: 1.1em;
  margin: -6px 0 0;
  color: var(--danger);
  font-size: 0.83rem;
}

.practice-header {
  min-height: 54px;
}

.practice-progress-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  text-align: center;
}

.practice-progress-copy strong {
  font-size: 1rem;
}

.practice-progress-copy span {
  color: var(--muted);
  font-size: 0.75rem;
}

.linear-progress {
  height: 4px;
  margin: 8px 0 16px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.linear-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.question-card {
  padding: 19px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.question-meta,
.wrong-meta,
.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.meta-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.meta-pill.type {
  background: var(--brand-soft);
  color: var(--brand);
}

.question-stem {
  margin: 17px 0 18px;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.question-instruction {
  margin: -9px 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

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

.option-button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: start;
  min-height: 62px;
  padding: 11px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.option-key {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  margin-top: 1px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  font-weight: 800;
}

.option-text {
  padding: 4px 0 2px 11px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
}

.option-button.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.option-button.selected .option-key {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

:root[data-theme="dark"] .option-button.selected .option-key {
  color: #102218;
}

.option-button.correct {
  border-color: var(--success);
  background: var(--success-soft);
}

.option-button.correct .option-key {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.option-button.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.option-button.wrong .option-key {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.option-button:disabled {
  opacity: 1;
}

.answer-panel {
  margin-top: 12px;
}

.result-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.result-banner.correct {
  border-color: color-mix(in srgb, var(--success) 55%, var(--line));
  background: var(--success-soft);
}

.result-banner.incorrect {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--line));
  background: var(--danger-soft);
}

.result-banner.pending {
  border-color: color-mix(in srgb, var(--warning) 55%, var(--line));
  background: var(--warning-soft);
}

.result-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--surface);
  font-size: 1.2rem;
  font-weight: 900;
}

.result-copy {
  display: grid;
  min-width: 0;
}

.result-copy strong {
  font-size: 1.06rem;
}

.result-copy span {
  color: var(--muted);
  font-size: 0.83rem;
}

.answer-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 10px;
}

.answer-summary > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.answer-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.answer-summary strong {
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.explanation-card {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.explanation-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.explanation-card summary::-webkit-details-marker {
  display: none;
}

.explanation-card summary::after {
  color: var(--muted);
  content: "+";
  font-size: 1.2rem;
}

.explanation-card[open] summary::after {
  content: "−";
}

.explanation-body {
  padding: 0 14px 15px;
  color: color-mix(in srgb, var(--text) 90%, var(--muted));
  white-space: pre-wrap;
  word-break: break-word;
}

.wrong-option-list {
  display: grid;
  gap: 9px;
  padding: 0 14px 15px;
}

.wrong-option-row {
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.wrong-option-row strong {
  color: var(--danger);
}

.source-body {
  display: grid;
  gap: 9px;
  padding: 0 14px 15px;
  color: color-mix(in srgb, var(--text) 90%, var(--muted));
  overflow-wrap: anywhere;
}

.source-body > span {
  display: grid;
  grid-template-columns: minmax(68px, auto) 1fr;
  gap: 8px;
}

.source-body > span strong {
  color: var(--muted);
  font-size: 0.8rem;
}

.source-basis-list {
  margin: 2px 0;
  padding-left: 1.25rem;
}

.source-link {
  width: fit-content;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.source-link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

.memory-rule {
  margin-top: 10px;
  padding: 15px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
}

.memory-rule strong {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
}

.answer-commands {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.ai-explanation {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  white-space: pre-wrap;
}

.practice-spacer {
  height: 12px;
}

.practice-actions {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(112px, 1.2fr);
  gap: 8px;
  width: min(100%, var(--content-max));
  margin: 0 auto;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 19px 19px 0 0;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 -8px 28px rgba(17, 35, 25, 0.1);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.practice-actions .nav-button {
  padding-inline: 12px;
}

.practice-actions .uncertain-button {
  padding-inline: 10px;
}

.practice-actions #next-question-button {
  grid-column: 3;
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  box-shadow: none;
}

.filter-panel .wide-field {
  grid-column: 1 / -1;
}

.filter-panel select {
  min-height: 44px;
  font-size: 0.86rem;
}

.list-summary {
  padding: 14px 2px 9px;
  color: var(--muted);
  font-size: 0.83rem;
}

.wrong-list {
  display: grid;
  gap: 11px;
}

.wrong-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.wrong-card.is-key {
  border-left: 4px solid var(--danger);
}

.wrong-stem {
  display: -webkit-box;
  margin: 12px 0;
  overflow: hidden;
  font-weight: 650;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.wrong-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.wrong-numbers strong {
  color: var(--text);
}

.reason-editor {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.reason-editor label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.reason-editor select {
  min-height: 44px;
  font-size: 0.84rem;
}

.status-pill.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-pill.success {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.bar-list,
.daily-list {
  display: grid;
  gap: 13px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.8fr) minmax(110px, 1.4fr) auto;
  align-items: center;
  gap: 9px;
}

.bar-row > span:first-child {
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.bar-row strong {
  font-size: 0.82rem;
}

.daily-row {
  display: grid;
  grid-template-columns: minmax(62px, 0.7fr) minmax(0, 1.3fr) auto;
  align-items: center;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.daily-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.daily-row span,
.daily-row small {
  color: var(--muted);
}

.daily-row > div {
  display: grid;
}

.bottom-nav {
  position: fixed;
  z-index: 35;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: calc(66px + var(--safe-bottom));
  padding: 6px 8px calc(5px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.bottom-nav button {
  display: grid;
  min-height: 52px;
  place-items: center;
  gap: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
}

.bottom-nav button span {
  font-size: 1.08rem;
  font-weight: 750;
  line-height: 1.3;
}

.bottom-nav button small {
  font-size: 0.66rem;
  line-height: 1.3;
}

.bottom-nav button.active {
  background: var(--brand-soft);
  color: var(--brand);
}

.toast-region {
  position: fixed;
  z-index: 80;
  top: calc(74px + var(--safe-top));
  right: 12px;
  left: 12px;
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.toast {
  max-width: min(100%, 520px);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  text-align: center;
}

.sync-banner {
  position: fixed;
  z-index: 75;
  right: 12px;
  bottom: calc(76px + var(--safe-bottom));
  left: 12px;
  max-width: 520px;
  margin: auto;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--warning);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

.empty-state {
  display: grid;
  min-height: 60vh;
  place-items: center;
  align-content: center;
  padding: 24px;
  text-align: center;
}

.empty-symbol {
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
}

.empty-state h1 {
  margin-bottom: 10px;
}

.empty-state p {
  max-width: 480px;
  color: var(--muted);
}

.status-copy {
  font-weight: 700;
}

.empty-card,
.error-card,
.skeleton-block {
  padding: 24px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
}

.error-card {
  border-color: var(--danger);
  color: var(--danger);
}

.wrong-load-more,
#wrong-load-more {
  width: 100%;
  margin-top: 12px;
}

@media (min-width: 620px) {
  .view {
    padding-right: 24px;
    padding-left: 24px;
  }

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

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

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

  .filter-panel .wide-field {
    grid-column: auto;
  }

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

  .bottom-nav {
    right: 50%;
    left: auto;
    width: min(100%, var(--content-max));
    transform: translateX(50%);
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
  }
}

@media (max-width: 374px) {
  .view {
    padding-right: 12px;
    padding-left: 12px;
  }

  .practice-actions {
    grid-template-columns: auto minmax(0, 0.9fr) minmax(100px, 1fr);
    padding-right: 8px;
    padding-left: 8px;
  }

  .practice-actions button {
    font-size: 0.82rem;
  }

  .network-pill {
    display: none;
  }

  .today-card {
    padding: 17px;
  }
}

@supports (height: 100dvh) {
  body,
  .app-shell {
    min-height: 100dvh;
  }

  .view {
    min-height: calc(100dvh - 64px);
  }

  .login-view {
    min-height: 100dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
