/* GIT PUZZLE LAB · clean dark minimal */

:root {
  color-scheme: dark;

  --bg: #0a0a0b;
  --panel: #131316;
  --panel-2: #181820;
  --field: #0c0c0f;

  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.10);
  --border-bright: rgba(255, 255, 255, 0.18);

  --text: #ededed;
  --mute: #9c9ca0;
  --faint: #6c6c70;
  --ghost: #44444a;

  --pass: #7bd194;
  --fail: #ef7869;
  --warn: #d9b771;

  --primary-bg: #ededed;
  --primary-bg-hover: #ffffff;
  --primary-fg: #0a0a0b;

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

html { height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}

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

h1, h2, h3, p { margin: 0; }
h1 { font-size: 14px; font-weight: 500; letter-spacing: -0.005em; color: var(--text); }
h2 { font-size: 28px; font-weight: 500; letter-spacing: -0.02em; color: var(--text); line-height: 1.15; }
h3 { font-size: 12px; font-weight: 500; color: var(--mute); letter-spacing: 0; text-transform: none; }

code { font-family: var(--mono); color: var(--warn); }

/* hide DOM-only elements the JS still writes to */
.legacy-hidden { display: none !important; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.002em;
  cursor: pointer;
  transition: background 100ms ease, border-color 100ms ease, color 100ms ease;
}
button:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--border-bright); }
button:active { transform: translateY(0.5px); }
button:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.32); outline-offset: 1px; }

.primary-action {
  border-color: var(--primary-bg);
  background: var(--primary-bg);
  color: var(--primary-fg);
}
.primary-action:hover { background: var(--primary-bg-hover); border-color: var(--primary-bg-hover); }

.ghost-button {
  height: 26px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--mute);
  font-size: 12px;
  font-weight: 500;
}
.ghost-button:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }

/* unified borderless icon button — plain glyph that shades on hover */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--mute);
  cursor: pointer;
  transition: color 100ms ease, background 100ms ease;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.icon-btn:active { transform: translateY(0.5px); }
.icon-btn:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.32); outline-offset: 1px; }
.icon-btn svg { width: 15px; height: 15px; display: block; }
.icon-btn .icon-glyph { font-size: 17px; font-weight: 400; line-height: 1; }

.icon-btn.primary-action {
  background: var(--primary-bg);
  color: var(--primary-fg);
}
.icon-btn.primary-action:hover {
  background: var(--primary-bg-hover);
  color: var(--primary-fg);
}

textarea:focus-visible, input:focus-visible {
  outline: 1px solid var(--border-bright);
  outline-offset: -1px;
}

/* ── App shell ───────────────────────────────────────────────────────────── */

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.brand-mark {
  position: relative;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.012em;
  white-space: nowrap;
}
.brand-mark:hover { color: var(--text); }

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-nav .puzzle-nav { display: inline-flex; }
.topbar-nav .puzzle-nav[hidden] { display: none; }

/* ── Tag list chips ──────────────────────────────────────────────────────── */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tag-list span {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
}

/* ── Home page ───────────────────────────────────────────────────────────── */

.home-page,
.user-page {
  min-height: 0;
  overflow: auto;
  padding: 36px 24px 48px;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 40px;
  align-items: start;
  max-width: 1180px;
  margin: 0 auto;
}

.home-main { min-width: 0; }

.home-header {
  margin: 8px 0 28px;
  max-width: 760px;
}
.home-header h2 {
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -0.005em;
}
.home-header p {
  margin-top: 10px;
  color: var(--mute);
  font-size: 14px;
  line-height: 1.55;
}
.home-stats {
  display: flex;
  gap: 14px;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}
.home-stats span {
  display: inline-flex;
  align-items: center;
}
.home-stats span + span::before {
  content: "·";
  margin: 0 10px 0 0;
  color: var(--ghost);
}

/* ── Filters ─────────────────────────────────────────────────────────────── */

.home-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-bottom: 16px;
}

.filter-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.filter-label {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.filter-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-select {
  height: 28px;
  min-width: 112px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--field);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
}
.filter-select.compact {
  min-width: 74px;
}
.filter-select:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.32);
  outline-offset: 1px;
}

.filter-chip {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--mute);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: capitalize;
  cursor: pointer;
  transition: background 100ms ease, border-color 100ms ease, color 100ms ease;
}
.filter-chip:hover { color: var(--text); border-color: var(--border-bright); background: rgba(255, 255, 255, 0.03); }

/* status and difficulty use distinct palettes */
.filter-chip.todo           { color: var(--text); border-color: rgba(237, 237, 237, 0.22); }
.filter-chip.started        { color: var(--warn); border-color: rgba(217, 183, 113, 0.34); }
.filter-chip.done           { color: var(--faint); border-color: rgba(156, 156, 160, 0.24); }
.filter-chip.easy           { color: var(--pass); border-color: rgba(123, 209, 148, 0.32); }
.filter-chip.medium         { color: var(--warn); border-color: rgba(217, 183, 113, 0.32); }
.filter-chip.hard,
.filter-chip.expert         { color: var(--fail); border-color: rgba(239, 120, 105, 0.32); }

.filter-chip.active {
  background: var(--primary-bg);
  border-color: var(--primary-bg);
  color: var(--primary-fg);
}
.filter-chip.todo.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.filter-chip.done.active {
  background: var(--faint);
  border-color: var(--faint);
  color: var(--bg);
}
.filter-chip.easy.active {
  background: var(--pass);
  border-color: var(--pass);
  color: var(--bg);
}
.filter-chip.started.active,
.filter-chip.medium.active {
  background: var(--warn);
  border-color: var(--warn);
  color: var(--bg);
}
.filter-chip.hard.active,
.filter-chip.expert.active {
  background: var(--fail);
  border-color: var(--fail);
  color: var(--bg);
}

/* ── Home about ──────────────────────────────────────────────────────────── */

.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 50;
  padding: 6px 12px;
  font-size: 12px;
  font-family: var(--sans);
}

.home-about {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 13px;
  line-height: 1.6;
}
.home-about p { margin: 0; }
.home-about a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--border-bright); }
.home-about a:hover { text-decoration-color: var(--text); }

/* ── Tag cloud sidebar ───────────────────────────────────────────────────── */

.home-sidebar {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 12px;
  padding-top: 8px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-chip {
  height: 24px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease, border-color 100ms ease;
}
.tag-chip:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); border-color: var(--border-strong); }
.tag-chip.active {
  color: var(--primary-fg);
  background: var(--primary-bg);
  border-color: var(--primary-bg);
}

/* ── Puzzle table ────────────────────────────────────────────────────────── */

.puzzle-table { min-width: 540px; }

.home-list-sentinel {
  height: 1px;
}

.home-list-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
}
.home-list-loader::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border: 1px solid var(--ghost);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.puzzle-row {
  position: relative;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: background 100ms ease, border-color 100ms ease;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 50px 100px;
  gap: 12px;
  align-items: stretch;
}
.puzzle-row:last-child { border-bottom: 0; }
.puzzle-row:hover {
  background: rgba(255, 255, 255, 0.04);
  border-bottom-color: transparent;
}

.puzzle-name-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  overflow: hidden;
}

.puzzle-rate-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
}

.puzzle-diff-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.puzzle-number {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
  flex-shrink: 0;
}

.puzzle-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
}
.puzzle-name.started { color: var(--warn); }
.puzzle-name.done { color: var(--faint); }

.puzzle-status-icon {
  width: 14px;
  flex: 0 0 14px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
  text-align: center;
}
.puzzle-status-icon.started::before {
  content: "●";
  color: var(--warn);
  font-size: 8px;
}
.puzzle-status-icon.done::before {
  content: "✓";
  color: var(--faint);
}

.difficulty-pill {
  width: fit-content;
  padding: 2px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--mute);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: capitalize;
}
.difficulty-pill.easy     { color: var(--pass); border-color: rgba(123, 209, 148, 0.32); }
.difficulty-pill.medium   { color: var(--warn); border-color: rgba(217, 183, 113, 0.32); }
.difficulty-pill.hard     { color: var(--fail); border-color: rgba(239, 120, 105, 0.32); }
.difficulty-pill.expert   { color: var(--fail); border-color: rgba(239, 120, 105, 0.32); }

/* ── Workspace ───────────────────────────────────────────────────────────── */

.workspace {
  min-height: 0;
  height: calc(100dvh - 96px);
  width: calc(100% - 48px);
  max-width: 1400px;
  margin: 16px auto 24px;
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.pane {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--panel);
}
.pane:last-child { border-right: 0; }

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
}
.pane-header h3 {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--mute);
  letter-spacing: 0;
  text-transform: none;
}

/* ── Files pane (no icons, inset highlight) ──────────────────────────────── */

.files-pane {
  display: grid;
  grid-template-rows: auto 1fr;
}
.file-tree {
  overflow: auto;
  padding: 0 0 8px;
}

.tree-directory,
.tree-file {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: 100%;
  min-height: 24px;
  line-height: 24px;
  padding: 0 12px;
  padding-left: calc(12px + var(--depth) * 12px);
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}

.tree-directory {
  color: var(--mute);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease;
}
.tree-directory:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.tree-disclosure {
  width: 20px;
  flex: 0 0 20px;
  color: var(--faint);
  font-size: 24px;
  line-height: 0.8;
  transform: translateY(-1px);
}

.tree-file {
  overflow: hidden;
  color: var(--mute);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease;
}
.tree-file:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.tree-file.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

/* ── Work pane: tab bar with right-side action toolbar ───────────────────── */

.work-pane {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.tabbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.tab-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: color 100ms ease, background 100ms ease;
}
.tab svg { width: 15px; height: 15px; display: block; }
.tab:hover { color: var(--mute); background: rgba(255, 255, 255, 0.06); }
.tab.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.10);
}

.tab-group {
  display: inline-flex;
  gap: 2px;
}

.work-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.puzzle-context {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 4px;
}
.puzzle-context .difficulty-pill:empty { display: none; }
.puzzle-context .tag-list { gap: 4px; }

.puzzle-nav {
  display: inline-flex;
  gap: 2px;
}

/* ── Status popover trigger (matches .icon-btn dimensions) ───────────────── */

.status-popover {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.status-trigger {
  width: auto;
  min-width: 0;
  padding: 0 10px;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.status-trigger > * {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.status-trigger.is-open {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}
#progressText {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
#progressText {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.status-pill {
  display: inline-block;
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ghost);
  font-size: 0;
  color: transparent;
  text-indent: -9999px;
  overflow: hidden;
  flex-shrink: 0;
}
.status-pill.pass { background: var(--pass); }
.status-pill.fail { background: var(--warn); }

.status-popover-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 25;
  width: 280px;
  padding: 12px 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--panel-2);
  box-shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.9);
  animation: pop-in 120ms ease;
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.status-popover-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.status-popover-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--mute);
}
.status-popover-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}

.tab-context { display: none; }

.view-panel { min-height: 0; overflow: hidden; }
.view-panel.active { display: grid; }
#terminalPanel.active,
#editorPanel.active { grid-template-rows: minmax(0, 1fr); }
#editorPanel.active { grid-template-rows: auto 1fr; }

/* ── Terminal ────────────────────────────────────────────────────────────── */

.terminal-console {
  box-sizing: border-box;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0 12px;
  background: var(--field);
}
.terminal-console .xterm {
  width: 100%;
  height: 100%;
}
.terminal-console .xterm-viewport,
.terminal-console .xterm-screen { background: transparent !important; }
.terminal-console .xterm-viewport {
  scrollbar-color: var(--faint) transparent;
  scrollbar-width: thin;
}

/* ── Editor ──────────────────────────────────────────────────────────────── */

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}

#openFileName {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  white-space: nowrap;
}

.editor-meta {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
}
.editor-meta + .editor-meta::before {
  content: "·";
  margin-right: 10px;
  color: var(--ghost);
}
#dirtyState.dirty { color: var(--warn); }

.editor-body {
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  background: var(--panel);
}

.line-numbers {
  min-width: 44px;
  overflow: hidden;
  padding: 16px 10px 16px 8px;
  border-right: 1px solid var(--border);
  color: var(--ghost);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  text-align: right;
  white-space: pre;
  user-select: none;
}

#fileEditor {
  width: 100%;
  height: 100%;
  min-height: 280px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 16px 18px;
  background: var(--panel);
  color: var(--text);
  caret-color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  tab-size: 2;
}

/* ── Checks list (lives inside popover) ──────────────────────────────────── */

.checks-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow: auto;
}

.check-item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 9px;
  align-items: start;
  padding: 7px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--mute);
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.4;
}
.check-item > span:first-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--ghost);
}
.check-item > span:first-child svg { display: block; }
.check-item.pass { color: var(--text); }
.check-item.pass > span:first-child { color: var(--pass); }
.check-item.fail { color: var(--text); }
.check-item.fail > span:first-child { color: var(--fail); }
.check-label-locked { color: var(--ghost); }
.checks-reveal-row {
  padding: 6px 6px 2px;
}
.checks-reveal-btn {
  width: 100%;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--mute);
  border-color: transparent;
  text-align: center;
}
.checks-reveal-btn:hover {
  color: var(--warn);
  border-color: rgba(217, 183, 113, 0.35);
  background: rgba(217, 183, 113, 0.04);
}

/* ── User page ───────────────────────────────────────────────────────────── */

.user-layout {
  max-width: 880px;
  margin: 0 auto;
}

.user-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 8px 0 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.user-header h2 { font-size: 32px; }
.user-header p {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
}

.user-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 1px;
  margin-bottom: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--border);
  max-width: 720px;
}
.user-summary > div {
  padding: 16px 18px 14px;
  background: var(--bg);
}
.user-summary span {
  display: block;
  color: var(--faint);
  font-size: 12px;
}
.user-summary strong {
  display: block;
  margin-top: 6px;
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.018em;
  color: var(--text);
}

.difficulty-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.difficulty-stat {
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.difficulty-stat strong {
  display: block;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
}
.difficulty-stat.easy strong { color: var(--pass); }
.difficulty-stat.medium strong { color: var(--warn); }
.difficulty-stat.hard strong,
.difficulty-stat.expert strong { color: var(--fail); }
.difficulty-stat span {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 11px;
  text-transform: capitalize;
}

/* ── Hint box ────────────────────────────────────────────────────────────── */

.hint-box {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 20;
  width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--panel-2);
  box-shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.9);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}
.hint-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.hint-label {
  color: var(--warn);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.hint-pager {
  color: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.hint-text {
  margin: 0;
}
.hint-nav {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  align-items: center;
  margin-top: 10px;
}
.hint-nav-btn {
  padding: 0 9px;
  font-size: 13px;
  color: var(--mute);
  border-color: transparent;
}
.hint-nav-btn:hover { color: var(--text); border-color: var(--border-bright); }
.hint-nav-btn:disabled { opacity: 0.25; pointer-events: none; }
.hint-nav-btn--unlock { color: var(--warn); }
.hint-nav-btn--unlock:hover {
  color: var(--warn);
  border-color: rgba(217, 183, 113, 0.4);
  background: rgba(217, 183, 113, 0.06);
}

/* ── Completion modal ────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(5, 5, 7, 0.7);
  backdrop-filter: blur(4px);
}
.complete-modal {
  width: min(380px, calc(100vw - 28px));
  padding: 22px 22px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--panel-2);
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.95);
}
.complete-modal h2 { font-size: 22px; }
.complete-modal p {
  margin-top: 8px;
  color: var(--mute);
  font-size: 14px;
  line-height: 1.5;
}
.modal-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 20px;
}
.modal-actions button {
  gap: 8px;
}

.kbd-hint {
  opacity: 0.5;
}

/* ── Misc ────────────────────────────────────────────────────────────────── */

.empty-state {
  padding: 18px 10px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}

.boot-error {
  margin: 28px;
  padding: 18px;
  border: 1px solid rgba(239, 120, 105, 0.4);
  border-radius: 6px;
  background: rgba(239, 120, 105, 0.06);
  color: var(--fail);
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .home-layout { grid-template-columns: 1fr; gap: 28px; }
  .home-sidebar { position: static; }
}

@media (max-width: 900px) {
  .topbar { padding: 0 16px; }
  .workspace {
    width: calc(100% - 32px);
    margin: 12px auto 16px;
    grid-template-columns: minmax(160px, 200px) minmax(0, 1fr);
  }
  .work-actions { flex-wrap: wrap; row-gap: 6px; }
}

@media (max-width: 760px) {
  .home-page, .user-page { padding: 24px 16px 32px; }
  .home-header h2 { font-size: 20px; }
  .user-header h2 { font-size: 26px; }
  .home-filters { gap: 16px; }
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .pane { border-right: 0; border-bottom: 1px solid var(--border); }
  .pane:last-child { border-bottom: 0; }
  .work-pane { min-height: 480px; }
  .tabbar { flex-wrap: wrap; min-height: 44px; padding: 6px 8px; }
  .work-actions { width: 100%; margin-left: 0; justify-content: flex-end; }
  .user-summary,
  .difficulty-breakdown { grid-template-columns: 1fr; }
  .user-header { flex-direction: column; align-items: flex-start; }
  .puzzle-table { min-width: 380px; }
  .puzzle-row {
    grid-template-columns: minmax(0, 1fr) 100px;
  }
  .puzzle-row > .puzzle-diff-cell { display: none; }
}
