[data-longarith-root] .longarith-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 960px) {
  [data-longarith-root] .longarith-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}

[data-longarith-root] .mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

[data-longarith-root] .mode-tabs button {
  border: 1px solid var(--surface-border, #d0d7de);
  background: var(--surface-subtle, #f5f7fa);
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
}

[data-longarith-root] .mode-tabs button.is-active {
  background: var(--accent-soft, #204ecf);
  border-color: var(--accent-soft, #204ecf);
  color: #fff;
}

[data-longarith-root] .longarith-controls {
  display: grid;
  gap: 12px;
}

[data-longarith-root] .longarith-controls .grid-two {
  display: grid;
  gap: 12px;
}

@media (min-width: 640px) {
  [data-longarith-root] .longarith-controls .grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

[data-longarith-root] .longarith-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

[data-longarith-root] .steps-list {
  list-style: decimal;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
}

[data-longarith-root] .steps-list li {
  background: var(--surface-subtle, #f7f9fc);
  border: 1px solid var(--surface-border, #d0d7de);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 1rem;
  line-height: 1.6;
}

[data-longarith-root] .steps-list li.is-active {
  border-color: var(--accent-soft, #204ecf);
  background: rgba(32, 78, 207, 0.14);
  font-weight: 600;
}

[data-longarith-root] #layout-output {
  background: var(--surface-subtle, #f7f9fc);
  border: 1px solid var(--surface-border, #d0d7de);
  border-radius: 6px;
  padding: 12px;
  font-family: var(--font-mono, 'Roboto Mono', 'Fira Code', monospace);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  overflow-x: auto;
}

[data-longarith-root] #layout-output .layout-line {
  white-space: pre;
}

[data-longarith-root] #layout-output .layout-line.is-active {
  font-weight: 700;
  color: var(--accent-strong, #0b57d0);
}

[data-longarith-root] #result-summary {
  display: grid;
  gap: 6px;
}

[data-longarith-root] .step-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.95rem;
}

[data-longarith-root] .step-controls button {
  border: 1px solid var(--surface-border, #d0d7de);
  border-radius: 6px;
  padding: 6px 12px;
  background: #fff;
  cursor: pointer;
}

[data-longarith-root] .step-controls button:hover {
  background: var(--surface-subtle, #f1f4fb);
}

[data-longarith-root].teacher-mode {
  font-size: 1.05rem;
}

[data-longarith-root].teacher-mode #layout-output {
  font-size: 1rem;
}
