:root {
  --bg: #ffffff;
  --fg: #1f2328;
  --muted: #656d76;
  --border: #d0d7de;
  --accent: #0969da;
  --accent-fg: #ffffff;
  --error: #cf222e;
  --ui-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --editor-font: ui-monospace, "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --fg: #e6edf3;
    --muted: #8d96a0;
    --border: #30363d;
    --accent: #4493f8;
    --accent-fg: #0d1117;
    --error: #ff7b72;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  display: flex;
  flex-direction: column;
  font-family: var(--ui-font);
  background: var(--bg);
  color: var(--fg);
}

/* ── Topbar ── */

#topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

#filename {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  font-weight: 600;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
}
#filename:hover:not(:disabled) { border-color: var(--border); }
#filename:focus { border-color: var(--accent); outline: none; }
#filename:disabled { opacity: 1; -webkit-text-fill-color: var(--fg); }

.dot { color: var(--accent); font-size: 12px; }

#status { color: var(--muted); font-size: 13px; white-space: nowrap; }
#status.error { color: var(--error); }

.badge {
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
}

button {
  font: inherit;
  font-weight: 600;
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
}
button:hover:not(:disabled) { filter: brightness(1.08); }
button:disabled { opacity: 0.5; cursor: default; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Main ── */

main {
  flex: 1;
  display: flex;
  min-height: 0;
}

#editor {
  flex: 1;
  width: 100%;
  padding: 20px 24px;
  border: none;
  outline: none;
  resize: none;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 var(--editor-font);
  tab-size: 4;
}

.panel {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 540px;
  padding: 32px;
  text-align: center;
}

.logo {
  width: 72px;
  height: 72px;
}

.points {
  text-align: left;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  padding-left: 20px;
}
.points li { margin-top: 6px; }
.panel h1 { font-size: 22px; }
.panel .muted { color: var(--muted); font-size: 14px; }
.panel code {
  font-family: var(--editor-font);
  font-size: 0.9em;
  background: color-mix(in srgb, var(--border) 40%, transparent);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ── Statusbar ── */

#statusbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.brand {
  color: var(--muted);
  text-decoration: none;
}
.brand:hover { color: var(--accent); text-decoration: underline; }
