/* ============================================================
   Otimeo — a timer you can feel
   ============================================================ */

:root {
  --font: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue",
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --phase: #ff7a45;
  --radius: 999px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08090b;
  --fg: #f4f3f0;
  --muted: rgba(244, 243, 240, .42);
  --faint: rgba(244, 243, 240, .22);
  --line: rgba(244, 243, 240, .12);
  --line-strong: rgba(244, 243, 240, .26);
  --surface: rgba(244, 243, 240, .05);
  --surface-strong: rgba(244, 243, 240, .10);
  --track: rgba(244, 243, 240, .07);
  --shadow: 0 24px 70px rgba(0, 0, 0, .55);
  --halo: .30;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f1ec;
  --fg: #17160f;
  --muted: rgba(23, 22, 15, .46);
  --faint: rgba(23, 22, 15, .22);
  --line: rgba(23, 22, 15, .12);
  --line-strong: rgba(23, 22, 15, .28);
  --surface: rgba(23, 22, 15, .045);
  --surface-strong: rgba(23, 22, 15, .09);
  --track: rgba(23, 22, 15, .08);
  --shadow: 0 24px 70px rgba(23, 22, 15, .16);
  --halo: .20;
}

* , *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--fg);
  background: var(--bg);
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100svh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

/* ambient halo that takes the current phase colour */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 44%,
      color-mix(in srgb, var(--phase) 16%, transparent) 0%,
      color-mix(in srgb, var(--phase) 6%, transparent) 34%,
      transparent 66%);
  opacity: var(--halo);
  transition: background 1.1s linear, opacity .6s var(--ease);
}

/* film grain — barely there, keeps the dark from looking flat */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .038;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- header ---------- */

.app-header {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(14px, 2.2vh, 26px) clamp(18px, 3vw, 40px);
  transition: opacity .45s var(--ease);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .24em;
  text-transform: uppercase;
  transition: color .3s var(--ease);
}
.brand:hover { color: var(--fg); }
.brand-o { width: 17px; height: 17px; display: block; }

.icon-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color .25s var(--ease), background .25s var(--ease), border-color .25s var(--ease);
}
.icon-btn:hover { color: var(--fg); background: var(--surface); border-color: var(--line); }
.icon-btn svg {
  width: 19px; height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#soundBtn .ico-mute { display: none; }
#soundBtn[aria-pressed="true"] .ico-mute { display: block; }
#soundBtn[aria-pressed="true"] .ico-sound { display: none; }

/* ---------- stage ---------- */

.stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vh, 34px);
  min-height: 0;
  padding-bottom: clamp(4px, 1.5vh, 16px);
}

.ring-wrap {
  position: relative;
  width: min(84vw, 58vh, 620px);
  aspect-ratio: 1;
  container-type: inline-size;
  animation: sway 11s ease-in-out infinite;
  will-change: transform;
}

@keyframes sway {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.006); }
}

.ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ring circle {
  fill: none;
  stroke-linecap: round;
  transform-box: view-box;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}

.ring .track { stroke: var(--track); stroke-width: 20; }

/* layered strokes instead of an SVG blur filter: no filter-region clipping,
   cheaper to paint, same falloff */
.ring .halo {
  stroke: var(--phase);
  stroke-width: 62;
  opacity: .07;
}

.ring .glow {
  stroke: var(--phase);
  stroke-width: 33;
  opacity: .16;
  animation: breathe 7s ease-in-out infinite;
}

.ring .progress {
  stroke: var(--phase);
  stroke-width: 21;
}

@keyframes breathe {
  0%, 100% { opacity: .12; }
  50%      { opacity: .24; }
}

body.is-running .ring .glow { animation-duration: 4.6s; }

/* digits */
.face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  user-select: none;
}

.time {
  font-size: 16.5cqw;
  font-weight: 200;
  line-height: .92;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--fg);
  opacity: .94;
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}

.hint {
  margin-top: 2.2cqw;
  font-size: 2.35cqw;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  transition: opacity .45s var(--ease), color .6s var(--ease);
  white-space: nowrap;
}

body.is-quiet .time,
body.is-quiet .hint { opacity: 0; transform: translateY(4px); }

body.is-done .time { opacity: .55; }
body.is-done .hint { color: var(--fg); opacity: .7; }

/* clickable ring surface */
.ring-hit {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: transparent;
  font-size: 0;
}
.ring-hit:focus-visible {
  outline: 2px solid var(--phase);
  outline-offset: 22px;
  border-radius: 50%;
}

/* ---------- controls ---------- */

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 2vh, 20px);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}

.presets {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}

body.is-running .presets { opacity: 0; transform: translateY(8px); pointer-events: none; }

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  min-width: 46px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color .2s var(--ease), background .2s var(--ease),
              border-color .2s var(--ease), transform .15s var(--ease);
}
.chip:hover { color: var(--fg); border-color: var(--line-strong); }
.chip:active { transform: scale(.97); }
.chip.is-active {
  color: var(--fg);
  background: var(--surface-strong);
  border-color: var(--line-strong);
}

.chip-custom { letter-spacing: .12em; color: var(--faint); }
.chip-custom:hover { color: var(--muted); }

.custom-form {
  display: flex;
  align-items: center;
  gap: 8px;
  animation: rise .25s var(--ease);
}
.custom-form[hidden] { display: none; }
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.custom-form input[type="number"] {
  appearance: none;
  width: 88px;
  padding: 9px 12px;
  font: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}
.custom-form input[type="number"]:focus { border-color: var(--line-strong); }
.custom-form input::-webkit-outer-spin-button,
.custom-form input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.custom-unit { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.chip-go { min-width: 0; }

.primary-row { display: flex; align-items: center; gap: 10px; }

.btn {
  appearance: none;
  font: inherit;
  font-size: 13.5px;
  letter-spacing: .04em;
  padding: 13px 30px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  transition: background .25s var(--ease), border-color .25s var(--ease),
              transform .15s var(--ease), opacity .25s var(--ease);
}
.btn:hover { background: var(--surface-strong); border-color: var(--line-strong); }
.btn:active { transform: scale(.98); }

.btn.primary {
  background: var(--fg);
  color: var(--bg);
  border-color: transparent;
  font-weight: 500;
  padding-inline: 38px;
  box-shadow: 0 6px 26px color-mix(in srgb, var(--fg) 12%, transparent);
}
.btn.primary:hover { background: var(--fg); opacity: .92; }

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  padding-inline: 20px;
}
.btn.ghost:hover { color: var(--fg); background: var(--surface); }

.btn[hidden] { display: none; }

/* ---------- footer ---------- */

.app-footer {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(12px, 2vh, 22px) clamp(18px, 3vw, 40px);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--faint);
  transition: opacity .45s var(--ease);
}

.foot-right { display: flex; align-items: center; gap: 2px; }
.foot-center { color: var(--faint); white-space: nowrap; }
.foot-left { min-width: 0; }
.today { white-space: nowrap; }
.today:empty { display: none; }

/* ---------- sheet ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: transparent;
  opacity: 0;
  animation: fade .2s var(--ease) forwards;
}
@keyframes fade { to { opacity: 1; } }

@media (max-width: 560px) {
  .scrim { background: rgba(0, 0, 0, .36); }
}

.sheet {
  position: fixed;
  z-index: 11;
  top: clamp(58px, 8vh, 86px);
  right: clamp(16px, 3vw, 40px);
  width: min(330px, calc(100vw - 32px));
  padding: 6px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(28px) saturate(1.3);
  -webkit-backdrop-filter: blur(28px) saturate(1.3);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-8px) scale(.985);
  pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.sheet.open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
}
.sheet-row + .sheet-row { margin-top: 2px; }
.sheet-col { flex-direction: column; align-items: stretch; gap: 9px; }

.sheet-label {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.seg button {
  flex: 1;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 7px 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease);
  white-space: nowrap;
}
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"] {
  background: var(--surface-strong);
  color: var(--fg);
}

.switch {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  width: 46px;
  height: 27px;
  border-radius: 999px;
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: background .25s var(--ease), border-color .25s var(--ease);
}
.switch-dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--fg);
  opacity: .5;
  transition: transform .25s var(--ease), opacity .25s var(--ease);
}
.switch[aria-checked="true"] { background: color-mix(in srgb, var(--phase) 26%, transparent); border-color: color-mix(in srgb, var(--phase) 50%, transparent); }
.switch[aria-checked="true"] .switch-dot { transform: translateX(19px); opacity: 1; }

.range {
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: var(--line);
  outline: none;
  cursor: pointer;
}
.range::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--fg);
  border: 0;
}

.sheet-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 12px;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------- states ---------- */

body.ui-hidden .app-header,
body.ui-hidden .app-footer,
body.ui-hidden .controls { opacity: 0; pointer-events: none; }

body.is-fullscreen .app-header,
body.is-fullscreen .app-footer { opacity: 0; pointer-events: none; }
body.is-fullscreen .ring-wrap { width: min(78vw, 82vh, 900px); }
body.is-fullscreen .controls { opacity: 0; }
body.is-fullscreen:not(.ui-hidden) .controls { opacity: 1; }

body.is-done .ring .glow { animation: done 2.4s ease-out 1; }

@keyframes done {
  0%   { opacity: .16; }
  30%  { opacity: .40; }
  100% { opacity: .12; }
}

/* ---------- accessibility ---------- */

.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;
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .ring-wrap { animation: none; }
}

/* ---------- small screens ---------- */

@media (max-width: 560px) {
  .ring-wrap { width: min(86vw, 46vh, 520px); }
  .foot-center { display: none; }
  .time { font-size: 17cqw; }
  .sheet {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    border-radius: 22px 22px 0 0;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    transform: translateY(12px);
  }
  .sheet.open { transform: none; }
  .btn { padding: 12px 24px; }
}

@media (max-height: 640px) {
  .ring-wrap { width: min(60vh, 84vw, 460px); }
  .foot-center { display: none; }
}


/* ============================================================
   v0.2 — shared chrome, navigation, help, toast
   ============================================================ */

.app-header { gap: 18px; }

.nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 26px);
  margin: 0 auto;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  padding: 6px 2px;
  position: relative;
  transition: color .25s var(--ease);
  white-space: nowrap;
}

.nav a:hover { color: var(--fg); }

.nav a[aria-current="page"] { color: var(--fg); }

.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--phase);
  transform: translateX(-50%);
}

.header-actions { display: flex; align-items: center; gap: 2px; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: clamp(70px, 9vh, 96px);
  transform: translate(-50%, 10px);
  z-index: 40;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  color: var(--fg);
  font-size: 12.5px;
  letter-spacing: .02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* shortcuts */
.help {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s var(--ease);
}
.help.open { opacity: 1; pointer-events: auto; }

.help-panel {
  width: min(380px, 100%);
  padding: 8px 8px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  box-shadow: var(--shadow);
}

.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

.help-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--fg);
}
.help-row kbd {
  min-width: 62px;
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--muted);
  text-align: center;
}

.help-note {
  margin: 12px 16px 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--faint);
}

body.is-help .app-header,
body.is-help .app-footer { opacity: .35; }

/* ring interaction */
.ring-hit { touch-action: none; }
body:not(.is-running):not(.is-done) .ring-hit { cursor: grab; }
body.is-scrubbing .ring-hit { cursor: grabbing; }
body.is-scrubbing .time,
body.is-scrubbing .hint { opacity: 1 !important; transform: none !important; }

@media (max-width: 760px) {
  .app-header {
    flex-wrap: wrap;
    row-gap: 8px;
    padding-bottom: 6px;
  }
  .brand { order: 1; }
  .header-actions { order: 2; margin-left: auto; }
  .nav {
    order: 3;
    width: 100%;
    margin: 0;
    justify-content: center;
    gap: 18px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px 0 4px;
  }
  .nav::-webkit-scrollbar { display: none; }
}


/* ============================================================
   v0.2 — content pages
   ============================================================ */

body:not([data-page="home"]) {
  height: auto;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
}

.page {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: clamp(28px, 6vh, 72px) clamp(20px, 4vw, 40px) clamp(60px, 9vh, 120px);
  display: flex;
  flex-direction: column;
  gap: clamp(36px, 6vh, 76px);
}

.page--center {
  min-height: 62vh;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 720px;
}

.hero--center { align-items: center; }

.eyebrow {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--phase);
  transition: color .8s var(--ease);
}

.page-h1 {
  margin: 0;
  font-size: clamp(36px, 5.6vw, 68px);
  font-weight: 200;
  line-height: 1.02;
  letter-spacing: -.035em;
}

.lede {
  margin: 0;
  max-width: 60ch;
  font-size: clamp(15px, 1.5vw, 17.5px);
  line-height: 1.62;
  color: var(--muted);
}

.section-title {
  margin: 0 0 16px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
}

.prose { max-width: 640px; }
.prose h2 {
  margin: 0 0 12px;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 300;
  letter-spacing: -.02em;
}
.prose p {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.68;
  color: var(--muted);
}

/* ---------- tool card ---------- */

.tool-card {
  width: 100%;
  padding: clamp(22px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--fg) 4%, transparent),
    color-mix(in srgb, var(--fg) 1.5%, transparent));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 3.4vh, 34px);
}

.tool-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.tool-note {
  margin: 0;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--faint);
  text-align: center;
  max-width: 56ch;
}

.today-line {
  margin: 0;
  min-height: 1em;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------- mini ring ---------- */

.mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 3vh, 26px);
  width: 100%;
}

.mini-ring { width: min(74vw, 42vh, 400px); }

.mini-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ---------- classroom activities ---------- */

.activity-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.activity {
  appearance: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 18px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .25s var(--ease), background .25s var(--ease), transform .15s var(--ease);
}

.activity:hover { border-color: var(--line-strong); }
.activity:active { transform: scale(.985); }

.activity strong {
  font-size: 26px;
  font-weight: 250;
  letter-spacing: -.02em;
  line-height: 1;
}

.activity span {
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.activity.is-active {
  border-color: color-mix(in srgb, var(--phase) 55%, transparent);
  background: color-mix(in srgb, var(--phase) 9%, transparent);
}

/* ---------- steps ---------- */

.steps ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.steps li {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-left: 38px;
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--muted);
}

.steps strong { font-weight: 500; font-size: 14px; }
.steps span {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}

.steps--compact strong { font-weight: 400; font-size: 13.5px; color: var(--muted); }

/* ---------- stream ---------- */

.field-label {
  align-self: flex-start;
  font-size: 10.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
}

.copy-row {
  display: flex;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
}

.copy-field {
  flex: 1 1 300px;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--muted);
  overflow-x: auto;
  white-space: nowrap;
}

.stream-grid {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  width: 100%;
  align-items: center;
}

.preview-frame {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  border-radius: 26px;
  border: 1px solid var(--line);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 122, 69, .14), transparent 62%),
    #0b0c10;
  display: grid;
  place-items: center;
}

.preview-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.preview-caption {
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .38);
  pointer-events: none;
}

/* ---------- embed ---------- */

.embed-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
}

.embed-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  color: var(--fg);
}

.field input[type="number"],
.field select {
  appearance: none;
  width: 120px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  text-align: right;
  outline: none;
  cursor: pointer;
}

.field select { width: auto; }
.field select option { background: #101114; color: #f2f1ee; }
html[data-theme="light"] .field select option { background: #fff; color: #17160f; }

.embed-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.embed-code { grid-column: 1 / -1; width: 100%; }

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 10.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
}

.code-block {
  margin: 0;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
  overflow-x: auto;
  white-space: pre;
}

/* ---------- big screen (classroom) ---------- */

body.is-bigscreen { overflow: hidden; }
body.is-bigscreen .app-header,
body.is-bigscreen .app-footer,
body.is-bigscreen .page { display: none; }

body.is-bigscreen .tool-card {
  position: fixed;
  inset: 0;
  z-index: 60;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  padding: 0;
  display: grid;
  place-items: center;
}

body.is-bigscreen .tool-note,
body.is-bigscreen .tool-actions { display: none; }
body.is-bigscreen .mini-ring { width: min(82vmin, 900px); }

.exit-big {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease);
}
.exit-big.show { opacity: .55; pointer-events: auto; }
.exit-big.show:hover { opacity: 1; }

/* ---------- source / embedded ring ---------- */

html:has(.source-page),
.source-page {
  background: transparent !important;
}

.source-page {
  margin: 0;
  height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.source-page::before { display: none; }

.source-ring {
  position: relative;
  width: min(96vmin, 100%);
  aspect-ratio: 1;
  container-type: inline-size;
  cursor: pointer;
}

/* ---------- responsive ---------- */

@media (max-width: 820px) {
  .activity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stream-grid { grid-template-columns: 1fr; justify-items: center; }
  .stream-grid .preview-frame { width: min(300px, 72vw); }
  .embed-layout { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .page { gap: 34px; }
  .tool-card { border-radius: 24px; padding: 20px 16px 26px; }
  .mini-ring { width: min(78vw, 38vh, 320px); }
  .hero { gap: 14px; }
  .copy-row .btn { width: 100%; }
  .stream-grid .steps { width: 100%; }
}


/* ---------- split layout + typography polish ---------- */

.page-h1, .lede { text-wrap: balance; }
.hero { max-width: 820px; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}

.split .hero { max-width: none; }
.split .page-h1 { font-size: clamp(32px, 4.2vw, 54px); }
.split .tool-card { padding: clamp(20px, 2.6vw, 30px); }
.split .mini-ring { width: min(100%, 336px); }
.split .activity-grid { margin-top: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split .tool-note { font-size: 11px; line-height: 1.6; }
.split .lede { font-size: clamp(14.5px, 1.35vw, 16.5px); }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .split .mini-ring { width: min(72vw, 38vh, 340px); }
}

.preview-caption { z-index: 2; }


/* classroom: one primary action — the big screen */
body[data-page="classroom"] .mini [data-role="start"] {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
  box-shadow: none;
  padding-inline: 26px;
}
body[data-page="classroom"] .mini [data-role="start"]:hover {
  color: var(--fg);
  background: var(--surface);
}
body[data-page="classroom"] .tool-actions .btn { padding-inline: 34px; }
