/* Teleprompter, a Cyber tool of Vibe Handling. The nav, the type and the four themes are the site's (site/public/assets/site.css). The stage under the nav is this tool's own. */

@font-face { font-family: "Archivo Black"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/archivo-black-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Archivo Black"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/archivo-black-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: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/inter-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/inter-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: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/jetbrains-mono-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/jetbrains-mono-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; }

/* ---- Tokens. The four theme blocks are copied from site.css; change a colour there and here. ---- */

:root {
  --display: "Archivo Black", "Inter", system-ui, sans-serif;
  --text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 14px;
  --gutter: clamp(20px, 4vw, 48px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* Home: blaugrana. Navy for text, garnet for the one accent. */
:root, [data-theme="home"] {
  color-scheme: light;
  --ground: #E9EEF8;
  --surface: #FFFFFF;
  --ink: #1E2C53;
  --ink-2: #566389;
  --line: #C3CFE8;
  --accent: #9C1747;
  --accent-hover: #85133C;
  --on-accent: #FFFFFF;
  --accent-2: #1345A6;
  --inset: #1E2C53;
  --inset-ink: #E9EEF8;
  --theme-color: #E9EEF8;
  --fade: #E9EEF8;
  --dim: rgba(233, 238, 248, .78);
}

/* Away: black fading into purple at the hem, gold logos. --fade is the ground's colour around the toolbar. */
[data-theme="away"] {
  color-scheme: dark;
  --ground: linear-gradient(180deg, #131116 0%, #2A2145 45%, #3A2D63 100%) #131116;
  --surface: #271F3E;
  --ink: #E9E2F4;
  --ink-2: #B7ABD1;
  --line: #4B3F6C;
  --accent: #D2BF8E;
  --accent-hover: #E0D0A4;
  --on-accent: #1C1529;
  --accent-2: #A18BE0;
  --inset: #0E0C12;
  --inset-ink: #D9D0E8;
  --theme-color: #131116;
  --fade: #372D5F;
  --dim: rgba(19, 17, 22, .78);
}

/* Third: Green Frost split by a zigzag into a deeper teal, navy collar, burgundy piping. */
[data-theme="third"] {
  color-scheme: light;
  --ground: #E0F3EF;
  --surface: #F8FCFB;
  --ink: #1C2A52;
  --ink-2: #4E6678;
  --line: #B4DCD7;
  --accent: #197689;
  --accent-hover: #13606F;
  --on-accent: #FFFFFF;
  --accent-2: #6A2540;
  --inset: #1C2A52;
  --inset-ink: #E0F3EF;
  --theme-color: #E0F3EF;
  --fade: #E0F3EF;
  --dim: rgba(224, 243, 239, .78);
}

/* Fourth: light beige with navy and garnet. */
[data-theme="fourth"] {
  color-scheme: light;
  --ground: #EDE4D6;
  --surface: #FAF6EF;
  --ink: #161D36;
  --ink-2: #616880;
  --line: #D6C8B2;
  --accent: #6B2232;
  --accent-hover: #581B29;
  --on-accent: #FAF6EF;
  --accent-2: #161D36;
  --inset: #161D36;
  --inset-ink: #EDE4D6;
  --theme-color: #EDE4D6;
  --fade: #EDE4D6;
  --dim: rgba(237, 228, 214, .78);
}

/* ---- Base ------------------------------------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--line) transparent;   /* The site's rule, for the two panels when they scroll on a desktop */
}

body {
  position: fixed;
  inset: 0;
  margin: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--ground);
  color: var(--ink);
  font: 400 17px/1.6 var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

::selection { background: var(--accent); color: var(--on-accent); }
* { caret-color: var(--accent); -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 6px;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: .16em;
}
a:hover { color: var(--accent); }

h2, p { margin: 0; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: fixed;
  left: var(--gutter);
  top: -80px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: top .15s var(--ease);
}
.skip:focus { top: 12px; }

/* Icons: one stroke style for the whole tool, the same weight as the mark in the logo. */
.i {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Nav. The site's header, plus the language picker. ---------------------- */

.top {
  position: relative;
  z-index: 6;
  transition: opacity .25s;
}
.nav {
  max-width: 1200px;
  min-height: 40px;
  margin: 0 auto;
  padding: 22px var(--gutter) 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "logo links theme lang";
  align-items: center;
  gap: 10px 18px;
}

.logo {
  grid-area: logo;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  justify-self: start;
  font: 400 20px/1 var(--display);
  white-space: nowrap;
  letter-spacing: -.02em;
  text-decoration: none;
}
.logo svg { width: 28px; height: 28px; flex: none; color: var(--accent); }

.nav .links {
  grid-area: links;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 20px;
  margin-left: auto;
  font-weight: 600;
}
.nav .links a { text-decoration: none; }
.nav .links a:hover { text-decoration: underline; color: inherit; }

.theme {
  grid-area: theme;
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme input {
  position: absolute;
  width: 1px; height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.theme label {
  display: block;
  width: 24px; height: 24px;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(90deg, var(--sw-a) 0 50%, var(--sw-b) 50% 100%);
  transition: outline-color .15s linear;
}
.theme input:checked + label { outline: 2px solid var(--ink); outline-offset: 3px; }
.theme input:focus-visible + label { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.theme .sw-home   { --sw-a: #1345A6; --sw-b: #9C1747; }
.theme .sw-away   { --sw-a: #2A2145; --sw-b: #D2BF8E; }
.theme .sw-third  { --sw-a: #8BD9D9; --sw-b: #2E97AC; }
.theme .sw-fourth { --sw-a: #DCCCBC; --sw-b: #5E212E; }

/* The language picker reads like a nav item: a globe, the language's own name, a caret. */
.lang {
  grid-area: lang;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-self: end;
  color: var(--ink);
}
.lang .i { width: 17px; height: 17px; margin-right: 4px; stroke-width: 1.75; color: var(--ink-2); }
.lang select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 40px;
  max-width: 100%;
  padding: 0 22px 0 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: 600 17px/1 var(--text);
  cursor: pointer;
}
.lang::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 7px; height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.lang select:hover { color: var(--accent); }
.lang select:focus-visible { border-radius: 8px; }

/* Under 760px the nav flows: the name and the kits on the first row, the links and the language on the next. Written after the rules above, so it wins over them. */
@media (max-width: 759px) {
  .nav { display: flex; flex-wrap: wrap; gap: 12px 16px; }
  .logo { order: 1; }
  .theme { order: 2; margin-left: auto; }
  .nav .links { order: 3; margin-left: 0; }
  .lang { order: 4; margin-left: auto; }
}

@media (max-width: 640px) {
  .logo svg { width: 26px; height: 26px; }
  .theme { gap: 9px; }
  .theme label { width: 22px; height: 22px; }
  .lang select { font-size: 15px; }
  /* The links at 14px and no globe: then the links and the picker fit on one row in every language. */
  .nav { gap: 12px; }
  .nav .links { font-size: 14px; gap: 2px 16px; }
  .lang .i { display: none; }
  .lang select { padding-right: 16px; }
  .lang::after { right: 2px; }
}

/* ---- Stage ------------------------------------------------------------------ */

#app {
  position: relative;
  min-height: 0;
  overflow: hidden;
}
#view {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
}
#view:focus-visible { outline-offset: -4px; }
#guide {
  position: absolute;
  left: 0; right: 0;
  top: 35%;
  height: 1px;
  background: var(--ink);
  opacity: .14;
  pointer-events: none;
}
#progress {
  position: absolute;
  left: 0;
  top: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
  pointer-events: none;
}
#prompt {
  position: absolute;
  left: 0; right: 0;
  top: 0;
  /* --app-h is the stage height in px, set by tp.js */
  padding: calc(var(--app-h, 60vh) * .35) 0 calc(var(--app-h, 60vh) * .65);
  will-change: transform;
}
#text {
  max-width: 17.5em;
  margin: 0 auto;
  padding: 0 .6em;
  font-size: var(--fs, 40px);
  line-height: 1.45;
  font-weight: 500;
  overflow-wrap: break-word;
}
#text p { margin: 0 0 .55em; }
#text .cue { font-size: .62em; line-height: 1.35; font-weight: 700; color: var(--ink-2); margin: 1.1em 0 .9em; }
#text .gap { height: .5em; }
#text .ph { color: var(--accent); font-weight: 700; }

/* Countdown */
#count {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font: 400 30vmin/1 var(--display);
  color: var(--accent);
  pointer-events: none;
  background: var(--dim);
}
#count.on { display: flex; }

/* Mirror mode: the device sits under the glass of a mirror teleprompter. Text, toolbar and countdown are flipped left to right, so they read correctly in the mirror. The nav and the two panels are not flipped. */
body.mirror #text { transform: scaleX(-1); }
body.mirror #tools { transform: translateX(-50%) scaleX(-1); }
body.mirror #count { transform: scaleX(-1); }
body.mirror #toast { transform: translateX(-50%) scaleX(-1); }

/* Small message shown when a remote key is used. Placed near the top, away from the reading line. */
#toast {
  position: absolute;
  left: 50%;
  top: 9%;
  transform: translateX(-50%);
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--inset);
  color: var(--inset-ink);
  font-size: 16px;
  line-height: 1.4;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  white-space: nowrap;
}
#toast.on { opacity: .96; }

/* ---- Toolbar ---------------------------------------------------------------- */

#tools {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  /* Full width, so the fade has no side edges to show against the ground. */
  width: 100%;
  /* The fade is opaque by 72px, just above where the first row of controls starts, whatever the toolbar's height. */
  padding: 64px 12px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  gap: 10px 8px;
  align-items: center;
  justify-content: center;
  background: linear-gradient(transparent, var(--fade) 72px);
}
.grp { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.lab { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.val { min-width: 2.2em; text-align: center; font: 400 15px/1 var(--mono); font-variant-numeric: tabular-nums; }
/* The speed slider is drawn here, so it looks the same on every system: a thin track, the part already reached in the accent, a round thumb. --fill is set by tp.js. */
input[type=range] {
  appearance: none;
  -webkit-appearance: none;
  width: 130px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-x;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  background: linear-gradient(90deg, var(--accent) var(--fill, 36%), color-mix(in srgb, var(--ink) 24%, transparent) 0);
}
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 24%, transparent); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  transition: transform .15s var(--ease);
}
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: var(--accent); }
input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.12); }
input[type=range]:focus-visible { outline-offset: 0; border-radius: 10px; }
#info { width: 100%; text-align: center; font: 400 13px/1.5 var(--mono); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hint { font-size: 13px; line-height: 1.5; color: var(--ink-2); text-align: center; }
#tools .hint { width: 100%; }

/* Pills, as on the site: the one solid pill is the main action, the rest are flat with a hairline. */
.tbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 600 15px/1 var(--text);
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: color .15s linear, border-color .15s linear, background-color .15s linear, transform .15s var(--ease);
}
.tbtn:hover { color: var(--accent); border-color: var(--accent); }
.tbtn:active { transform: scale(.97); }
.tbtn.on { color: var(--accent); border-color: var(--accent); }
.tbtn.icon { width: 44px; padding: 0; }
.tbtn.primary { min-width: 64px; min-height: 46px; padding: 0 22px; border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.tbtn.primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); color: var(--on-accent); }
.tbtn.primary .i { width: 20px; height: 20px; }
.tbtn:focus-visible, .sel select:focus-visible { border-radius: 999px; }

/* A secondary action reads as a link, not as a second button. */
.tbtn-text {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 600 16px/1.15 var(--text);
  text-decoration: underline;
  text-underline-offset: .16em;
  cursor: pointer;
}
.tbtn-text:hover { color: var(--accent); }

/* A select drawn as a pill, with its own caret so it looks the same on every system. */
.sel { position: relative; display: inline-flex; }
.sel select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
  max-width: 100%;
  padding: 0 36px 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 600 15px/1 var(--text);
  white-space: nowrap;
  cursor: pointer;
}
.sel::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--ink-2);
  border-bottom: 1.5px solid var(--ink-2);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

/* While reading, the nav and the toolbar go away together. visibility waits for the fade to end, and takes the controls out of the tab order. */
#tools, .top { transition: opacity .25s, visibility 0s; }
body.chrome-off #tools, body.chrome-off .top {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s, visibility 0s .25s;
}

/* On a phone the rows are: script; play, top, fullscreen and countdown; speed; text size and the three modes. The two labels go: a slider between − and + and the A− A+ pair explain themselves. */
@media (max-width: 640px) {
  #tools { padding-top: 44px; background: linear-gradient(transparent, var(--fade) 40px); gap: 8px 6px; }
  #tools .hint, #tools .lab { display: none; }
  #tools .grp:nth-child(1) { order: 1; }
  #tools .grp:nth-child(2) { order: 2; }
  #tools .grp:nth-child(5) { order: 3; }
  #tools .grp:nth-child(3) { order: 4; }
  #tools .grp:nth-child(4) { order: 5; }
  #tools .grp:nth-child(6) { order: 6; }
  .tbtn { padding: 0 14px; }
  .tbtn.icon { padding: 0; }
}

/* ---- Editor and remote panels ------------------------------------------------ */

/* Full-area sheets over the stage. The nav stays above them. */
.layer {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  touch-action: pan-y;
  background: var(--surface);
  -webkit-user-select: text;
  user-select: text;
}
.layer-in {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 760px;
  min-height: 100%;
  margin: 0 auto;
  padding: 28px var(--gutter) calc(20px + env(safe-area-inset-bottom));
}
.layer h2 { font: 400 clamp(1.35rem, 1.2rem + .7vw, 1.7rem)/1.2 var(--display); letter-spacing: -.02em; }
.which { color: var(--ink-2); font-weight: 600; }
.layer .hint { text-align: left; }
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; }
#ta {
  flex: 1;
  width: 100%;
  min-height: 40vh;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.55 var(--text);
  resize: none;
}

#learnBox {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px 16px;
  border: 2px dashed var(--line);
  border-radius: var(--r);
  font-size: 16px;
  line-height: 1.5;
}
#learnBox.wait { border-color: var(--accent); color: var(--accent); }
#learnBox code, #actList .ky { font: 400 13px/1.5 var(--mono); color: var(--ink-2); }
#actList .act {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(6em, auto) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
#actList .act:first-child { border-top: 0; }
#actList .nm { font-weight: 600; }
#actList .ky { text-align: center; }
#actList .tbtn { min-height: 40px; padding: 0 14px; }

@media (max-width: 560px) {
  #actList .act { grid-template-columns: minmax(0, 1fr) auto; }
  #actList .ky { grid-column: 1; grid-row: 2; text-align: left; }
}
