* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --text: #102033;
  --muted: #5b6b7d;
  --border: #d7e0ea;
  --accent: #2457ff;
  --accent-dark: #183cc0;
  --shadow: 0 18px 45px rgba(16, 32, 51, 0.08);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111a2d;
  --surface-2: #17233a;
  --text: #e5edf8;
  --muted: #9fb0c7;
  --border: #24334d;
  --accent: #6f8cff;
  --accent-dark: #8aa0ff;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, rgba(237, 243, 255, 0.92) 0%, var(--bg) 100%);
  color: var(--text);
}

[data-theme="dark"] body {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.94) 0%, var(--bg) 100%);
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.theme-toggle:hover {
  background: var(--surface-2);
}

.theme-toggle__icon {
  font-size: 1.05rem;
  line-height: 1;
}

.theme-toggle__icon--light {
  display: none;
}

[data-theme="dark"] .theme-toggle__icon--dark {
  display: none;
}

[data-theme="dark"] .theme-toggle__icon--light {
  display: inline;
}

.app {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0 40px;
}

.hero {
  padding: 18px 0 28px;
}

.hero-copy {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
}

.lede {
  max-width: 60ch;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.panel h2 {
  margin-bottom: 16px;
  font-size: 1.2rem;
}

.form {
  display: grid;
  gap: 14px;
}

.form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: var(--muted);
}

.form input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
}

.form input:focus {
  outline: 3px solid rgba(36, 87, 255, 0.16);
  border-color: rgba(36, 87, 255, 0.45);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

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

button.secondary {
  background: var(--surface-2);
  color: var(--text);
}

button.secondary:hover {
  background: #dfe8f4;
}

.equation-block,
.result,
.steps {
  margin-top: 18px;
  padding: 16px;
  border-radius: 12px;
  background: var(--surface-2);
}

.label {
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.equation,
.result-text,
.steps li {
  font-size: 1.02rem;
  line-height: 1.65;
}

.steps ol {
  margin: 0;
  padding-left: 20px;
}

.steps li + li {
  margin-top: 8px;
}

.output {
  display: grid;
  align-content: start;
}

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