/* Aurora: modal contents (tutorial, correction), mic help, guide penguin, bubbles and tours
   Owned by the "guide" screen group, and only by it. Loaded after /style.css and
   /aurora/base.css, so a rule here overrides both. Never edit style.css or
   base.css from here: use the tokens (--au-*, --ink, --muted...) and the base
   pieces (.card, .btn.brand, .au-hero, .au-tile, .au-chip, .au-stat, .au-ring,
   .au-progress, .seg/.tabs, .au-row, .au-dock...) described in base.css.
   Scope every rule to this group's own classes.

   The phone app is the reference: components/Sheet.tsx (the sheets),
   components/Overlays.tsx (the tutorial and the correction), ui/Penguin.tsx
   PenguinSays (the bubble), ui/Guide.tsx and Aurora.tsx PeekBehind (the tour).
   base.css already draws the backdrop, the sheet itself (and the bottom sheet
   with its grab handle on a phone) and the toasts; this file only does what
   is inside them. */

/* ---------- "how to play": the round ? on a game card ---------- */

.how-btn {
  width: 32px; height: 32px; border: 0;
  color: var(--au-teal);
  background: var(--au-glass-flat);
  box-shadow: inset 0 1px 0 var(--au-highlight), inset 0 0 0 1px var(--line-hi);
  transition: background-color var(--dur-2), transform var(--dur-1) var(--ease-out), box-shadow var(--dur-2);
}
.how-btn .i { width: 17px; height: 17px; }
@media (hover: hover) and (pointer: fine) {
  .how-btn:hover { background: var(--au-glass-hi); transform: translateY(-1px); box-shadow: inset 0 1px 0 var(--au-highlight), inset 0 0 0 1px color-mix(in srgb, var(--au-teal) 55%, transparent), 0 0 14px -2px color-mix(in srgb, var(--au-teal) 50%, transparent); }
}
.how-btn:active { transform: translateY(1px); }
:root[data-theme="light"] .how-btn { color: #0a8a78; background: rgba(255, 255, 255, 0.9); box-shadow: inset 0 1px 0 #fff, inset 0 0 0 1px var(--line-hi), 0 4px 10px -6px rgba(30, 70, 130, 0.35); }

/* ---------- the sheets: tutorial, mic help, correction ---------- */

/* The phone sheet's two soft glows along its top: violet on the right, teal
   on the left, over the sheet gradient base.css gives every .modal. */
.modal:is(.tut-modal, .corr-modal) {
  --glow-v: 30%; --glow-t: 22%;
  gap: 16px;
  background:
    radial-gradient(340px 200px at calc(100% + 70px) -60px, color-mix(in srgb, var(--au-violet) var(--glow-v), transparent), transparent 72%),
    radial-gradient(300px 180px at -70px -60px, color-mix(in srgb, var(--au-teal) var(--glow-t), transparent), transparent 72%),
    var(--au-sheet);
}
:root[data-theme="light"] .modal:is(.tut-modal, .corr-modal) { --glow-v: 18%; --glow-t: 16%; }

/* The head: a teal icon tile, the title in Outfit, a quiet round close. */
:is(.tut-modal, .corr-modal) .modal-head { gap: 12px; }
:is(.tut-modal, .corr-modal) .modal-head h2 {
  display: flex; align-items: center; gap: 12px; min-width: 0; margin: 0;
  font: 600 20px/1.2 var(--display); letter-spacing: -0.015em; color: var(--ink);
}
.tut-icon {
  flex: none; width: 40px; height: 40px; margin: 0; border-radius: 14px;
  display: inline-grid; place-items: center; vertical-align: middle;
  background: color-mix(in srgb, var(--au-teal) 14%, transparent); color: var(--au-teal);
  box-shadow: inset 0 1px 0 var(--au-highlight);
}
.tut-icon > span { display: grid; }
.tut-icon .i { width: 21px; height: 21px; }
.tut-icon.mic-icon { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
:root[data-theme="light"] .tut-icon { color: #0a8a78; }
:root[data-theme="light"] .tut-icon.mic-icon { color: var(--bad); }
:is(.tut-modal, .corr-modal) .modal-head [data-act="modal-close"] {
  flex: none; width: 36px; height: 36px; padding: 0; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--au-glass-flat); color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
:is(.tut-modal, .corr-modal) .modal-head [data-act="modal-close"] .i { width: 20px; height: 20px; }
@media (hover: hover) and (pointer: fine) {
  :is(.tut-modal, .corr-modal) .modal-head [data-act="modal-close"]:hover { background: var(--au-glass-hi); color: var(--ink); filter: none; }
}

/* A sheet's opening line. */
.tut-lead { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.tut-lead.muted { color: var(--muted); }

/* The penguin says hello from his ice floe, his bubble beside him. */
.tut-pg { gap: 12px; align-items: flex-end; padding-top: 2px; }
.tut-pg .penguin { margin: 0 6px 10px 4px; }
.tut-pg .penguin::before {
  content: ''; position: absolute; left: -16%; right: -16%; bottom: -11%; height: 21%; border-radius: 50%;
  background: radial-gradient(70% 45% at 50% 32%, rgba(255, 255, 255, 0.7), transparent 70%), var(--au-ice);
  box-shadow: 0 0 22px 2px color-mix(in srgb, var(--au-teal) 32%, transparent);
}
.tut-pg .pg-shadow { display: none; }
.tut-pg .pg-bubble { margin-bottom: 18px; padding: 11px 14px; font-size: 14.5px; }

/* How long it takes, and how it scores: glass chips (the sheet is opaque, so
   no night base under them). */
.tut-meta { gap: 8px; }
.tut-meta .pill {
  background: var(--au-glass-flat); border-color: var(--line); color: var(--ink);
  font-size: 12.5px; min-height: 30px; padding: 4px 12px;
}
.tut-meta .pill .i { width: 15px; height: 15px; color: var(--au-teal); }
.tut-meta .tut-score .i { color: var(--au-gold); }
:root[data-theme="light"] .tut-meta .pill { background: rgba(255, 255, 255, 0.85); border-color: var(--line-hi); }
:root[data-theme="light"] .tut-meta .pill .i { color: #0a8a78; }
:root[data-theme="light"] .tut-meta .tut-score .i { color: #d99a00; }

/* The steps: a soft row each, a teal numbered dot, the text, and the step's
   icon quietly at the end. */
.tut-steps { gap: 10px; }
.tut-steps li {
  grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px;
  padding: 12px 14px; border: 0; border-radius: 18px;
  background: var(--au-glass-flat);
  box-shadow: inset 0 1px 0 var(--au-highlight), inset 0 0 0 1px var(--au-edge);
  font-size: 15px; line-height: 1.45; color: var(--ink);
}
:root[data-theme="light"] .tut-steps li { background: rgba(255, 255, 255, 0.8); box-shadow: inset 0 1px 0 #fff, inset 0 0 0 1px var(--line), 0 6px 14px -12px rgba(30, 70, 130, 0.4); }
.tut-num {
  width: 32px; height: 32px;
  background: color-mix(in srgb, var(--au-teal) 16%, transparent); color: var(--au-teal);
  font: 600 15px/1 var(--display); font-variant-numeric: tabular-nums;
  box-shadow: 0 0 14px -3px color-mix(in srgb, var(--au-teal) 55%, transparent);
}
:root[data-theme="light"] .tut-num { color: #0a8a78; background: color-mix(in srgb, var(--au-teal) 14%, #fff); box-shadow: none; }
.tut-step-icon { order: 1; width: auto; height: auto; border-radius: 0; background: none; color: var(--ink-2); }
.tut-step-icon .i { width: 18px; height: 18px; }

/* "Got it" and the one orange "Play". On a phone they share the width. */
.tut-foot { justify-content: flex-end; gap: 10px; margin-top: 2px; }
.tut-foot > .btn, .mic-actions > .btn {
  min-height: 50px; padding: 12px 20px; border-radius: var(--au-r-btn);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
.tut-foot > .btn .i, .mic-actions > .btn .i { width: 18px; height: 18px; }
@media (max-width: 480px) {
  .tut-foot > .btn.brand, .tut-foot > .btn:only-child { flex: 1; }
}

/* A desktop window not much taller than the sheet (1280x720 and the like):
   the sheet reaches its 90vh cap and scrolls inside, and its buttons must not
   end up cut off by its bottom edge. They stick to the bottom, over the
   bottom padding, on a solid band the sheet's own gradient fades into, with
   a short fade above them for the steps that scroll under. The band is the
   sheet's last --tut-band px: its gradient stops there and the rest is the
   gradient's end colour, so the stuck buttons sit on exactly the colour
   behind them, whatever the sheet's height. (The phone bottom sheet keeps
   its own layout.) */
@media (min-width: 481px) {
  .modal.tut-modal {
    --tut-end: #081633; --tut-band: 96px;
    background-color: var(--tut-end);
    background-size: auto, auto, 100% calc(100% - var(--tut-band));
    background-repeat: no-repeat;
  }
  :root[data-theme="light"] .modal.tut-modal { --tut-end: #eef6fd; }
  .tut-modal > :is(.tut-foot, .mic-actions) {
    position: sticky; bottom: -22px; z-index: 1;
    margin: -10px 0 -22px; padding: 12px 0 22px;
    background: var(--tut-end);
  }
  .tut-modal > :is(.tut-foot, .mic-actions)::before {
    content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 18px;
    background: linear-gradient(transparent, var(--tut-end));
    pointer-events: none;
  }
}

/* ---------- the microphone help ---------- */

.mic-os {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border: 0; border-radius: 16px;
  background: var(--au-glass-flat); box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13px; line-height: 1.5; color: var(--muted);
}
.mic-os > span:first-child { flex: none; display: grid; margin-top: 1px; color: var(--au-teal); }
.mic-os .i { width: 18px; height: 18px; }
:root[data-theme="light"] .mic-os { background: rgba(255, 255, 255, 0.8); }
:root[data-theme="light"] .mic-os > span:first-child { color: #0a8a78; }
.mic-actions { gap: 10px; margin-top: 2px; }
.mic-listen-help { font-size: 12.5px; line-height: 1.45; color: var(--muted); }
@media (max-width: 480px) {
  .mic-actions > .btn { flex: 1 1 100%; }
  .mic-listen-help { text-align: center; }
}

/* "Tap here for the microphone": the violet 3D pill in the corner. */
#mic-hint {
  border-radius: 18px; padding: 12px 16px; gap: 10px;
  background: linear-gradient(180deg, var(--au-violet-hi), var(--au-violet-lo)); color: #fff;
  font-size: 14.5px; font-weight: 700; line-height: 1.35;
  box-shadow: 0 3px 0 var(--au-violet-deep), 0 18px 34px -14px rgba(122, 98, 245, 0.6), inset 0 1px 0 var(--au-btn-highlight);
}

/* ---------- the correction ---------- */

.corr-modal .field { gap: 7px; font-size: 12.5px; font-weight: 700; letter-spacing: 0.01em; color: var(--ink-2); }
.corr-modal .input { font-size: 15px; }
.corr-modal textarea.input { min-height: 78px; resize: vertical; line-height: 1.45; font-family: var(--font); }
.corr-modal > .btn.violet {
  width: 100%; margin-top: 2px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.corr-modal > .btn.violet .i { width: 19px; height: 19px; }
/* With room for it, what was said and how it should go stand side by side. */
@media (min-width: 640px) {
  .corr-modal { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 12px; }
  .corr-modal > :not(label:has(textarea)) { grid-column: 1 / -1; }
}

/* ---------- the speech bubble ---------- */

/* Beside the penguin wherever he talks (tutorial, reading, stories): a solid
   raised bubble with a hairline ring and a tail pointing at him. (div only:
   the AI mascot's .pg-bubble is an SVG group.) */
div.pg-bubble {
  --pg-bubble: #1a3367;
  padding: 12px 15px; border: 1px solid var(--line-hi); border-radius: 20px;
  background: var(--pg-bubble); color: var(--ink);
  box-shadow: inset 0 1px 0 var(--au-highlight), var(--au-drop);
  font-size: 15px; line-height: 1.5;
  transform-origin: 0 100%;
}
div.pg-bubble::before {
  left: -8px; bottom: 16px; width: 14px; height: 14px; border-radius: 0 0 0 3px;
  background: var(--pg-bubble);
  border-style: solid; border-width: 0 0 1px 1px; border-color: var(--line-hi);
}
div.pg-bubble b { font-family: var(--display); font-weight: 700; }
:root[data-theme="light"] div.pg-bubble:not(:is(.au-hero, .au-night) *) { --pg-bubble: #ffffff; }

/* ---------- the tour: a spotlight, and the penguin peeking over his card ---------- */

/* The page dimmed to the night, the part lit with a teal ring that breathes. */
.guide-spot {
  --scrim: rgba(4, 10, 25, 0.66);
  border-radius: 20px;
  box-shadow: 0 0 0 3px var(--au-teal), 0 0 28px 6px color-mix(in srgb, var(--au-teal) 45%, transparent), 0 0 0 9999px var(--scrim);
}
:root[data-theme="light"] .guide-spot { --scrim: rgba(13, 33, 64, 0.42); }
.guide-spot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 23px;
  box-shadow: 0 0 0 2px var(--au-teal);
  animation: au-spot-breathe 1.8s var(--ease-out) infinite;
}
.guide-spot.none { box-shadow: 0 0 0 9999px var(--scrim); }
.guide-spot.none::after, .guide-spot.moving::after { display: none; }
@keyframes au-spot-breathe { from { opacity: 0.9; transform: scale(1); } to { opacity: 0; transform: scale(1.06, 1.14); } }

/* The card: room on top for the penguin (guide.tsx sets --peek), who stands
   behind the glass so only his head and chest show over its edge. */
.guide-card { gap: 0; padding-top: var(--peek, 55px); isolation: isolate; }
.guide-peek {
  position: absolute; top: 0; left: 22px; z-index: 0;
  line-height: 0; pointer-events: none;
  animation: au-peek-in var(--dur-4) var(--ease-spring) both;
}
@keyframes au-peek-in { from { transform: translateY(34%); } }
/* The body is opaque, so he shows only above it. (Its glow strength is
   --guide-glow, not --glow: style.css already has a --glow shadow token, and
   picking that up made color-mix() invalid and dropped the whole background.)
   A plain colour sits under the gradients so it never turns see-through. */
.guide-body {
  --guide-glow: 30%;
  position: relative; z-index: 1; isolation: isolate;
  display: grid; gap: 14px; padding: 18px 18px 16px;
  border-radius: var(--au-r-card);
  background-color: #132a5c;
  background-image:
    radial-gradient(260px 180px at calc(100% + 40px) -50px, color-mix(in srgb, var(--au-teal) var(--guide-glow), transparent), transparent 70%),
    radial-gradient(220px 160px at -50px calc(100% + 40px), color-mix(in srgb, var(--au-violet) var(--guide-glow), transparent), transparent 70%),
    var(--au-sheet);
  box-shadow: inset 0 1px 0 var(--au-highlight), inset 0 0 0 1px var(--au-edge), 0 30px 60px -20px rgba(0, 0, 0, 0.7);
}
:root[data-theme="light"] .guide-body { --guide-glow: 18%; background-color: #fff; box-shadow: inset 0 1px 0 #fff, inset 0 0 0 1px var(--line), 0 24px 50px -20px rgba(13, 33, 64, 0.45); }

/* What he says is the card itself: no second box inside it. */
.guide-card div.pg-bubble {
  padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  font-size: 15.5px; line-height: 1.5; color: var(--ink);
  animation: au-guide-say var(--dur-3) var(--ease-out) both;
}
.guide-card div.pg-bubble::before { display: none; }
@keyframes au-guide-say { from { opacity: 0; transform: translateY(4px); } }

/* Where he is in the tour: teal dots, the ones behind him dimmer. */
.guide-foot { gap: 8px; }
.guide-dots { gap: 5px; }
.guide-dots i { width: 7px; height: 7px; background: var(--line-hi); }
.guide-dots i.past { background: color-mix(in srgb, var(--au-teal) 45%, transparent); }
.guide-dots i.on { width: 20px; background: var(--au-teal); box-shadow: 0 0 10px color-mix(in srgb, var(--au-teal) 60%, transparent); }
.guide-card .btn.ghost { background: transparent; }
.guide-card .btn.ghost.guide-skip { box-shadow: none; color: var(--ink-2); padding-inline: 10px; }
@media (hover: hover) and (pointer: fine) { .guide-card .btn.ghost.guide-skip:hover { color: var(--ink); background: var(--au-glass-flat); } }
.guide-card .btn.ghost.guide-back {
  width: 38px; height: 38px; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--au-glass-flat); box-shadow: inset 0 1px 0 var(--au-highlight), inset 0 0 0 1px var(--line-hi);
}
.guide-card .btn.brand { min-height: 40px; padding: 9px 16px; display: inline-flex; align-items: center; gap: 6px; }
.guide-card .btn .i { width: 17px; height: 17px; }

@media (prefers-reduced-motion: reduce) {
  .guide-spot::after { display: none; }
  .guide-peek, .guide-card div.pg-bubble { animation: none; }
}
