:root {
  color-scheme: light dark;
  --font-ui: Manrope, ui-sans-serif, system-ui, sans-serif;
  --font-mono: Iosevka, "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  font-family: var(--font-ui);
}

* {
  box-sizing: border-box;
}

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

html {
  background: oklch(0.9 0.012 82);
}

body {
  min-height: 100vh;
  margin: 0;
  background: oklch(0.9 0.012 82);
  color: oklch(0.24 0.012 82);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  appearance: none;
}

button:focus-visible,
input:focus-visible,
.sheet-grid:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  margin: -1px;
  clip-path: inset(50%);
  white-space: nowrap;
}

code,
.formula-input,
.cell-inline-input,
.formula-cell-address,
.formula-last-edit,
.cell-address,
.cell-value,
.cell-formula,
.cell-state,
.cell-dirty,
.keycap,
.toggle-badge,
.cell-chip,
.example-chip,
.empty-chip {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
  font-variant-numeric: tabular-nums;
}

.loading-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: var(--space-xl);
  background: oklch(0.9 0.012 82);
  color: oklch(0.24 0.012 82);
}


.loading-title,
.loading-note {
  margin: 0;
}

.loading-title {
  font-size: 1.05rem;
  font-weight: 650;
}

.loading-note {
  margin-top: var(--space-xs);
  color: oklch(0.48 0.014 82);
}

.app-shell {
  --page: oklch(0.976 0.004 92);
  --page-deep: oklch(0.957 0.005 92);
  --paper: oklch(0.988 0.0025 92);
  --paper-soft: oklch(0.971 0.0035 92);
  --paper-hover: oklch(0.951 0.005 92);
  --ink: oklch(0.25 0.012 82);
  --ink-soft: oklch(0.38 0.012 82);
  --muted: oklch(0.5 0.014 82);
  --line: oklch(0.885 0.005 92);
  --line-strong: oklch(0.78 0.007 92);
  --accent: oklch(0.52 0.08 285);
  --accent-soft: color-mix(in oklch, var(--accent), transparent 86%);
  --success: oklch(0.47 0.08 148);
  --warning: oklch(0.57 0.08 85);
  --danger: oklch(0.53 0.12 25);
  --focus: oklch(0.55 0.11 285);
  --shadow: 0 28px 90px color-mix(in oklch, var(--ink), transparent 84%);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--page);
  color: var(--ink);
}

.app-shell--night {
  color-scheme: dark;
  --page: oklch(0.19 0.014 280);
  --page-deep: oklch(0.15 0.012 280);
  --paper: oklch(0.235 0.014 280);
  --paper-soft: oklch(0.285 0.014 280);
  --paper-hover: oklch(0.32 0.016 280);
  --ink: oklch(0.89 0.012 286);
  --ink-soft: oklch(0.74 0.018 286);
  --muted: oklch(0.62 0.018 286);
  --line: oklch(0.36 0.02 280);
  --line-strong: oklch(0.46 0.025 280);
  --accent: oklch(0.7 0.09 292);
  --accent-soft: color-mix(in oklch, var(--accent), transparent 84%);
  --success: oklch(0.72 0.11 148);
  --warning: oklch(0.78 0.09 86);
  --danger: oklch(0.72 0.13 24);
  --focus: oklch(0.74 0.1 292);
  --shadow: 0 30px 92px color-mix(in oklch, black, transparent 58%);
}

.panel-rail {
  position: fixed;
  bottom: var(--space-sm);
  z-index: 20;
  display: flex;
  gap: var(--space-xs);
  align-items: center;
  max-width: calc(50vw - 1.5 * var(--space-sm));
  padding: 4px;
  overflow-x: auto;
  border: 1px solid color-mix(in oklch, var(--line-strong), transparent 20%);
  border-radius: 999px;
  background: color-mix(in oklch, var(--paper), transparent 18%);
  box-shadow: 0 18px 52px color-mix(in oklch, var(--ink), transparent 88%);
  backdrop-filter: blur(16px);
}

.panel-rail--left {
  left: var(--space-sm);
}

.panel-rail--right {
  right: var(--space-sm);
}

.demo-intro {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 12;
  display: grid;
  gap: var(--space-xs);
  width: min(360px, calc(100vw - 2 * var(--space-md)));
  border: 1px solid color-mix(in oklch, var(--line-strong), transparent 24%);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
  background: color-mix(in oklch, var(--paper), transparent 10%);
  box-shadow: 0 18px 52px color-mix(in oklch, var(--ink), transparent 88%);
  backdrop-filter: blur(16px);
}

.demo-intro-kicker,
.demo-intro-title,
.demo-intro-copy,
.inspector-note {
  margin: 0;
}

.demo-intro-kicker {
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.demo-intro-title {
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.18;
  letter-spacing: -0.018em;
}

.demo-intro-copy,
.inspector-note {
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.45;
}

.status-line,
.formula-cell-label,
.example-label,
.key-label,
.toggle-label,
.inspector-title p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.status-line {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in oklch, var(--line), transparent 18%);
  border-radius: 999px;
  padding: 0.5rem 0.72rem;
  background: color-mix(in oklch, var(--paper), transparent 18%);
  backdrop-filter: blur(14px);
}

.status-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-line--error {
  border-color: color-mix(in oklch, var(--danger), var(--line) 45%);
  color: var(--danger);
}

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

.panel-controls,
.formula-actions,
.example-chips,
.keyboard-hint,
.cell-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  align-items: center;
}

.panel-controls {
  justify-content: space-between;
}

.quiet-button,
.primary-action,
.example-chip,
.cell-chip,
.appearance-option {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.48rem 0.78rem;
  background: color-mix(in oklch, var(--paper), transparent 16%);
  color: var(--ink-soft);
  cursor: pointer;
  transition:
    transform 160ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 160ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 160ms cubic-bezier(0.22, 1, 0.36, 1),
    color 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.quiet-button:hover,
.primary-action:hover:not(:disabled),
.example-chip:hover,
.cell-chip:hover,
.appearance-option:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--paper-hover);
  color: var(--ink);
}

.quiet-button:active,
.primary-action:active:not(:disabled),
.example-chip:active,
.cell-chip:active,
.appearance-option:active {
  transform: translateY(0);
}

.primary-action {
  border-color: color-mix(in oklch, var(--accent), var(--line) 28%);
  background: color-mix(in oklch, var(--accent), transparent 78%);
  color: var(--ink);
  font-weight: 650;
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.danger-action:hover {
  border-color: color-mix(in oklch, var(--danger), var(--line) 30%);
  color: var(--danger);
}

.overlay-toggle {
  display: inline-flex;
  gap: var(--space-xs);
  align-items: center;
}

.toggle-badge {
  display: grid;
  min-width: 1.45rem;
  min-height: 1.45rem;
  place-items: center;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: color-mix(in oklch, var(--ink), transparent 92%);
  color: var(--muted);
  font-size: 0.72rem;
}

.overlay-toggle.is-active,
.appearance-option.is-active {
  border-color: color-mix(in oklch, var(--accent), var(--line) 32%);
  background: var(--accent-soft);
  color: var(--ink);
}

.appearance-switch {
  display: inline-flex;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  background: color-mix(in oklch, var(--paper), transparent 20%);
}

.appearance-option {
  min-height: 34px;
  border-color: transparent;
  padding: 0.38rem 0.62rem;
  background: transparent;
}

.sheet-workspace {
  width: 100vw;
  height: 100vh;
  min-height: 0;
  display: grid;
  margin: 0;
}

.formula-bar {
  display: grid;
  grid-template-columns: minmax(8.5rem, auto) minmax(18rem, 1fr) auto;
  gap: var(--space-sm);
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
  background: color-mix(in oklch, var(--paper), transparent 10%);
  box-shadow: 0 14px 44px color-mix(in oklch, var(--ink), transparent 92%);
}

.formula-cell {
  display: grid;
  align-content: center;
  gap: 2px;
  border: 1px solid color-mix(in oklch, var(--line), transparent 20%);
  border-radius: var(--radius-md);
  padding: var(--space-xs) var(--space-sm);
  background: color-mix(in oklch, var(--paper-soft), transparent 26%);
}

.formula-cell-address {
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 650;
}

.formula-last-edit {
  max-width: 16rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.formula-input {
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0 var(--space-md);
  background: color-mix(in oklch, var(--paper), transparent 6%);
  color: var(--ink);
  font-size: clamp(1rem, 1.4vw, 1.2rem);
}

.formula-input::placeholder {
  color: color-mix(in oklch, var(--muted), transparent 26%);
}

.formula-actions {
  justify-content: end;
}

.example-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-sm);
  align-items: center;
  padding: 0 var(--space-xs) var(--space-2xs);
}

.example-chips {
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 2px;
}

.example-chip,
.cell-chip,
.empty-chip {
  min-height: 32px;
  padding: 0.34rem 0.58rem;
  font-size: 0.82rem;
  white-space: nowrap;
}

.sheet-stage {
  position: relative;
  min-height: 0;
  display: grid;
  align-items: stretch;
}

.keyboard-hint {
  justify-self: end;
  justify-content: end;
  margin-bottom: var(--space-xs);
  opacity: 0.88;
}

.keyboard-hint--panel {
  justify-self: start;
  justify-content: start;
  margin-bottom: 0;
  opacity: 1;
}

.key-hint {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 1px solid color-mix(in oklch, var(--line), transparent 18%);
  border-radius: 999px;
  padding: 0.28rem 0.46rem;
  background: color-mix(in oklch, var(--paper), transparent 10%);
  backdrop-filter: blur(10px);
}

.keycap {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.sheet-grid {
  display: grid;
  grid-template-columns: clamp(32px, 3.4vw, 44px) repeat(50, minmax(64px, 72px));
  grid-template-rows: clamp(30px, 3.4vw, 38px) repeat(50, minmax(34px, 40px));
  gap: 1px;
  width: 100vw;
  height: 100vh;
  min-height: 0;
  overflow: auto;
  align-content: start;
  border: 0;
  border-radius: 0;
  background: var(--line);
  box-shadow: none;
}

.sheet-corner,
.sheet-column-header,
.sheet-row-header {
  display: grid;
  place-items: center;
  background: color-mix(in oklch, var(--paper-soft), transparent 8%);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

.sheet-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 6;
}

.sheet-column-header {
  position: sticky;
  top: 0;
  z-index: 5;
}

.sheet-row-header {
  position: sticky;
  left: 0;
  z-index: 4;
}

.grid-cell {
  position: relative;
  display: grid;
  align-items: center;
  min-width: 0;
  min-height: 34px;
  border: 0;
  border-radius: 0;
  padding: 0 var(--space-xs);
  background: var(--paper);
  color: var(--ink);
  text-align: right;
  cursor: pointer;
  transition:
    background-color 160ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 160ms cubic-bezier(0.22, 1, 0.36, 1),
    color 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.grid-cell:hover {
  background: var(--paper-hover);
}

.grid-cell.is-active {
  z-index: 1;
  background: color-mix(in oklch, var(--accent), var(--paper) 88%);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.grid-cell.is-dirty {
  background: color-mix(in oklch, var(--warning), var(--paper) 88%);
}

.grid-cell.is-active.is-dirty {
  background: color-mix(in oklch, var(--accent), var(--paper) 82%);
}

.grid-cell.is-editing {
  padding: 0;
  background: color-mix(in oklch, var(--accent), var(--paper) 90%);
}

.cell-inline-input {
  width: 100%;
  height: 100%;
  min-width: 0;
  border: 0;
  padding: 0 var(--space-xs);
  background: transparent;
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1;
  text-align: right;
}

.cell-address {
  color: var(--accent);
  font-size: 0.98rem;
  font-weight: 650;
}

.cell-state {
  justify-self: end;
  border: 1px solid color-mix(in oklch, currentcolor, var(--line) 52%);
  border-radius: 999px;
  padding: 0.14rem 0.34rem;
  color: var(--muted);
  background: color-mix(in oklch, currentcolor, transparent 93%);
  font-size: 0.64rem;
}

.grid-cell--ready .cell-state {
  color: var(--success);
}

.grid-cell--missing .cell-state {
  color: var(--muted);
}

.grid-cell--error .cell-state {
  color: var(--danger);
}

.cell-value {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.018em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-cell--missing .cell-value {
  color: color-mix(in oklch, var(--muted), transparent 18%);
  font-size: 0.78rem;
  letter-spacing: -0.01em;
}

.cell-formula {
  grid-column: 1 / -1;
  align-self: end;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-dirty {
  position: absolute;
  right: var(--space-xs);
  bottom: var(--space-xs);
  border-radius: 999px;
  padding: 0.2rem 0.46rem;
  background: color-mix(in oklch, var(--warning), transparent 82%);
  color: var(--warning);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
}

.inspector-panel {
  position: fixed;
  bottom: calc(var(--space-sm) + 58px);
  right: clamp(var(--space-sm), 2vw, var(--space-xl));
  z-index: 30;
  width: min(420px, calc(100vw - 2 * var(--space-md)));
  max-height: calc(100vh - 92px);
  overflow: auto;
  display: grid;
  gap: var(--space-md);
  border: 1px solid color-mix(in oklch, var(--line-strong), transparent 14%);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  background: color-mix(in oklch, var(--paper), transparent 6%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.inspector-panel--editor {
  right: auto;
  left: clamp(var(--space-sm), 2vw, var(--space-xl));
  width: min(720px, calc(100vw - 2 * var(--space-md)));
}

.inspector-panel--editor .formula-bar {
  box-shadow: none;
}

.panel-controls {
  border-top: 1px solid color-mix(in oklch, var(--line), transparent 20%);
  padding-top: var(--space-sm);
}

.inspector-header {
  display: flex;
  gap: var(--space-md);
  align-items: start;
  justify-content: space-between;
}

.inspector-title {
  display: grid;
  gap: var(--space-2xs);
}

.inspector-title h2,
.inspector-title p {
  margin: 0;
}

.inspector-title h2 {
  font-size: 1.05rem;
  line-height: 1.1;
}

.close-button {
  min-height: 34px;
}

.inspector-panel--explanation {
  top: var(--space-md);
  bottom: auto;
  width: min(350px, calc(100vw - 2 * var(--space-md)));
  gap: 20px;
  border-radius: 12px;
  padding: 20px;
  overflow-x: hidden;
}

.explanation-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: baseline;
}

.explanation-cell,
.explanation-result,
.explanation-formula,
.explanation-input strong,
.explanation-input-cell,
.explanation-history-event strong,
.explanation-before-after strong {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
  font-variant-numeric: tabular-nums;
}

.explanation-cell {
  margin: 0;
  font-size: 1rem;
}

.explanation-result {
  min-width: 0;
  overflow: hidden;
  color: var(--accent);
  font-size: 1.2rem;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explanation-result--missing {
  color: var(--muted);
}

.explanation-result--error {
  color: var(--danger);
  font-size: 0.76rem;
  white-space: normal;
}

.explanation-formula {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.explanation-direct-value {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.explanation-inputs {
  display: grid;
  gap: var(--space-xs);
}

.explanation-inputs h3 {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.explanation-input-list {
  display: grid;
}

.explanation-input {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 7px 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

.explanation-input:hover {
  color: var(--accent);
}

.explanation-input:focus-visible,
.explanation-disclosure summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.explanation-input strong {
  font-size: 0.78rem;
}

.explanation-disclosure {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
}

.explanation-disclosure summary {
  display: list-item;
  min-height: 44px;
  padding-block: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  font-weight: 650;
}

.explanation-disclosure summary span:last-child {
  float: right;
  margin-left: var(--space-sm);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 500;
}

.explanation-disclosure > .cell-chip-row {
  padding-bottom: var(--space-xs);
}

.explanation-history {
  display: grid;
  gap: var(--space-xs);
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.explanation-history-event {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-sm);
  align-items: center;
  padding-block: 6px 10px;
}

.explanation-history-event > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.explanation-history-event > div > span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.explanation-history-event strong {
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explanation-change-state {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--muted);
  font-size: 0.64rem;
}

.explanation-change-state.is-active {
  border-color: color-mix(in oklch, var(--success), transparent 58%);
  color: var(--success);
  background: color-mix(in oklch, var(--success), transparent 88%);
}

.explanation-trace {
  display: grid;
  gap: 10px;
  padding: 4px 0 14px;
}

.explanation-trace > div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: var(--space-xs);
  align-items: start;
}

.explanation-trace > div > strong {
  color: var(--muted);
  font-size: 0.68rem;
}

.explanation-before-after {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: var(--space-xs);
  align-items: center;
  padding-bottom: 14px;
}

.explanation-before-after > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--space-xs);
  background: var(--paper-soft);
}

.explanation-before-after span {
  color: var(--muted);
  font-size: 0.64rem;
}

.explanation-before-after strong {
  overflow-wrap: anywhere;
  font-size: 0.7rem;
}

.empty-chip {
  display: inline-grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .status-line {
    justify-content: start;
  }

  .panel-controls {
    justify-content: start;
  }

  .formula-bar {
    grid-template-columns: 1fr;
  }

  .formula-actions {
    justify-content: start;
  }
}

@media (max-width: 720px) {
  .panel-rail {
    bottom: var(--space-xs);
    max-width: calc(50vw - 1.5 * var(--space-xs));
  }

  .panel-rail--left {
    left: var(--space-xs);
  }

  .panel-rail--right {
    right: var(--space-xs);
  }

  .demo-intro {
    top: auto;
    right: var(--space-xs);
    bottom: calc(var(--space-xs) + 62px);
    left: var(--space-xs);
    width: auto;
    gap: 6px;
    border-radius: var(--radius-md);
    padding: var(--space-xs);
  }

  .demo-intro-title {
    font-size: 0.86rem;
  }

  .demo-intro-copy,
  .inspector-note {
    font-size: 0.76rem;
  }

  .status-line {
    border-radius: var(--radius-md);
  }

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

  .appearance-switch {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .quiet-button,
  .primary-action,
  .example-chip,
  .cell-chip {
    min-height: 44px;
  }

  .formula-bar {
    border-radius: var(--radius-md);
    padding: var(--space-xs);
  }

  .formula-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .example-strip {
    grid-template-columns: 1fr;
  }

  .keyboard-hint {
    justify-self: start;
    justify-content: start;
  }

  .sheet-stage {
    align-content: start;
  }

  .sheet-grid {
    grid-template-columns: 32px repeat(50, minmax(60px, 68px));
    grid-template-rows: 32px repeat(50, minmax(34px, 38px));
  }

  .grid-cell {
    padding: 0 var(--space-xs);
  }

  .cell-value {
    font-size: 0.82rem;
  }

  .cell-formula {
    font-size: 0.64rem;
  }

  .inspector-panel {
    top: auto;
    right: var(--space-sm);
    bottom: var(--space-sm);
    left: var(--space-sm);
    width: auto;
    max-height: min(72vh, 620px);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-md) var(--radius-md);
  }

}

@media (max-width: 420px) {
  .formula-actions {
    grid-template-columns: 1fr;
  }

  .sheet-grid {
    grid-template-columns: 30px repeat(50, minmax(56px, 64px));
    grid-template-rows: 30px repeat(50, minmax(34px, 36px));
  }

  .cell-state {
    justify-self: start;
  }
}

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