:root {
  --bg: #f5faf8;
  --bg-raise: #edf4f0;
  --ink: #092722;
  --ink-dim: #566e67;
  --line: #d9e5df;
  --surface: #edf4f0;
  --surface-sel: #dbeee3;
  --accent: #18533d;
  --accent-ink: #ffffff;
  --focus: #277552;
  --error: #a52f36;
  --green: #538d4e;
  --yellow: #b59f3b;
  --mark-b: #8a948f;
  --caret: #092722;
  --leader: #a9bfb6;
  --underline-grad: linear-gradient(180deg, #effbf5 0%, #d9eee4 55%, #b9dbcc 100%);
  --underline-shadow:
    inset 0 1px 1px rgb(255 255 255 / 95%),
    inset 0 -2px 3px rgb(53 127 96 / 16%),
    0 0 0 1px rgb(65 138 107 / 20%),
    0 10px 22px rgb(54 121 91 / 7%);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #101c19;
  --bg-raise: #1a2d25;
  --ink: #eaf4ef;
  --ink-dim: #a6bab1;
  --line: #344a40;
  --surface: #1a2d25;
  --surface-sel: #2c483b;
  --accent: #b8e1ca;
  --accent-ink: #10261c;
  --focus: #a0dabb;
  --error: #ffb4b6;
  --mark-b: #3a3c41;
  --caret: #d9eee4;
  --leader: #42584d;
  --underline-grad: linear-gradient(180deg, #24382f 0%, #1a2c25 55%, #14211c 100%);
  --underline-shadow:
    inset 0 1px 1px rgb(255 255 255 / 8%),
    inset 0 -2px 3px rgb(0 0 0 / 30%),
    0 0 0 1px rgb(160 218 187 / 14%),
    0 10px 22px rgb(0 0 0 / 25%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px 64px;
  position: relative;
}

.shell-entry {
  max-width: 1600px;
  padding: 0 clamp(20px, 3.9vw, 64px) calc(48px + env(safe-area-inset-bottom));
}

.app-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 22px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  width: 30px;
  height: 30px;
  flex: none;
}

.brand-mark i {
  border-radius: 3px;
}

.brand-mark i:nth-child(1) {
  background: #1d5c40;
}

.brand-mark i:nth-child(2) {
  background: #4c9a72;
}

.brand-mark i:nth-child(3) {
  background: #8fc7a6;
}

.brand-mark i:nth-child(4) {
  background: #14462f;
}

.brand-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.app-tabs {
  justify-self: center;
}

.tab-list {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.tab {
  font-family: inherit;
  cursor: pointer;
  min-height: 44px;
  border: none;
  border-radius: 999px;
  padding: 10px 28px;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-dim);
  background: transparent;
  transition: color 0.12s ease, background 0.12s ease;
}

@media (hover: hover) and (pointer: fine) {
  .tab:hover:not(.active):not(:disabled) {
    color: var(--ink);
  }
}

.tab.active {
  background: var(--accent);
  color: var(--accent-ink);
}

.tab:disabled {
  opacity: 0.5;
  cursor: default;
}

.header-utils {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-link {
  font-family: inherit;
  cursor: pointer;
  min-height: 44px;
  padding: 8px 14px;
  border: none;
  background: transparent;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-dim);
  border-radius: 8px;
  transition: color 0.12s ease;
}

@media (hover: hover) and (pointer: fine) {
  .header-link:hover {
    color: var(--ink);
  }
}

.theme-toggle {
  font-family: inherit;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  transition: background 0.12s ease;
}

@media (hover: hover) and (pointer: fine) {
  .theme-toggle:hover {
    background: var(--surface);
  }
}

.modes {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  align-self: flex-start;
}

.mode-option {
  position: relative;
  display: flex;
}

.mode-option input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.mode-option input:disabled {
  cursor: default;
}

.mode-label {
  display: block;
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink-dim);
  transition: color 0.12s ease, background 0.12s ease;
  white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
  .mode-option input:not(:checked):not(:disabled) + .mode-label:hover {
    color: var(--ink);
  }
}

.mode-option input:checked + .mode-label {
  background: var(--surface-sel);
  color: var(--ink);
  font-weight: 600;
}

.mode-option input:focus-visible + .mode-label {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.entry-panel {
  padding-bottom: 24px;
}

.word-composer {
  display: flex;
  flex-direction: column;
}

.composer-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  margin-top: clamp(48px, 10vh, 128px);
}

.composer-heading {
  margin: 0;
  font-size: clamp(42px, 4.1vw, 64px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
  color: var(--ink);
  text-wrap: balance;
}

.composer-desc {
  margin: 16px 0 0;
  font-size: clamp(20px, 2.1vw, 34px);
  font-weight: 400;
  color: var(--ink-dim);
  letter-spacing: -0.01em;
}

.composer-intro .modes {
  margin-top: 14px;
  flex: none;
}

.composer-field {
  margin-top: clamp(48px, 8vh, 88px);
}

.composer-label {
  display: block;
  font-size: clamp(15px, 1.3vw, 20px);
  font-weight: 500;
  color: var(--ink);
  margin-bottom: clamp(8px, 1vw, 14px);
}

.composer-editor {
  position: relative;
}

.composer-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
  font-size: 16px;
  font-family: var(--font);
  cursor: text;
}

.composer-input:focus {
  outline: none;
}

.composer-input::selection {
  background: transparent;
}

.composer-visual {
  position: relative;
  pointer-events: none;
}

.composer-columns {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(10px, 2.65vw, 42px);
}

.composer-column {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.composer-letter {
  display: block;
  height: 1em;
  font-size: clamp(56px, 15.2vw, 240px);
  font-weight: 800;
  line-height: 1;
  text-align: center;
  color: var(--ink);
}

.composer-underline {
  display: block;
  height: clamp(12px, 1.52vw, 24px);
  margin-top: clamp(8px, 0.9vw, 14px);
  border-radius: 999px;
  background: var(--underline-grad);
  box-shadow: var(--underline-shadow);
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

.composer-underline.active {
  background: var(--accent);
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 18%),
    0 0 0 1px rgb(65 138 107 / 30%),
    0 10px 22px rgb(54 121 91 / 10%);
}

.composer-caret {
  position: absolute;
  top: 0.08em;
  left: 0;
  width: 4px;
  border-radius: 2px;
  background: var(--caret);
  font-size: clamp(56px, 15.2vw, 240px);
  height: 0.8em;
}

.composer-caret[hidden] {
  display: none;
}

.composer-selection {
  position: absolute;
  top: -0.04em;
  height: 1.06em;
  font-size: clamp(56px, 15.2vw, 240px);
  border-radius: 0.1em;
  background: rgb(39 117 82 / 14%);
}

[data-theme="dark"] .composer-selection {
  background: rgb(160 218 187 / 18%);
}

.composer-selection[hidden] {
  display: none;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: clamp(48px, 11vh, 112px);
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.composer-message {
  margin: 0;
  font-size: clamp(15px, 1.2vw, 19px);
  color: var(--ink-dim);
  min-height: 1.4em;
}

.composer-message.is-error {
  color: var(--error);
  font-weight: 500;
}

.composer-submit {
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 340px;
  min-height: 68px;
  padding: 0 40px;
  border: none;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform 0.1s ease, filter 0.12s ease, opacity 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
  .composer-submit:hover:not(:disabled) {
    filter: brightness(1.07);
  }
}

.composer-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.composer-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.about-page {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(40px, 8vh, 96px) 0 64px;
}

.about-title {
  margin: 0;
  font-size: clamp(56px, 7.5vw, 110px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.95;
  color: var(--ink);
}

.about-tag {
  margin: 18px 0 0;
  max-width: 32ch;
  font-size: clamp(19px, 1.9vw, 26px);
  line-height: 1.35;
  color: var(--ink-dim);
}

.stat-grid {
  margin-top: clamp(36px, 6vh, 64px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.stat {
  background: var(--bg);
  padding: 18px 16px;
}

.stat-value {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  margin: 6px 0 0;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.about-section {
  margin-top: clamp(36px, 6vh, 64px);
}

.about-sankey {
  margin-top: 12px;
  max-width: 480px;
}

.about-note {
  margin: 10px 0 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
}

.about-steps {
  margin: 14px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  font-size: 15px;
  line-height: 1.6;
}

.about-steps li::marker {
  color: var(--green);
  font-weight: 700;
}

.about-copy {
  margin: 14px 0 0;
  max-width: 60ch;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-dim);
}

.about-status {
  display: inline-block;
  margin: 14px 0 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.about-status.ok {
  background: #14462f;
  color: #fff;
}

.about-status.warn {
  border: 1px solid var(--error);
  color: var(--error);
}

.about-page > .primary {
  margin-top: clamp(36px, 6vh, 64px);
}

@media (max-width: 640px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.board-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.tile {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  font-size: clamp(20px, 4vw, 30px);
  font-weight: 700;
  background: var(--bg-raise);
  color: var(--ink);
  user-select: none;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.tile[role="button"] {
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .tile[role="button"]:hover {
    border-color: var(--ink-dim);
  }
}

.tile.filled:not(.mark-b):not(.mark-y):not(.mark-g) {
  border-color: var(--ink-dim);
}

.tile.reveal {
  animation: flip 0.38s ease;
  animation-fill-mode: backwards;
}

.mark-b {
  background: var(--mark-b);
  border-color: var(--mark-b);
  color: #fff;
}

[data-theme="dark"] .mark-b {
  color: var(--ink);
}

.mark-y {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #14151a;
}

.mark-g {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.scope-hint {
  margin: 0;
  color: var(--ink-dim);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.scope-warning {
  margin: 0;
  color: var(--error);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.result {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.primary {
  font-family: inherit;
  cursor: pointer;
  min-height: 44px;
  align-self: flex-start;
  padding: 12px 28px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--accent-ink);
  background: var(--accent);
  border: none;
  border-radius: 10px;
  transition: transform 0.1s ease, filter 0.15s ease, opacity 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
  .primary:hover:not(:disabled) {
    filter: brightness(1.07);
  }
}

.primary:active {
  transform: scale(0.97);
}

.primary:disabled {
  opacity: 0.45;
  cursor: default;
}

.sankey {
  display: block;
  width: 100%;
  height: auto;
  margin: 14px 0 16px;
}

.sk-field {
  fill: var(--ink-dim);
  opacity: 0.12;
}

.sk-alive {
  fill: var(--green);
}

.sk-word {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  fill: var(--ink);
}

.sk-count {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  fill: var(--ink-dim);
}

.sk-count.ok {
  fill: var(--green);
  font-weight: 700;
}

.sk-delta {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
  fill: var(--ink-dim);
  opacity: 0.75;
}

.sk-flow {
  fill: none;
  stroke: var(--bg);
  stroke-width: 1.3;
  stroke-dasharray: 1.5 10;
  opacity: 0.55;
  animation: skflow 0.9s linear infinite;
  pointer-events: none;
}

@keyframes skflow {
  to {
    stroke-dashoffset: -11.5;
  }
}

.sk-new {
  transform-box: fill-box;
  transform-origin: left center;
  animation: skgrow 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes skgrow {
  from {
    transform: scaleX(0);
    opacity: 0.3;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

.sankey-cap {
  margin: 6px 0 0;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}

.difficulty {
  align-self: flex-start;
}

.mode-note {
  margin: 8px 4px 0;
  max-width: 34ch;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
}

.error {
  margin: 0;
  color: var(--error);
  font-size: 13px;
  font-weight: 600;
}

.shell-result {
  max-width: 1440px;
  padding: 0 clamp(20px, 3.6vw, 56px) calc(48px + env(safe-area-inset-bottom));
}

.return-path-result {
  display: flex;
  flex-direction: column;
}

.return-path-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  margin-top: clamp(24px, 4vh, 48px);
}

.return-path-title {
  margin: 0;
  font-size: clamp(36px, 3.6vw, 56px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--ink);
}

.return-path-subtitle {
  margin: 14px 0 0;
  font-size: clamp(20px, 1.9vw, 30px);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.return-path-intro .difficulty {
  flex: none;
  margin-top: 6px;
}

.return-path-stage {
  --rp-cols: 64px minmax(0px, 516px) minmax(100px, 1fr) 300px;
  --rp-gap: 20px;
  --rp-pitch: 114px;
  --rp-row-h: 90px;
  position: relative;
  display: grid;
  grid-template-columns: var(--rp-cols);
  column-gap: var(--rp-gap);
  margin-top: clamp(16px, 3vh, 36px);
}

.return-path-origin {
  grid-column: 3;
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0 40px 24px 0;
  font-size: clamp(18px, 1.7vw, 26px);
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.return-path-origin-dot {
  display: block;
  width: 12px;
  height: 12px;
}

.return-path-rows {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  row-gap: calc(var(--rp-pitch) - var(--rp-row-h));
  margin: 0;
  padding: 0;
  list-style: none;
  position: relative;
  z-index: 1;
  min-height: max(
    300px,
    calc((var(--rp-rows) - 1) * var(--rp-pitch) + var(--rp-row-h))
  );
}

.return-path-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: center;
}

.return-path-turn {
  justify-self: center;
  width: 48px;
  height: 48px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-dim);
  font-family: inherit;
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

@media (hover: hover) and (pointer: fine) {
  .return-path-turn:hover:not(:disabled):not(.selected) {
    color: var(--ink);
    border-color: var(--ink-dim);
  }
}

.return-path-turn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.return-path-turn:disabled {
  cursor: default;
  opacity: 0.55;
}

.return-path-word {
  gap: 17px;
  width: 100%;
}

.return-path-result .tile {
  border-radius: 3px;
  font-size: clamp(30px, 3vw, 48px);
  font-weight: 700;
}

.return-path-leader-anchor {
  display: block;
  width: 2px;
  height: 2px;
  justify-self: start;
  align-self: center;
}

.return-path-count {
  display: flex;
  align-items: center;
  gap: 17px;
  min-width: 0;
}

.return-path-node {
  flex: none;
  display: block;
  width: 14px;
  height: 14px;
}

.is-final .return-path-node {
  width: 44px;
  height: 44px;
  margin-left: 26px;
}

.return-path-count-text {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.is-final .return-path-count-text,
.is-terminal .return-path-count-text {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.return-path-count-value {
  font-size: clamp(30px, 2.9vw, 44px);
  font-weight: 650;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}

.return-path-count-unit {
  font-size: clamp(14px, 1.2vw, 18px);
  color: var(--ink-dim);
  white-space: nowrap;
}

.return-path-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: visible;
  pointer-events: none;
}

.trace-leader {
  fill: none;
  stroke: var(--leader);
  stroke-width: 1;
}

.trace-spine,
.trace-return {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-theme="dark"] .trace-return {
  filter: drop-shadow(0 0 6px rgb(184 225 202 / 28%));
}

.trace-dot,
.trace-node {
  fill: var(--accent);
}

.trace-check {
  fill: var(--accent);
}

.trace-tick {
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trace-ring {
  fill: var(--bg);
  stroke: var(--ink-dim);
  stroke-width: 2;
}

.trace-pending {
  fill: var(--bg);
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 3 4;
}

.is-pending .return-path-turn {
  cursor: default;
  border-style: dashed;
  color: var(--accent);
}

.return-path-selection.scope-warning {
  color: var(--error);
}

.trace-fade {
  animation: tracefade 0.18s ease;
}

@keyframes tracefade {
  from {
    opacity: 0;
  }
}

.return-path-selection {
  margin: 12px 0 0;
  min-height: 1.5em;
  font-size: 15px;
  color: var(--ink-dim);
}

.return-path-footer {
  margin-top: clamp(36px, 6vh, 64px);
  border-top: 1px solid var(--line);
  padding: 34px 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
}

.return-path-footer .result {
  font-size: clamp(26px, 2.4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.return-path-certification {
  margin: 10px 0 0;
  font-size: 16px;
  color: var(--ink-dim);
}

.return-path-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: none;
}

.return-path-footer .primary {
  min-width: 273px;
  min-height: 60px;
  padding: 12px 40px;
  border-radius: 12px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0;
}

.return-path-proof {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.return-path-proof:disabled {
  cursor: default;
  opacity: 0.55;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@keyframes flip {
  0% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.2s !important;
    transition-duration: 0.2s !important;
  }

  .sk-flow {
    animation: none !important;
    opacity: 0.35;
  }

  .sk-new {
    animation: none !important;
  }

  .tile.reveal {
    animation: none;
  }
}

@media (max-width: 1099px) {
  .shell-entry {
    padding-inline: 32px;
  }
}

@media (max-width: 899px) {
  .app-header {
    display: flex;
    flex-wrap: wrap;
    row-gap: 12px;
  }

  .brand {
    flex: 1 1 auto;
  }

  .brand-name {
    font-size: 17px;
    white-space: normal;
    line-height: 1.15;
  }

  .app-tabs {
    order: 3;
    width: 100%;
    justify-self: auto;
  }

  .tab-list {
    width: 100%;
    justify-content: center;
  }

  .tab {
    flex: 1;
  }
}

@media (max-width: 699px) {
  .shell-entry {
    padding-inline: 20px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
  }

  .composer-intro {
    flex-direction: column;
    gap: 24px;
    margin-top: 40px;
  }

  .composer-heading {
    font-size: 34px;
    line-height: 1.1;
  }

  .composer-desc {
    font-size: 19px;
  }

  .composer-intro .modes {
    margin-top: 0;
  }

  .composer-field {
    margin-top: 48px;
  }

  .composer-letter {
    font-size: clamp(48px, 15.5vw, 64px);
  }

  .composer-caret,
  .composer-selection {
    font-size: clamp(48px, 15.5vw, 64px);
  }

  .composer-underline {
    height: 12px;
  }

  .composer-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-top: 48px;
  }

  .composer-submit {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    font-size: 18px;
  }
}

@media (max-width: 340px) {
  .shell-entry {
    padding-inline: 16px;
  }
}

@media (max-width: 420px) {
  .shell {
    padding: 0 12px 48px;
  }
}

@media (max-width: 1099px) {
  .return-path-stage {
    --rp-cols: 48px minmax(0px, 340px) minmax(32px, 1fr) 220px;
    --rp-gap: 14px;
    --rp-pitch: 88px;
    --rp-row-h: 60px;
  }

  .return-path-word {
    gap: 10px;
  }

  .return-path-result .tile {
    font-size: 34px;
  }

  .return-path-turn {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }

  .return-path-count {
    gap: 12px;
  }

  .is-final .return-path-node {
    width: 40px;
    height: 40px;
    margin-left: 14px;
  }

  .return-path-intro {
    flex-wrap: wrap;
  }
}

@media (max-width: 699px) {
  .return-path-stage {
    --rp-cols: 44px minmax(0px, 1fr) 22px;
    --rp-gap: 10px;
    --rp-pitch: 104px;
    --rp-row-h: 94px;
  }

  .return-path-intro {
    flex-direction: column;
    gap: 20px;
  }

  .return-path-intro .difficulty {
    margin-top: 0;
  }

  .return-path-title {
    font-size: 34px;
  }

  .return-path-subtitle {
    font-size: 19px;
  }

  .return-path-origin {
    grid-column: 2 / 4;
    margin-right: 16px;
    font-size: 20px;
  }

  .return-path-row {
    grid-template-areas:
      "turn word path"
      ". count path";
    row-gap: 10px;
    align-items: start;
  }

  .return-path-turn {
    grid-area: turn;
    width: 44px;
    height: 44px;
  }

  .return-path-word {
    grid-area: word;
    gap: 6px;
  }

  .return-path-result .tile {
    font-size: 26px;
  }

  .return-path-leader-anchor {
    display: none;
  }

  .return-path-count {
    grid-area: count;
    position: relative;
    gap: 0;
  }

  .return-path-node {
    position: absolute;
    right: -26px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    margin: 0;
  }

  .is-final .return-path-node {
    width: 40px;
    height: 40px;
    right: -32px;
  }

  .return-path-count-value {
    font-size: 28px;
  }

  .return-path-count-unit {
    font-size: 14px;
  }

  .return-path-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .return-path-actions {
    align-items: stretch;
  }

  .return-path-footer .primary {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    font-size: 17px;
  }

  .return-path-proof {
    min-height: 44px;
  }
}

@media (max-width: 400px) {
  .return-path-word {
    gap: 4px;
  }

  .return-path-result .tile {
    font-size: 23px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .trace-fade {
    animation: none;
  }
}

@media (forced-colors: active) {
  .return-path-lines path,
  .return-path-lines circle {
    stroke: CanvasText;
  }

  .trace-dot,
  .trace-node,
  .trace-check {
    fill: CanvasText;
  }

  .trace-ring,
  .trace-pending {
    fill: Canvas;
  }

  .trace-tick {
    stroke: Canvas;
  }

  .composer-visual {
    display: none;
  }

  .composer-input {
    position: static;
    color: CanvasText;
    -webkit-text-fill-color: CanvasText;
    caret-color: auto;
    background: Field;
    border: 1px solid ButtonBorder;
    font-size: 24px;
    padding: 12px 14px;
    border-radius: 8px;
  }

  .composer-input:focus {
    outline: 2px solid Highlight;
  }
}
