:root {
  --ink: #fffdfd;
  --ink-soft: #eef1f0;
  --muted: #cbd2d0;
  --muted-2: #98a29f;
  --canvas: #202623;
  --panel: #2e3532;
  --panel-2: #343c38;
  --panel-3: #3b4540;
  --line: #505b56;
  --line-strong: #7b8782;
  --accent: #ff715b;
  --accent-hover: #ff8b79;
  --accent-soft: rgba(255, 113, 91, .13);
  --accent-ink: #2e3532;
  --danger: #8b2635;
  --danger-soft: rgba(139, 38, 53, .22);
  --success: #cbd2d0;
  --shadow: 0 14px 42px rgba(0, 0, 0, .45);
  --topbar-h: 52px;
  --radius: 3px;
  font-family: "Segoe UI Variable Display", "Aptos Display", "Inter Tight", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  color-scheme: dark;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--canvas); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, input, textarea, select { border-radius: var(--radius); }
::selection { color: var(--accent-ink); background: var(--accent); }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border: 2px solid transparent; background: #68736e; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #89938f; background-clip: padding-box; }

.topbar {
  position: fixed;
  z-index: 100;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: 230px minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(46, 53, 50, .97);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .02);
  backdrop-filter: blur(18px) saturate(120%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
  letter-spacing: -.02em;
  text-transform: uppercase;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  border: 1px solid rgba(255, 113, 91, .72);
  color: var(--accent);
  background: rgba(255, 113, 91, .08);
  font-size: 21px;
  font-weight: 500;
  line-height: 1;
  box-shadow: inset 0 0 12px rgba(255, 113, 91, .06);
}

.brand-mark::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 5px;
  height: 5px;
  background: var(--accent);
}

.board-title-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}

.board-title {
  width: min(360px, 42vw);
  min-width: 120px;
  padding: 4px 7px;
  border: 1px solid transparent;
  color: var(--ink);
  background: transparent;
  text-align: center;
  font-size: 13px;
  font-weight: 640;
  letter-spacing: -.01em;
}

.board-title:hover { border-color: var(--line); background: var(--panel); }
.board-title:focus { border-color: var(--accent); background: var(--panel); }

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-2);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 9px;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.save-status::before {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--success);
  box-shadow: 0 0 7px rgba(203, 210, 208, .4);
}

.save-status.saving::before { background: var(--accent); animation: pulse .8s infinite; }
.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }

.button {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: var(--panel-2);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .01em;
  cursor: pointer;
  transition: border-color .14s ease, color .14s ease, background .14s ease, transform .14s ease;
}

.button:hover { border-color: var(--line-strong); color: var(--ink); background: var(--panel-3); }
.button:active { transform: translateY(1px); }
.button.primary { border-color: var(--accent); color: var(--accent-ink); background: var(--accent); font-weight: 780; }
.button.primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.button.ghost { width: 30px; padding: 0; color: var(--muted); background: transparent; font-size: 17px; }
.button.ghost:hover { color: var(--accent); background: var(--accent-soft); }
.button.danger { color: #fffdfd; border-color: #a84050; background: var(--danger-soft); }
.button.danger:hover { color: #fffdfd; border-color: #bd5362; background: var(--danger); }
.button:disabled { opacity: .35; cursor: not-allowed; transform: none; }

@keyframes pulse { 50% { opacity: .25; box-shadow: none; } }

@media (max-width: 820px) {
  .topbar { grid-template-columns: auto 1fr; gap: 8px; }
  .brand { width: 31px; font-size: 0; }
  .board-title-wrap { display: none; }
  .top-actions { grid-column: 2; }
  .top-actions .button:not(.ghost) { padding: 5px 7px; font-size: 10px; }
}

@media (max-width: 460px) {
  .topbar { padding-inline: 7px; }
  .top-actions { gap: 2px; }
  .top-actions .button:not(.ghost) { padding-inline: 5px; }
  #export-btn { font-size: 0; }
  #export-btn::after { content: "ZIP"; font-size: 10px; }
}
