:root {
  --bg: #fbfaf7;
  --bg-elevated: #ffffff;
  --ink: #1a1715;
  --ink-soft: #5a544f;
  --ink-faint: #9b9590;
  --rule: #e7e2db;
  --accent: #d94a1f;
  --accent-soft: #fde8df;
  --good: #2f8a4a;
  --bad: #c0392b;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(20, 15, 10, 0.04), 0 8px 24px rgba(20, 15, 10, 0.06);
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-serif, Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14110f;
    --bg-elevated: #1d1a17;
    --ink: #f5f1ec;
    --ink-soft: #b8b1a8;
    --ink-faint: #7a736b;
    --rule: #2c2823;
    --accent: #ff6b3d;
    --accent-soft: #3a201a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

a { color: inherit; }

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

.eyebrow {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px;
  font-weight: 600;
}

.version-stamp {
  position: fixed;
  top: 14px;
  right: 16px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 600;
  z-index: 100;
  pointer-events: none;
}

.studio {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 32px 64px;
}

.studio__nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.studio__home {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

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

.studio__title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  margin: 0;
  text-align: center;
}

.modes {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 4px;
  width: min(432px, 100%);
  max-width: 100%;
  margin: 0 auto 36px;
  position: static;
  transform: none;
}

.mode-btn {
  appearance: none;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-soft);
  padding: 10px 15px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-btn:hover { color: var(--ink); }

.mode-btn[aria-selected="true"],
.mode-btn.is-active {
  background: var(--ink);
  color: var(--bg);
}

.view { display: none; }
.view.is-visible { display: block; }

.intro {
  max-width: 760px;
  margin: 0 auto 26px;
}

.intro h2 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

.intro p {
  font-size: 18px;
  color: var(--ink-soft);
  max-width: 62ch;
  margin: 0;
}

.searchbox {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 22px;
  max-width: 520px;
}

.searchbox label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.searchbox input {
  appearance: none;
  border: 1.5px solid var(--rule);
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  width: 100%;
  transition: border-color 0.15s ease;
}

.searchbox input:focus {
  outline: none;
  border-color: var(--accent);
}

.domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.domain,
.panel,
.case-card,
.drill,
.dialog {
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: none;
}

.domain {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.domain:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.domain h3,
.panel h3,
.case-card h3,
.drill h3 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 6px;
}

.domain p,
.panel p,
.case-card p,
.drill p {
  color: var(--ink-soft);
}

.panel__lede {
  font-size: 15px;
  margin: 0 0 12px;
}

.tool-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}

.tool-link:hover {
  text-decoration: underline;
}

.concept-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.concept {
  appearance: none;
  border: 1px solid var(--rule);
  background: var(--bg);
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.08s ease;
}

.concept:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.concept:active { transform: scale(0.98); }

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

.panel,
.case-card,
.drill {
  padding: 32px 28px;
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  position: relative;
  padding-left: 24px;
  color: var(--ink-soft);
  font-size: 15px;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.primary,
.answer {
  appearance: none;
  font: inherit;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.08s ease, border-color 0.12s ease, background 0.12s ease;
}

.primary {
  border: 0;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 22px;
  border-radius: 999px;
}

.primary:active,
.answer:active { transform: scale(0.98); }

.primary:disabled,
.answer:disabled {
  opacity: 0.55;
  cursor: default;
}

.drill {
  display: none;
  margin-top: 18px;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.drill.is-visible {
  display: block;
}

.drill ol {
  margin: 0;
  padding-left: 22px;
  color: var(--ink-soft);
}

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

.question-card {
  min-height: 300px;
}

.answers {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.answer {
  border: 1px solid var(--rule);
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--ink);
  font-size: 15px;
  text-align: left;
}

.answer:hover:not(:disabled) {
  border-color: var(--accent);
}

.answer.is-correct {
  border-color: rgba(47, 138, 74, 0.28);
  background: rgba(47, 138, 74, 0.10);
  color: var(--good);
}

.answer.is-wrong {
  border-color: rgba(192, 57, 43, 0.20);
  background: rgba(192, 57, 43, 0.08);
  color: var(--bad);
}

.feedback {
  width: 100%;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  background: var(--accent-soft);
  color: var(--ink-soft);
  line-height: 1.5;
}

.case-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 760px;
  margin: 0 auto;
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--accent);
  color: white;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

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

.case-steps div {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--ink-soft);
  font-size: 14px;
}

.dialog {
  width: min(760px, calc(100% - 28px));
  padding: 32px 28px;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  color: var(--ink);
}

.dialog::backdrop {
  background: rgba(20, 15, 10, 0.45);
}

.icon-button {
  appearance: none;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.dialog h2 {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.1;
  font-weight: 500;
  margin: 0 34px 12px 0;
}

.dialog h3 {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 8px;
  font-weight: 600;
}

.dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.dialog-grid div,
.selfcheck {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.selfcheck {
  margin-top: 10px;
}

@media (max-width: 760px) {
  .studio { padding: 20px 16px 40px; }

  .studio__nav {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .studio__nav span { display: none; }

  .modes {
    overflow-x: auto;
    justify-content: flex-start;
    margin-bottom: 30px;
  }

  .mode-btn { white-space: nowrap; }

  .intro h2 { font-size: 36px; }

  .two-col,
  .case-steps,
  .dialog-grid {
    grid-template-columns: 1fr;
  }
}
