:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --surface-muted: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --ink: #18181b;
  --ink-muted: #52525b;
  --ink-subtle: #71717a;

  /* Yellowish rule & highlight tokens */
  --rule-bg: #fefce8;
  --rule-border: #fde047;
  --rule-title: #92400e;
  --rule-text: #b45309;
  --mark-bg: #fef08a;
  --mark-line: #eab308;
  --mark-ink: #713f12;

  /* Robot level colors */
  --robot-quick: #f59e0b;
  --robot-quick-bg: #fffbeb;
  --robot-quick-ink: #92400e;

  --robot-short: #2563eb;
  --robot-short-bg: #eff6ff;
  --robot-short-ink: #1e40af;

  --robot-detailed: #10b981;
  --robot-detailed-bg: #ecfdf5;
  --robot-detailed-ink: #065f46;

  --robot-obscene: #7c3aed;
  --robot-obscene-bg: #f5f3ff;
  --robot-obscene-ink: #5b21b6;

  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-ink: #991b1b;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg);
  background-image: radial-gradient(#e4e4e7 0.85px, transparent 0.85px);
  background-size: 24px 24px;
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* Minimalist Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(250, 250, 248, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
}

.brand-crest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  margin: 0;
  font-weight: 800;
  font-size: 1.06rem;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gfx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.gfx-btn:hover:not(:disabled) {
  border-color: var(--ink);
  transform: translateY(-1px);
}

.gfx-btn-nav {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.btn-svg {
  flex-shrink: 0;
}

.lang-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
}

.gfx-lang-select {
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding-inline-end: 2px;
  max-width: 140px;
}

.gfx-lang-select:focus {
  outline: none;
}

/* 1-Column Main Layout + Additional Side Column for Cached Equations (mobile+ and up) */
.workspace-grid {
  max-width: 1060px;
  margin: 0 auto;
  padding: 24px 18px 80px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: start;
}

@media (min-width: 640px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr) 225px;
    gap: 20px;
    padding: 28px 20px 80px;
  }
}

@media (min-width: 960px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 32px;
    padding: 36px 24px 96px;
  }
}

.solver-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* First Section: 4 Cartoon Robots + Speech Bubble Above Selected Robot */
.robots-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.robot-speech-bubble {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--robot-short);
  border-radius: 14px;
  padding: 11px 15px;
  box-shadow: 0 3px 0 rgba(24, 24, 27, 0.04);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.robot-speech-bubble[data-preset="ultra_short"] {
  border-color: var(--robot-quick);
  background: var(--robot-quick-bg);
}

.robot-speech-bubble[data-preset="medium"] {
  border-color: var(--robot-short);
  background: var(--robot-short-bg);
}

.robot-speech-bubble[data-preset="high"] {
  border-color: var(--robot-detailed);
  background: var(--robot-detailed-bg);
}

.robot-speech-bubble[data-preset="obscene"] {
  border-color: var(--robot-obscene);
  background: var(--robot-obscene-bg);
}

.robot-speech-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.45;
}

.robot-speech-tail {
  position: absolute;
  bottom: -8px;
  inset-inline-start: 37.5%;
  width: 14px;
  height: 14px;
  background: inherit;
  border-inline-end: 1.5px solid;
  border-bottom: 1.5px solid;
  border-color: inherit;
  transform: translateX(-50%) rotate(45deg);
  transition: inset-inline-start 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

[dir="rtl"] .robot-speech-tail {
  transform: translateX(50%) rotate(45deg);
}

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

@media (max-width: 440px) {
  .robots-grid {
    gap: 6px;
  }
}

.robot-choice-btn {
  appearance: none;
  font-family: inherit;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 10px 6px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--ink-muted);
  opacity: 0.72;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease, background-color 0.16s ease;
}

.robot-choice-btn:hover {
  opacity: 1;
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.robot-choice-btn.active {
  opacity: 1;
  transform: translateY(-3px);
  color: var(--ink);
  border-width: 2px;
}

.robot-choice-btn.active[data-preset="ultra_short"] {
  background: var(--robot-quick-bg);
  border-color: var(--robot-quick);
  box-shadow: 0 4px 0 rgba(245, 158, 11, 0.25);
  color: var(--robot-quick-ink);
}

.robot-choice-btn.active[data-preset="medium"] {
  background: var(--robot-short-bg);
  border-color: var(--robot-short);
  box-shadow: 0 4px 0 rgba(37, 99, 235, 0.22);
  color: var(--robot-short-ink);
}

.robot-choice-btn.active[data-preset="high"] {
  background: var(--robot-detailed-bg);
  border-color: var(--robot-detailed);
  box-shadow: 0 4px 0 rgba(16, 185, 129, 0.22);
  color: var(--robot-detailed-ink);
}

.robot-choice-btn.active[data-preset="obscene"] {
  background: var(--robot-obscene-bg);
  border-color: var(--robot-obscene);
  box-shadow: 0 4px 0 rgba(124, 58, 237, 0.22);
  color: var(--robot-obscene-ink);
}

.robot-avatar-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.robot-choice-label {
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

@media (max-width: 440px) {
  .robot-choice-btn {
    padding: 8px 4px;
  }
  .robot-choice-label {
    font-size: 0.75rem;
  }
}

/* Main Equation Input (Randomize + Full Column Width, Large Font) */
.equation-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.equation-input-bar {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.randomize-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border-radius: 14px;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease, transform 0.12s ease;
}

.randomize-btn:hover {
  border-color: var(--ink);
  background: var(--surface-muted);
  transform: translateY(-1px);
}

.randomize-btn:active {
  transform: translateY(1px);
}

@media (max-width: 480px) {
  .equation-input-bar {
    gap: 8px;
  }
  .randomize-btn {
    padding: 0 12px;
  }
  .randomize-label {
    display: none;
  }
}

.main-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.eq-input {
  width: 100%;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: 14px;
  padding: 15px 18px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.eq-input-main {
  padding-inline-end: 46px;
}

.eq-input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(24, 24, 27, 0.08);
}

.eq-input::placeholder {
  color: #a1a1aa;
  font-weight: 500;
  font-size: clamp(0.95rem, 2vw, 1.15rem);
}

.eq-input.is-valid {
  border-color: #10b981;
}

.eq-input.is-invalid {
  border-color: #ef4444;
}

@media (max-width: 480px) {
  .eq-input {
    font-size: 1.25rem;
    padding: 12px 14px;
  }
  .eq-input-main {
    padding-inline-end: 40px;
  }
}

.equation-status {
  position: absolute;
  inset-inline-end: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

@keyframes spinSlow {
  to {
    transform: rotate(360deg);
  }
}

.status-spinner {
  animation: spinSlow 0.8s linear infinite;
}

.error-banner {
  background: var(--danger-bg);
  color: var(--danger-ink);
  border: 1.5px solid var(--danger-border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.86rem;
  font-weight: 500;
}

.unsupported-card {
  background: var(--rule-bg);
  border: 1.5px solid var(--rule-border);
  border-radius: 12px;
  padding: 12px 15px;
}

.unsupported-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--rule-title);
  margin-bottom: 3px;
}

.unsupported-reason {
  margin: 0;
  font-size: 0.84rem;
  color: var(--rule-text);
}

/* Interactive Steps Timeline */
.steps-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.steps-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeSlideIn 0.2s ease-out;
}

/* Connector Row: Arrow + Greyed-out Empty Box (or Yellowish Rule Box) */
.step-connector {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-inline-start: 44px;
  padding-inline-end: 66px;
}

@media (max-width: 480px) {
  .step-connector {
    padding-inline-start: 38px;
    padding-inline-end: 58px;
    gap: 8px;
  }
}

.step-arrow {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 36px;
  color: var(--ink-subtle);
}

.step-rule-box {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  border-radius: 10px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  display: flex;
  align-items: center;
}

.step-rule-box.is-empty {
  background: var(--surface-muted);
  border: 1.5px dashed var(--border-strong);
  opacity: 0.72;
}

.step-rule-box.is-revealed {
  background: var(--rule-bg);
  border: 1.5px solid var(--rule-border);
  padding: 7px 12px;
  opacity: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.step-rule-heading {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--rule-title);
  letter-spacing: 0.01em;
}

.step-rule-text {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--rule-text);
  line-height: 1.35;
}

/* Completed Step Display (Large Equation) */
.step-rendered-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-inline-start: 44px;
  padding-inline-end: 66px;
}

@media (max-width: 480px) {
  .step-rendered-row {
    padding-inline-start: 38px;
    padding-inline-end: 58px;
  }
}

.step-rendered-card {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.step-equation-rendered {
  font-family: var(--font-mono);
  font-size: clamp(1.38rem, 3vw, 1.9rem);
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  word-break: break-word;
  direction: ltr;
  unicode-bidi: isolate;
}

.step-equation-rendered mark {
  background: var(--mark-bg);
  color: var(--mark-ink);
  padding: 1px 6px;
  border-radius: 6px;
  border-bottom: 2px solid var(--mark-line);
}

.step-undo-btn {
  flex-shrink: 0;
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-subtle);
  border-radius: 8px;
  padding: 5px 7px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.step-rendered-card:hover .step-undo-btn,
.step-undo-btn:focus-visible {
  opacity: 1;
}

.step-undo-btn:hover {
  background: var(--surface-muted);
  color: var(--ink);
  border-color: var(--border);
}

/* Active Step Input Row: [Small Left Validate Btn] [Large Step Input] [Selected-Color Robot + "Click me"] */
.step-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 480px) {
  .step-input-row {
    gap: 6px;
  }
}

.step-validate-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease, transform 0.12s ease;
}

@media (max-width: 480px) {
  .step-validate-btn {
    width: 32px;
    height: 32px;
  }
}

.step-validate-btn:hover:not(:disabled) {
  border-color: #10b981;
  background: #ecfdf5;
  color: #047857;
  transform: translateY(-1px);
}

.step-validate-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.step-input-wrap {
  flex: 1;
  min-width: 0;
}

.step-robot-slot {
  position: relative;
  flex-shrink: 0;
  width: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

@media (max-width: 480px) {
  .step-robot-slot {
    width: 50px;
  }
}

.step-robot-btn {
  position: relative;
  appearance: none;
  border: none;
  background: transparent;
  padding: 2px;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.16s ease;
}

.step-robot-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.04);
}

.step-robot-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.step-robot-btn:disabled {
  cursor: wait;
  opacity: 0.8;
}

.step-robot-bubble {
  position: absolute;
  bottom: calc(100% + 4px);
  inset-inline-end: 0;
  background: var(--ink);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.15;
  padding: 4px 8px;
  border-radius: 9px;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(24, 24, 27, 0.14);
  pointer-events: none;
  transition: background-color 0.16s ease;
}

.step-robot-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  inset-inline-end: 18px;
  border-width: 5px 5px 0 5px;
  border-style: solid;
  border-color: var(--ink) transparent transparent transparent;
}

.step-robot-btn[data-phase="rule_shown"] .step-robot-bubble {
  background: #ca8a04;
}

.step-robot-btn[data-phase="rule_shown"] .step-robot-bubble::after {
  border-top-color: #ca8a04;
}

.step-inline-error {
  margin-top: 6px;
  margin-inline-start: 44px;
  margin-inline-end: 66px;
  background: var(--danger-bg);
  color: var(--danger-ink);
  border: 1.5px solid var(--danger-border);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 500;
}

@media (max-width: 480px) {
  .step-inline-error {
    margin-inline-start: 38px;
    margin-inline-end: 58px;
  }
}

/* Final Answer Banner */
.final-answer-banner {
  margin-top: 6px;
  padding: 16px 20px;
  border-radius: 14px;
  background: var(--surface);
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  animation: fadeSlideIn 0.22s ease-out;
}

.final-label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.final-value {
  font-family: var(--font-mono);
  font-size: clamp(1.45rem, 3vw, 1.95rem);
  font-weight: 800;
  color: var(--ink);
  direction: ltr;
  unicode-bidi: isolate;
}

/* Side Column: Cached Equations */
.sidebar-col {
  min-width: 0;
}

.sidebar-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

@media (min-width: 640px) {
  .sidebar-card {
    position: sticky;
    top: 68px;
  }
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.latest-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 62vh;
  overflow-y: auto;
  padding-inline-end: 2px;
}

.latest-item {
  width: 100%;
  text-align: start;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.14s ease, background-color 0.14s ease, transform 0.12s ease;
}

.latest-item:hover {
  border-color: var(--ink);
  background: var(--surface);
  transform: translateY(-1px);
}

.latest-item.active-cache {
  border-color: var(--ink);
  background: var(--surface);
}

.latest-eq-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.latest-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--ink-subtle);
}

.latest-dot[data-preset="ultra_short"] { background: var(--robot-quick); }
.latest-dot[data-preset="medium"] { background: var(--robot-short); }
.latest-dot[data-preset="high"] { background: var(--robot-detailed); }
.latest-dot[data-preset="obscene"] { background: var(--robot-obscene); }

.latest-eq {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
  word-break: break-word;
  direction: ltr;
  unicode-bidi: isolate;
}

.latest-meta {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-subtle);
  padding-inline-start: 13px;
}

.empty-state {
  font-size: 0.82rem;
  color: var(--ink-subtle);
  padding: 6px 2px;
}

.browser-cache-footer {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--ink-subtle);
}

.browser-cache-stats {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-cache-clear-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 7px;
  cursor: pointer;
}

.browser-cache-clear-btn:hover {
  border-color: var(--ink);
}

/* Rules Guide Page (/rules) */
.rules-page-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.rules-hero {
  margin-bottom: 24px;
}

.rules-hero h1 {
  margin: 0 0 8px;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.rules-hero p {
  margin: 0;
  color: var(--ink-muted);
  max-width: 660px;
}

.rules-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

@media (max-width: 760px) {
  .rules-guide-grid {
    grid-template-columns: 1fr;
  }
}

.rule-guide-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.guide-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.guide-card-head h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
}

.guide-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-subtle);
}

.guide-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
}

.icon-quick { background: var(--robot-quick-bg); border-color: #fcd34d; }
.icon-standard { background: var(--robot-short-bg); border-color: #93c5fd; }
.icon-detailed { background: var(--robot-detailed-bg); border-color: #6ee7b7; }
.icon-every { background: var(--robot-obscene-bg); border-color: #c4b5fd; }

.guide-summary {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.guide-rules-list {
  margin: 0 0 16px;
  padding-inline-start: 18px;
  font-size: 0.86rem;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.guide-rules-list strong {
  color: var(--ink);
}

.guide-example {
  background: var(--rule-bg);
  border: 1.5px solid var(--rule-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.84rem;
}

.guide-ex-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--rule-title);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.guide-example mark {
  background: var(--mark-bg);
  color: var(--mark-ink);
  padding: 1px 4px;
  border-radius: 4px;
}

/* Keep mathematical formulas left-to-right even in RTL (Arabic) mode */
#equationInput,
.eq-input,
.step-equation-rendered,
.final-value,
.latest-eq,
.ltr-math,
.guide-rules-list code,
.guide-example code {
  direction: ltr;
  unicode-bidi: isolate;
}
