:root {
  color-scheme: light;
  --canvas: #f5f5f2;
  --surface: #ffffff;
  --ink: #171915;
  --muted: #686b63;
  --faint: #8d9087;
  --line: #dedfd9;
  --line-strong: #c4c6bd;
  --accent: #536f3f;
  --accent-dark: #354a29;
  --accent-soft: #edf3e8;
  --selection: #d9e9ca;
  --code: #20231e;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1, h2, h3, p, blockquote, dl, dd { margin: 0; }
button, select { font: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }

.playground-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 28px 30px;
}

.topbar {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-area, .project-links { display: flex; align-items: center; }
.brand-area { gap: 20px; }
.project-links { gap: 13px; padding-left: 20px; border-left: 1px solid var(--line); }
.project-links a { color: var(--muted); font-size: 12px; font-weight: 650; text-decoration: none; }
.project-links a:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.brand strong { color: var(--muted); font-weight: 500; }
.brand-mark { width: 13px; height: 13px; border: 2px solid var(--accent); border-radius: 50%; box-shadow: inset 0 0 0 3px var(--canvas); background: var(--accent); }

.topbar-actions, .example-picker, .language-switch { display: flex; align-items: center; }
.topbar-actions { gap: 18px; }
.example-picker { gap: 8px; color: var(--muted); font-size: 13px; }
.example-picker select { max-width: 190px; padding: 7px 28px 7px 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: var(--surface); cursor: pointer; }
.language-switch { gap: 2px; padding-left: 18px; border-left: 1px solid var(--line); }
.language-switch button { padding: 6px 8px; border: 0; border-radius: 4px; color: var(--faint); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
.language-switch button[aria-pressed="true"] { color: var(--accent-dark); background: var(--accent-soft); }

.intro { padding: 48px 0 32px; }
.eyebrow, .pane-label, .principle-note span { color: var(--accent); font-size: 14px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.intro h1 { margin-top: 10px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(36px, 4.2vw, 60px); font-weight: 500; line-height: 1.03; letter-spacing: -.035em; }
.adapter-note { margin: -14px 0 18px; color: var(--faint); font-size: 12px; line-height: 1.5; }

.workspace { display: grid; grid-template-columns: minmax(520px, 1.08fr) minmax(430px, .92fr); min-height: 680px; border: 1px solid var(--line-strong); background: var(--surface); }
.source-pane, .context-pane { min-width: 0; }
.source-pane { border-right: 1px solid var(--line-strong); }
.context-pane { position: relative; display: flex; flex-direction: column; }
.pane-header { display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.pane-header > div { display: flex; align-items: center; gap: 13px; min-width: 0; }
.pane-header h2 { margin-top: 3px; font-size: 17px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-number { display: grid; width: 32px; height: 32px; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.try-button { padding: 8px 11px; border: 1px solid var(--accent); border-radius: 5px; color: var(--accent-dark); background: var(--accent-soft); cursor: pointer; font-size: 14px; font-weight: 650; }
.try-button:hover { background: var(--selection); }
.result-state { padding: 5px 8px; border-radius: 999px; color: var(--muted); background: var(--canvas); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.result-state.ready { color: var(--accent-dark); background: var(--accent-soft); }

.source-instruction { display: flex; align-items: center; gap: 9px; min-height: 43px; padding: 9px 20px; border-bottom: 1px solid var(--line); color: var(--muted); background: #fafaf8; font-size: 12px; }
.selection-icon { width: 13px; height: 13px; border-left: 2px solid var(--accent); border-right: 2px solid var(--accent); }
iframe { display: block; width: 100%; height: 558px; border: 0; background: var(--surface); }

.empty-state { display: grid; flex: 1; place-content: center; justify-items: center; padding: 52px; text-align: center; }
.empty-state h3 { margin-top: 24px; font-family: Georgia, "Times New Roman", serif; font-size: 25px; font-weight: 500; }
.empty-state p { max-width: 390px; margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.empty-illustration { position: relative; width: 124px; height: 92px; border: 1px solid var(--line); background: #fafaf8; }
.object-line { position: absolute; left: 22px; height: 7px; border-radius: 2px; background: #dfe1da; }
.line-one { top: 22px; width: 74px; }
.line-two { top: 41px; width: 58px; background: var(--selection); }
.line-three { top: 60px; width: 69px; }
.cursor-shape {
  position: absolute;
  z-index: 1;
  right: 14px;
  bottom: 8px;
  width: 25px;
  height: 31px;
  overflow: visible;
  fill: #ffffff;
  stroke: var(--accent-dark);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 2px rgba(23, 25, 21, 0.2));
  transform: rotate(-5deg);
}

.result-view { padding: 20px; }
.meaning-callout { padding: 18px; border-left: 3px solid var(--accent); background: var(--accent-soft); }
.meaning-callout blockquote { margin-top: 8px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(24px, 3vw, 36px); line-height: 1.15; overflow-wrap: anywhere; }
.plain-meaning { margin-top: 10px; color: var(--accent-dark); font-size: 14px; line-height: 1.5; }
.view-tabs { display: flex; gap: 22px; margin-top: 23px; border-bottom: 1px solid var(--line); }
.view-tabs button { padding: 0 1px 10px; border: 0; border-bottom: 2px solid transparent; color: var(--faint); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
.view-tabs button[aria-selected="true"] { border-color: var(--accent); color: var(--ink); }
.structure-panel { padding-top: 20px; }
.context-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.trail-item { padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: #fafaf8; }
.trail-arrow { color: var(--line-strong); }
.context-facts { display: grid; grid-template-columns: 1fr 1fr; margin-top: 18px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.context-facts > div { min-width: 0; padding: 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.context-facts dt { color: var(--faint); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.context-facts dd { margin-top: 5px; font-size: 13px; font-weight: 620; line-height: 1.35; overflow-wrap: anywhere; }
.source-evidence { margin-top: 22px; }
.evidence-view { display: grid; gap: 8px; max-height: 245px; margin-top: 9px; overflow: auto; }
.evidence-card { border: 1px solid var(--line); }
.evidence-card h3 { padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--muted); background: #fafaf8; font-size: 11px; font-weight: 650; }
.evidence-lines { display: grid; }
.evidence-line { display: grid; grid-template-columns: minmax(82px, .32fr) 1fr; gap: 9px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.evidence-line:last-child { border-bottom: 0; }
.evidence-line span { color: var(--faint); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.evidence-line p { font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.evidence-line.is-selected { background: var(--accent-soft); }
.json-panel { padding-top: 18px; }
.json-panel pre { max-height: 455px; margin: 0; overflow: auto; padding: 16px; border-radius: 4px; color: #dce6d4; background: var(--code); font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }

.principle-note { display: flex; gap: 28px; align-items: flex-end; justify-content: space-between; padding: 24px 2px 0; }
.principle-note > div { display: flex; gap: 18px; align-items: baseline; }
.principle-note p { color: var(--muted); font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.45; }
.principle-note a { flex: 0 0 auto; color: var(--accent-dark); font-size: 12px; font-weight: 650; text-decoration: none; }
.principle-note a:hover { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; }
  .source-pane { border-right: 0; border-bottom: 1px solid var(--line-strong); }
  iframe { height: 520px; }
  .context-pane { min-height: 570px; }
}

@media (max-width: 640px) {
  .playground-shell { padding: 0 14px 22px; }
  .topbar { align-items: flex-start; flex-wrap: wrap; padding: 14px 0; }
  .brand-area { width: 100%; justify-content: space-between; }
  .topbar-actions { width: 100%; align-items: center; justify-content: space-between; gap: 10px; }
  .language-switch { padding-left: 0; border-left: 0; }
  .example-picker > span { display: none; }
  .example-picker select { max-width: 145px; }
  .intro { padding: 34px 0 25px; }
  .intro h1 { font-size: 36px; }
  .pane-header { padding: 13px; }
  .try-button { max-width: 125px; }
  .source-instruction { padding-inline: 13px; }
  iframe { height: 480px; }
  .result-view { padding: 14px; }
  .context-facts { grid-template-columns: 1fr; }
  .evidence-line { grid-template-columns: 72px 1fr; }
  .principle-note, .principle-note > div { align-items: flex-start; flex-direction: column; gap: 8px; }
}
