:root {
  --bg: #f4f7fc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #334155;
  --accent: #1d4ed8;
  --accent-2: #1e40af;
  --border: #b8c5d6;
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #ebf2ff 0%, var(--bg) 64%);
}

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 16px 42px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f8fbff;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
}

.home-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  font-weight: 700;
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
}

.lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.grid > section {
  min-width: 0;
}

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

h2 {
  margin: 0 0 10px;
  font-size: 1.14rem;
}

p, li { line-height: 1.45; }

.subtle {
  color: var(--muted);
  font-size: 0.95rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

a:focus-visible,
button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid #111827;
  outline-offset: 3px;
}

.problem-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.problem-tab {
  border: 1px solid var(--border);
  background: #f8fbff;
  color: var(--text);
  border-radius: 10px;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  min-height: 40px;
}

.problem-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.problem-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfdff;
  padding: 12px;
}

.hint {
  border-left: 4px solid #93c5fd;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eff6ff;
  margin: 8px 0;
}

.hint pre {
  margin: 6px 0 0;
  background: #0b1224;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: auto;
}

.hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
}

.snippet-block {
  margin-top: 6px;
}

.snippet-editor {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  overflow: hidden;
  display: none;
  background: #0b1224;
}

.snippet-fallback {
  margin: 0;
}

.mini-load {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.problem-panel.hidden { display: none; }

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

button {
  border: none;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
}

button:hover,
button:focus-visible {
  background: var(--accent-2);
}

button.ghost {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.runner textarea {
  width: 100%;
  min-height: 320px;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  resize: vertical;
  background: #0b1224;
  color: #e2e8f0;
}

.editor-host {
  width: 100%;
  height: 420px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: none;
}

.editor-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

pre.output {
  margin: 8px 0 0;
  min-height: 130px;
  max-height: 280px;
  overflow: auto;
  background: #0b1224;
  color: #e2e8f0;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 10px;
}

.callout {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  border: 1px solid #fdba74;
  background: #ffedd5;
  color: #7c2d12;
  font-size: 0.8rem;
  font-weight: 700;
}

.status.ready {
  border-color: #86efac;
  color: #14532d;
  background: #dcfce7;
}

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