/* ==========================================================================
   STEM Challenge Studio — Snow-White Liquid Glass design system
   ========================================================================== */

@property --trace {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

:root {
  /* surfaces */
  --snow: #fcfcfd;
  --snow-2: #f6f7f9;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-soft: rgba(255, 255, 255, 0.45);
  --pearl: #e4e6ea;
  --pearl-2: #d5d8de;
  --silver: #b9bec7;

  /* text */
  --ink: #16181d;
  --charcoal: #2b2f36;
  --grey: #5b616b;
  --grey-2: #7d838d;

  /* highlights */
  --silver-light: #c9d0da;
  --silver-glint: #ffffff;
  --gold: #c9b07a;
  --gold-deep: #9c8350;
  --gold-soft: #efe5cf;

  /* depth */
  --shadow-sm: 0 1px 2px rgba(20, 24, 32, 0.04), 0 2px 8px rgba(20, 24, 32, 0.04);
  --shadow-md: 0 1px 2px rgba(20, 24, 32, 0.05), 0 10px 30px -10px rgba(20, 24, 32, 0.12);
  --shadow-lg: 0 2px 6px rgba(20, 24, 32, 0.05), 0 24px 60px -20px rgba(20, 24, 32, 0.18);
  --edge: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 -1px 0 rgba(200, 205, 214, 0.35);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --blur: 18px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --trace-time: 1.5s;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--charcoal);
  background: var(--snow);
  min-height: 100vh;
  overflow-x: hidden;
}

/* soft ambient light behind the glass — still white, just layered */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 12% -10%, #ffffff 0%, rgba(255,255,255,0) 70%),
    radial-gradient(700px 500px at 100% 0%, rgba(235, 238, 243, 0.9) 0%, rgba(235,238,243,0) 70%),
    radial-gradient(800px 600px at 50% 110%, rgba(241, 237, 228, 0.55) 0%, rgba(241,237,228,0) 70%),
    var(--snow);
}

h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.02em; }
h2 { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; font-size: 1.6rem; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 0.8em; }
a { color: var(--ink); }
img, svg { max-width: 100%; display: block; }
.muted { color: var(--grey); }
.small { font-size: 0.85rem; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* --------------------------------------------------------------------------
   Glass surfaces
   -------------------------------------------------------------------------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  border: 1px solid rgba(213, 216, 222, 0.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md), var(--edge);
}
.glass-strong { background: var(--glass-strong); }
.panel { padding: 24px; }
.panel + .panel { margin-top: 18px; }

/* --------------------------------------------------------------------------
   Signature border-light trace
   A thin light runs once around the border on hover / keyboard focus, then fades.
   .trace uses silver by default; .trace.gold or [data-glow="gold"] uses champagne gold.
   -------------------------------------------------------------------------- */
.trace { position: relative; isolation: isolate; }
.trace::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--trace),
    transparent 0deg,
    transparent 250deg,
    var(--trace-tail, rgba(201, 208, 218, 0.0)) 285deg,
    var(--trace-color, #aeb6c2) 340deg,
    var(--trace-head, #ffffff) 356deg,
    transparent 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.trace[data-glow="gold"], .trace.gold {
  --trace-color: var(--gold);
  --trace-head: #fff6e2;
  --trace-tail: rgba(201, 176, 122, 0);
}
.trace:hover::after,
.trace:focus-visible::after,
.trace:focus-within:has(:focus-visible)::after {
  animation: trace-run var(--trace-time) var(--ease) 1 forwards;
}
@keyframes trace-run {
  0%   { --trace: 0deg;   opacity: 0; }
  12%  { opacity: 1; }
  78%  { opacity: 1; }
  100% { --trace: 360deg; opacity: 0; }
}

/* keyboard focus indicator (always visible, independent of the trace) */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 8px;
}
.trace:focus-visible { outline-offset: 3px; }

/* --------------------------------------------------------------------------
   Buttons — small and elegant
   -------------------------------------------------------------------------- */
.btn {
  --h: 36px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h);
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--pearl-2);
  background: var(--glass-strong);
  color: var(--ink);
  font: 500 0.88rem/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm), var(--edge);
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: #fff; box-shadow: var(--shadow-md), var(--edge); }
.btn:active { transform: translateY(1px) scale(0.98); box-shadow: var(--shadow-sm); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary {
  background: linear-gradient(180deg, #2a2d33, #16181d);
  color: #fff;
  border-color: #16181d;
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 8px 20px -8px rgba(22,24,29,0.5);
}
.btn-primary:hover { background: linear-gradient(180deg, #33363d, #1d2026); }
.btn-ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn-ghost:hover { background: var(--glass-strong); border-color: var(--pearl); }
.btn-sm { --h: 30px; padding: 0 11px; font-size: 0.82rem; }
.btn-icon { width: var(--h); padding: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn.is-on { background: var(--gold-soft); border-color: var(--gold); }

/* --------------------------------------------------------------------------
   Layout: header + nav
   -------------------------------------------------------------------------- */
.app-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  padding: 10px 16px;
}
.app-header .bar {
  max-width: 1240px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 8px 16px;
  border-radius: 999px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink); font-weight: 600; letter-spacing: -0.01em;
  flex: none; border-radius: 999px;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 30%, #fff, #e7e9ee 60%, #cfd3da);
  border: 1px solid var(--pearl-2);
  box-shadow: var(--edge);
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-name { font-family: var(--font-display); font-weight: 500; font-size: 1.05rem; }

.main-nav { flex: 1; display: flex; justify-content: center; min-width: 0; }
.main-nav ul { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; }
.main-nav a {
  display: block; padding: 7px 11px; white-space: nowrap; border-radius: 999px;
  text-decoration: none; color: var(--grey); font-size: 0.86rem; font-weight: 500;
  transition: color 0.2s, background 0.2s;
}
.main-nav a:hover { color: var(--ink); background: rgba(255,255,255,0.8); }
.main-nav a[aria-current="page"] {
  color: var(--ink); background: #fff;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--pearl);
}
.header-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.profile-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 3px 12px 3px 3px; border-radius: 999px;
  border: 1px solid var(--pearl); background: var(--glass-strong);
  text-decoration: none; color: var(--charcoal); font-size: 0.82rem;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 600; font-size: 0.78rem;
  background: linear-gradient(145deg, #fff, #e9e4d6); color: var(--gold-deep);
  border: 1px solid var(--gold-soft);
}
.menu-toggle { display: none; }

@media (max-width: 1220px) {
  .menu-toggle { display: inline-flex; }
  .main-nav {
    position: absolute; left: 16px; right: 16px; top: calc(100% + 4px);
    display: none;
  }
  .main-nav.open { display: block; }
  .main-nav ul {
    flex-direction: column; padding: 8px;
    background: var(--glass-strong);
    -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur));
    border: 1px solid var(--pearl); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  }
  .main-nav a { padding: 10px 14px; }
  .header-actions { margin-left: auto; }
  .profile-chip .name { display: none; }
  .profile-chip { padding-right: 3px; }
}

/* --------------------------------------------------------------------------
   Page shell
   -------------------------------------------------------------------------- */
main { max-width: 1240px; margin: 0 auto; padding: 8px 16px 80px; }
.page { animation: page-in 0.45s var(--ease) both; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); filter: blur(2px); }
  to   { opacity: 1; transform: none; filter: none; }
}
.page-head { margin: 18px 0 22px; }
.page-head h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); margin-bottom: 6px; }
.page-head p { color: var(--grey); max-width: 70ch; margin: 0; }
.page-head .btn-row { margin-top: 14px; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--grey-2); margin-top: 6px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.crumbs li { display: flex; align-items: center; gap: 6px; }
.crumbs li + li::before { content: "/"; color: var(--silver); }
.crumbs a { color: var(--grey); text-decoration: none; border-radius: 4px; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs [aria-current] { color: var(--ink); }
.back-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.section { margin-top: 44px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.eyebrow {
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold-deep); font-weight: 600; margin-bottom: 6px;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 32px; align-items: center;
  padding: clamp(28px, 5vw, 56px);
  border-radius: var(--radius-lg);
  margin-top: 14px;
}
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); margin-bottom: 10px; }
.hero .subtitle { font-family: var(--font-display); font-style: italic; font-size: 1.15rem; color: var(--charcoal); }
.hero .intro { color: var(--grey); max-width: 52ch; }
.hero .btn-row { margin-top: 22px; }
.hero-art {
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #f3f4f7);
  border: 1px solid var(--pearl);
  box-shadow: var(--edge), var(--shadow-sm);
  overflow: hidden;
  aspect-ratio: 4 / 3;
}
.hero-art svg { width: 100%; height: 100%; }
.hero-stats { display: flex; gap: 22px; margin-top: 26px; flex-wrap: wrap; }
.hero-stats div { font-size: 0.8rem; color: var(--grey); }
.hero-stats strong { display: block; font-family: var(--font-display); font-weight: 500; font-size: 1.5rem; color: var(--ink); }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } .hero-art { order: -1; aspect-ratio: 16/9; } }

/* --------------------------------------------------------------------------
   Grids and cards
   -------------------------------------------------------------------------- */
.grid { display: grid; gap: 16px; }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
@media (max-width: 1100px) { .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px)  { .grid-5 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px)  { .grid-5, .grid-2 { grid-template-columns: 1fr; } }

.card {
  display: flex; flex-direction: column;
  border-radius: var(--radius);
  text-decoration: none; color: inherit;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s;
}
a.card:hover, button.card:hover, .card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--edge);
  background: var(--glass-strong);
}
a.card:active, .card.clickable:active { transform: translateY(0) scale(0.995); }

.nav-card { padding: 20px 18px 16px; min-height: 200px; }
.nav-card .icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(160deg, #fff, #eef0f3); border: 1px solid var(--pearl);
  box-shadow: var(--edge); margin-bottom: 16px; color: var(--ink);
}
.nav-card[data-glow="gold"] .icon { background: linear-gradient(160deg, #fffdf8, #f2ead9); border-color: var(--gold-soft); color: var(--gold-deep); }
.nav-card .icon svg { width: 20px; height: 20px; }
.nav-card h3 { margin-bottom: 6px; }
.nav-card p { font-size: 0.86rem; color: var(--grey); flex: 1; }
.card-go { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 600; color: var(--ink); margin-top: 8px; }
.card-go svg { width: 14px; height: 14px; transition: transform 0.25s var(--ease); }
.card:hover .card-go svg { transform: translateX(3px); }

/* challenge cards */
.ch-card { overflow: visible; }
.ch-card .thumb {
  aspect-ratio: 16 / 10; background: #f4f5f7; border-bottom: 1px solid var(--pearl);
  border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; position: relative;
}
.ch-card .thumb svg, .ch-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.ch-card .fav {
  position: absolute; top: 10px; right: 10px; z-index: 3;
}
.ch-card .body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ch-card h3 { margin: 0; font-size: 1.02rem; }
.ch-card .desc { font-size: 0.86rem; color: var(--grey); margin: 0; flex: 1; }
.ch-card .objective { font-size: 0.8rem; color: var(--charcoal); margin: 0; padding-left: 10px; border-left: 2px solid var(--gold-soft); }
.ch-card .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }

.meta { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 500; color: var(--charcoal);
  padding: 3px 9px; border-radius: 999px;
  background: rgba(255,255,255,0.85); border: 1px solid var(--pearl);
}
.tag svg { width: 12px; height: 12px; }
.tag.gold { border-color: var(--gold-soft); background: #fffbf2; color: var(--gold-deep); }

.diff { display: inline-flex; align-items: center; gap: 3px; font-size: 0.72rem; color: var(--grey); }
.diff i { width: 6px; height: 6px; border-radius: 50%; background: var(--pearl-2); display: inline-block; }
.diff i.on { background: var(--charcoal); }

/* month cards */
.month-card { padding: 20px; min-height: 180px; }
.month-card .top { display: flex; justify-content: space-between; align-items: start; }
.month-card .mi { width: 44px; height: 44px; color: var(--charcoal); opacity: 0.85; }
.month-card .count { font-size: 0.78rem; color: var(--grey); }
.month-card .count strong { font-family: var(--font-display); font-size: 1.6rem; font-weight: 500; color: var(--ink); display: block; line-height: 1; text-align: right; }
.month-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.35rem; margin: 14px 0 4px; }
.month-card p { font-size: 0.84rem; color: var(--grey); flex: 1; margin: 0 0 8px; }
.month-card.is-current { border-color: var(--gold); }
.month-card .now { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold-deep); font-weight: 600; }

/* quick access */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.quick {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 14px; text-decoration: none; color: var(--ink); font-size: 0.86rem; font-weight: 500;
}
.quick .qi { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: #fff; border: 1px solid var(--pearl); flex: none; }
.quick .qi svg { width: 16px; height: 16px; }
.quick small { display: block; color: var(--grey); font-weight: 400; font-size: 0.76rem; }

/* --------------------------------------------------------------------------
   Toolbar / filters / custom dropdown
   -------------------------------------------------------------------------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px; border-radius: var(--radius); margin-bottom: 18px;
}
.toolbar .grow { flex: 1 1 220px; }
.field-search {
  position: relative; display: flex; align-items: center;
}
.field-search svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--grey-2); pointer-events: none; }
.input, .textarea, .field-search input {
  width: 100%;
  font: inherit; font-size: 0.9rem; color: var(--ink);
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--pearl-2); border-radius: 12px;
  padding: 8px 12px;
  box-shadow: inset 0 1px 2px rgba(20,24,32,0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field-search input { padding-left: 36px; height: 36px; border-radius: 999px; }
.input:focus, .textarea:focus, .field-search input:focus { outline: none; border-color: var(--charcoal); box-shadow: 0 0 0 3px rgba(43,47,54,0.1); }
.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: #a1533f; box-shadow: 0 0 0 3px rgba(161,83,63,0.12); }
.field-error { color: #8c4434; font-size: 0.8rem; margin-top: 4px; }

.dd { position: relative; display: inline-block; min-width: 150px; }
.dd-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--pearl-2); background: rgba(255,255,255,0.92);
  font: 500 0.85rem/1 var(--font); color: var(--ink); cursor: pointer;
  box-shadow: var(--shadow-sm), var(--edge);
}
.dd-btn .lbl { color: var(--grey-2); font-weight: 400; margin-right: 2px; }
.dd-btn .val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn svg { width: 14px; height: 14px; flex: none; transition: transform 0.2s var(--ease); color: var(--grey); }
.dd[data-open="true"] .dd-btn svg { transform: rotate(180deg); }
.dd.is-set .dd-btn { border-color: var(--silver); background: #fff; }
.dd-list {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  min-width: 100%; max-height: 280px; overflow: auto;
  margin: 0; padding: 6px; list-style: none;
  background: rgba(255,255,255,0.96);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border: 1px solid var(--pearl); border-radius: 14px; box-shadow: var(--shadow-lg);
  transform-origin: top; animation: dd-in 0.16s var(--ease);
}
.dd-list[hidden] { display: none; }
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.dd-list li {
  padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: 0.86rem;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; white-space: nowrap;
}
.dd-list li[aria-selected="true"] { font-weight: 600; color: var(--ink); }
.dd-list li[aria-selected="true"]::after { content: "✓"; color: var(--gold-deep); }
.dd-list li.active { background: #f1f2f5; }
.dd-list li.reset { color: var(--grey); border-bottom: 1px solid var(--pearl); border-radius: 9px 9px 0 0; margin-bottom: 4px; }
.dd.block { display: block; width: 100%; }
.dd.block .dd-btn { border-radius: 12px; }

.result-count { font-size: 0.84rem; color: var(--grey); margin: -6px 0 14px; }

/* --------------------------------------------------------------------------
   Empty states, toasts, notices
   -------------------------------------------------------------------------- */
.empty {
  text-align: center; padding: 44px 24px; border-radius: var(--radius);
  border: 1px dashed var(--pearl-2); background: rgba(255,255,255,0.5);
}
.empty .ei { width: 48px; height: 48px; margin: 0 auto 14px; color: var(--silver); }
.empty h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.2rem; }
.empty p { color: var(--grey); max-width: 46ch; margin: 0 auto 14px; font-size: 0.9rem; }
.empty .btn-row { justify-content: center; }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px; font-size: 0.86rem;
  background: rgba(255,255,255,0.8); border: 1px solid var(--pearl);
}
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--gold-deep); }
.notice.warn { border-color: #e2cfa6; background: #fffaf0; }
.notice.error { border-color: #e3c0b6; background: #fff6f3; }
.notice.error svg { color: #8c4434; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast {
  padding: 11px 16px; border-radius: 14px; font-size: 0.86rem;
  background: rgba(22,24,29,0.92); color: #fff; box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s var(--ease);
}
.toast.out { animation: toast-out 0.25s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* --------------------------------------------------------------------------
   Challenge detail
   -------------------------------------------------------------------------- */
.detail-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.toc { position: sticky; top: 86px; padding: 14px; }
.toc h3 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--grey-2); margin: 4px 6px 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li a {
  display: flex; gap: 10px; padding: 7px 8px; border-radius: 9px; text-decoration: none;
  color: var(--grey); font-size: 0.85rem;
}
.toc li a::before { counter-increment: toc; content: counter(toc); font-size: 0.72rem; color: var(--silver); width: 14px; padding-top: 2px; }
.toc li a:hover, .toc li a.active { background: #fff; color: var(--ink); }
.toc .progress-mini { margin: 14px 6px 4px; }
@media (max-width: 900px) { .detail-layout { grid-template-columns: minmax(0, 1fr); } .toc { position: static; } .toc h3, .toc ol { display: none; } .toc .progress-mini { margin-top: 2px; } }

.overview { display: grid; grid-template-columns: 1fr 1.1fr; gap: 24px; }
.overview .img { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--pearl); background: #f4f5f7; aspect-ratio: 16/11; }
.overview .img svg, .overview .img img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 760px) { .overview { grid-template-columns: 1fr; } }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 14px 0; }
.fact { padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.7); border: 1px solid var(--pearl); }
.fact > span { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--grey-2); }
.fact strong { font-weight: 600; color: var(--ink); font-size: 0.9rem; }

.sec-title { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sec-num {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font: 600 0.8rem/1 var(--font); color: var(--ink);
  background: #fff; border: 1px solid var(--pearl-2); box-shadow: var(--edge);
}
.sec-title h2 { margin: 0; font-size: 1.35rem; }
.sec-title .spacer { flex: 1; }

.callout {
  padding: 16px 18px; border-radius: 14px; background: linear-gradient(180deg, #fff, #fbfaf6);
  border: 1px solid var(--gold-soft); font-family: var(--font-display); font-size: 1.08rem; color: var(--ink);
}

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checklist label {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-radius: 11px;
  background: rgba(255,255,255,0.7); border: 1px solid var(--pearl); cursor: pointer; transition: background 0.2s;
}
.checklist label:hover { background: #fff; }
.checklist input { margin-top: 3px; accent-color: #2b2f36; width: 16px; height: 16px; flex: none; }
.checklist input:checked + span { color: var(--grey-2); text-decoration: line-through; text-decoration-color: var(--silver); }
.checklist .qty { color: var(--grey); font-size: 0.82rem; margin-left: auto; padding-left: 10px; white-space: nowrap; }
.checklist.steps label { align-items: flex-start; }
.checklist.steps .n { font-weight: 600; color: var(--gold-deep); margin-right: 2px; }

.progress { height: 6px; background: var(--pearl); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--silver), var(--gold)); border-radius: inherit; transition: width 0.4s var(--ease); }
.progress-label { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--grey); margin-bottom: 6px; }

.safety li { margin-bottom: 6px; }
.safety-level { display: inline-flex; align-items: center; gap: 6px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
.box { padding: 14px 16px; border-radius: 14px; background: rgba(255,255,255,0.72); border: 1px solid var(--pearl); }
.box h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--grey-2); margin-bottom: 8px; }
.box ul { margin: 0; padding-left: 18px; }
.box.expected { border-color: var(--gold-soft); background: #fffdf8; }
.vocab { display: grid; gap: 8px; margin: 0; }
.vocab dt { font-weight: 600; color: var(--ink); }
.vocab dd { margin: 0 0 4px; color: var(--grey); font-size: 0.88rem; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 680px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field label, .field .label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--charcoal); margin-bottom: 6px; }
.field .hint { font-size: 0.76rem; color: var(--grey-2); margin-top: 4px; }
.save-state { font-size: 0.78rem; color: var(--grey-2); }

.attachments { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.attachments figure { margin: 0; position: relative; width: 120px; }
.attachments img { width: 120px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--pearl); }
.attachments button { position: absolute; top: 4px; right: 4px; }

.rubric { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.85rem; }
.rubric th, .rubric td { padding: 10px; border-bottom: 1px solid var(--pearl); vertical-align: top; text-align: left; }
.rubric thead th { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--grey); background: rgba(255,255,255,0.6); }
.rubric td.lvl { cursor: pointer; border-radius: 8px; transition: background 0.15s; }
.rubric td.lvl:hover { background: #fff; }
.rubric td.lvl[aria-pressed="true"] { background: #fffaf0; box-shadow: inset 0 0 0 1.5px var(--gold); }
.rubric td.lvl .pts { display: block; font-size: 0.72rem; color: var(--gold-deep); font-weight: 600; margin-top: 4px; }
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--pearl); background: rgba(255,255,255,0.6); }

/* --------------------------------------------------------------------------
   Task card (screen)
   -------------------------------------------------------------------------- */
.taskcard-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 22px; align-items: start; }
@media (max-width: 960px) { .taskcard-wrap { grid-template-columns: minmax(0, 1fr); } .side-actions { position: static; } }
.taskcard {
  background: #fff; border: 1px solid var(--pearl-2); border-radius: 18px; padding: 34px;
  box-shadow: var(--shadow-lg); color: var(--ink);
}
.taskcard header { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--ink); padding-bottom: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.taskcard header h1 { font-size: 1.9rem; margin: 2px 0 0; }
.tc-id { display: grid; gap: 8px; min-width: 220px; font-size: 0.85rem; }
.tc-id label { display: flex; gap: 8px; align-items: center; }
.tc-id input { flex: 1; border: 0; border-bottom: 1px solid var(--silver); font: inherit; padding: 2px 4px; background: transparent; }
.tc-sec { border: 1px solid var(--pearl-2); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; break-inside: avoid; }
.tc-sec h2 { font-family: var(--font); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.tc-sec h2 .n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--ink); font-size: 0.7rem; letter-spacing: 0; }
.tc-sec p, .tc-sec li { font-size: 0.9rem; }
.tc-sec ul, .tc-sec ol { margin: 0; padding-left: 20px; }
.tc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .tc-grid { grid-template-columns: 1fr; } .taskcard { padding: 20px; } }
.tc-check { list-style: none; padding: 0 !important; columns: 2; column-gap: 20px; }
.tc-check li { display: flex; gap: 8px; align-items: baseline; break-inside: avoid; margin-bottom: 4px; }
.tc-check li::before { content: ""; width: 12px; height: 12px; border: 1.5px solid var(--charcoal); border-radius: 3px; flex: none; transform: translateY(2px); }
.tc-lines { display: grid; gap: 0; }
.tc-lines textarea {
  width: 100%; border: 0; resize: vertical; min-height: 70px; font: inherit; font-size: 0.9rem;
  background: repeating-linear-gradient(transparent, transparent 27px, #d9dce1 27px, #d9dce1 28px);
  line-height: 28px; padding: 0 2px;
}
.tc-lines textarea:focus { outline: 2px solid var(--gold-soft); }
.obs-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.obs-table th, .obs-table td { border: 1px solid var(--silver); padding: 0; text-align: left; }
.obs-table th { background: #f4f5f7; padding: 7px 8px; font-size: 0.78rem; }
.obs-table input { width: 100%; border: 0; padding: 8px; font: inherit; background: transparent; min-height: 34px; }
[contenteditable="true"] { outline: 1px dashed var(--gold); outline-offset: 3px; border-radius: 4px; }
[contenteditable="true"]:focus { outline: 2px solid var(--gold); background: #fffdf7; }
.side-actions { position: sticky; top: 86px; padding: 16px; display: grid; gap: 8px; }
.side-actions .btn { justify-content: flex-start; }
.side-actions h3 { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--grey-2); margin: 4px 2px 4px; }

/* --------------------------------------------------------------------------
   Presentations
   -------------------------------------------------------------------------- */
.pres-card .thumb { aspect-ratio: 16 / 9; }
.slide-mini {
  width: 100%; height: 100%; background: #fff; padding: 10% 9%;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  font-size: 10px; overflow: hidden; position: relative;
}
.slide-mini h4 { font-family: var(--font-display); font-weight: 500; font-size: 15px; margin: 0; color: var(--ink); }
.slide-mini p { margin: 0; color: var(--grey); font-size: 10px; }
.slide-mini .bar { width: 36px; height: 2px; background: var(--gold); }

.viewer { display: grid; grid-template-rows: auto 1fr auto; gap: 14px; min-height: calc(100vh - 140px); }
.viewer-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.viewer-top h1 { font-size: 1.35rem; margin: 0; }
.viewer-body { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 14px; min-height: 0; }
.thumbs { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: calc(100vh - 230px); padding: 4px; }
.thumb-btn {
  border: 1px solid var(--pearl); border-radius: 10px; background: #fff; padding: 0; cursor: pointer;
  aspect-ratio: 16/9; overflow: hidden; position: relative; text-align: left; flex: 0 0 auto; width: 100%;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.thumb-btn[aria-current="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.thumb-btn .num { position: absolute; bottom: 4px; right: 6px; font-size: 9px; color: var(--grey); z-index: 2; }
.thumb-btn .slide-mini { padding: 8%; }
.thumb-btn .slide-mini h4 { font-size: 9px; }
.thumb-btn .slide-mini p { font-size: 6px; }
.stage-wrap { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stage {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  background: #fff; border-radius: 16px; border: 1px solid var(--pearl);
  box-shadow: var(--shadow-lg); overflow: hidden; container-type: inline-size;
}
.slide { position: absolute; inset: 0; padding: 6cqw 7cqw; display: flex; flex-direction: column; animation: slide-in 0.35s var(--ease); }
@keyframes slide-in { from { opacity: 0; transform: translateX(10px); } }
.slide .kicker { font-size: 1.4cqw; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-deep); font-weight: 600; margin-bottom: 1.4cqw; }
.slide h2 { font-size: 4cqw; margin-bottom: 2cqw; }
.slide.title-slide { justify-content: center; }
.slide.title-slide h2 { font-size: 6cqw; }
.slide .lead { font-size: 2.1cqw; color: var(--grey); max-width: 60ch; }
.slide ul, .slide ol { font-size: 2.1cqw; padding-left: 3cqw; margin: 0; display: grid; gap: 1cqw; }
.slide .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4cqw; align-items: center; flex: 1; min-height: 0; }
.slide .cols .art { border-radius: 1.4cqw; overflow: hidden; border: 1px solid var(--pearl); height: 100%; max-height: 32cqw; }
.slide .cols .art svg { width: 100%; height: 100%; object-fit: cover; }
.slide .q { font-family: var(--font-display); font-size: 3.2cqw; color: var(--ink); border-left: 0.4cqw solid var(--gold); padding-left: 2cqw; }
.slide .foot { position: absolute; bottom: 2.4cqw; left: 7cqw; right: 7cqw; display: flex; justify-content: space-between; font-size: 1.2cqw; color: var(--grey-2); }
.slide dl { font-size: 1.9cqw; display: grid; grid-template-columns: auto 1fr; gap: 1cqw 2.4cqw; margin: 0; }
.slide dt { font-weight: 600; color: var(--ink); }
.slide dd { margin: 0; color: var(--grey); }
.viewer-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.slide-count { font-size: 0.86rem; color: var(--grey); min-width: 90px; text-align: center; }
.notes { padding: 14px 16px; font-size: 0.9rem; }
.notes h3 { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--grey-2); }
.viewer.is-full { position: fixed; inset: 0; z-index: 200; background: #0f1013; padding: 18px; min-height: 0; grid-template-rows: 1fr auto; }
.viewer.is-full .viewer-top, .viewer.is-full .thumbs, .viewer.is-full .notes { display: none; }
.viewer.is-full .viewer-body { grid-template-columns: 1fr; place-items: center; }
.viewer.is-full .stage-wrap { width: min(100%, calc((100vh - 90px) * 16 / 9)); }
.viewer.is-full .viewer-controls .btn { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.18); }
.viewer.is-full .slide-count { color: #c9ccd2; }
@media (max-width: 760px) { .viewer-body { grid-template-columns: 1fr; } .thumbs { flex-direction: row; overflow-x: auto; max-height: none; order: 2; } .thumb-btn { width: 120px; } }

/* --------------------------------------------------------------------------
   Resource tools
   -------------------------------------------------------------------------- */
.tool-card { padding: 20px; min-height: 180px; }
.tool-card .icon { margin-bottom: 14px; }
.tool-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 960px) { .tool-layout { grid-template-columns: minmax(0, 1fr); } }
.tool-form { padding: 20px; display: grid; gap: 14px; position: sticky; top: 86px; }
@media (max-width: 960px) { .tool-form { position: static; } }
.tool-form { grid-template-columns: minmax(0, 1fr); }
.tool-form .row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span {
  display: inline-block; padding: 5px 11px; border-radius: 999px; font-size: 0.8rem;
  border: 1px solid var(--pearl-2); background: rgba(255,255,255,0.85); cursor: pointer; transition: all 0.15s;
}
.chip input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.86rem; }
.switch input { appearance: none; width: 36px; height: 21px; border-radius: 999px; background: var(--pearl-2); position: relative; cursor: pointer; transition: background 0.2s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform 0.2s var(--ease); }
.switch input:checked { background: var(--charcoal); }
.switch input:checked::after { transform: translateX(15px); }

.output { padding: 0; overflow: hidden; }
.output-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--pearl); background: rgba(255,255,255,0.6); }
.source-badge { font-size: 0.74rem; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--pearl-2); color: var(--grey); background: #fff; }
.source-badge.ai { border-color: var(--gold-soft); color: var(--gold-deep); background: #fffbf2; }
.doc { padding: 32px 36px; background: #fff; min-height: 420px; color: var(--ink); }
.doc h1 { font-size: 1.7rem; }
.doc h2 { font-family: var(--font); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--charcoal); margin: 22px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--pearl); }
.doc .doc-meta { color: var(--grey); font-size: 0.85rem; margin-bottom: 8px; }
.doc ol, .doc ul { padding-left: 22px; }
.doc li { margin-bottom: 6px; }
.doc .q { margin-bottom: 14px; }
.doc .opts { list-style: upper-alpha; margin-top: 4px; }
.doc .answer { color: var(--gold-deep); font-size: 0.86rem; }
.doc .write-line { display: block; border-bottom: 1px solid var(--silver); height: 26px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.doc th, .doc td { border: 1px solid var(--pearl-2); padding: 8px; text-align: left; vertical-align: top; }
.doc th { background: #f5f6f8; }
.flashcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.flashcard { border: 1px solid var(--pearl-2); border-radius: 12px; padding: 14px; min-height: 110px; background: linear-gradient(180deg, #fff, #fafafa); }
.flashcard .front { font-weight: 600; margin-bottom: 8px; }
.flashcard .back { color: var(--grey); font-size: 0.86rem; border-top: 1px dashed var(--pearl-2); padding-top: 8px; }
.doc .placeholder { color: #8c7442; background: #fff8e8; border-radius: 4px; padding: 0 3px; }
.loading { display: grid; place-items: center; gap: 14px; padding: 60px 20px; color: var(--grey); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--pearl); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Progress & settings
   -------------------------------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { padding: 16px; }
.stat strong { display: block; font-family: var(--font-display); font-weight: 500; font-size: 1.9rem; color: var(--ink); line-height: 1.1; }
.stat span { font-size: 0.8rem; color: var(--grey); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 13px; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 600; color: var(--ink); font-size: 0.92rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .s { font-size: 0.78rem; color: var(--grey); }
.list-item .progress { width: 120px; }
.settings-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--pearl); flex-wrap: wrap; }
.settings-row:last-child { border-bottom: 0; }
.settings-row .txt { max-width: 60ch; }
.settings-row .txt strong { display: block; color: var(--ink); }
.settings-row .txt span { font-size: 0.85rem; color: var(--grey); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--silver); margin-right: 6px; }
.status-dot.ok { background: #6f8f6a; }
.status-dot.bad { background: #b0786a; }

/* --------------------------------------------------------------------------
   Search overlay + dialog
   -------------------------------------------------------------------------- */
.overlay {
  position: fixed; inset: 0; z-index: 120; background: rgba(240, 241, 244, 0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px;
  animation: fade 0.2s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.search-box { width: min(640px, 100%); padding: 10px; border-radius: 20px; background: rgba(255,255,255,0.95); }
.search-box .field-search input { height: 44px; font-size: 1rem; border-radius: 14px; }
.search-results { list-style: none; margin: 8px 0 0; padding: 0; max-height: 55vh; overflow: auto; }
.search-results li a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); }
.search-results li a:hover, .search-results li a.active { background: #f2f3f6; }
.search-results .kind { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--grey-2); width: 92px; flex: none; }
.search-results .t { font-weight: 500; }
.search-results .s { font-size: 0.8rem; color: var(--grey); display: block; }
.search-hint { font-size: 0.76rem; color: var(--grey-2); padding: 8px 12px 2px; display: flex; justify-content: space-between; }
kbd { font: 500 0.72rem var(--font); border: 1px solid var(--pearl-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; background: #fff; color: var(--grey); }

.app-footer { max-width: 1240px; margin: 0 auto; padding: 24px 16px 40px; font-size: 0.8rem; color: var(--grey-2); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--pearl); }

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .trace:hover::after, .trace:focus-visible::after { animation: none !important; opacity: 1; --trace: 300deg; background: none; box-shadow: inset 0 0 0 1px var(--trace-color, #aeb6c2); -webkit-mask: none; mask: none; padding: 0; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
html.reduce-motion .trace:hover::after, html.reduce-motion .trace:focus-visible::after { animation: none !important; opacity: 1; background: none; box-shadow: inset 0 0 0 1px var(--trace-color, #aeb6c2); -webkit-mask: none; mask: none; padding: 0; }

section[id^="sec-"], #saved { scroll-margin-top: 90px; }
.rubric-doc th { width: auto; }
.doc .name-line { color: var(--grey); }

h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }
.fact .diff { font-size: 0.85rem; color: var(--ink); }
/* keep open dropdowns above neighbouring glass panels and cards */
.toolbar { position: relative; z-index: 20; }
.tool-form { z-index: 15; }
.glass:has(.dd[data-open="true"]), .page-head:has(.dd[data-open="true"]) { position: relative; z-index: 25; }
.dd[data-open="true"] { z-index: 26; }

@media (max-width: 600px) {
  .panel { padding: 18px 16px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .doc { padding: 22px 18px; }
  .hero { padding: 24px 20px; }
  .output-bar .btn-row { gap: 6px; }
}

.notice > span, .notice > div { min-width: 0; }
.notice .btn { white-space: normal; height: auto; min-height: 30px; padding-top: 5px; padding-bottom: 5px; }

.confirm-box { max-width: 440px; padding: 18px; }
.overlay { padding-top: max(10vh, env(safe-area-inset-top, 0px)); }
