:root {
  --ink: #1f2430;
  --muted: #667085;
  --line: #d9e0ea;
  --surface: #ffffff;
  --soft: #f5f7fb;
  --primary: #0067c7;
  --primary-ink: #ffffff;
  --secondary: #16a085;
  --warning: #b54708;
  --danger: #b42318;
  --shadow: 0 18px 42px rgba(24, 39, 75, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(0, 103, 199, 0.08), rgba(22, 160, 133, 0.05)),
    var(--soft);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

code {
  border-radius: 6px;
  background: #eef3f8;
  padding: 2px 6px;
  color: #2b3445;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 14px clamp(16px, 4vw, 34px);
  border-bottom: 1px solid rgba(217, 224, 234, 0.86);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.top-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.status-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 44px;
}

.landing-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 24px;
  align-items: stretch;
  min-height: calc(100vh - 150px);
}

.landing-copy,
.auth-card,
.pending-card,
.surface,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.landing-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(26px, 5vw, 56px);
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 14px;
  max-width: 780px;
  font-size: clamp(34px, 6vw, 62px);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 20px;
}

.lead {
  max-width: 620px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.landing-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.landing-metrics span {
  border: 1px solid rgba(0, 103, 199, 0.18);
  border-radius: 999px;
  background: #eef7ff;
  padding: 9px 12px;
  color: #004f9a;
  font-size: 13px;
  font-weight: 700;
}

.auth-card,
.pending-card {
  align-self: center;
  padding: 24px;
}

.auth-card p,
.pending-card p,
.surface p,
.metric-card p {
  color: var(--muted);
  line-height: 1.5;
}

.login-message {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--warning);
  font-size: 13px;
  font-weight: 700;
}

.primary,
.secondary,
.ghost {
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 10px 16px;
  font-weight: 800;
}

.primary {
  background: var(--primary);
  color: var(--primary-ink);
}

.secondary {
  border-color: rgba(0, 103, 199, 0.22);
  background: #edf6ff;
  color: var(--primary);
}

.ghost {
  border-color: var(--line);
  background: white;
  color: var(--ink);
}

.danger {
  color: var(--danger);
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

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

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 11px 12px;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 103, 199, 0.12);
}

textarea {
  resize: vertical;
}

.field-help {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.code-area {
  min-height: 220px;
  font-family:
    "Cascadia Code", "Fira Code", Consolas, ui-monospace, SFMono-Regular,
    monospace;
  font-size: 12px;
  line-height: 1.45;
}

.pending-card {
  max-width: 680px;
  margin: 60px auto;
}

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

.console-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
  box-shadow: var(--shadow);
}

.tab-button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 12px;
  color: var(--muted);
  text-align: left;
  font-weight: 800;
}

.tab-button.active {
  background: #edf6ff;
  color: var(--primary);
}

.workspace {
  min-width: 0;
}

.panel {
  display: none;
}

.panel.active {
  display: grid;
  gap: 18px;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
}

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

.metric-card {
  padding: 18px;
}

.metric-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 34px;
  font-weight: 900;
}

.metric-card p {
  margin-bottom: 0;
  font-weight: 700;
}

.split-grid,
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.82fr);
  gap: 18px;
}

.editor-grid .wide {
  grid-column: 1 / -1;
}

.surface {
  padding: 18px;
}

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

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.list-stack {
  display: grid;
  gap: 10px;
}

.builder-section {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 14px;
}

.builder-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.builder-heading h3,
.builder-heading p {
  margin: 0;
}

.builder-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.builder-stack,
.word-editor-list {
  display: grid;
  gap: 12px;
}

.level-editor,
.word-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 13px;
}

.level-header,
.word-editor-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

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

.item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 13px;
}

.item-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.item-card strong {
  display: block;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  border-radius: 999px;
  background: #eef3f8;
  padding: 4px 8px;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

.pill.ok {
  background: #e8f7f2;
  color: #08745f;
}

.pill.warn {
  background: #fff3e6;
  color: var(--warning);
}

.table-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) minmax(80px, 0.7fr) minmax(120px, 1fr);
  gap: 10px;
  background: white;
  padding: 11px 12px;
  color: var(--muted);
}

.table-row strong {
  color: var(--ink);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  transform: translateY(18px);
  border-radius: 8px;
  background: #1f2430;
  padding: 13px 15px;
  color: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 900px) {
  .landing-shell,
  .console-layout,
  .split-grid,
  .editor-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  main {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .landing-copy,
  .auth-card,
  .surface,
  .pending-card {
    padding: 16px;
  }

  h1 {
    font-size: 32px;
  }

  .form-pair,
  .level-header,
  .word-editor-top,
  .word-grid,
  .table-row {
    grid-template-columns: 1fr;
  }
}
