/* The drill widget.
 *
 * Deliberately quiet. adlathe's equivalent is a glowing amber reactor core on a dark HUD; this is a
 * small labelled button on a light page. Two certification sites sharing one visual language read as
 * one template applied twice, and the widget is the most recognisable element on either.
 *
 * It is also a tool the owner opens dozens of times a day, not a call to action being sold to a
 * visitor — so it sits still, does not pulse, and does not ask for attention it has not earned. */

#sfx-orb-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 900;
  font: inherit;
}

/* ── the button ── */
#sfx-orb {
  display: flex;
  align-items: center;
  gap: .55rem;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  padding: .6rem 1rem .6rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .08), 0 8px 28px rgba(0, 0, 0, .06);
  transition: border-color .16s ease, box-shadow .16s ease, transform .12s ease;
}
#sfx-orb:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .1), 0 10px 32px rgba(0, 0, 0, .08);
}
#sfx-orb:active { transform: translateY(1px); }
#sfx-orb:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#sfx-orb.on { border-color: var(--accent); color: var(--accent); }

/* A filled dot rather than an icon font or an SVG: one element, no request, no glyph that renders
   differently across platforms. */
.orb-mark {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}
#sfx-orb.on .orb-mark { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }

@media (prefers-color-scheme: dark) {
  #sfx-orb { box-shadow: 0 2px 10px rgba(0, 0, 0, .5), 0 8px 28px rgba(0, 0, 0, .4); }
}

/* ── the panel ── */
#sfx-panel {
  position: fixed;
  right: 18px;
  bottom: 76px;
  top: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .06);
}
#sfx-panel[hidden] { display: none; }

#sfx-panel > header {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .6rem .7rem .6rem .95rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.p-title { font-weight: 600; font-size: .9rem; }
.p-sub {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  flex: 1;
}
.p-btn {
  font: inherit;
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-faint);
}
.p-btn:hover { color: var(--ink); border-color: var(--line); }
.p-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

#sfx-frame { flex: 1; width: 100%; border: 0; background: var(--bg); }

/* On a desktop the page gives up the width the panel occupies, so the two sit side by side rather
   than the panel covering what is being read.

   ⚠️ The reservation goes on BODY, not on `.wrap`. `.wrap` is `max-width: 44rem; margin: 0 auto`, so
   padding applied there eats into the centred box instead of moving it — measured at 1175px wide, the
   h1 was crushed from full width to 72px while the box still stretched under the panel. Narrowing the
   body lets `.wrap` re-centre inside what is left, which is what "reserve room" should mean. */
@media (min-width: 1100px) {
  html.orb-open body { padding-right: calc(var(--orb-w, 0px) + 36px); }
}

/* Below that there is nothing to sit beside, so the panel takes the screen. */
@media (max-width: 1099px) {
  #sfx-panel {
    left: 12px;
    right: 12px;
    top: 12px;
    bottom: 68px;
    width: auto !important;
  }
}

/* ── compact mode, inside the iframe ── */
/* The drill page is reused whole rather than ported. These rules trim the chrome that only makes
   sense at full width; everything functional stays exactly as it is on the standalone page. */
html.compact .wrap { padding: 1.1rem 1.1rem 2rem; max-width: none; }
html.compact .head,
html.compact .foot,
html.compact .reset-row { display: none; }
html.compact section { margin-top: 1.4rem; }
html.compact section:first-of-type { margin-top: 0; }
html.compact .q-text { font-size: 1.04rem; }
html.compact .cloze { font-size: 1rem; line-height: 2; }
/* Only the question area scrolls, so the mode bar and the Check button never scroll out of reach
   mid-answer. */
html.compact #session { display: flex; flex-direction: column; min-height: calc(100vh - 3rem); }
html.compact #session .answer-area,
html.compact #session .explain { overflow-y: auto; }
html.compact .controls { margin-top: auto; padding-top: .8rem; }
