/* ============================================================================
   La Ruleta — Almanaque de decisiones
   Editorial almanac: ivory paper by day, ink by night. Flat spot inks,
   hairline rules, didone display. No glass, no glow, no gradient text.
   ============================================================================ */

/* ---------- Tipografía autoalojada ---------- */

@font-face {
  font-family: "Bodoni Moda";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/bodoni-moda-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: "Bodoni Moda";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/bodoni-moda-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: "Bodoni Moda";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/bodoni-moda-italic-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: "Bodoni Moda";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/bodoni-moda-italic-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: "Karla";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/karla-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: "Karla";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/karla-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;
}

/* ---------- Tokens: edición de día ---------- */

:root {
  color-scheme: light;

  --paper: #f4eee1;
  --paper-2: #ede4d2;
  --paper-3: #e6dbc5;
  --ink: #1a1611;
  --ink-soft: #4e463a;
  --ink-mute: #6e6352;
  --rule: rgba(26, 22, 17, 0.22);
  --rule-strong: rgba(26, 22, 17, 0.5);
  --vermilion: #b03a24;
  --vermilion-deep: #8a2b18;
  --brass: #8c6e36;
  --focus: #8a2b18;

  --shadow-plate: 0 26px 40px -30px rgba(48, 34, 16, 0.55);
  --shadow-lift: 0 18px 30px -18px rgba(48, 34, 16, 0.4);

  --serif: "Bodoni Moda", "Bodoni MT", Didot, "Times New Roman", serif;
  --sans: "Karla", "Segoe UI", system-ui, -apple-system, sans-serif;

  --app: 1200px;
  --gutter: clamp(18px, 3.6vw, 44px);
  --radius: 2px;
}

[data-theme="night"] {
  color-scheme: dark;

  --paper: #15120e;
  --paper-2: #1c1812;
  --paper-3: #231d15;
  --ink: #f2e9d8;
  --ink-soft: #c9bca4;
  --ink-mute: #a59880;
  --rule: rgba(242, 233, 216, 0.18);
  --rule-strong: rgba(242, 233, 216, 0.42);
  --vermilion: #e2704d;
  --vermilion-deep: #f09a80;
  --brass: #c9a567;
  --focus: #f09a80;

  --shadow-plate: 0 30px 48px -32px rgba(0, 0, 0, 0.9);
  --shadow-lift: 0 18px 30px -18px rgba(0, 0, 0, 0.8);
}

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

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

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

body {
  margin: 0;
  min-height: 100svh;
  background-color: var(--paper);
  background-image: radial-gradient(1100px 640px at 16% -12%, rgba(255, 255, 255, 0.5), transparent 62%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.35s ease, color 0.35s ease;
}

[data-theme="night"] body {
  background-image: radial-gradient(1100px 640px at 16% -12%, rgba(255, 236, 200, 0.045), transparent 62%);
}

::selection { background: var(--vermilion); color: var(--paper); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

button,
input { font: inherit; }

button {
  -webkit-tap-highlight-color: transparent;
  color: inherit;
}

a { color: inherit; }
p { margin: 0; }
h1, h2 { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

input { caret-color: var(--vermilion); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* ---------- Estructura ---------- */

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--app);
  margin: 0 auto;
  padding: 24px var(--gutter) 42px;
}

/* ---------- Cabecera ---------- */

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: clamp(14px, 3vw, 36px);
  padding-bottom: 14px;
  border-bottom: 3px double var(--rule-strong);
}

.wordmark {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
}

.wordmark__mark {
  align-self: center;
  flex: none;
  width: 26px;
  height: 26px;
  color: var(--vermilion);
}

.wordmark__name {
  font-family: var(--serif);
  font-size: 1.42rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
}

.wordmark__tag {
  padding-left: 10px;
  border-left: 1px solid var(--rule);
  color: var(--ink-mute);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
}

.dateline {
  color: var(--ink-mute);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.masthead__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.icon-btn[aria-pressed="true"] { background: var(--paper-3); border-color: var(--rule-strong); color: var(--ink); }
.icon-btn .icon-off { display: none; }
.icon-btn[aria-pressed="true"] .icon-on { display: none; }
.icon-btn[aria-pressed="true"] .icon-off { display: block; }

.icon-btn .icon-sun { display: none; }
[data-theme="night"] .icon-btn .icon-sun { display: block; }
[data-theme="night"] .icon-btn .icon-moon { display: none; }

.lang-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.lang-link:hover { color: var(--vermilion); border-color: var(--rule); }

/* ---------- Titular ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  align-items: end;
  gap: clamp(24px, 4vw, 64px);
  padding: clamp(26px, 4.4vw, 46px) 0 clamp(22px, 3vw, 32px);
  border-bottom: 1px solid var(--rule);
}

.hero__title {
  max-width: 15ch;
  font-family: var(--serif);
  font-size: clamp(2.65rem, 5.9vw, 5rem);
  font-weight: 500;
  line-height: 0.94;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

.hero__title em {
  color: var(--vermilion);
  font-style: italic;
}

.hero__aside {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-left: clamp(16px, 2vw, 26px);
  border-left: 1px solid var(--rule);
}

.hero__lede {
  color: var(--ink-soft);
  font-size: clamp(0.96rem, 1.15vw, 1.05rem);
  line-height: 1.6;
  max-width: 34ch;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  column-gap: 8px;
  row-gap: 4px;
  color: var(--ink-mute);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero__meta span + span::before {
  content: "·";
  margin-right: 8px;
  color: var(--vermilion);
}

/* ---------- Escenario ---------- */

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(350px, 404px);
  align-items: start;
  gap: clamp(32px, 5vw, 72px);
  padding-top: clamp(28px, 4vw, 44px);
}

.stage__wheel {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.plate {
  position: relative;
  width: min(100%, 560px);
  margin: 0 auto;
}

.wheel {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  isolation: isolate;
}

#wheelCanvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-plate);
  transition: box-shadow 0.4s ease;
}

.wheel.is-spinning #wheelCanvas { cursor: default; }

.pointer {
  position: absolute;
  top: -9px;
  left: 50%;
  z-index: 3;
  width: 22px;
  height: 34px;
  transform: translateX(-50%);
  filter: drop-shadow(0 5px 5px rgba(40, 28, 12, 0.22));
}

.pointer::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: var(--ink);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

[data-theme="night"] .pointer::before { background: var(--vermilion); }

.hub {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 30%;
  aspect-ratio: 1;
  padding: 0 8px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 10px 18px -12px rgba(40, 28, 12, 0.5);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.hub::before {
  content: "";
  position: absolute;
  inset: 5%;
  border: 1px solid var(--rule);
  border-radius: 50%;
  pointer-events: none;
}

.hub:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper);
  transform: translate(-50%, -50%) scale(1.035);
  box-shadow: 0 14px 26px -14px rgba(40, 28, 12, 0.55);
}

.hub:active:not(:disabled) { transform: translate(-50%, -50%) scale(0.985); }
.hub:disabled { cursor: default; opacity: 0.55; }
.wheel.is-spinning .hub:disabled { opacity: 1; }
.wheel.is-spinning .hub::before { border-color: var(--vermilion); }

.hub__label {
  font-size: clamp(0.7rem, 1.4vw, 0.82rem);
  font-weight: 700;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  line-height: 1;
  text-transform: uppercase;
}

.hub__sub {
  color: var(--ink-mute);
  font-size: clamp(0.7rem, 1vw, 0.74rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: color 0.18s ease;
}

.hub:hover:not(:disabled) .hub__sub { color: var(--paper-3); }

.caption {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: min(100%, 560px);
  margin-top: clamp(18px, 3vw, 26px);
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  color: var(--ink-mute);
  font-size: 0.72rem;
  line-height: 1.4;
}

.caption__fig {
  flex: none;
  color: var(--vermilion);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.caption__touch { display: none; }

@media (hover: none) and (pointer: coarse) {
  .caption__pointer { display: none; }
  .caption__touch { display: inline; }
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper-2);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.94em;
  font-weight: 700;
  line-height: 1.4;
}

/* ---------- Columna de veredicto ---------- */

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.slip {
  position: relative;
  padding: 15px 18px 20px;
  border: 1px solid var(--rule-strong);
  /* impeccable-disable-next-line border-accent-on-rounded: the slip is square on purpose */
  border-top: 3px solid var(--vermilion);
  border-radius: 0;
  background: var(--paper-2);
  scroll-margin-block: 24px;
}

.slip__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--rule-strong);
}

.label {
  color: var(--ink-mute);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-mute);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.result[data-state="spinning"] .status .dot {
  background: var(--vermilion);
  box-shadow: 0 0 0 3px rgba(176, 58, 36, 0.18);
  animation: blink 0.9s steps(2, jump-none) infinite;
}

.result[data-state="done"] .status .dot { background: var(--win, var(--vermilion)); }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.result__value {
  position: relative;
  min-height: 1.12em;
  margin: 14px 0 6px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.95rem, 2.9vw, 2.55rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.012em;
  overflow-wrap: anywhere;
}

.result__value::after {
  content: "";
  display: block;
  width: 46px;
  height: 3px;
  margin-top: 12px;
  background: var(--win, var(--rule-strong));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.result__value.is-win::after { opacity: 1; }

/* En el pliego de día, las tintas claras necesitan peso para leerse como filete. */
[data-theme="day"] .result__value::after {
  background: color-mix(in oklab, var(--win, var(--rule-strong)) 62%, var(--ink) 38%);
}

.result.is-pop .result__value { animation: inkIn 0.55s cubic-bezier(0.16, 0.84, 0.24, 1) both; }

@keyframes inkIn {
  from { opacity: 0; filter: blur(5px); transform: translateY(7px); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

.result__meta {
  max-width: 32ch;
  min-height: 3em;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* ---------- Bloques editoriales ---------- */

.block {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.block__title {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.count {
  color: var(--ink-mute);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 10px;
  margin-bottom: 8px;
}

.add-form input {
  width: 100%;
  height: 44px;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.add-form input::placeholder { color: var(--ink-mute); opacity: 1; }
.add-form input:focus-visible {
  outline: none;
  border-bottom-color: var(--vermilion);
  box-shadow: inset 0 -2px 0 var(--vermilion);
}
.add-form input:disabled { opacity: 0.5; }

.add-form button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--vermilion);
  border-radius: var(--radius);
  background: var(--vermilion);
  color: var(--paper);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.16s ease;
}

.add-form button svg { width: 16px; height: 16px; }
.add-form button:hover:not(:disabled) {
  background: var(--vermilion-deep);
  border-color: var(--vermilion-deep);
}
.add-form button:active:not(:disabled) { transform: translateY(1px); }
.add-form button:disabled { opacity: 0.45; cursor: default; }

.options {
  max-height: 409px;
  overflow-y: auto;
  border-top: 1px dotted var(--rule);
}

.option {
  display: grid;
  grid-template-columns: 11px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  padding: 9px 6px 9px 4px;
  border-bottom: 1px dotted var(--rule);
  transition: background 0.16s ease, color 0.16s ease;
}

.option:hover { background: var(--paper-2); }

.option__dot {
  width: 10px;
  height: 10px;
  border-radius: 1px;
  background: var(--c, var(--ink));
}

.option__label {
  overflow: hidden;
  font-size: 0.92rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.option__remove {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease;
}

.option__remove svg { width: 11px; height: 11px; }
.option__remove:hover:not(:disabled) { color: var(--vermilion); background: var(--paper-3); }
.option__remove:disabled { opacity: 0.35; cursor: default; }

.options-empty {
  padding: 18px 4px;
  border-top: 1px dotted var(--rule);
  border-bottom: 1px dotted var(--rule);
  color: var(--ink-mute);
  font-size: 0.86rem;
  line-height: 1.5;
}

.panel__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn svg { width: 14px; height: 14px; }
.btn:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn:disabled { opacity: 0.4; cursor: default; }

/* ---------- Historial ---------- */

.history {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.3;
}

.chip__dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 1px;
  background: var(--c, var(--ink));
}

.chip > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-empty {
  color: var(--ink-mute);
  font-size: 0.84rem;
  line-height: 1.5;
}

/* ---------- Colofón ---------- */

.colophon {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 32px;
  margin-top: clamp(44px, 6vw, 72px);
  padding-top: 14px;
  border-top: 3px double var(--rule-strong);
  color: var(--ink-mute);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
}

.colophon p {
  max-width: 46ch;
  text-wrap: pretty;
}

/* ---------- Avisos ---------- */

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 60;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  transform: translate(-50%, 12px);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-lift);
  color: var(--ink);
  font-size: 0.84rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.noscript {
  position: fixed;
  bottom: 22px;
  left: 50%;
  z-index: 70;
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  transform: translateX(-50%);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  font-size: 0.86rem;
  text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 1020px) {
  .masthead { grid-template-columns: minmax(0, 1fr) auto; }
  .dateline { display: none; }
  .hero { grid-template-columns: 1fr; align-items: start; gap: 20px; }
  .hero__aside {
    padding: 16px 0 0;
    border-left: 0;
    border-top: 1px solid var(--rule);
  }
  .hero__lede { max-width: 52ch; }
  .stage { grid-template-columns: 1fr; }
  .stage__wheel { margin-bottom: 8px; }
  .panel { width: 100%; max-width: 560px; margin: 0 auto; }
}

@media (max-width: 640px) {
  .app { padding: 16px 16px 30px; }
  .masthead { gap: 10px; }
  .wordmark__name { font-size: 1.24rem; }
  .wordmark__tag { display: none; }
  .masthead__actions { gap: 2px; }
  .icon-btn,
  .lang-link { width: 38px; height: 38px; }
  .lang-link { padding: 0; }
  .hero { padding-top: 24px; }
  .hero__title { font-size: clamp(2.55rem, 12.6vw, 3.4rem); text-wrap: wrap; }
  .hero__lede { font-size: 0.95rem; }
  .hero__meta { font-size: 0.7rem; letter-spacing: 0.08em; row-gap: 2px; }
  .caption { font-size: 0.7rem; }
  .slip { padding: 14px 15px 18px; }
  .result__value { font-size: clamp(1.85rem, 8vw, 2.25rem); }
  .options { max-height: none; }
  .colophon { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .hero__title em,
  .caption__fig { color: inherit; }
  .icon-btn,
  .btn,
  .slip,
  .add-form button { border: 1px solid CanvasText; }
}
