/* ── Drill page — premium minimal, desktop-first ──────────────────
   No tabs, no clutter. The page is a stage for one daily ritual:
   open Drill → see how many words today → press Begin. Mini-games
   sit below as a quieter secondary path.

   Composition: centered editorial column, generous breathing room.
   Mobile gets a stacked, tightened version of the same layout.
*/

body.is-drill .stub-shell { overflow: hidden; }
body.is-drill .stub-body.is-drill-body {
  padding: 0;
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  display: flex;
  align-items: stretch;
  justify-content: center;
  /* Subtle warm radial behind the stage — gives the page depth without
     distracting. Uses brand cream + a faint warm light spot. */
  background:
    radial-gradient(ellipse at 50% 30%, rgba(192, 138, 62, 0.06) 0%, transparent 55%),
    var(--bg, #fdf9f1);
}

.drill-page {
  width: 100%;
  max-width: 720px;
  padding: 4vh 2.5rem 3vh;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-sizing: border-box;
  animation: drillFadeIn 0.55s ease-out both;
}
@keyframes drillFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.drill-loading,
.drill-empty {
  margin: auto;
  text-align: center;
  color: var(--ink-soft, #6b6f78);
  padding: 2rem 1rem;
  max-width: 32ch;
}
.drill-empty h3 { margin: 0 0 .5rem; color: var(--ink); font-family: 'Fraunces', serif; }
.drill-empty p { margin: 0; line-height: 1.55; }
.drill-empty code {
  font-family: 'SF Mono', Menlo, monospace;
  background: var(--line-soft, #e8e2d6);
  padding: .15rem .4rem;
  border-radius: 4px;
  font-size: .85em;
}

/* ─── Hero ─── */
.drill-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 2.5vh;
}
.drill-eyebrow {
  font-size: .7rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--brand-accent, #c08a3e);
  margin-bottom: 1.25rem;
}
.drill-numeral {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(6rem, 14vw, 10rem);
  line-height: 0.92;
  color: var(--ink, #1a1d23);
  letter-spacing: -0.04em;
  font-feature-settings: "lnum";
  /* Gentle warm-shadow gives weight without feeling heavy */
  text-shadow: 0 2px 0 rgba(192, 138, 62, 0.06);
}
.drill-numeral-label {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 1.45rem;
  color: var(--ink-soft, #6b6f78);
  margin-top: .5rem;
}
.drill-status {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: var(--ink-soft, #6b6f78);
  margin: 1.25rem 0 1.75rem;
  max-width: 28ch;
  line-height: 1.5;
}

/* CTA */
.drill-cta-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.drill-cta {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  background: var(--ink, #1a1d23);
  color: var(--bg, #fdf9f1);
  border: none;
  padding: 1.05rem 2.2rem;
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: .98rem;
  font-weight: 600;
  letter-spacing: .005em;
  cursor: pointer;
  transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s, background .18s;
  box-shadow: 0 6px 18px rgba(26, 29, 35, 0.18), 0 1px 2px rgba(26, 29, 35, 0.12);
}
.drill-cta:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(26, 29, 35, 0.24), 0 2px 4px rgba(26, 29, 35, 0.14);
  background: #2a2f3a;
}
.drill-cta:not(:disabled):active { transform: translateY(0); }
.drill-cta:disabled {
  background: var(--line, #d9d2c1);
  color: var(--ink-soft);
  cursor: default;
  box-shadow: none;
}
.drill-cta-arrow {
  font-size: 1.05rem;
  transition: transform .2s ease-out;
}
.drill-cta:not(:disabled):hover .drill-cta-arrow { transform: translateX(4px); }
.drill-cta-meta {
  font-size: .85rem;
  color: var(--ink-soft, #6b6f78);
  font-weight: 500;
}

/* ─── Divider ─── */
.drill-divider {
  position: relative;
  margin: 4vh 0 3vh;
  text-align: center;
}
.drill-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line, #d9d2c1);
}
.drill-divider-mark {
  position: relative;
  display: inline-block;
  background: var(--bg, #fdf9f1);
  color: var(--brand-accent, #c08a3e);
  padding: 0 1rem;
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  line-height: 1;
}

/* ─── Mini-game grid ─── */
.drill-mini-eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: .82rem;
  font-weight: 500;
  color: var(--ink-soft, #6b6f78);
  text-align: center;
  margin-bottom: 1.25rem;
}
.drill-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.drill-mini-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .85rem;
  padding: 1.35rem 1.2rem 1.15rem;
  background: var(--bg, #fdf9f1);
  border: 1px solid var(--line, #d9d2c1);
  border-radius: 16px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform .22s cubic-bezier(.2,.8,.2,1), border-color .2s, box-shadow .22s, background .2s;
  min-height: 150px;
}
/* Subtle warm gradient backplate — barely visible until hover, but adds
   a hint of depth to the otherwise flat cream card. */
.drill-mini-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 100% 0%, rgba(192, 138, 62, 0.06) 0%, transparent 60%);
  opacity: .7;
  pointer-events: none;
  transition: opacity .22s;
}
/* Bottom accent line — animates to full width on hover, like a magazine
   "more" indicator. */
.drill-mini-card::after {
  content: '';
  position: absolute;
  left: 1.2rem;
  right: 1.2rem;
  bottom: 0;
  height: 2px;
  background: var(--brand-accent, #c08a3e);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.drill-mini-card:not(:disabled):hover {
  transform: translateY(-4px);
  border-color: rgba(26, 29, 35, 0.4);
  box-shadow: 0 14px 32px rgba(26, 29, 35, 0.1), 0 2px 6px rgba(26, 29, 35, 0.04);
}
.drill-mini-card:not(:disabled):hover::before { opacity: 1; }
.drill-mini-card:not(:disabled):hover::after { transform: scaleX(1); }
.drill-mini-card:disabled,
.drill-mini-card.is-disabled {
  opacity: .45;
  cursor: default;
}

/* Letter badge — postage-stamp style monogram. Larger, serif, with a
   warm gradient + inner highlight to feel printed-on rather than flat. */
.drill-mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d49a4d 0%, #b07930 100%);
  color: var(--bg, #fdf9f1);
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 2px 6px rgba(192, 138, 62, 0.25);
}

.drill-mini-title {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink, #1a1d23);
  line-height: 1.25;
  letter-spacing: -0.005em;
  position: relative;
  z-index: 1;
}
.drill-mini-sub {
  font-size: .82rem;
  color: var(--ink-soft, #6b6f78);
  line-height: 1.5;
  margin-top: -.4rem;
  position: relative;
  z-index: 1;
}


/* ─── Footer ─── */
.drill-foot {
  margin-top: auto;
  padding-top: 2vh;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .8rem;
  color: var(--ink-soft, #6b6f78);
  font-weight: 500;
}
.drill-foot-deck { letter-spacing: .04em; }
.drill-foot-streak { font-family: 'Inter', sans-serif; }

/* God-only debug strip — visible only to god accounts */
.drill-god-strip {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  margin-top: .85rem;
  background: rgba(26, 29, 35, 0.04);
  border: 1px dashed rgba(26, 29, 35, 0.15);
  border-radius: 8px;
  font-size: .72rem;
}
.drill-god-label {
  color: var(--ink-soft, #6b6f78);
  font-weight: 600;
  letter-spacing: .08em;
  margin-right: .25rem;
}
.drill-god-btn {
  background: transparent;
  border: 1px solid rgba(26, 29, 35, 0.2);
  color: var(--ink, #1a1d23);
  padding: .35rem .7rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: .72rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.drill-god-btn:hover { background: rgba(26, 29, 35, 0.06); border-color: rgba(26, 29, 35, 0.4); }
.drill-god-btn.is-danger { color: #b04444; border-color: rgba(176, 68, 68, 0.3); }
.drill-god-btn.is-danger:hover { background: rgba(176, 68, 68, 0.06); border-color: rgba(176, 68, 68, 0.5); }

/* ─── Responsive ─── */
@media (max-width: 760px) {
  .drill-page { padding: 3vh 1.25rem 2vh; max-width: 520px; }
  .drill-numeral-label { font-size: 1.2rem; }
  .drill-status { font-size: .95rem; margin: 1rem 0 1.4rem; }
  .drill-cta { padding: .9rem 1.7rem; font-size: .92rem; }
  .drill-divider { margin: 3vh 0 2.5vh; }
  .drill-mini-grid { gap: .75rem; }
  .drill-mini-card { padding: 1rem .9rem .9rem; min-height: 118px; }
  .drill-mini-title { font-size: .9rem; }
  .drill-mini-sub { font-size: .75rem; }
  .drill-mini-count { font-size: 1.25rem; bottom: .8rem; right: .9rem; }
}
@media (max-width: 480px) {
  .drill-page { padding: 2vh 1rem 1.5vh; }
  .drill-mini-grid { grid-template-columns: 1fr; gap: .6rem; }
  .drill-mini-card { min-height: 0; flex-direction: row; align-items: center; gap: .8rem; padding: .75rem .9rem; }
  .drill-mini-card .drill-mini-sub { display: none; }
  .drill-mini-count { position: static; margin-left: auto; }
  .drill-foot { flex-direction: column; gap: .25rem; }
}

/* Editor entry — visible to god / editor / teacher / headmaster.
   Sits below the streak footer, low-key but findable. */
.drill-edit-btn {
  display: inline-flex; align-items: center; gap: .45rem;
  margin: 1.5rem auto 0;
  padding: .55rem 1rem;
  font-size: .85rem; font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 999px;
  transition: color .15s, border-color .15s, background .15s, transform .15s;
}
.drill-edit-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
  border-style: solid;
  transform: translateY(-1px);
}
.drill-page > .drill-edit-btn { display: flex; width: max-content; }

/* ─── Trust pill (Leitner / memory science authority signal) ─── */
.drill-trust-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  margin: .6rem auto 0;
  padding: .3rem .75rem;
  font-size: .72rem; font-weight: 600; letter-spacing: .005em;
  color: var(--ink-soft);
  background: var(--bg-tint, #f4ecdc);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s, transform .15s;
}
.drill-trust-pill:hover {
  color: var(--ink);
  border-color: var(--ink);
  transform: translateY(-1px);
}
.drill-trust-pill svg { color: #2a8f5a; flex-shrink: 0; }

/* Trust modal */
.drill-trust-bg {
  position: fixed; inset: 0;
  background: rgba(20,15,10,0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 1.5rem;
  z-index: 200;
  overflow-y: auto;
}
.drill-trust-modal {
  position: relative;
  width: 100%; max-width: 560px;
  padding: 2rem 2rem 1.7rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 56px -16px rgba(0,0,0,0.28);
  animation: drillTrustLift .18s ease-out;
}
@keyframes drillTrustLift {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.drill-trust-x {
  position: absolute; top: .85rem; right: .85rem;
  width: 32px; height: 32px;
  background: transparent; border: none;
  border-radius: 8px;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.drill-trust-x:hover { background: rgba(0,0,0,0.06); color: var(--ink); }
.drill-trust-eyebrow {
  font-size: .65rem; font-weight: 700; letter-spacing: .15em;
  color: #2a8f5a;
  margin-bottom: .55rem;
}
.drill-trust-h {
  font-size: 1.5rem; line-height: 1.2;
  color: var(--ink);
  margin: 0 0 .85rem;
  letter-spacing: -.005em;
}
.drill-trust-lede {
  font-size: .95rem; line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 1.3rem;
}
.drill-trust-lede strong { color: var(--ink); }
.drill-trust-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-bottom: 1.3rem;
}
.drill-trust-stat {
  padding: .85rem .9rem;
  background: var(--bg-tint, #f4ecdc);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}
.drill-trust-stat-n {
  font-family: var(--font-display, inherit);
  font-size: 1.5rem; font-weight: 600;
  color: var(--ink);
  letter-spacing: -.01em;
  margin-bottom: .25rem;
}
.drill-trust-stat-l {
  font-size: .72rem; line-height: 1.4;
  color: var(--ink-soft);
}
.drill-trust-stat-l em { font-style: italic; opacity: .85; }
.drill-trust-explain {
  font-size: .9rem; line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 1rem;
  padding: .9rem 1rem;
  background: var(--bg-tint, #f4ecdc);
  border-left: 3px solid var(--accent-warm, #D67659);
  border-radius: 8px;
}
.drill-trust-foot {
  font-size: .88rem; line-height: 1.55;
  color: var(--ink);
  margin: 0;
  font-weight: 500;
}
@media (max-width: 540px) {
  .drill-trust-grid { grid-template-columns: 1fr; }
  .drill-trust-stat { display: flex; align-items: center; gap: .85rem; text-align: left; }
  .drill-trust-stat-n { margin-bottom: 0; flex-shrink: 0; min-width: 70px; }
  .drill-trust-modal { padding: 1.5rem 1.4rem 1.4rem; }
}
