:root {
  color-scheme: light;
  --background: #f6f7f8;
  --surface: #ffffff;
  --surface-muted: #eef3f4;
  --text: #152023;
  --muted: #627176;
  --line: #d8e0e2;
  --accent: #0f6f68;
  --accent-strong: #0a4f4a;
  --warning: #8d5b12;
  --paid: #3756a6;
  --shadow: 0 10px 30px rgb(21 32 35 / 8%);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button,
.primary-link,
.empty-state a,
.paywall-preview a {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-weight: 700;
}

button:hover,
.primary-link:hover,
.empty-state a:hover,
.paywall-preview a:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:disabled:hover {
  background: var(--accent);
}

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

.app-header {
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 92%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
}

.brand-mark {
  width: 42px;
  height: 32px;
  border-radius: 6px;
  background: var(--text);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  letter-spacing: 0;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.primary-nav a {
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 10px 12px;
}

.primary-nav a:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.app-main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.page-stack {
  display: grid;
  gap: 24px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.page-heading h1,
.problem-pane h1 {
  margin: 4px 0 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
}

.page-heading p {
  max-width: 640px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  margin: 0;
  text-transform: uppercase;
}

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

.content-card,
.form-surface,
.problem-pane,
.step-pane,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.content-card {
  display: grid;
  gap: 18px;
  min-height: 300px;
  padding: 20px;
}

.content-card h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.content-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.content-facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.content-facts div {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding-top: 10px;
}

.content-facts dt {
  color: var(--muted);
}

.content-facts dd {
  margin: 0;
  font-weight: 700;
}

.status-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge--trial {
  border-color: rgb(141 91 18 / 24%);
  background: rgb(141 91 18 / 10%);
  color: var(--warning);
}

.status-badge--paid {
  border-color: rgb(55 86 166 / 24%);
  background: rgb(55 86 166 / 10%);
  color: var(--paid);
}

.exercise-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
}

.problem-pane,
.step-pane {
  padding: 22px;
}

.pane-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.pane-header h2,
.paywall-preview h3,
.empty-state h2,
.detail-band h2 {
  margin: 0;
}

.problem-paper {
  display: grid;
  gap: 20px;
  line-height: 1.8;
}

.problem-paper p {
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
}

caption {
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 8px;
  text-align: left;
}

th,
td {
  border: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  width: 160px;
  background: var(--surface-muted);
}

.step-list {
  display: grid;
  gap: 8px;
  margin: 0 0 20px;
  padding-left: 22px;
}

.step-list__item {
  border-radius: 6px;
  color: var(--muted);
  line-height: 1.5;
  padding: 8px 10px;
}

.step-list__item--active {
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 700;
}

.answer-form,
.form-surface {
  display: grid;
  gap: 12px;
}

.answer-form {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 12px;
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid rgb(15 111 104 / 18%);
}

.paywall-preview {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
}

.paywall-preview p,
.empty-state p,
.detail-band p {
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

.narrow-page {
  display: grid;
  gap: 24px;
  margin: 0 auto;
  max-width: 680px;
}

.form-surface {
  padding: 22px;
}

.detail-band {
  border-block: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0;
}

.empty-state {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: 28px;
}

.empty-state h1,
.empty-state h2 {
  font-size: 1.5rem;
}

@media (max-width: 860px) {
  .app-header,
  .page-heading,
  .detail-band {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-nav {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .content-grid,
  .exercise-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-header {
    padding: 14px 16px;
  }

  .app-main {
    width: min(100% - 24px, 1180px);
    padding-top: 24px;
  }

  .brand {
    white-space: normal;
  }

  .page-heading h1,
  .problem-pane h1 {
    font-size: 2rem;
  }

  .content-card,
  .problem-pane,
  .step-pane,
  .form-surface,
  .empty-state {
    padding: 16px;
  }

  .content-card__meta,
  .pane-header {
    align-items: start;
    flex-direction: column;
  }
}

:root {
  --success: #2f6b3f;
  --success-bg: #edf7ef;
  --danger: #9b2c2c;
  --danger-bg: #fff0ee;
  --note: #315f8f;
  --note-bg: #edf4fb;
}

.exercise-layout--interactive {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 400px);
}

.problem-source {
  border-block: 1px solid var(--line);
  margin-bottom: 20px;
  padding: 14px 0;
}

.source-note {
  color: var(--muted);
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  line-height: 1.55;
}

.source-note a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.problem-task {
  color: var(--text);
  font-weight: 800;
}

.row-value,
.row-note {
  display: block;
}

.row-value {
  font-weight: 800;
}

.row-note {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

.focus-button {
  width: 100%;
  min-height: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 8px;
  text-align: left;
  white-space: normal;
}

.focus-button:hover {
  background: #ffffff;
  color: var(--text);
}

.focus-button small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.focus-button--selected {
  border-color: rgb(15 111 104 / 38%);
  background: #ffffff;
  color: var(--accent-strong);
}

.focus-button--correct {
  border-color: rgb(47 107 63 / 35%);
  background: var(--success-bg);
}

.focus-button--incorrect,
.focus-button--trap.focus-button--selected:not(.focus-button--correct) {
  border-color: rgb(155 44 44 / 28%);
  background: var(--danger-bg);
}

.action-panel {
  border-block: 1px solid var(--line);
  display: grid;
  gap: 14px;
  padding: 18px 0;
}

.action-panel h3 {
  font-size: 1.2rem;
  line-height: 1.3;
  margin: 0;
}

.focus-kind {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  justify-self: start;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.focus-kind--derived,
.focus-kind--requires-context {
  border-color: rgb(49 95 143 / 22%);
  background: var(--note-bg);
  color: var(--note);
}

.focus-kind--trap {
  border-color: rgb(155 44 44 / 24%);
  background: var(--danger-bg);
  color: var(--danger);
}

.focus-facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.focus-facts div {
  display: grid;
  gap: 4px;
}

.focus-facts dt,
.prerequisite-list strong {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.focus-facts dd {
  margin: 0;
  font-weight: 700;
  line-height: 1.45;
}

.prerequisite-list {
  /* Prerequisites are informational only; enforcement lands in TK-017. Use a
     neutral rule so the panel is not mistaken for a hard block (himmel C-02). */
  border-left: 3px solid var(--line);
  display: grid;
  gap: 8px;
  padding-left: 12px;
}

.prerequisite-list ul {
  color: var(--muted);
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.step-prompt {
  font-weight: 800;
  line-height: 1.55;
  margin: 0;
}

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

.option-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  justify-content: flex-start;
  padding: 12px;
  text-align: left;
  white-space: normal;
}

.option-button:hover {
  border-color: rgb(15 111 104 / 38%);
  background: var(--surface-muted);
  color: var(--text);
}

.option-button--selected {
  border-color: var(--accent);
  background: rgb(15 111 104 / 8%);
  color: var(--accent-strong);
}

.option-button--correct {
  border-color: rgb(47 107 63 / 42%);
  background: var(--success-bg);
  color: var(--success);
}

.option-button--incorrect {
  border-color: rgb(155 44 44 / 36%);
  background: var(--danger-bg);
  color: var(--danger);
}

.feedback {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding-top: 14px;
}

.feedback strong {
  font-size: 0.9rem;
}

.feedback p {
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

.feedback code {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text);
  display: block;
  overflow-x: auto;
  padding: 10px;
  white-space: pre-wrap;
}

.feedback--correct strong {
  color: var(--success);
}

.feedback--incorrect strong {
  color: var(--danger);
}

.order-track {
  display: grid;
  gap: 8px;
  padding-top: 16px;
}

.order-chip {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  display: grid;
  grid-template-columns: 28px 1fr;
  justify-content: start;
  gap: 8px;
  padding: 8px 10px;
  text-align: left;
  white-space: normal;
}

.order-chip:hover,
.order-chip--active {
  border-color: rgb(15 111 104 / 35%);
  background: var(--surface-muted);
  color: var(--text);
}

.order-chip span {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
}

.order-chip--visited span {
  background: rgb(49 95 143 / 12%);
  color: var(--note);
}

.order-chip--correct span {
  background: var(--success-bg);
  color: var(--success);
}

.trial-gate {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
}

.trial-gate h3 {
  margin: 0;
}

.trial-gate p {
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

.trial-gate a {
  min-height: 44px;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-weight: 800;
}

.trial-gate a:hover {
  background: var(--accent-strong);
}

@media (max-width: 860px) {
  .exercise-layout--interactive {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  th,
  td {
    display: block;
    width: 100%;
  }

  .order-chip {
    grid-template-columns: 26px 1fr;
  }
}

.calculator-panel {
  border-block: 1px solid var(--line);
  background: #d9dee1;
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px 0 18px;
}

.calculator-header,
.calculator-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calculator-header {
  justify-content: space-between;
}

.calculator-header h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.calculator-body {
  display: grid;
  gap: 10px;
}

.calculator-display {
  min-height: 72px;
  border: 1px solid #b8c2c6;
  border-radius: 6px;
  background: #eef1ef;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px 12px;
  text-align: right;
}

.calculator-display span {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.calculator-display output {
  color: var(--text);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.calculator-grid {
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(4, 42px);
  justify-content: center;
}

.calculator-key,
.calculator-clear-tape,
.calculator-toggle {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
}

.calculator-key {
  width: 42px;
  min-height: 34px;
  height: 34px;
  padding: 0;
  font-size: 0.82rem;
}

.calculator-key:hover,
.calculator-clear-tape:hover,
.calculator-toggle:hover {
  border-color: rgb(15 111 104 / 38%);
  background: var(--surface-muted);
  color: var(--text);
}

.calculator-key--operator {
  border-color: rgb(49 95 143 / 22%);
  background: var(--note-bg);
  color: var(--note);
}

.calculator-key--utility {
  color: var(--muted);
}

.calculator-key--equal {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.calculator-key--equal:hover {
  background: var(--accent-strong);
  color: #ffffff;
}

.calculator-key--wide {
  grid-column: span 2;
}

.calculator-key--full {
  grid-column: span 4;
  min-height: 36px;
}

.calculator-clear-tape,
.calculator-toggle {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.calculator-toggle {
  display: none;
}

/* Reveal the collapse toggle wherever the compact 3-column layout auto-applies
   (matches getDefaultPresetId in Calculator.tsx) so users on phone/landscape
   can still hide the keypad (himmel M-01). */
@media (max-width: 860px) and (orientation: landscape) {
  .calculator-toggle {
    display: inline-flex;
  }
}

.calculator-tape {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px 0 0;
}

.calculator-tape li {
  display: grid;
  gap: 3px;
  list-style: none;
}

.calculator-tape span {
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.calculator-tape strong {
  color: var(--text);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

@media (min-width: 861px) {
  .step-pane {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
  }

  .calculator-panel {
    position: sticky;
    top: -1px;
    z-index: 3;
  }
}

@media (max-width: 560px) {
  .calculator-panel {
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px 0;
  }

  .calculator-toggle {
    border-color: rgb(141 91 18 / 32%);
    background: rgb(141 91 18 / 12%);
    color: var(--warning);
    display: inline-flex;
  }

  .calculator-panel--collapsed {
    padding-bottom: 12px;
  }

  .calculator-display output {
    font-size: 1.35rem;
  }

  .calculator-key {
    min-height: 34px;
  }
}

.calculator-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.calculator-title-row h3 {
  white-space: nowrap;
}

.calculator-header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.calculator-layout-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.calculator-layout-select {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0 8px;
}

.calculator-reset-position,
.calculator-clear-tape,
.calculator-toggle {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
}

.calculator-reset-position {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.calculator-reset-position:hover,
.calculator-layout-select:hover {
  border-color: rgb(15 111 104 / 38%);
  background: var(--surface-muted);
  color: var(--text);
}

.calculator-memory-indicator {
  min-width: 24px;
  min-height: 24px;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 900;
}

.calculator-key--memory {
  border-color: rgb(47 107 63 / 28%);
  background: var(--success-bg);
  color: var(--success);
}

.calculator-panel--floating {
  width: min(272px, calc(100vw - 24px));
  border: 1px solid #b5bec2;
  border-radius: 8px;
  box-shadow: 0 18px 48px rgb(21 32 35 / 22%);
  padding: 14px;
  position: fixed;
  z-index: 60;
}

.calculator-panel--floating .calculator-body {
  max-height: min(680px, calc(100vh - 170px));
  overflow-y: auto;
  padding-right: 2px;
}

.calculator-panel--floating.calculator-panel--collapsed {
  padding-bottom: 14px;
}

@media (max-width: 860px) {
  .calculator-panel--floating {
    width: auto;
    border-inline: 0;
    border-radius: 0;
    box-shadow: none;
    left: auto !important;
    padding: 12px 0;
    position: static;
    top: auto !important;
    z-index: auto;
  }

  .calculator-panel--floating .calculator-body {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .calculator-reset-position {
    display: none;
  }
}

@media (max-width: 560px) {
  .calculator-header,
  .calculator-header-actions {
    align-items: stretch;
  }

  .calculator-header-actions {
    justify-content: flex-start;
  }

  .calculator-layout-select {
    flex: 1 1 96px;
  }
}

.calculator-panel--floating {
  right: 24px;
  top: 92px;
}

.calculator-panel--floating {
  cursor: grab;
}

.calculator-panel--floating button,
.calculator-panel--floating select,
.calculator-panel--floating label {
  cursor: pointer;
}

.calculator-panel--floating.calculator-panel--compact {
  width: min(164px, calc(100vw - 24px));
}

.calculator-panel--compact .calculator-header {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}

.calculator-panel--compact .calculator-header-actions {
  gap: 5px;
  justify-content: flex-start;
}

.calculator-panel--compact .calculator-layout-label,
.calculator-panel--compact .calculator-reset-position {
  font-size: 0.7rem;
}

.calculator-panel--compact .calculator-layout-select,
.calculator-panel--compact .calculator-reset-position {
  min-height: 28px;
}

.calculator-panel--compact .calculator-layout-select {
  width: 74px;
  padding: 0 4px;
  font-size: 0.74rem;
}

.calculator-panel--compact .calculator-display {
  width: 136px;
  min-height: 58px;
  justify-self: center;
  padding: 8px;
}

.calculator-panel--compact .calculator-display span {
  min-height: 14px;
  font-size: 0.62rem;
}

.calculator-panel--compact .calculator-display output {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  white-space: nowrap;
}

.calculator-grid--compact-3-column {
  gap: 5px;
  justify-content: center;
}

.calculator-panel--dragging {
  cursor: grabbing;
}

@media (max-width: 860px) {
  .calculator-panel--floating {
    right: auto !important;
  }
}

/* Legal pages (/legal/*) and the shared footer */

.app-shell {
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
}

.app-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding: 20px 32px;
}

.app-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.app-footer__links a {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.app-footer__links a:hover {
  color: var(--text);
  text-decoration: underline;
}

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

.legal-page {
  display: grid;
  gap: 20px;
  margin: 0 auto;
  max-width: 760px;
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.legal-nav a {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  padding: 7px 14px;
}

.legal-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.legal-body {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  line-height: 1.9;
  padding: 32px;
}

.legal-body h1 {
  font-size: 1.9rem;
  line-height: 1.3;
  margin: 0 0 8px;
}

.legal-body h2 {
  border-top: 1px solid var(--line);
  font-size: 1.14rem;
  margin: 34px 0 12px;
  padding-top: 22px;
}

.legal-body h3 {
  font-size: 1rem;
  margin: 22px 0 8px;
}

.legal-body p {
  margin: 0 0 14px;
}

.legal-body ol,
.legal-body ul {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding-left: 24px;
}

.legal-body ol ol {
  margin: 8px 0 0;
}

.legal-body table {
  margin: 0 0 16px;
}

.legal-body th {
  width: 200px;
  font-size: 0.92rem;
}

.legal-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.legal-body a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
}

.legal-body a:hover {
  color: var(--accent-strong);
}

@media (max-width: 560px) {
  .app-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 16px;
  }

  .legal-body {
    padding: 20px 16px;
  }

  .legal-body th,
  .legal-body td {
    display: block;
    width: auto;
  }

  .legal-body th {
    border-bottom: 0;
  }

  .legal-body td {
    border-top: 0;
  }
}
