/* base.css — tokens, reset, layout shell.
   Palette follows Tokyo Night, matching the Obsidian vault this belongs to. */

:root {
  --bg: #1a1b26;
  --bg-2: #16161e;
  --surface: #24283b;
  --surface-2: #2f334d;
  --line: #3b4261;
  --text: #c0caf5;
  --muted: #7f87b0;

  --blue: #7aa2f7;
  --green: #9ece6a;
  --red: #f7768e;
  --orange: #ff9e64;
  --yellow: #e0af68;
  --purple: #bb9af7;
  --teal: #2ac3de;

  --radius: 12px;
  --radius-sm: 7px;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

/**
 * The `hidden` attribute only sets `display:none` in the UA stylesheet, so ANY
 * author rule with an explicit `display` silently beats it. Half this app's
 * containers are flex or grid, which made `el.hidden = true` a no-op — grade
 * buttons showed before the answer, and inactive views stacked up. This rule is
 * load-bearing, not a tidy-up.
 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Segoe UI", system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.25; }
h3 { font-size: .95rem; margin-bottom: 1rem; }

.muted { color: var(--muted); }
.small { font-size: .8rem; }

/* ------------------------------------------------------------- shell */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: .7rem 1.1rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: .95rem; letter-spacing: .01em; }

.tabs { display: flex; gap: .25rem; }
.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: .4rem .85rem;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .875rem;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); border-color: var(--line); }

.toolbar { display: flex; gap: .5rem; margin-left: auto; align-items: center; flex-wrap: wrap; }

.view {
  flex: 1;
  width: 100%;
  max-width: 62rem;
  margin: 0 auto;
  padding: 1.5rem 1.1rem 2rem;
}

#view-review {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 46rem;
}

.foot {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: .9rem 1.1rem;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}

.boot, .fatal {
  margin: auto;
  padding: 2.5rem;
  text-align: center;
  max-width: 34rem;
}
.fatal h2 { color: var(--red); margin-bottom: .6rem; }

/* --------------------------------------------------------- utilities */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.1rem;
}

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

@media (max-width: 40rem) {
  .toolbar { width: 100%; margin-left: 0; }
  .view { padding: 1rem .8rem 1.5rem; }
}
