/*
 * Claro AI
 * The page is one scene: it starts at night with an unopened official letter
 * and ends in the morning. Colours come from that sky (night blue, sunrise,
 * envelope yellow); text sits directly on it, without boxes.
 */
:root {
  --night: #070b24;
  --ink: #131a4a;
  --ink-soft: #454c7d;
  --sun: #ffc27a;
  --sun-deep: #ff9d7c;
  --white: #ffffff;
  --white-soft: #d3d9ff;
  --paper: #fffdf8;
  --paper-ink: #1d2030;
  --error: #ffb3a1;

  --r-panel: 32px;
  --header-h: 84px;
  --max-w: 1280px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --font-display: 'Unbounded', 'IBM Plex Sans Arabic', 'Noto Sans Ethiopic', -apple-system, sans-serif;
  --font-body: 'Onest', 'IBM Plex Sans Arabic', 'Noto Sans Ethiopic', -apple-system, sans-serif;
  --font-paper: 'Source Serif 4', Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  background: var(--night);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

body {
  --fg: var(--white);
  --fg-soft: var(--white-soft);
  margin: 0;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  overflow-x: clip;
}

body.is-day {
  --fg: var(--ink);
  --fg-soft: var(--ink-soft);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

[dir='rtl'] :is(h1, h2, h3) {
  font-weight: 700;
  letter-spacing: 0;
}

p,
ul,
ol,
dl,
dd {
  margin: 0;
  padding: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

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

.is-day :focus-visible {
  outline-color: var(--ink);
}

.container {
  width: 100%;
  max-width: calc(var(--max-w) + 64px);
  margin-inline: auto;
  padding-inline: max(20px, min(32px, 4vw));
}

.hidden {
  display: none !important;
}

/* ---------- sky ---------- */

.sky,
.sky > div,
.scene-host {
  position: fixed;
  inset: 0;
}

.sky {
  --dawn: 0;
  --day: 0;
  --sun: 0;
  z-index: -2;
  overflow: hidden;
  background: var(--night);
}

.sky-night {
  background: linear-gradient(180deg, #060a22 0%, #0b1446 42%, #1f2a80 68%, #5a4a9f 86%, #b5638f 100%);
}

.sky-dawn {
  background: linear-gradient(180deg, #0c1650 0%, #1b2a86 34%, #4248ad 58%, #8a62ab 76%, #f58a7c 92%, #ffb98a 100%);
  opacity: var(--dawn);
  will-change: opacity;
}

.sky-day {
  background: linear-gradient(180deg, #b9d6ff 0%, #dbe9ff 46%, #fff1df 100%);
  opacity: var(--day);
  will-change: opacity;
}

/* the sun stands behind the letter and rises with the story */
.sky .sky-sun {
  inset: auto;
  left: 73%;
  top: 112%;
  width: 120vmax;
  height: 120vmax;
  translate: -50% -50%;
  transform: translateY(calc(var(--sun) * -46vh)) scale(calc(0.62 + var(--sun) * 0.4));
  will-change: transform, opacity;
  background: radial-gradient(closest-side, #fff4dc 0%, #ffd9a0 14%, rgba(255, 158, 110, 0.72) 34%, rgba(255, 120, 120, 0.25) 62%, rgba(255, 110, 130, 0) 100%);
  opacity: calc(0.9 - var(--day) * 0.35);
}

[dir='rtl'] .sky .sky-sun {
  left: 27%;
}

.sky::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.14;
  mix-blend-mode: overlay;
  background: 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='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}

.scene-host {
  z-index: -1;
  height: 100vh;
  height: 100lvh;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s;
}

.scene-host.is-ready {
  opacity: 1;
}

.scene-host canvas {
  display: block;
  width: 100%;
  height: 100%;
}

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

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  color: var(--fg);
  transition: color 0.3s;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.brand-cai {
  display: block;
  transition: filter 0.3s;
}

.is-day .brand-cai {
  filter: brightness(0);
}

/* frosted blur bar behind the Claro AI header so scrolled text dissolves cleanly */
.site-header::before {
  content: '';
  position: absolute;
  inset: 0 0 -28px;
  z-index: -1;
  background: linear-gradient(180deg, rgba(10, 16, 52, 0.72) 0%, rgba(16, 26, 76, 0.42) 62%, rgba(16, 26, 76, 0) 100%);
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
  -webkit-mask: linear-gradient(180deg, #000 0%, #000 66%, transparent 100%);
  mask: linear-gradient(180deg, #000 0%, #000 66%, transparent 100%);
  opacity: 1;
  transition: background 0.35s, opacity 0.3s;
  pointer-events: none;
}

.is-day .site-header::before {
  background: linear-gradient(180deg, rgba(206, 224, 255, 0.84) 0%, rgba(219, 233, 255, 0.48) 62%, rgba(219, 233, 255, 0) 100%);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--sun);
  color: #1c1238;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.15;
  white-space: nowrap;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, scale 0.2s var(--ease-out);
}

@media (hover: hover) {
  .btn:hover {
    background: #fff;
  }
}

.btn:active {
  scale: 0.97;
}

.btn:disabled {
  opacity: 0.65;
  cursor: default;
}

.btn-sm {
  min-height: 46px;
  padding: 0 22px;
  font-size: 16px;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.is-day .site-header .btn {
  background: var(--ink);
  color: #fff;
}

.lang-dropdown {
  position: relative;
}

.lang-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-weight: 500;
  font-size: 16px;
}

.lang-trigger:hover,
.lang-dropdown.open .lang-trigger {
  background: color-mix(in srgb, currentColor 14%, transparent);
}

.lang-chevron {
  transition: rotate 0.2s;
}

.lang-dropdown.open .lang-chevron {
  rotate: 180deg;
}

.lang-menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  width: 256px;
  max-height: min(64vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px;
  border-radius: 20px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(8, 10, 50, 0.35);
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: 13px;
  background: none;
  font-size: 15px;
  text-align: start;
}

.lang-option:hover,
.lang-option.active {
  background: #e8edff;
}

.lang-code {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

/* ---------- hero ---------- */

.hero-chapter {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: calc(var(--header-h) + 8px) 0 48px;
}

.hero-copy {
  width: min(50%, 580px);
}

h1 {
  font-size: clamp(32px, 3.85vw, 62px);
  line-height: 1.08;
}

.hero-line {
  display: block;
}

.hero-sub {
  margin-top: 22px;
  max-width: 30em;
  font-size: clamp(16px, 1.35vw, 19px);
  line-height: 1.55;
  color: var(--white-soft);
}

.join {
  margin-top: 28px;
  scroll-margin-top: 45vh;
}

.join-form label {
  display: block;
  margin-bottom: 12px;
  font-size: clamp(15px, 1.2vw, 17px);
  font-weight: 500;
}

.join-row,
.ticket,
.join-panel {
  max-width: 520px;
}

.join-row {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
  transition: box-shadow 0.2s;
}

.join-row:focus-within {
  box-shadow: inset 0 0 0 2px var(--sun);
}

.join-row input {
  flex: 1;
  min-width: 0;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 16px;
  outline: 0;
}

.join-row input:focus-visible {
  outline: none;
}

.join-row input::placeholder {
  color: #c8cff7;
  opacity: 1;
}

.join-row input[aria-invalid='true'] {
  color: var(--error);
}

.hp-trap {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.field-error {
  margin-top: 12px;
  font-weight: 500;
  color: var(--error);
}

.field-error:empty,
.field-note:empty {
  display: none;
}

.field-note {
  margin-top: 14px;
  font-size: 15px;
  color: var(--white-soft);
}

.note-link {
  padding: 0;
  border: 0;
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.server-counter {
  margin-top: 18px;
  font-size: 16px;
}

.server-counter-val {
  margin-inline-start: 6px;
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--sun);
}

/* ---------- after signup: the Wartenummer ---------- */

.join-success {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
}

.ticket-machine {
  position: relative;
  min-width: 0;
  max-width: 520px;
}

/* The mouth of the ticket machine; only there while the number is being printed */
.ticket-slot {
  display: none;
  position: absolute;
  z-index: 2;
  top: -7px;
  inset-inline: -14px;
  height: 14px;
  border-radius: 999px;
  background: #02041a;
  box-shadow:
    inset 0 3px 6px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.14),
    0 0 26px rgba(255, 194, 122, 0.55);
}

.ticket-machine.is-printing .ticket-slot {
  display: block;
}

/* While printing, everything above the slot is cut off, so the ticket looks like it comes out of it */
.ticket-machine.is-printing {
  clip-path: inset(0 -80px -120px -80px);
}

.ticket {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  background: var(--paper);
  color: var(--ink);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(5, 5, 40, 0.45);
  rotate: -1.2deg;
}

.ticket-machine.is-printing .ticket {
  rotate: 0deg;
}

/* Rolling digits, like a slot machine */
.digit {
  display: inline-block;
  height: 1.1em;
  overflow: hidden;
  vertical-align: top;
}

.digit-reel {
  display: block;
}

.digit-reel span {
  display: block;
  height: 1.1em;
  text-align: center;
}

.ticket-machine.is-printing .digit {
  mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
}

.burst-bit {
  position: fixed;
  z-index: 60;
  top: 0;
  left: 0;
  width: 7px;
  height: 11px;
  border-radius: 2px;
  pointer-events: none;
}

.ticket-main,
.ticket-side {
  padding: 22px 28px;
}

.ticket-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  border-inline-start: 2px dashed #c8cbe6;
}

.ticket-label,
.ticket-refs {
  font-size: 15px;
  color: var(--ink-soft);
}

.ticket-num {
  direction: ltr;
  text-align: start;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 66px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.ticket-title {
  font-weight: 600;
  font-size: 20px;
  line-height: 1.3;
}

.ticket-mail {
  font-size: 14px;
  font-weight: 600;
  color: #137a54;
}

.ticket-refs strong {
  margin-inline-start: 6px;
  color: var(--ink);
}

.ticket.ticket-simple {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 24px;
  rotate: 0deg;
  border-radius: 20px;
}

.ticket-check {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(19, 122, 84, 0.12);
  color: #137a54;
}

.ticket.ticket-simple .ticket-side {
  padding: 0;
  border-inline-start: 0;
  gap: 6px;
  text-align: start;
}

.ticket.ticket-simple .ticket-mail {
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ---------- referral rank progress bar ---------- */

.rank-progress {
  max-width: 520px;
  padding: 18px 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.20);
  display: grid;
  gap: 10px;
}

.rank-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rank-progress-title {
  font-weight: 700;
  font-size: 15px;
  color: #ffffff;
}

.rank-progress-count {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: #1c1238;
  background: var(--sun);
  padding: 3px 11px;
  border-radius: 999px;
}

.rank-bar-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.rank-bar-fill {
  height: 100%;
  min-width: 6%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd98f 0%, #ffc27a 52%, #ff9d7c 100%);
  box-shadow: 0 0 14px rgba(255, 194, 122, 0.65);
  transition: width 0.6s var(--ease-out);
}

.rank-milestones {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.rank-step {
  font-size: 12px;
  font-weight: 600;
  color: rgba(211, 217, 255, 0.68);
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.rank-step.is-done {
  color: #1c1238;
  background: var(--sun);
}

.rank-progress-copy {
  font-size: 14.5px;
  line-height: 1.45;
  color: #ffffff;
  font-weight: 500;
}

.rank-progress-limit {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--sun);
  font-weight: 500;
}

.join-panel h2 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0;
}

.join-panel p:not(.field-note) {
  margin-bottom: 12px;
  font-size: 16px;
  color: var(--white-soft);
}

.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.cat-chip {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 16px;
}

.cat-chip:hover {
  background: rgba(255, 255, 255, 0.28);
}

.cat-chip[aria-pressed='true'] {
  background: var(--sun);
  color: #1c1238;
  font-weight: 600;
}

.join-success > .btn {
  justify-self: start;
}

/* ---------- story ---------- */

.beat {
  height: 150vh;
  color: #fff;
}

.beat-day {
  color: var(--ink);
}

.beat:last-child {
  height: 190vh;
}

.beat-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  padding-top: var(--header-h);
  display: flex;
  align-items: center;
}

.beat-title {
  max-width: 11.5em;
  font-size: clamp(32px, 3.8vw, 58px);
  line-height: 1.1;
}

.beat-title,
.beat-text {
  width: min(48%, 540px);
}

.beat-text {
  margin-top: 22px;
  max-width: 460px;
  font-size: clamp(16px, 1.35vw, 19px);
  line-height: 1.55;
}

/* ---------- examples ---------- */

.chapter {
  padding: clamp(80px, 11vw, 160px) 0 0;
}

.section-heading {
  max-width: 14em;
  font-size: clamp(34px, 4.4vw, 64px);
  line-height: 1.1;
}

.section-lead {
  margin-top: 20px;
  max-width: 34em;
  font-size: 20px;
}

/* From here on it is always morning, whatever the scroll position */
#funktionen,
#faq,
.site-footer {
  color: var(--ink);
}

.decoder {
  margin-top: 48px;
}

.decoder-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lang-pills-live {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(19, 26, 74, 0.25) transparent;
  -webkit-overflow-scrolling: touch;
}

.lang-pill-btn {
  flex: none;
  white-space: nowrap;
}

.decoder-tab,
.lang-pill-btn {
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  font-size: 17px;
  transition: background 0.2s;
}

.lang-pill-btn {
  min-height: 44px;
  padding: 0 16px;
  font-size: 16px;
}

.decoder-tab:hover,
.lang-pill-btn:hover {
  background: #fff;
}

.decoder-tab.active,
.lang-pill-btn.active {
  background: var(--ink);
  color: #fff;
}

.decoder-body {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(36px, 6vw, 88px);
  align-items: center;
  margin-top: 44px;
}

.pane-tag {
  margin-bottom: 14px;
  font-size: 16px;
  color: var(--ink-soft);
}

.paper {
  padding: clamp(26px, 3.4vw, 48px);
  background: var(--paper);
  color: var(--paper-ink);
  font: 400 17px/1.65 var(--font-paper);
  rotate: -1.6deg;
  box-shadow: 0 34px 70px rgba(50, 50, 120, 0.22), 0 4px 12px rgba(50, 50, 120, 0.1);
}

.paper > p + p {
  margin-top: 14px;
}

.paper-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid #d6d3c9;
  font-size: 15px;
  line-height: 1.4;
}

.paper-head strong {
  font-size: 20px;
}

.paper-ref {
  text-align: end;
}

.paper-subject {
  font-weight: 700;
  font-size: 20px;
}

.paper mark {
  padding: 1px 4px;
  color: inherit;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.mark-key {
  background: #ffd98f;
}

.mark-due {
  background: #ffb39b;
}

.decoder-answer {
  margin-top: 32px;
}

.decoder-answer .pane-tag {
  display: none;
}

.pane-plain-text {
  font-weight: 500;
  font-size: clamp(24px, 2.3vw, 33px);
  line-height: 1.32;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}

[dir='rtl'] .pane-plain-text {
  letter-spacing: 0;
}

.pane-meta {
  display: grid;
  gap: 12px;
  margin-top: 32px;
}

.pane-meta > div {
  padding: 18px 24px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
}

.pane-meta .meta-due {
  background: var(--sun-deep);
}

.pane-meta dt {
  font-size: 15px;
}

.pane-meta dd {
  font-weight: 600;
  font-size: 19px;
  line-height: 1.35;
}

.meta-due dd {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.03em;
}

/* ---------- FAQ ---------- */

.faq-wrap {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  column-gap: clamp(36px, 6vw, 88px);
}

.faq-wrap .section-header-stack {
  grid-row: span 2;
}

.faq-item {
  border-bottom: 1px solid rgba(19, 26, 74, 0.2);
}

.faq-item summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 24px 0;
  font-weight: 600;
  font-size: 20px;
  line-height: 1.35;
  list-style: none;
  cursor: pointer;
}

.faq-item:first-child summary {
  padding-top: 8px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-toggle {
  position: relative;
  flex: none;
  width: 18px;
  height: 18px;
}

.faq-toggle::before,
.faq-toggle::after {
  content: '';
  position: absolute;
  inset: 8px 0;
  background: currentColor;
  border-radius: 2px;
}

.faq-toggle::after {
  rotate: 90deg;
  transition: rotate 0.25s var(--ease-out);
}

.faq-item[open] .faq-toggle::after {
  rotate: 0deg;
}

.faq-body {
  max-width: 36em;
  padding-bottom: 26px;
  color: var(--ink-soft);
}

.rdg-bar {
  grid-column: 2;
  margin-top: 28px;
  font-size: 15px;
  color: var(--ink-soft);
}

/* ---------- closing ---------- */

.closing {
  padding: clamp(80px, 11vw, 160px) 0 28px;
}

.closing-panel {
  display: grid;
  justify-items: center;
  padding: clamp(64px, 9vw, 130px) 24px clamp(120px, 15vw, 220px);
  border-radius: var(--r-panel);
  background:
    radial-gradient(70% 60% at 50% 108%, #fff1d6 0%, #ffcf94 24%, rgba(255, 150, 110, 0.75) 48%, rgba(255, 120, 120, 0) 100%),
    linear-gradient(180deg, #0c1650 0%, #24339a 44%, #6a5fb8 72%, #f28a80 100%);
  color: #fff;
  text-align: center;
}

.closing .section-lead {
  color: #e6eaff;
  text-wrap: balance;
}

.closing .btn {
  margin-top: 34px;
}

/* ---------- footer, legal ---------- */

.site-footer {
  padding: 8px 0 36px;
  font-size: 15px;
}

.footer-inner,
.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
}

.footer-btn {
  padding: 10px 0;
  border: 0;
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 11, 36, 0.6);
}

.modal-card {
  display: grid;
  gap: 18px;
  justify-items: start;
  width: min(100%, 580px);
  max-height: min(82vh, 680px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 34px;
  border-radius: var(--r-panel);
  background: #fff;
  color: var(--ink);
}

.modal-card h3 {
  font-size: 24px;
  line-height: 1.25;
}

.modal-card p {
  white-space: pre-line;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.modal-card .btn {
  background: var(--ink);
  color: #fff;
}

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

@media (max-width: 899px) {
  :root {
    --header-h: 72px;
    --r-panel: 26px;
  }

  body {
    font-size: 17px;
  }

  .sky::after {
    display: none;
  }

  /* Fade out the 3D document while the mobile keyboard / input is active */
  body.is-typing .scene-host {
    opacity: 0 !important;
    transition: opacity 0.2s;
  }

  .sky .sky-sun,
  [dir='rtl'] .sky .sky-sun {
    left: 50%;
    width: 130vw;
    height: 130vw;
  }

  /* Crisp opaque-top fade on mobile (zero WebGL blur lag, zero text bleed behind CAI) */
  .site-header::before {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: linear-gradient(180deg, rgba(7, 11, 36, 0.98) 0%, rgba(10, 16, 52, 0.96) 72%, rgba(10, 16, 52, 0) 100%);
  }

  .is-day .site-header::before {
    background: linear-gradient(180deg, rgba(185, 214, 255, 0.98) 0%, rgba(206, 224, 255, 0.96) 72%, rgba(206, 224, 255, 0) 100%);
  }

  .join-row,
  .rank-progress {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(16, 24, 72, 0.68);
  }

  .hero-chapter {
    align-items: flex-start;
    padding-bottom: 46vh;
  }

  .is-registered .hero-chapter {
    padding-bottom: 60px;
  }

  .hero-copy {
    width: min(100%, 520px);
    margin-inline: auto;
    text-align: center;
  }

  .hero-sub {
    margin-top: 18px;
    margin-inline: auto;
    font-size: 17px;
  }

  .join-row,
  .ticket-machine,
  .rank-progress,
  .join-panel {
    margin-inline: auto;
  }

  .ticket,
  .rank-progress {
    text-align: start;
  }

  .cat-chips {
    justify-content: center;
  }

  .beat-title,
  .beat-text {
    width: 100%;
    margin-inline: auto;
    text-align: center;
  }

  .join {
    margin-top: 24px;
    scroll-margin-top: 35vh;
  }

  .beat-pin {
    align-items: flex-end;
    padding-bottom: max(7vh, 40px);
  }

  .beat-title {
    font-size: clamp(27px, 7.4vw, 44px);
  }

  .beat-text {
    margin-top: 14px;
    font-size: 17px;
  }

  .decoder-body,
  .faq-wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .faq-wrap .section-header-stack {
    margin-bottom: 28px;
  }

  .rdg-bar {
    grid-column: 1;
  }
}

@media (max-width: 560px) {
  .brand-text,
  .hide-xs {
    display: none;
  }

  .is-day .hide-xs,
  .is-past-hero .hide-xs {
    display: inline-flex;
  }

  h1 {
    font-size: clamp(31px, 8.9vw, 40px);
  }

  .join-form .join-row {
    flex-direction: column;
    gap: 10px;
    padding: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }

  .join-form .join-row:focus-within {
    box-shadow: none;
  }

  .join-form .join-row input {
    width: 100%;
    min-height: 54px;
    padding: 0 20px;
    border-radius: 999px;
    background: rgba(16, 24, 72, 0.78);
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.24);
    font-size: 16px;
    text-align: center;
  }

  .join-form .join-row input:focus {
    box-shadow: inset 0 0 0 2px var(--sun);
    outline: none;
  }

  .join-form .join-row .btn {
    width: 100%;
    min-height: 54px;
  }

  .join-row input {
    font-size: 16px;
  }

  .ticket {
    grid-template-columns: minmax(0, 1fr);
  }

  .ticket-main,
  .ticket-side {
    padding: 18px 20px;
  }

  .ticket-side {
    border-inline-start: 0;
    border-top: 2px dashed #c8cbe6;
  }

  .ticket.ticket-simple {
    padding: 18px 20px;
    gap: 14px;
  }

  .ticket.ticket-simple .ticket-side {
    padding: 0;
    border-top: 0;
  }

  .ticket-num {
    font-size: 64px;
  }

  .ticket-title {
    font-size: 17px;
  }

  .decoder-tabs,
  .lang-pills-live {
    flex-wrap: nowrap;
    margin-inline: -20px;
    padding: 4px 20px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .decoder-tab,
  .lang-pill-btn {
    flex: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

/* ---------- notice from the admin ---------- */

.notice-bar {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 40;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 12px 16px 20px;
  border-radius: 20px;
  background: var(--paper);
  color: var(--paper-ink);
  box-shadow: 0 18px 50px rgba(7, 11, 36, 0.35);
  text-align: center;
}

.notice-bar .notice-inner {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 4px;
}

.notice-bar .notice-title {
  font-weight: 600;
}

.notice-bar .notice-text {
  margin: 0;
  font-size: 15px;
  color: var(--ink-soft);
}

.notice-close {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.notice-close:hover {
  background: rgba(19, 26, 74, 0.08);
}

.notice-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.notice-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  text-decoration: none;
}

.notice-cover {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: var(--night);
  color: #fff;
  text-align: center;
}

.notice-cover .notice-inner {
  max-width: 460px;
  display: grid;
  justify-items: center;
  gap: 14px;
}

.notice-logo {
  height: 30px;
  margin-bottom: 18px;
}

.notice-cover .notice-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(24px, 6vw, 34px);
  font-weight: 500;
  line-height: 1.2;
  text-wrap: balance;
}

.notice-cover .notice-text {
  margin: 0;
  color: var(--white-soft);
  font-size: 17px;
  line-height: 1.55;
}

.notice-cover .notice-link {
  background: var(--sun);
  color: var(--night);
}

body.site-paused {
  overflow: hidden;
}

body.site-paused .page-layer,
body.site-paused .scene-host {
  visibility: hidden;
}

/* ---------- letter question as a modal after the signup ---------- */
.cat-card {
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.cat-card h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 22px;
  text-wrap: balance;
}

.cat-card .cat-chips {
  justify-content: center;
  margin-top: 4px;
}

.cat-card .cat-chip {
  background: #f1f0f6;
  color: var(--ink);
}

.cat-card .cat-chip:hover {
  background: #e4e2ee;
}

.cat-card .cat-chip[aria-pressed='true'] {
  background: var(--sun);
  color: #1c1238;
}

.cat-status {
  min-height: 1.4em;
  font-size: 15px;
  color: var(--ink);
  opacity: 0.75;
}

.cat-later {
  padding: 6px 12px;
  border: 0;
  background: none;
  color: var(--ink);
  opacity: 0.55;
  font-size: 15px;
  cursor: pointer;
}

.cat-later:hover {
  opacity: 0.9;
}

@media (max-width: 520px) {
  .cat-card {
    padding: 28px 20px 20px;
  }
}
