/* The Ai-Tech identity, shared by every page: the stage, the admin page, the
   school form and the phone remote. Each page links this file first and its
   own stylesheet after it; the page stylesheets lay out their own screens and
   use only the tokens and components defined here, never a colour, font,
   radius or shadow of their own (tools/check-styles.mjs checks it).

   Values copied from the aitech-iq.com site code: the dark homepage tokens in
   src/app/globals.css (--color-home-*), its glass recipe in
   src/components/home/parts.tsx and its fonts in src/lib/fonts.ts. Correct
   them here. */
:root {
  color-scheme: dark;

  /* Navy grounds */
  --navy: #070b1f;               /* home-bg */
  --navy-surface: #0c1336;       /* home-surface */
  --line: #1f2b5c;               /* home-line-2 */
  --line-strong: #2a3768;        /* home-line-3 */

  /* Text */
  --ink: #eaf0ff;                /* home-ink */
  --ink-2: #d3dbf3;              /* home-ink-2 */
  --ink-3: #b4c0e4;              /* home-ink-3 */
  --ink-4: #8fa0cf;              /* home-ink-4 */
  --ink-5: #7f8ebd;              /* home-ink-5 */
  --on-accent: #04102a;          /* home-on-accent: dark text on cyan and blue */

  /* Brand accents */
  --cyan: #22d3ee;               /* home-cyan, primary */
  --blue: #3b82f6;               /* home-blue */
  --violet: #8b5cf6;             /* home-violet, secondary */
  --cyan-soft: #9fe7f5;          /* home-cyan-soft */
  --violet-soft: #c4b5fd;        /* home-violet-soft */
  --ok: #4ade80;                 /* home-ok: the green "ready" light */

  /* Not in the site palette: Stop, failures and warnings */
  --red: #ef4444;
  --red-soft: #fca5a5;
  --amber: #f59e0b;
  --amber-soft: #fcd34d;

  /* Page background: two soft glows and a dot grid */
  --glow-a: rgb(59 130 246 / 0.22);   /* home-glow-a */
  --glow-b: rgb(139 92 246 / 0.1);    /* home-glow-b */
  --dot: rgb(125 211 252 / 0.13);     /* home-dot */
  --dot-gap: 26px;                    /* bg-home-dots */

  /* Glass panels */
  --glass: rgb(7 11 31 / 0.45);              /* bg-home-navy/45 */
  --glass-strong: rgb(7 11 31 / 0.62);       /* bg-home-navy/62 */
  --glass-border: rgb(255 255 255 / 0.14);   /* border-white/14 */
  --glass-border-strong: rgb(255 255 255 / 0.22);
  --glass-blur: 12px;                        /* backdrop-blur-md */
  --shadow: 0 30px 80px -30px rgb(3 6 20 / 0.6);

  /* Gradients */
  --gradient-button: linear-gradient(270deg, var(--cyan), var(--blue));                  /* bg-home-button */
  --gradient-text: linear-gradient(270deg, var(--cyan), var(--blue) 55%, var(--violet)); /* text-home-gradient */

  /* State tints: a line (border) and a wash (background) per colour */
  --cyan-line: rgb(34 211 238 / 0.5);
  --cyan-wash: rgb(34 211 238 / 0.1);
  --ok-line: rgb(74 222 128 / 0.45);
  --ok-wash: rgb(74 222 128 / 0.1);
  --amber-line: rgb(252 211 77 / 0.5);
  --amber-wash: linear-gradient(rgb(245 158 11 / 0.18), rgb(245 158 11 / 0.08));
  --red-line: rgb(248 113 113 / 0.6);
  --red-wash: linear-gradient(rgb(239 68 68 / 0.22), rgb(239 68 68 / 0.1));
  --red-strong: rgb(248 113 113 / 0.85);

  /* Grounds for controls */
  --field: rgb(4 8 24 / 0.7);                  /* inputs and text areas */
  --raised: rgb(255 255 255 / 0.06);           /* a plain button */
  --raised-hover: rgb(255 255 255 / 0.1);
  --tile: linear-gradient(160deg, rgb(255 255 255 / 0.07), rgb(255 255 255 / 0.02)), var(--glass-strong);
  --inset: rgb(4 8 24 / 0.45);                 /* a card inside a card */
  --scrim: rgb(3 6 20 / 0.72);                 /* behind a panel */
  --paper: #fff;                               /* the QR code's ground */
  --white: #fff;
  --shadow-accent: 0 12px 32px rgb(34 211 238 / 0.28);
  --shadow-accent-strong: 0 0 0 3px rgb(159 231 245 / 0.55), 0 18px 50px -10px rgb(34 211 238 / 0.6);
  --shadow-inset: inset 0 2px 10px rgb(0 0 0 / 0.35);
  --highlight: inset 0 1px 0 rgb(255 255 255 / 0.06);

  /* Hakim's orb and the phone's Talk: light on glass, and its rings */
  --sheen: rgb(255 255 255 / 0.14);
  --sheen-strong: rgb(255 255 255 / 0.35);
  --edge-light: rgb(255 255 255 / 0.3);
  --deep: rgb(4 16 42 / 0.5);
  --deep-strong: rgb(4 16 42 / 0.6);
  --cyan-ring: rgb(34 211 238 / 0.7);
  --cyan-faint: rgb(34 211 238 / 0.25);
  --violet-line: rgb(139 92 246 / 0.35);
  --talk-wash: linear-gradient(rgb(34 211 238 / 0.22), rgb(59 130 246 / 0.16));
  --shadow-talk: 0 14px 40px -12px rgb(34 211 238 / 0.45);

  /* Corner radii */
  --radius-small: 10px;
  --radius-button: 14px;
  --radius-tile: 18px;
  --radius-card: 24px;
  --radius-pill: 999px;

  /* Type scale. The stage is read from 3 metres, so it uses the top of it;
     the admin page and the form use the middle. */
  --text-xs: 0.85rem;
  --text-sm: 0.95rem;
  --text-base: 1.05rem;
  --text-md: 1.2rem;
  --text-lg: 1.4rem;
  --text-xl: 1.75rem;
  --text-2xl: 2.2rem;
  --text-3xl: 2.8rem;
  --leading: 1.6;
  --leading-tight: 1.3;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Control heights: never under 48px, the touch target */
  --control-sm: 48px;
  --control: 56px;
  --control-lg: 68px;
  --control-xl: 84px;

  /* Motion: only transform and opacity move */
  --press: 40ms;
  --quick: 0.15s;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --focus-ring: 3px solid var(--cyan-soft);

  /* Fonts, bundled in fonts/ so the page works offline. The bundled fonts
     have Arabic and Latin only: Hebrew comes from the device's own font. */
  --font-text: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Noto Sans Hebrew", "Arial Hebrew", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-display: "Readex Pro", var(--font-text);
  --font-mono: ui-monospace, "Cascadia Mono", "DejaVu Sans Mono", monospace;
}

/* Fonts (SIL Open Font License, see fonts/OFL-*.txt) */

@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/plex-arabic-400-arabic.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/plex-arabic-400-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/plex-arabic-600-arabic.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/plex-arabic-600-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/plex-arabic-700-arabic.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/plex-arabic-700-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Readex Pro";
  font-style: normal;
  font-weight: 160 700;
  font-display: swap;
  src: url(fonts/readex-pro-arabic.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Readex Pro";
  font-style: normal;
  font-weight: 160 700;
  font-display: swap;
  src: url(fonts/readex-pro-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------------------
   Page
   --------------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:root {
  scrollbar-color: var(--line-strong) transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
}

body {
  background: var(--navy);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 18px;
}

/* The navy ground: two soft glows and a dot grid, fixed behind every page. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 55% at 85% 0%, var(--glow-a), transparent 70%),
    radial-gradient(55% 60% at 10% 100%, var(--glow-b), transparent 70%),
    radial-gradient(var(--dot) 1px, transparent 1px) 0 0 / var(--dot-gap) var(--dot-gap);
}

h1,
h2,
h3,
p,
ol,
ul,
fieldset {
  margin: 0;
}

img {
  max-width: 100%;
}

::selection {
  background: var(--cyan);
  color: var(--on-accent);
}

/* One focus ring everywhere, shown for the keyboard only. */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

/* Glass: a translucent panel over the navy ground. */
.glass {
  border: 1px solid var(--glass-border);
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
}

/* ---------------------------------------------------------------------------
   Header: the Ai-Tech logo and Hakim's name
   --------------------------------------------------------------------------- */

.top {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  display: block;
  height: 52px;
  width: auto;
}

.brand-name {
  padding-block: 0.15em;
  font: 700 2rem/1 var(--font-display);
  background-image: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* A small label in a pill, beside the name or in a list. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 4px 14px;
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-pill);
  color: var(--ink-3);
  font: 600 var(--text-base)/1.3 var(--font-display);
}

/* ---------------------------------------------------------------------------
   Buttons. Every button is at least 48px high. .btn is a plain glass button;
   .primary is the one main action, .danger deletes or stops, .quiet is a
   link-like button, .wide fills its row.
   --------------------------------------------------------------------------- */

button {
  font: inherit;
  color: inherit;
  border: none;
  border-radius: var(--radius-card);
  cursor: pointer;
  font-weight: 700;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: var(--control);
  padding: 0 var(--space-5);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-button);
  background: var(--raised);
  color: var(--ink);
  font: 700 var(--text-md)/1.25 var(--font-display);
  text-align: center;
  text-decoration: none;
  transition: transform var(--quick) var(--ease-out);
}

.btn.primary {
  border-color: transparent;
  background: var(--gradient-button);
  color: var(--on-accent);
  box-shadow: var(--shadow-accent);
}

.btn.danger {
  border-color: var(--red-line);
  background: var(--red-wash);
  color: var(--ink);
}

.btn.ok {
  border-color: var(--ok-line);
  background: var(--ok-wash);
  color: var(--ink);
}

.btn.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--ink-3);
}

.btn.wide {
  width: 100%;
  min-height: var(--control-lg);
  font-size: var(--text-lg);
}

.btn.lg {
  min-height: var(--control-lg);
  padding-inline: var(--space-6);
  font-size: var(--text-lg);
}

@media (hover: hover) {
  .btn:not(.primary, .danger, .ok):hover:not(:disabled) {
    background: var(--raised-hover);
  }

  .btn.quiet:hover:not(:disabled) {
    color: var(--ink);
  }
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
  transition-duration: var(--press);
}

/* A row of buttons that wraps; on a phone each fills the row. */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------------------------------------------------------------------------
   Text, cards and badges
   --------------------------------------------------------------------------- */

.note {
  color: var(--ink-3);
  font-size: var(--text-base);
  line-height: var(--leading);
}

.cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-tile);
  background: linear-gradient(160deg, rgb(255 255 255 / 0.06), rgb(255 255 255 / 0.015)), var(--glass-strong);
}

.card .card {
  background: var(--inset);
}

.card-title {
  font: 700 var(--text-lg)/var(--leading-tight) var(--font-display);
}

.card-meta {
  color: var(--ink-3);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.5;
}

/* A count or a state, in amber: something waits for someone. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 2px 12px;
  border: 1px solid var(--amber-line);
  border-radius: var(--radius-pill);
  background: var(--amber-wash);
  color: var(--amber-soft);
  font: 600 var(--text-sm)/1.5 var(--font-text);
}

/* ---------------------------------------------------------------------------
   Fields: a label above its field, with a hint in <small>
   --------------------------------------------------------------------------- */

.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: var(--text-base);
  line-height: 1.4;
}

.form label small {
  color: var(--ink-4);
  font-weight: 400;
  font-size: var(--text-sm);
}

.input,
.form input,
.form select,
.form textarea {
  width: 100%;
  min-height: var(--control);
  padding: 10px 14px;
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-button);
  background: var(--field);
  color: var(--ink);
  font: 400 var(--text-md)/1.5 var(--font-text);
}

.input::placeholder,
.form ::placeholder {
  color: var(--ink-5);
}

/* Selects: the system arrow replaced by one in the page's colours, at the
   end of the line (the left, in Arabic and Hebrew). */
select.input,
.form select {
  appearance: none;
  padding-inline-end: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M1.5 1.5 8 8l6.5-6.5' fill='none' stroke='%23b4c0e4' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 16px center;
  background-size: 16px 10px;
}

select.input option,
.form select option {
  background: var(--navy-surface);
  color: var(--ink);
}

.form textarea {
  resize: vertical;
}

.form textarea[dir="ltr"],
.form input[dir="ltr"] {
  text-align: left;
}

.form input[readonly] {
  color: var(--ink-3);
  background: transparent;
}

.input:focus-visible,
.form input:focus-visible,
.form select:focus-visible,
.form textarea:focus-visible {
  border-color: var(--cyan);
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   Tabs: a pill of choices, the chosen one filled
   --------------------------------------------------------------------------- */

.tabs {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
}

.tabs button {
  min-height: 60px;
  padding: 0 30px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-3);
  font: 600 1.35rem var(--font-display);
}

@media (hover: hover) {
  .tabs button:hover:not([aria-selected="true"]) {
    color: var(--ink);
  }
}

.tabs button[aria-selected="true"] {
  background: var(--gradient-button);
  color: var(--on-accent);
  box-shadow: 0 8px 24px rgb(34 211 238 / 0.25);
}

/* ---------------------------------------------------------------------------
   Messages and notices: plain words first, the technical cause underneath.
   The tone is a class beside .message: fatal (red), warn (amber), hint
   (cyan); none is neutral.
   --------------------------------------------------------------------------- */

.message {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  padding: 16px 24px;
  border: 1px solid var(--glass-border);
  border-inline-start-width: 6px;
  border-radius: var(--radius-card);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow);
}

.message-body {
  flex: 1 1 320px;
  min-width: 0;
}

.message-text {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.5;
}

.message-cause {
  margin-top: 6px;
  font: var(--text-xs)/1.45 var(--font-mono);
  color: var(--ink-4);
  text-align: left;
  overflow-wrap: anywhere;
}

.message-cause:empty {
  display: none;
}

.message.fatal {
  background: var(--red-wash), var(--glass-strong);
  border-color: var(--red-line);
  border-inline-start-color: var(--red);
}

.message.warn {
  background: var(--amber-wash), var(--glass-strong);
  border-color: var(--amber-line);
  border-inline-start-color: var(--amber);
}

.message.hint {
  border-inline-start-color: var(--cyan);
}

/* The banner's own action (Reconnect, Update now, Try again). */
.message .reconnect {
  min-height: 76px;
  padding: 0 34px;
  border-radius: var(--radius-button);
  font: 700 1.6rem var(--font-display);
  background: var(--gradient-button);
  color: var(--on-accent);
  box-shadow: var(--shadow-accent);
  transition: transform var(--quick) var(--ease-out);
}

.message .reconnect:active {
  transform: scale(0.97);
  transition-duration: var(--press);
}

/* ---------------------------------------------------------------------------
   The PIN card: a title, one large field and one large button
   --------------------------------------------------------------------------- */

.pin {
  display: grid;
  justify-items: center;
  gap: 18px;
  width: min(100%, 520px);
  padding: 32px clamp(20px, 5vw, 36px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow);
}

.pin-title {
  font: 700 var(--text-2xl)/1.2 var(--font-display);
  text-align: center;
}

.pin-input,
.pin-submit {
  width: 100%;
  min-height: var(--control-lg);
  border-radius: var(--radius-button);
}

.pin-input {
  padding: 0 20px;
  border: 1px solid var(--glass-border-strong);
  background: var(--field);
  color: var(--ink);
  font: 700 1.8rem var(--font-text);
  letter-spacing: 0.25em;
  text-align: center;
  box-shadow: var(--shadow-inset);
}

.pin-input:focus-visible {
  border-color: var(--cyan);
  outline: var(--focus-ring);
  outline-offset: 3px;
}

.pin-submit {
  background: var(--gradient-button);
  color: var(--on-accent);
  font: 700 1.6rem var(--font-display);
  box-shadow: var(--shadow-accent);
  transition: transform var(--quick) var(--ease-out);
}

.pin-submit:active {
  transform: scale(0.97);
  transition-duration: var(--press);
}

.pin-hint {
  color: var(--ink-3);
  font-size: var(--text-base);
  line-height: 1.5;
  text-align: center;
}

/* ---------------------------------------------------------------------------
   Hakim's light: the same colour for the same state on every screen.
   body[data-state] is the live voice state.
   --------------------------------------------------------------------------- */

body {
  --light: var(--ink-5);
}
[data-state="connecting"] { --light: var(--cyan); }
[data-state="idle"] { --light: var(--ok); }
[data-state="listening"] { --light: var(--cyan); }
[data-state="thinking"] { --light: var(--violet); }
[data-state="speaking"] { --light: var(--blue); }
[data-state="failed"] { --light: var(--red); }

.status {
  position: relative;
  z-index: 2;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.2em 0.9em;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  font: 700 clamp(1.7rem, 5.6vh, 3rem)/1.3 var(--font-display);
}

.light {
  flex: none;
  width: 0.62em;
  height: 0.62em;
  border-radius: 50%;
  background: var(--light);
  box-shadow:
    0 0 0 0.14em color-mix(in srgb, var(--light) 22%, transparent),
    0 0 0.8em var(--light);
}

[data-state="connecting"] .light,
[data-state="thinking"] .light {
  animation: blink 0.8s ease-in-out infinite alternate;
}

[data-state="failed"] .status {
  border-color: var(--red-line);
  color: var(--red-soft);
}

/* ---------------------------------------------------------------------------
   Stop: red, with a square, on the stage and on the phone alike
   --------------------------------------------------------------------------- */

#stop {
  border: 2px solid var(--red-strong);
  background: linear-gradient(rgb(239 68 68 / 0.34), rgb(239 68 68 / 0.18)), var(--glass);
  color: var(--white);
}

#stop::before {
  content: "";
  flex: none;
  width: 0.62em;
  height: 0.62em;
  border-radius: 4px;
  background: var(--red-soft);
}

/* ---------------------------------------------------------------------------
   Soundboard: groups of clip tiles, on the stage and on the phone
   --------------------------------------------------------------------------- */

.group h2 {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  font: 600 1.3rem var(--font-display);
  color: var(--ink-3);
}

.group h2::before {
  content: "";
  width: 28px;
  height: 4px;
  border-radius: 4px;
  background: var(--gradient-button);
}

.clips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

/* Tiles are translucent without a backdrop blur: 37 blurred tiles would cost
   the laptop a lot while scrolling, for no visible difference on this ground. */
.clip {
  position: relative;
  min-height: 96px;
  padding: 14px 18px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-tile);
  background: var(--tile);
  box-shadow: var(--highlight);
  font: 600 1.55rem/1.3 var(--font-display);
  color: var(--ink);
  transition: transform var(--quick) var(--ease-out);
}

@media (hover: hover) {
  .clip:hover:not(:disabled, .playing) {
    border-color: var(--cyan-line);
  }
}

.clip:active:not(:disabled) {
  transform: scale(0.97);
  transition-duration: var(--press);
}

.clip.playing {
  border-color: transparent;
  background: var(--gradient-button);
  color: var(--on-accent);
  box-shadow: var(--shadow-accent-strong);
}

/* A beating dot on the playing tile */
.clip.playing::after {
  content: "";
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--on-accent);
  animation: blink 0.6s ease-in-out infinite alternate;
}

.group .message {
  margin-bottom: var(--space-3);
}

/* ---------------------------------------------------------------------------
   "Say this": a typed line said in Hakim's voice, on the stage's soundboard
   and in its own tab on the phone
   --------------------------------------------------------------------------- */

.say {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.say-label {
  color: var(--ink-3);
  font-size: var(--text-base);
  line-height: 1.5;
}

.say-row {
  display: flex;
  align-items: stretch;
  gap: var(--space-3);
}

.say-text {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-button);
  background: var(--field);
  color: var(--ink);
  font: 1.25rem/1.5 var(--font-text);
  resize: none;
}

.say-text::placeholder {
  color: var(--ink-5);
}

.say-text:focus-visible {
  border-color: var(--cyan);
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.say-send {
  min-height: 60px;
  min-width: 120px;
  padding: 0 24px;
  border-radius: var(--radius-button);
  background: var(--gradient-button);
  color: var(--on-accent);
  font: 700 1.3rem var(--font-display);
  box-shadow: var(--shadow-accent);
  transition: transform var(--quick) var(--ease-out);
}

.say-send:active:not(:disabled) {
  transform: scale(0.97);
  transition-duration: var(--press);
}

.say-send:disabled {
  opacity: 0.55;
  box-shadow: none;
}

.say-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  color: var(--ink-4);
  font-size: var(--text-sm);
}

.say-count {
  font-family: var(--font-mono);
}

/* ---------------------------------------------------------------------------
   Panels: a dialog over the page, in the same glass, with a dimmed and
   blurred page behind it. Its last button closes it.
   --------------------------------------------------------------------------- */

.sheet {
  width: min(94vw, 600px);
  max-height: min(94dvh, 900px);
  padding: 0;
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-card);
  background:
    radial-gradient(120% 60% at 85% 0%, var(--glow-a), transparent 60%),
    var(--navy-surface);
  color: var(--ink);
  box-shadow: var(--shadow), 0 0 0 1px rgb(0 0 0 / 0.2);
  overflow: hidden;
}

.sheet::backdrop {
  background: var(--scrim);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.sheet[open] {
  display: flex;
  flex-direction: column;
}

/* The part that scrolls, and the foot that stays: the close button is
   always in reach. */
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px 28px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.sheet-foot {
  flex: none;
  display: flex;
  justify-content: center;
  padding: 14px 28px 18px;
  border-top: 1px solid var(--glass-border);
  background: var(--glass-strong);
}

.sheet-title {
  font: 700 1.9rem/1.2 var(--font-display);
  text-align: center;
}

/* ---------------------------------------------------------------------------
   Motion
   --------------------------------------------------------------------------- */

@keyframes blink {
  to {
    opacity: 0.35;
  }
}

@keyframes breathe {
  from {
    opacity: 0.3;
    transform: scale(0.96);
  }
  to {
    opacity: 0.6;
    transform: scale(1.04);
  }
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

/* Gently in: panels and screens that appear. */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* No breathing, turning, rising or pressing in: states change at once. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .btn:active:not(:disabled),
  .clip:active:not(:disabled),
  .pin-submit:active,
  .say-send:active:not(:disabled),
  .message .reconnect:active {
    transform: none;
  }
}

/* ---------------------------------------------------------------------------
   Phone
   --------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .brand-logo {
    height: 40px;
  }

  .brand-name {
    font-size: 1.6rem;
  }

  .tabs button {
    flex: 1;
    min-height: 54px;
    padding: 0 12px;
    font-size: 1.15rem;
  }

  .message {
    padding: 12px 16px;
  }

  .message-text {
    font-size: 1.3rem;
  }

  .message .reconnect {
    width: 100%;
    min-height: 64px;
    font-size: 1.4rem;
  }

  .clips {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .clip {
    min-height: 84px;
    padding: 10px 12px;
    font-size: 1.25rem;
  }

  .actions > .btn {
    flex: 1 1 100%;
  }

  .sheet-body {
    padding: 20px 16px 16px;
  }

  .sheet-foot {
    padding: 12px 16px 14px;
  }
}
