/* HEX website — night comic theme.
   A deep dark base with soft comic touches: muted ink outlines, small coloured offset shadows,
   faint halftone dots and speed lines, a speech bubble and stickers. Straight system type throughout.
   Ten colour themes (picked with the palette button, see ui/themes.js) set the base, the primary and the
   secondary colour; rose, amber, teal and sky stay as extra accents. Controls come from Sakuga VFX (vendor/sakuga). */

:root {
  color-scheme: dark;
  /* Theme colours. These are Midnight Navy (navy base, off-white, steel blue); each theme below overrides them. */
  --bg: #080b12;
  --bg-2: #0c1019;
  --surface: #111723;
  --surface-2: #171f2e;
  --surface-3: #202a3c;
  --ink: #33405a;
  --ink-2: #475676;
  --text: #edf1f8;
  --text-2: #b3bccd;
  --mute: #7a8499;
  --pri: #e8ecf4;
  --pri-hi: #ffffff;
  --pri-2: #b9c2d3;
  --pri-deep: #2c3a5c;
  --pri-rgb: 232, 236, 244;
  --pri-on: #0b0f18;
  --sec: #6d93d8;
  --sec-deep: #26406f;
  --sec-rgb: 109, 147, 216;
  --sec-on: #fff;
  --fg-rgb: 255, 255, 255;
  --strong: #fff;
  --glow-3: rgba(63, 216, 200, 0.07);
  --glow-4: rgba(255, 198, 92, 0.05);

  /* Extra accents (timers, stickers). Neutral themes turn them into greys. */
  --amber-on: #1b1426;
  --teal-on: #10201f;
  --accent-on: var(--pri-on);
  --border: rgba(var(--fg-rgb), 0.07);
  --rose: #ff6b9d;
  --rose-deep: #7d2a52;
  --amber: #ffc65c;
  --amber-deep: #7a5419;
  --teal: #3fd8c8;
  --teal-deep: #1b6762;
  --sky: #6aa8ff;
  --sky-deep: #24487f;

  /* Each panel can set its own --accent / --accent-deep; the theme's primary is the default. */
  --accent: var(--pri);
  --accent-deep: var(--pri-deep);

  --line: 2px;
  --radius: 16px;
  --pop: 5px 5px 0 var(--accent-deep);
  --pop-sm: 3px 3px 0 var(--accent-deep);
  --tone: radial-gradient(rgba(var(--fg-rgb), 0.075) 1px, transparent 1.5px) 0 0 / 8px 8px;
  --speed: repeating-conic-gradient(
    from 0deg at 50% 50%,
    rgba(var(--fg-rgb), 0.035) 0deg 1.4deg,
    transparent 1.4deg 6deg
  );
  --bounce: cubic-bezier(0.3, 1.45, 0.5, 1);
  --display: 'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --body: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;

  /* Sakuga components */
  --sk-card: var(--surface-2);
  --sk-ink: var(--text);
  --sk-dim: var(--mute);
  --sk-soft: var(--pri-deep);
  --sk-pri: var(--pri);
  --sk-pri-ink: var(--pri-on);
  --sk-on-pri: var(--pri-on);
  --sk-acc: var(--sec);
  --sk-track: var(--surface-3);
  --sk-r: 12px;
  --sk-bw: 2px;
  --sk-sh: 3px 4px 0 var(--pri-deep);
  --sk-btn-sh: var(--sk-sh);
  --sk-btn-line: var(--ink);
  --sk-alt-sh: var(--sk-sh);
  --sk-alt-line: var(--ink);
}

/* ───────── colour themes ───────── */

:root[data-theme='arctic'] {
  --bg: #0a0e13;
  --bg-2: #0e131a;
  --surface: #131a23;
  --surface-2: #19222d;
  --surface-3: #222d3b;
  --ink: #3a4a5e;
  --ink-2: #4f637b;
  --text: #eef4fa;
  --text-2: #b6c3d1;
  --mute: #7d8b9b;
  --pri: #7dd3fc;
  --pri-hi: #b5e6fd;
  --pri-2: #38a8de;
  --pri-deep: #1d5675;
  --pri-rgb: 125, 211, 252;
  --pri-on: #04121a;
  --sec: #c4b5fd;
  --sec-deep: #4b3f8a;
  --sec-rgb: 196, 181, 253;
  --sec-on: #160e33;
}

/* Black themes share a neutral black base; the extra accents become greys so one colour leads. */
:root:is(
  [data-theme='ink'],
  [data-theme='black-crimson'],
  [data-theme='black-gold'],
  [data-theme='black-jade'],
  [data-theme='black-cobalt']
) {
  --bg: #050505;
  --bg-2: #0a0a0a;
  --surface: #111111;
  --surface-2: #171717;
  --surface-3: #212121;
  --ink: #3a3a3a;
  --ink-2: #555555;
  --text: #f5f5f5;
  --text-2: #bdbdbd;
  --mute: #808080;
  --sec: #f2f2f2;
  --sec-deep: #3a3a3a;
  --sec-rgb: 242, 242, 242;
  --sec-on: #0a0a0a;
  --glow-3: rgba(255, 255, 255, 0.03);
  --glow-4: transparent;
  --amber: #e6e6e6;
  --amber-deep: #3a3a3a;
  --amber-on: #0a0a0a;
  --teal: #b3b3b3;
  --teal-deep: #333333;
  --teal-on: #0a0a0a;
  --sky: #8c8c8c;
  --sky-deep: #2b2b2b;
}
/* Ink Black: black with white. */
:root[data-theme='ink'] {
  --pri: #f2f2f2;
  --pri-hi: #ffffff;
  --pri-2: #c9c9c9;
  --pri-deep: #3d3d3d;
  --pri-rgb: 242, 242, 242;
  --pri-on: #0a0a0a;
  --sec: #9e9e9e;
  --sec-deep: #333333;
  --sec-rgb: 158, 158, 158;
}
:root[data-theme='black-crimson'] {
  --pri: #e53945;
  --pri-hi: #ff6b74;
  --pri-2: #b0202c;
  --pri-deep: #5c1219;
  --pri-rgb: 229, 57, 69;
  --pri-on: #fff;
}
:root[data-theme='black-gold'] {
  --pri: #d4a843;
  --pri-hi: #ebc96f;
  --pri-2: #a67c1c;
  --pri-deep: #5a4310;
  --pri-rgb: 212, 168, 67;
  --pri-on: #0a0a0a;
}
:root[data-theme='black-jade'] {
  --pri: #22c58b;
  --pri-hi: #6ee0b5;
  --pri-2: #12936a;
  --pri-deep: #0f5139;
  --pri-rgb: 34, 197, 139;
  --pri-on: #04130d;
}
:root[data-theme='black-cobalt'] {
  --pri: #3d7bff;
  --pri-hi: #7fa6ff;
  --pri-2: #1f55d6;
  --pri-deep: #173a80;
  --pri-rgb: 61, 123, 255;
  --pri-on: #fff;
}

/* Graphite: cool greys with white. */
:root[data-theme='graphite'] {
  --bg: #111214;
  --bg-2: #15171a;
  --surface: #1b1d21;
  --surface-2: #22252a;
  --surface-3: #2c3036;
  --ink: #474c55;
  --ink-2: #5f656f;
  --text: #eef0f3;
  --text-2: #b7bcc4;
  --mute: #80868f;
  --pri: #c9ced6;
  --pri-hi: #e8ebef;
  --pri-2: #9aa1ab;
  --pri-deep: #3a3f47;
  --pri-rgb: 201, 206, 214;
  --pri-on: #111214;
  --sec: #ffffff;
  --sec-deep: #4a4f57;
  --sec-rgb: 255, 255, 255;
  --sec-on: #111214;
  --glow-3: rgba(255, 255, 255, 0.03);
  --glow-4: transparent;
  --amber: #e2e5ea;
  --amber-deep: #3a3f47;
  --amber-on: #111214;
  --teal: #a9b0ba;
  --teal-deep: #353a42;
  --teal-on: #111214;
  --sky: #7d8590;
  --sky-deep: #2e3239;
}

/* Bone & Charcoal: warm charcoal with off-white. */
:root[data-theme='bone'] {
  --bg: #0f0e0c;
  --bg-2: #14130f;
  --surface: #1a1814;
  --surface-2: #211f1a;
  --surface-3: #2b2822;
  --ink: #4a453b;
  --ink-2: #625c50;
  --text: #f2ece0;
  --text-2: #c3baa9;
  --mute: #8c8474;
  --pri: #e8dfcc;
  --pri-hi: #f6f0e3;
  --pri-2: #c9bea6;
  --pri-deep: #4a4337;
  --pri-rgb: 232, 223, 204;
  --pri-on: #14120e;
  --sec: #b9a27a;
  --sec-deep: #4f4330;
  --sec-rgb: 185, 162, 122;
  --sec-on: #14120e;
  --glow-3: rgba(232, 223, 204, 0.03);
  --glow-4: transparent;
  --amber: #d9c9a6;
  --amber-deep: #4a4337;
  --amber-on: #14120e;
  --teal: #a89f8c;
  --teal-deep: #403a30;
  --teal-on: #14120e;
  --sky: #8a8272;
  --sky-deep: #36322a;
}

/* Ivory Paper: the one light theme. Off-white paper, black ink, a touch of manga red. */
:root[data-theme='ivory'] {
  color-scheme: light;
  --bg: #e9e4d8;
  --bg-2: #e2dccf;
  --surface: #f2eee5;
  --surface-2: #f7f4ed;
  --surface-3: #e4ded1;
  --ink: #2b2723;
  --ink-2: #16130f;
  --text: #16130f;
  --text-2: #3d3832;
  --mute: #6f685c;
  --pri: #16130f;
  --pri-hi: #3d3832;
  --pri-2: #000000;
  --pri-deep: #a69d8b;
  --pri-rgb: 22, 19, 15;
  --pri-on: #f7f4ed;
  --sec: #b3261e;
  --sec-deep: #7a1a14;
  --sec-rgb: 179, 38, 30;
  --sec-on: #fff;
  --fg-rgb: 22, 19, 15;
  --strong: #16130f;
  --glow-3: transparent;
  --glow-4: transparent;
  --rose: #c8352b;
  --rose-deep: #7a1a14;
  --amber: #d6cbb3;
  --amber-deep: #2b2723;
  --amber-on: #16130f;
  --teal: #b8ae99;
  --teal-deep: #2b2723;
  --teal-on: #16130f;
  --sky: #8f8675;
  --sky-deep: #2b2723;
}
/* On paper the big numbers get a light shadow; a dark one would smudge them. */
:root[data-theme='ivory'] :is(.time strong, .showcase-timer-content strong, .result-hero strong) {
  text-shadow: 3px 3px 0 #d3cab7;
}
/* The painted toggle art is already light, so it needs no inverting on paper. */
:root[data-theme='ivory'] sakuga-toggle {
  filter: none;
}

* {
  box-sizing: border-box;
}
html {
  scrollbar-color: var(--ink) var(--bg);
  background: var(--bg);
  overflow-x: clip;
  scroll-padding-top: 90px;
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-2);
  background:
    radial-gradient(900px 600px at 10% -10%, rgba(var(--pri-rgb), 0.2), transparent 70%),
    radial-gradient(700px 500px at 96% 6%, rgba(var(--sec-rgb), 0.11), transparent 70%),
    radial-gradient(800px 600px at 85% 95%, var(--glow-3), transparent 70%),
    radial-gradient(900px 700px at 0% 100%, var(--glow-4), transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 60%);
  background-attachment: fixed;
  font: 400 15px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
/* Halftone screentone in two corners of the page, fading out toward the content. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--tone);
  mask:
    radial-gradient(ellipse 45% 40% at 100% 0%, #000, transparent 75%),
    radial-gradient(ellipse 40% 35% at 0% 100%, #000, transparent 75%);
}
[hidden] {
  display: none !important;
}
img {
  max-width: 100%;
}
a {
  color: inherit;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}
h1,
h2,
h3 {
  margin: 0;
  color: var(--text);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
p {
  margin: 0;
}
em {
  font-style: normal;
}
::selection {
  color: var(--pri-on);
  background: var(--pri);
}

/* ───────── shared pieces ───────── */

/* Small stickers, tilted a touch. */
.eyebrow {
  display: inline-block;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--amber-on);
  background: var(--amber);
  font: 700 11px/1 var(--body);
  letter-spacing: 0.14em;
  transform: rotate(-1.5deg);
  box-shadow: 2px 2px 0 var(--amber-deep);
}
.tag {
  display: inline-block;
  padding: 6px 12px;
  border: var(--line) solid var(--teal);
  border-radius: 999px;
  color: var(--teal);
  background: color-mix(in srgb, var(--teal) 10%, transparent);
  font: 700 11.5px/1 var(--body);
  letter-spacing: 0.1em;
  transform: rotate(1.5deg);
  box-shadow: 2px 2px 0 var(--teal-deep);
}
.panel,
.calc-card,
.timer,
.home-features article,
.settings-group {
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--pop);
}

/* Plain buttons, drawn like the Sakuga secondary button. */
button:not(.download-button) {
  cursor: pointer;
}
.subtle,
.damage-actions button,
.calc-modes button,
.effect-heading button,
.effect-title button,
.hex-assistant-actions button,
.hex-assistant-suggestions button,
footer button {
  padding: 8px 15px;
  border: var(--line) solid var(--ink);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface-2);
  font-weight: 600;
  box-shadow: 2px 3px 0 var(--pri-deep);
  transition:
    transform 0.14s var(--bounce),
    box-shadow 0.14s,
    background 0.14s,
    border-color 0.14s;
}
:is(
    .subtle,
    .damage-actions button,
    .calc-modes button,
    .effect-heading button,
    .effect-title button,
    .hex-assistant-actions button,
    .hex-assistant-suggestions button,
    footer button
  ):hover:not(:disabled) {
  border-color: var(--ink-2);
  background: var(--surface-3);
  transform: translate(-1px, -1px);
  box-shadow: 3px 4px 0 var(--pri-deep);
}
:is(
    .subtle,
    .damage-actions button,
    .calc-modes button,
    .effect-heading button,
    .effect-title button,
    .hex-assistant-actions button,
    .hex-assistant-suggestions button,
    footer button
  ):active:not(:disabled) {
  transform: translate(1px, 2px);
  box-shadow: 0 0 0 var(--pri-deep);
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* The toggle is painted art; invert it so it sits on the dark surfaces. */
sakuga-toggle {
  margin: 0 10px;
  filter: invert(0.92) hue-rotate(180deg) saturate(1.3);
}
.toggle-text {
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 70px;
}

/* Sakuga controls: straight type to match the page. */
sakuga-button::part(button) {
  padding: 12px 22px;
  font: 600 15px/1.2 var(--body);
  letter-spacing: 0;
}
/* The tabs draw their outline and dividers in --sk-ink, so mute it there and keep the labels bright. */
sakuga-tabs {
  --sk-ink: var(--ink);
}
sakuga-tabs::part(tab) {
  color: var(--text);
  font-family: var(--body);
}

/* ───────── top bar ───────── */

/* The HEX logo (drawn once in index.html as #hex-logo); its colours follow the theme. */
.logo-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.hex-logo {
  flex: none;
  width: 30px;
  height: 30px;
  overflow: visible;
}
.logo-shadow {
  fill: var(--pri-deep);
  stroke: var(--pri-deep);
}
.logo-ring {
  fill: var(--bg);
  stroke: var(--bg);
}
.logo-hex {
  fill: var(--pri);
  stroke: var(--pri);
}
.logo-face {
  fill: var(--surface-2);
  stroke: var(--bg);
}
.logo-hands {
  stroke: var(--text);
}
.logo-dot {
  fill: var(--text);
}
.logo-ticks {
  stroke: var(--sec);
}
.logo-spark {
  fill: var(--sec);
  stroke: var(--bg);
}

.app-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px max(16px, calc((100vw - 1180px) / 2));
  border-bottom: var(--line) solid var(--ink);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-end: 20px;
  color: var(--text);
  font: 800 22px/1 var(--display);
  letter-spacing: -0.01em;
  text-shadow: 2px 2px 0 var(--pri-deep);
}
.nav-brand small {
  color: var(--mute);
  font: 600 10.5px/1 var(--body);
  letter-spacing: 0.18em;
  text-shadow: none;
}
.app-nav button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: var(--line) solid transparent;
  border-radius: 10px;
  color: var(--text-2);
  background: transparent;
  font-weight: 600;
  transition:
    color 0.15s,
    background 0.15s,
    border-color 0.15s,
    transform 0.15s var(--bounce),
    box-shadow 0.15s;
}
.app-nav button:hover {
  color: var(--text);
  border-color: var(--ink);
  background: var(--surface-2);
}
.app-nav button[aria-pressed='true'] {
  color: var(--pri-on);
  border-color: var(--pri-hi);
  background: var(--pri);
  box-shadow: 2px 3px 0 var(--pri-deep);
  transform: rotate(-1deg);
}
.nav-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}
.theme-button {
  margin-inline-start: auto;
}

/* Colour theme picker: a small panel under the palette button, with no backdrop so the page stays visible. */
.theme-panel {
  position: fixed;
  top: 70px;
  inset-inline-end: max(16px, calc((100vw - 1180px) / 2));
  z-index: 70;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 90px);
  padding: 16px;
  overflow-y: auto;
  border: var(--line) solid var(--ink-2);
  border-radius: 18px;
  background: var(--tone), var(--surface);
  box-shadow: 6px 6px 0 var(--pri-deep);
  animation: impact 0.3s var(--bounce);
}
.theme-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.theme-panel-head h2 {
  font-size: 17px;
}
.theme-panel-head p {
  margin-top: 2px;
  color: var(--mute);
  font-size: 12.5px;
}
.theme-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: var(--text-2);
  background: transparent;
}
.theme-close:hover {
  color: var(--text);
  background: var(--surface-3);
}
.theme-close svg {
  width: 17px;
  height: 17px;
}
.theme-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding-block: 8px;
  padding-inline: 8px 10px;
  border: var(--line) solid var(--ink);
  border-radius: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  text-align: start;
  transition:
    transform 0.14s var(--bounce),
    border-color 0.14s,
    box-shadow 0.14s;
}
.theme-option:hover {
  border-color: var(--ink-2);
  transform: translate(-1px, -1px);
}
.theme-option[aria-pressed='true'] {
  color: var(--text);
  border-color: var(--pri);
  box-shadow: 2px 3px 0 var(--pri-deep);
}
.theme-option > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lang-code {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 34px;
  height: 26px;
  padding: 0 6px;
  border: 1.5px solid var(--ink);
  border-radius: 7px;
  color: var(--text);
  background: var(--bg-2);
  font: 700 11px/1 var(--body);
  letter-spacing: 0.04em;
}
.theme-swatch {
  display: flex;
  flex: none;
  align-items: center;
  gap: 3px;
  padding: 5px 6px;
  border: 1.5px solid rgba(var(--fg-rgb), 0.14);
  border-radius: 8px;
}
.theme-swatch i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

/* ───────── home ───────── */

#home-view {
  max-width: 1180px;
  margin: 0 auto;
  padding: 44px 16px 30px;
}
.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 30px;
  align-items: stretch;
}
/* The hero is a comic panel: focus lines from the top right and a halftone patch at the bottom. */
.hero-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: 36px 34px 32px;
  border: var(--line) solid var(--ink);
  border-radius: 18px;
  background: linear-gradient(160deg, var(--surface-2), var(--bg-2));
  box-shadow: 6px 6px 0 var(--pri-deep);
  isolation: isolate;
  overflow: hidden;
}
.hero-copy::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: repeating-conic-gradient(
    from 180deg at 100% 0%,
    rgba(var(--fg-rgb), 0.045) 0deg 1.2deg,
    transparent 1.2deg 5deg
  );
  mask: radial-gradient(circle at 100% 0%, #000 0 25%, transparent 70%);
}
.hero-copy::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: -1;
  width: 55%;
  height: 50%;
  background: radial-gradient(rgba(var(--pri-rgb), 0.32) 1.1px, transparent 1.6px) 0 0 / 8px 8px;
  mask: radial-gradient(circle at 100% 100%, #000 0 20%, transparent 70%);
}
.hero-copy h1 {
  font-size: clamp(44px, 5.8vw, 74px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.hero-copy h1 em {
  display: inline-block;
  background: linear-gradient(100deg, var(--pri-hi) 10%, var(--sec) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(3px 3px 0 var(--pri-deep));
}
/* The description is a speech bubble. */
.hero-copy > p:not(.system-note) {
  position: relative;
  max-width: 480px;
  margin-top: 8px;
  padding: 14px 18px;
  border: var(--line) solid var(--ink);
  border-radius: 20px;
  color: var(--text-2);
  background: var(--surface-3);
  font-size: 16px;
  line-height: 1.6;
}
.hero-copy > p:not(.system-note)::before,
.hero-copy > p:not(.system-note)::after {
  content: '';
  position: absolute;
  inset-inline-start: 32px;
  border-style: solid;
}
.hero-copy > p:not(.system-note)::before {
  top: -15px;
  border-width: 0 0 15px 15px;
  border-color: transparent transparent var(--ink) transparent;
}
.hero-copy > p:not(.system-note)::after {
  top: -10.5px;
  inset-inline-start: 34.5px;
  border-width: 0 0 11px 11px;
  border-color: transparent transparent var(--surface-3) transparent;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-top: 4px;
}
.download-button {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  padding-block: 12px;
  padding-inline: 14px 22px;
  border: var(--line) solid var(--pri-hi);
  border-radius: 14px;
  color: var(--pri-on);
  background: linear-gradient(135deg, var(--pri-hi), var(--pri) 55%, var(--pri-2));
  text-decoration: none;
  box-shadow: 4px 5px 0 var(--sec-deep);
  transition:
    transform 0.16s var(--bounce),
    box-shadow 0.16s,
    filter 0.16s;
}
.download-button:hover {
  transform: translate(-1px, -2px);
  filter: brightness(1.08);
  box-shadow: 5px 7px 0 var(--sec-deep);
}
.download-button:active {
  transform: translate(2px, 3px);
  box-shadow: 1px 1px 0 var(--sec-deep);
}
.download-button svg {
  width: 34px;
  height: 34px;
  padding: 7px;
  border-radius: 50%;
  color: var(--pri-deep);
  background: #fff;
  stroke-width: 2.4;
}
.download-button span {
  display: grid;
  gap: 3px;
}
.download-button b {
  font: 700 17px/1.1 var(--display);
  letter-spacing: -0.01em;
}
.download-button small {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.82;
}
.system-note {
  color: var(--mute);
  font-size: 13px;
}

/* The live preview is a panel with a caption strip. */
.app-showcase {
  --accent-deep: var(--sec-deep);
  position: relative;
  display: flex;
  flex-direction: column;
  border: var(--line) solid var(--ink);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 6px 6px 0 var(--accent-deep);
  overflow: visible;
}
.showcase-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: var(--line) solid var(--ink);
  border-radius: 16px 16px 0 0;
  color: var(--text);
  background: var(--tone), var(--surface-3);
  font: 700 13px/1 var(--body);
  letter-spacing: 0.12em;
}
.showcase-top span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.showcase-top .hex-logo {
  width: 22px;
  height: 22px;
}
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--rose);
  font: 700 10.5px/1 var(--body);
  letter-spacing: 0.14em;
  box-shadow: 2px 2px 0 var(--rose-deep);
}
.live-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: pulse-dot 1.6s ease-in-out infinite;
}
.showcase-body {
  flex: 1;
  display: flex;
  padding: 20px 20px 22px;
  background: var(--speed);
  background-position: center 40%;
}
.showcase-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.showcase-label {
  align-self: flex-start;
  padding: 4px 9px;
  border-radius: 5px;
  color: var(--teal-on);
  background: var(--teal);
  font: 700 10.5px/1 var(--body);
  letter-spacing: 0.16em;
  transform: rotate(-1.5deg);
  box-shadow: 2px 2px 0 var(--teal-deep);
}
.showcase-card {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 210px;
  padding: 22px 22px 70px;
  border: var(--line) solid var(--ink);
  border-radius: 14px;
  color: var(--pri-hi);
  background: radial-gradient(120% 90% at 100% 0%, rgba(var(--pri-rgb), 0.16), transparent 60%), var(--bg-2);
  box-shadow: 3px 4px 0 var(--pri-deep);
  overflow: hidden;
}
.showcase-card > svg {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 70px;
  border-top: 2px dashed rgba(var(--fg-rgb), 0.08);
}
.showcase-timer-content {
  position: relative;
  display: grid;
  gap: 8px;
  transition:
    transform 0.3s var(--bounce),
    opacity 0.18s;
}
.showcase-timer-content span {
  color: var(--text);
  font: 600 18px/1.2 var(--display);
}
.showcase-timer-content strong {
  color: var(--strong);
  font: 800 clamp(48px, 5.4vw, 68px) / 1 var(--display);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  text-shadow: 3px 3px 0 var(--pri-deep);
}
.showcase-timer-content small {
  color: var(--mute);
  font: 600 11.5px/1 var(--body);
  letter-spacing: 0.14em;
}
/* The swap is a soft smear: out to the left, in from the right. */
.showcase-card.swap-out .showcase-timer-content {
  opacity: 0;
  transform: translateX(-26px) skewX(-8deg);
}
.showcase-card.swap-in .showcase-timer-content {
  opacity: 0;
  transform: translateX(26px) skewX(8deg);
  transition: none;
}
#home-timer-tabs {
  align-self: center;
  max-width: 100%;
}
#home-timer-tabs::part(tab) {
  padding: 9px 12px;
  font-size: 14px;
}

/* Featured video */
.featured-video {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 36px;
  align-items: center;
  margin-top: 84px;
  padding: 26px;
  border: var(--line) solid var(--ink);
  border-radius: 20px;
  background:
    radial-gradient(rgba(var(--sec-rgb), 0.16) 1px, transparent 1.5px) 0 0 / 8px 8px,
    linear-gradient(180deg, var(--surface-2), var(--surface));
  background-blend-mode: normal;
  box-shadow: 6px 6px 0 var(--sec-deep);
}
.featured-thumbnail {
  position: relative;
  display: block;
  border: var(--line) solid var(--ink-2);
  border-radius: 14px;
  overflow: hidden;
  transform: rotate(-1deg);
  box-shadow: 4px 4px 0 var(--sec-deep);
  transition: transform 0.2s var(--bounce);
}
.featured-thumbnail::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, color-mix(in srgb, var(--bg) 50%, transparent));
}
.featured-thumbnail:hover {
  transform: rotate(0deg) scale(1.015);
}
.featured-thumbnail img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
/* A small starburst play button. */
.featured-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  color: var(--sec-on);
  background: var(--sec);
  clip-path: polygon(
    50% 0%,
    61% 16%,
    80% 8%,
    80% 29%,
    100% 36%,
    87% 53%,
    98% 72%,
    77% 76%,
    72% 97%,
    54% 86%,
    36% 99%,
    29% 79%,
    8% 81%,
    15% 61%,
    0% 46%,
    17% 33%,
    12% 12%,
    33% 17%
  );
  transition: transform 0.25s var(--bounce);
}
.featured-thumbnail:hover .featured-play {
  transform: rotate(12deg) scale(1.06);
}
.featured-play svg {
  width: 24px;
  height: 24px;
  margin-left: 3px;
}
.featured-copy {
  display: grid;
  gap: 16px;
  justify-items: start;
}
.featured-copy .eyebrow {
  color: var(--sec-on);
  background: var(--sec);
  box-shadow: 2px 2px 0 var(--sec-deep);
}
.featured-copy h2 {
  font-size: clamp(30px, 3.4vw, 42px);
}
.featured-copy h2 em {
  color: var(--sec);
}
.featured-copy p {
  max-width: 440px;
}
.featured-watch,
.social-action {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border: var(--line) solid rgba(255, 255, 255, 0.2);
  border-radius: 11px;
  color: #fff;
  background: #d42a37;
  font: 600 14.5px/1 var(--body);
  text-decoration: none;
  box-shadow: 3px 3px 0 #5e1219;
  transition:
    transform 0.16s var(--bounce),
    box-shadow 0.16s,
    filter 0.16s;
}
.featured-watch:hover {
  transform: translate(-1px, -2px);
  box-shadow: 4px 5px 0 #5e1219;
}
.featured-watch:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 #5e1219;
}
.featured-watch svg {
  width: 20px;
  height: 20px;
}

/* Socials */
.social-section {
  margin-top: 90px;
}
.social-heading {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}
.social-heading .eyebrow {
  color: var(--teal-on);
  background: var(--teal);
  box-shadow: 2px 2px 0 var(--teal-deep);
}
.social-heading h2 {
  font-size: clamp(32px, 4vw, 48px);
}
.social-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-top: 36px;
}
.social-banner {
  --brand: var(--pri);
  --brand-deep: var(--pri-deep);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 0 22px;
  border: var(--line) solid var(--ink);
  border-radius: 18px;
  color: var(--text-2);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  text-decoration: none;
  box-shadow: 5px 5px 0 var(--brand-deep);
  overflow: hidden;
  transition:
    transform 0.2s var(--bounce),
    box-shadow 0.2s;
}
.social-banner:nth-child(1) {
  transform: rotate(-0.6deg);
}
.social-banner:nth-child(3) {
  transform: rotate(0.6deg);
}
.social-banner:hover {
  transform: translate(-1px, -4px) rotate(0deg);
  box-shadow: 6px 8px 0 var(--brand-deep);
}
.social-youtube {
  --brand: #e5323f;
  --brand-deep: #5e1219;
}
.social-discord {
  --brand: #5865f2;
  --brand-deep: #262c78;
}
.social-tiktok {
  --brand: var(--teal);
  --brand-deep: var(--teal-deep);
}
.social-mark {
  display: flex;
  align-items: flex-end;
  height: 92px;
  padding: 0 20px;
  border-bottom: var(--line) solid var(--ink);
  background:
    radial-gradient(rgba(255, 255, 255, 0.16) 1.1px, transparent 1.6px) 0 0 / 8px 8px,
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--brand) 70%, #000),
      color-mix(in srgb, var(--brand) 25%, var(--surface))
    );
}
.social-mark svg {
  width: 58px;
  height: 58px;
  margin-bottom: -26px;
  padding: 13px;
  border: var(--line) solid var(--ink-2);
  border-radius: 50%;
  color: #fff;
  background: color-mix(in srgb, var(--brand) 75%, #000);
  box-shadow: 3px 3px 0 var(--brand-deep);
}
.social-tiktok .social-mark svg {
  background: #111018;
  filter: drop-shadow(1.5px 0 0 #25f4ee) drop-shadow(-1.5px 0 0 #fe2c55);
}
.social-copy {
  display: grid;
  gap: 8px;
  padding: 24px 20px 0;
}
.social-copy > span {
  color: var(--brand);
  font: 700 11px/1 var(--body);
  letter-spacing: 0.16em;
}
.social-copy h3 {
  font-size: 22px;
}
.social-points {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.social-points b {
  padding: 4px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  color: var(--text-2);
  background: var(--surface-3);
  font-size: 12px;
  font-weight: 600;
}
.social-action {
  align-self: flex-start;
  margin: auto 20px 0;
  background: color-mix(in srgb, var(--brand) 85%, #000);
  box-shadow: 3px 3px 0 var(--brand-deep);
}
.social-tiktok .social-action {
  color: #0b1716;
  background: var(--brand);
}
.social-banner:hover .social-action {
  transform: rotate(-1.5deg) scale(1.03);
}

/* Features */
.home-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-top: 76px;
}
.home-features article {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 22px;
}
.home-features article:nth-child(2) {
  --accent-on: var(--amber-on);
  --accent: var(--amber);
  --accent-deep: var(--amber-deep);
}
.home-features article:nth-child(3) {
  --accent-on: var(--teal-on);
  --accent: var(--teal);
  --accent-deep: var(--teal-deep);
}
.home-features article > span {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: var(--accent-on);
  background: var(--accent);
  font: 800 16px/1 var(--display);
  box-shadow: 2px 3px 0 var(--accent-deep);
}
.home-features h2 {
  font-size: 19px;
}
.home-features p {
  margin-top: 6px;
  color: var(--mute);
}

/* Sections rise in when scrolled to, with a slight tilt. */
.reveal-ready .scroll-reveal:not(.is-visible) {
  opacity: 0;
  transform: translateY(22px) rotate(-0.5deg);
}
.scroll-reveal {
  transition:
    opacity 0.45s,
    transform 0.55s var(--bounce);
}

/* ───────── timers ───────── */

#timer-view,
#damage-view {
  max-width: 1180px;
  margin: 0 auto;
  padding: 44px 16px 30px;
}
.section-head,
.damage-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
}
.section-head > div,
.damage-heading > div:first-child {
  display: grid;
  gap: 14px;
}
.section-head h1,
.damage-heading h1 {
  font-size: clamp(38px, 4.6vw, 56px);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-shadow: 3px 3px 0 var(--pri-deep);
}
.damage-heading p {
  color: var(--mute);
}
.timer-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 22px;
}
.timer[data-kind='daily'] {
  --accent-on: var(--amber-on);
  --accent: var(--amber);
  --accent-deep: var(--amber-deep);
}
.timer[data-kind='weekly'] {
  --accent-on: var(--teal-on);
  --accent: var(--teal);
  --accent-deep: var(--teal-deep);
}
.timer[data-kind='cortex'] {
  --accent-on: #120f1c;
  --accent: var(--rose);
  --accent-deep: var(--rose-deep);
}
.timer[data-kind='gravity'] {
  --accent-on: #120f1c;
  --accent: var(--sky);
  --accent-deep: var(--sky-deep);
}
.timer {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  padding: 20px 20px 0;
  overflow: hidden;
  transition:
    transform 0.18s var(--bounce),
    box-shadow 0.18s;
}
.timer:hover {
  transform: translate(-1px, -3px);
  box-shadow: 6px 8px 0 var(--accent-deep);
}
.symbol {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--accent-on);
  background: var(--accent);
  font-size: 19px;
  font-weight: 700;
  box-shadow: 2px 3px 0 var(--accent-deep);
}
.timer-name {
  align-self: center;
}
.timer-name h2 {
  font-size: 19px;
}
.timer-name p {
  color: var(--mute);
  font-size: 13px;
}
.time {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  margin-top: 12px;
}
.time strong {
  color: var(--strong);
  font: 800 52px/1 var(--display);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  text-shadow: 3px 3px 0 var(--accent-deep);
}
.time span {
  color: var(--mute);
  font: 600 10.5px/1 var(--body);
  letter-spacing: 0.18em;
}
.timer-graph {
  grid-column: 1 / -1;
  width: calc(100% + 40px);
  height: 54px;
  margin: 14px -20px 0;
  color: var(--accent);
  border-top: 2px dashed rgba(var(--fg-rgb), 0.08);
  background: radial-gradient(color-mix(in srgb, var(--accent) 30%, transparent) 1px, transparent 1.5px) 0 0 / 8px 8px;
}
.timer-graph .graph-line {
  stroke: var(--accent);
  stroke-width: 2.2;
}
.timer-graph .graph-area {
  opacity: 0.16;
}
.timer-graph .graph-dot {
  r: 4.5;
  fill: #fff;
  stroke: var(--accent);
  stroke-width: 2.5;
}
/* Under a minute to go: soft speed lines and a rose glow that breathes. */
.timer.imminent {
  --accent-on: #120f1c;
  --accent: var(--rose);
  --accent-deep: var(--rose-deep);
  border-color: var(--rose);
  background:
    var(--speed), linear-gradient(180deg, color-mix(in srgb, var(--rose) 14%, var(--surface)), var(--surface));
  animation: glow 1.6s ease-in-out infinite;
}
.timer.imminent .time strong {
  color: var(--rose);
}
.timer.active-event {
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 65%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
}
.timer.event-start {
  animation: impact 0.55s var(--bounce);
}
.sound-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 30px;
  padding: 12px 18px;
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--pop);
  width: fit-content;
  max-width: 100%;
}
.sound-row .toggle-text {
  margin-inline-end: 8px;
}
#sound-status {
  margin-top: 10px;
  color: var(--rose);
  font-weight: 600;
}

/* ───────── damage calculator ───────── */

.damage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.calc-modes {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  border: var(--line) solid var(--ink);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--pop-sm);
}
.calc-modes button {
  border: 0;
  border-radius: 8px;
  padding: 8px 18px;
  color: var(--text-2);
  background: transparent;
  box-shadow: none;
  font-weight: 600;
}
.calc-modes button[aria-pressed='true'] {
  color: var(--pri-on);
  background: var(--pri);
}
.calc-modes button:hover:not([aria-pressed='true']),
.calc-modes button:active {
  background: var(--surface-3);
  transform: none;
  box-shadow: none;
}
#calc-error {
  min-height: 0;
  margin: 0 0 14px;
  color: var(--rose);
  font-weight: 600;
}
#calc-error:empty {
  display: none;
}
.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 22px;
  align-items: start;
}
#calc-form,
.calculator-output {
  display: grid;
  gap: 22px;
}
.calculator-output {
  position: sticky;
  top: 86px;
}
.calc-card {
  display: grid;
  gap: 12px;
  padding: 22px;
}
.calc-card h2 {
  font-size: 19px;
}
.calc-card > p,
.calc-card details p {
  color: var(--mute);
  font-size: 13.5px;
}
.fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.calc-field,
.field {
  display: grid;
  gap: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
.calc-field input,
.calc-field select,
.field select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: var(--line) solid var(--ink);
  border-radius: 10px;
  color: var(--text);
  background: var(--bg-2);
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.calc-field select option,
.field select option {
  background: var(--surface-2);
}
.calc-field input:focus,
.calc-field select:focus,
.field select:focus {
  outline: none;
  border-color: var(--pri-hi);
  box-shadow: 3px 3px 0 var(--pri-deep);
}
.effect-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.effect-heading button {
  padding: 7px 12px;
  font-size: 13px;
}
.effect-item {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding: 14px;
  border: var(--line) dashed var(--ink);
  border-radius: 12px;
  background: var(--bg-2);
}
.effect-item + .effect-item {
  margin-top: 12px;
}
.effect-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.effect-title strong {
  color: var(--text);
  font: 600 15px/1.2 var(--display);
}
.effect-title button {
  padding: 5px 11px;
  font-size: 12.5px;
}
.effect-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.effect-checks label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-weight: 500;
}
input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--pri);
}
.effect-empty {
  color: var(--mute);
}
/* The headline number sits in a soft burst of lines. */
.result-hero {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 28px 16px 24px;
  border: var(--line) solid var(--ink);
  border-radius: 14px;
  background:
    repeating-conic-gradient(from 0deg at 50% 60%, rgba(var(--pri-rgb), 0.1) 0deg 4deg, transparent 4deg 12deg),
    radial-gradient(90% 120% at 50% 0%, rgba(var(--pri-rgb), 0.24), transparent 70%), var(--bg-2);
  text-align: center;
}
.result-hero span {
  color: var(--text-2);
  font: 600 11.5px/1 var(--body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.result-hero strong {
  color: var(--strong);
  font: 800 clamp(44px, 5vw, 60px) / 1 var(--display);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  text-shadow: 3px 3px 0 var(--pri-deep);
}
#calc-empty {
  color: var(--rose);
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.result-grid > div,
#checkpoint-results > div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--bg-2);
}
.result-grid span,
.result-list span,
#checkpoint-results span {
  color: var(--mute);
  font-size: 12px;
  font-weight: 500;
}
.result-grid strong,
#checkpoint-results strong {
  color: var(--text);
  font: 700 20px/1.1 var(--display);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.result-list > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1.5px dashed var(--border);
}
.result-list strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
#checkpoint-results {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.contribution {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}
.contribution > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
}
.contribution progress {
  width: 100%;
  height: 12px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
  appearance: none;
}
.contribution progress::-webkit-progress-bar {
  background: var(--bg-2);
}
.contribution progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pri), var(--sec));
}
.contribution progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--pri);
}
#calc-chart {
  display: block;
  width: 100%;
  margin: 6px 0;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--bg-2);
}
/* The chart's colours are written by the shared calculator script; re-ink them here. */
#calc-chart line {
  stroke: rgba(var(--fg-rgb), 0.07);
}
#calc-chart text {
  fill: var(--mute);
}
#calc-chart path,
#calc-chart polyline {
  stroke: var(--pri-hi);
  stroke-width: 2.5;
}
#damage-view:not(.advanced) .advanced-only {
  display: none;
}
#comparison {
  margin-top: 22px;
}
.table-scroll {
  overflow: auto;
}
#comparison table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: start;
}
#comparison th,
#comparison td {
  padding: 10px 12px;
  border-bottom: 1.5px solid var(--ink);
}
#comparison th {
  color: var(--text);
  background: var(--surface-3);
  font-weight: 600;
}
#comparison th:first-child {
  border-top-left-radius: 8px;
}
#comparison th:last-child {
  border-top-right-radius: 8px;
}
#comparison td {
  font-variant-numeric: tabular-nums;
}
details.calc-card {
  margin-top: 22px;
}
.calc-card summary {
  color: var(--text);
  font: 600 16px/1.2 var(--display);
  cursor: pointer;
}

/* ───────── footer, dialogs ───────── */

footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 90px;
  padding: 24px max(16px, calc((100vw - 1180px) / 2)) 30px;
  border-top: var(--line) solid var(--ink);
  color: var(--mute);
  background: var(--tone), color-mix(in srgb, var(--bg) 70%, transparent);
  font-size: 14px;
}
footer span:first-child {
  color: var(--amber);
  font: 800 17px/1 var(--display);
  text-shadow: 2px 2px 0 var(--amber-deep);
}
footer button {
  margin-inline-start: auto;
}

dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 28px;
  border: var(--line) solid var(--ink-2);
  border-radius: 20px;
  color: var(--text-2);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: 8px 8px 0 var(--pri-deep);
}
dialog[open] {
  animation: impact 0.32s var(--bounce);
}
dialog::backdrop {
  background: var(--tone), color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(4px);
}
dialog h2 {
  margin-bottom: 14px;
  font-size: 26px;
  text-shadow: 2px 2px 0 var(--pri-deep);
}
dialog p {
  margin-bottom: 12px;
}
.settings-grid {
  display: grid;
  gap: 16px;
}
.settings-group {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  background: var(--bg-2);
  box-shadow: var(--pop-sm);
}
.settings-group h3 {
  font-size: 16px;
}
.label-row {
  display: flex;
  justify-content: space-between;
}
.label-row output {
  color: var(--amber);
}
.field sakuga-slider {
  margin-top: 30px;
  --sk-slider-width: 100%;
}
.setting-note {
  margin: 0 !important;
  color: var(--mute);
  font-size: 13px;
}
#settings-status {
  color: var(--teal);
  font-weight: 600;
}
#settings-status:empty {
  display: none;
}
#sound-preview {
  justify-self: start;
}

/* ───────── Ask HEX: speech bubbles ───────── */

.hex-assistant-launcher {
  position: fixed;
  inset-inline-end: 22px;
  bottom: 22px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-block: 8px;
  padding-inline: 8px 18px;
  border: var(--line) solid var(--ink-2);
  border-radius: 999px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: 3px 4px 0 var(--pri-deep);
  transition:
    transform 0.18s var(--bounce),
    box-shadow 0.18s;
}
.hex-assistant-launcher:hover {
  transform: translate(-1px, -2px);
  box-shadow: 4px 6px 0 var(--pri-deep);
}
.hex-assistant-launcher[aria-expanded='true'] {
  transform: scale(0.94);
}
.hex-assistant-launch-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--pri-on);
  background: linear-gradient(135deg, var(--pri-hi), var(--pri-2));
}
.hex-assistant-launch-icon svg {
  width: 19px;
  height: 19px;
}
.hex-assistant-launch-copy {
  display: grid;
  text-align: start;
}
.hex-assistant-launch-copy b {
  font: 700 14.5px/1.2 var(--display);
}
.hex-assistant-launch-copy small {
  color: var(--mute);
  font-size: 11.5px;
}
.hex-assistant {
  position: fixed;
  inset-inline-end: 22px;
  bottom: 96px;
  z-index: 61;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 130px));
  border: var(--line) solid var(--ink-2);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 6px 6px 0 var(--pri-deep);
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.96) rotate(1deg);
  transform-origin: bottom right;
  transition:
    opacity 0.18s,
    transform 0.3s var(--bounce);
}
.hex-assistant.is-open {
  opacity: 1;
  transform: none;
}
.hex-assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: var(--line) solid var(--ink);
  color: var(--text);
  background: var(--tone), var(--surface-3);
}
.hex-assistant-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hex-assistant-identity > span:last-child {
  display: grid;
}
.hex-assistant-identity b {
  font: 700 15px/1.2 var(--display);
}
.hex-assistant-identity small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--mute);
  font-size: 12px;
}
.hex-assistant-identity small i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
}
.hex-assistant-avatar,
.hex-assistant-mini-avatar {
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--pri-on);
  background: linear-gradient(135deg, var(--pri-hi), var(--pri-2));
  font: 700 15px/1 var(--display);
}
.hex-assistant-avatar {
  width: 38px;
  height: 38px;
}
.hex-assistant-mini-avatar {
  width: 30px;
  height: 30px;
  font-size: 13px;
}
.hex-assistant-header-actions {
  display: flex;
  gap: 4px;
}
.hex-assistant-header-actions button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: var(--text-2);
  background: transparent;
}
.hex-assistant-header-actions button:hover {
  color: var(--text);
  background: rgba(var(--fg-rgb), 0.07);
}
.hex-assistant-header-actions svg {
  width: 18px;
  height: 18px;
}
.hex-assistant-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.hex-assistant-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: bubble-in 0.28s var(--bounce);
}
.hex-assistant-message.user {
  justify-content: flex-end;
}
.hex-assistant-bubble {
  position: relative;
  max-width: 82%;
  padding: 10px 14px;
  border: 1.5px solid var(--ink);
  border-radius: 16px;
  color: var(--text-2);
  background: var(--surface-2);
  font-size: 14px;
  box-shadow: 2px 2px 0 var(--pri-deep);
}
.hex-assistant-message.bot .hex-assistant-bubble {
  border-end-start-radius: 4px;
}
.hex-assistant-message.user .hex-assistant-bubble {
  border-color: var(--pri-hi);
  border-end-end-radius: 4px;
  color: var(--pri-on);
  background: var(--pri);
}
.hex-assistant-bubble p + p,
.hex-assistant-bubble ol,
.hex-assistant-bubble ul {
  margin-top: 8px;
}
.hex-assistant-bubble ol,
.hex-assistant-bubble ul {
  padding-inline-start: 20px;
  margin-bottom: 0;
}
.hex-assistant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.hex-assistant-actions button,
.hex-assistant-suggestions button {
  padding: 6px 12px;
  border-width: 1.5px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 2px 2px 0 var(--pri-deep);
}
.hex-assistant-typing .hex-assistant-bubble {
  display: flex;
  gap: 5px;
  padding: 14px 16px;
}
.hex-assistant-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-2);
  animation: hop 0.9s infinite;
}
.hex-assistant-typing i:nth-child(2) {
  animation-delay: 0.12s;
}
.hex-assistant-typing i:nth-child(3) {
  animation-delay: 0.24s;
}
.hex-assistant-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 0;
  border-top: var(--line) solid var(--ink);
}
.hex-assistant-suggestions:empty {
  display: none;
}
.hex-assistant-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px 8px;
}
.hex-assistant-suggestions:empty + .hex-assistant-form {
  border-top: var(--line) solid var(--ink);
}
.hex-assistant-form input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 16px;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  color: var(--text);
  background: var(--bg-2);
}
.hex-assistant-form input:focus {
  outline: none;
  border-color: var(--pri-hi);
  box-shadow: 2px 3px 0 var(--pri-deep);
}
.hex-assistant-form button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: var(--pri-on);
  background: var(--pri);
  box-shadow: 2px 2px 0 var(--pri-deep);
}
.hex-assistant-form button:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}
.hex-assistant-form svg {
  width: 18px;
  height: 18px;
}
.hex-assistant-note {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 10px;
  color: var(--mute);
  font-size: 11.5px;
}
.hex-assistant-note span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
}
.hex-assistant-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ───────── motion ───────── */

.view-enter {
  animation: panel-in 0.4s var(--bounce);
}
@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(16px) rotate(-0.4deg);
  }
}
@keyframes impact {
  0% {
    transform: scale(0.93) rotate(-1deg);
  }
  60% {
    transform: scale(1.015);
  }
}
@keyframes glow {
  0%,
  100% {
    box-shadow:
      var(--pop),
      0 0 0 0 rgba(var(--sec-rgb), 0);
  }
  50% {
    box-shadow:
      var(--pop),
      0 0 26px -2px rgba(var(--sec-rgb), 0.4);
  }
}
@keyframes pulse-dot {
  50% {
    opacity: 0.35;
  }
}
@keyframes bubble-in {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(8px);
  }
}
@keyframes hop {
  0%,
  60%,
  100% {
    transform: none;
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}
body.motion-off *,
body.motion-off *::before,
body.motion-off *::after {
  animation: none !important;
  transition: none !important;
}
body.motion-off .scroll-reveal {
  opacity: 1 !important;
  transform: none !important;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .reveal-ready .scroll-reveal:not(.is-visible) {
    opacity: 1;
    transform: none;
  }
}

/* ───────── right-to-left (Arabic) ───────── */

/* Spacing letters apart breaks Arabic's joined script. */
:root[dir='rtl'] * {
  letter-spacing: 0 !important;
}
:root[dir='rtl'] .hex-assistant {
  transform-origin: bottom left;
}
/* The Sakuga controls measure from the left, so they keep a left-to-right layout. */
:root[dir='rtl'] :is(sakuga-slider, sakuga-toggle, sakuga-tabs) {
  direction: ltr;
}

/* ───────── smaller screens ───────── */

@media (max-width: 480px) {
  .theme-list {
    grid-template-columns: minmax(0, 1fr);
  }
  /* Language names are short, so they stay in two columns. */
  #lang-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .home-hero,
  .featured-video,
  .calculator-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .calculator-output {
    position: static;
  }
  .social-stack,
  .home-features {
    grid-template-columns: minmax(0, 1fr);
  }
  .social-banner:nth-child(n) {
    transform: none;
  }
}
@media (max-width: 680px) {
  .app-nav {
    gap: 4px;
  }
  .nav-brand {
    margin-inline-end: auto;
    font-size: 20px;
  }
  .nav-brand small {
    display: none;
  }
  .app-nav button {
    width: 40px;
    padding: 0;
    justify-content: center;
  }
  .app-nav button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .theme-button {
    margin-inline-start: 0;
  }
  .theme-panel {
    top: 64px;
    inset-inline-end: 16px;
  }
  #home-view,
  #timer-view,
  #damage-view,
  #mytimers-view {
    padding-top: 26px;
  }
  .hero-copy {
    padding: 26px 20px 24px;
  }
  .home-hero {
    gap: 30px;
  }
  .featured-video {
    margin-top: 60px;
    padding: 16px;
  }
  .social-section {
    margin-top: 60px;
  }
  .timer-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .time strong {
    font-size: 46px;
  }
  .result-grid,
  #checkpoint-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #home-timer-tabs::part(tab) {
    padding: 8px 7px;
    font-size: 12.5px;
  }
  .hex-assistant-launcher {
    inset-inline-end: 14px;
    bottom: 14px;
  }
  .hex-assistant {
    inset-inline-end: 12px;
    bottom: 84px;
    height: min(560px, calc(100vh - 110px));
  }
  footer button {
    margin-inline-start: 0;
  }
}

/* ───────── from the app: buttons, Customize, guide, checklist, My timers, reminders ───────── */
/* These sections are copied from ui/app.css so the shared scripts look the same here. */
/* Native buttons that lead, drawn like the Sakuga primary button. */
.primary {
  padding: 10px 20px;
  border: var(--line) solid var(--ink);
  border-radius: 12px;
  color: var(--pri-on);
  background: var(--pri);
  font-weight: 700;
  box-shadow: 3px 4px 0 var(--pri-deep);
  transition:
    transform 0.14s var(--bounce),
    box-shadow 0.14s,
    background 0.14s;
}
.primary:hover:not(:disabled) {
  background: var(--pri-hi);
  transform: translate(-1px, -1px);
  box-shadow: 4px 5px 0 var(--pri-deep);
}
.primary:active:not(:disabled) {
  transform: translate(1px, 2px);
  box-shadow: 0 0 0 var(--pri-deep);
}

/* ───────── customize timers ───────── */

.head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.customize-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.customize-button[aria-pressed='true'] {
  color: var(--pri-on);
  border-color: var(--pri-hi);
  background: var(--pri);
}
.customize-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: -8px 0 22px;
  padding: 12px 16px;
  border: var(--line) dashed var(--pri);
  border-radius: 14px;
  background: var(--tone), color-mix(in srgb, var(--pri) 8%, var(--surface));
  animation: impact 0.3s var(--bounce);
}
.customize-bar p:first-child {
  flex: 1 1 320px;
  color: var(--text);
  font-weight: 600;
}
.customize-status {
  color: var(--teal);
  font-size: 13px;
  font-weight: 600;
}
.customize-status:empty {
  display: none;
}

/* A colour picked for one timer replaces its accent (but not the rose warning in its last minute). */
.timer.custom-color:not(.imminent) {
  --accent: var(--custom);
  --accent-deep: var(--custom-deep);
  --accent-on: var(--custom-on);
}

/* The card toolbar (move, colour) only shows while customizing. */
.card-tools {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  z-index: 2;
  display: none;
  gap: 6px;
}
.customizing .card-tools {
  display: flex;
}
.card-tool {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: var(--line) solid var(--ink);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface-3);
  box-shadow: 2px 2px 0 var(--accent-deep);
  transition:
    transform 0.14s var(--bounce),
    background 0.14s;
}
.card-tool svg {
  width: 17px;
  height: 17px;
}
.card-tool:hover:not(:disabled) {
  color: var(--accent-on);
  background: var(--accent);
  transform: translate(-1px, -1px);
}
.card-tool:disabled {
  opacity: 0.3;
}
/* The arrows follow reading direction, so in Arabic "earlier" points right. */
:root[dir='rtl'] .move-earlier svg,
:root[dir='rtl'] .move-later svg {
  transform: scaleX(-1);
}
.customizing .timer {
  cursor: grab;
  border-style: dashed;
  animation: wiggle 0.5s var(--bounce);
}
.customizing .timer:hover {
  transform: none;
}
.customizing .timer-name {
  padding-inline-end: 112px;
}
.timer.dragging {
  opacity: 0.45;
  cursor: grabbing;
}
@keyframes wiggle {
  30% {
    transform: rotate(-0.8deg);
  }
  60% {
    transform: rotate(0.6deg);
  }
}

/* Colour picker: a small panel next to the palette button of a card. */
.color-popover {
  position: fixed;
  z-index: 80;
  display: grid;
  gap: 10px;
  width: 216px;
  padding: 14px;
  border: var(--line) solid var(--ink-2);
  border-radius: 14px;
  background: var(--tone), var(--surface);
  box-shadow: 5px 5px 0 var(--pri-deep);
  animation: impact 0.25s var(--bounce);
}
.color-popover h3 {
  font-size: 15px;
}
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.swatch {
  aspect-ratio: 1;
  padding: 0;
  border: var(--line) solid var(--ink-2);
  border-radius: 10px;
  background: var(--swatch);
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--swatch) 42%, #000);
  transition: transform 0.14s var(--bounce);
}
.swatch:hover {
  transform: translate(-1px, -1px) scale(1.06);
}
.swatch[aria-pressed='true'] {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}
.swatch-wide {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  color: var(--text);
  background: var(--bg-2);
  font-size: 13px;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
}
.swatch-wide:hover {
  border-color: var(--ink-2);
}
.swatch-wide[aria-pressed='true'] {
  border-color: var(--pri);
}
.swatch-dot {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}
.theme-dot {
  background: linear-gradient(135deg, var(--pri) 50%, var(--sec) 50%);
  box-shadow: 0 0 0 1.5px var(--ink-2);
}
.custom-color-field input {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.custom-color-field input::-webkit-color-swatch-wrapper {
  padding: 0;
}
.custom-color-field input::-webkit-color-swatch {
  border: 1.5px solid var(--ink-2);
  border-radius: 50%;
}

/* ───────── guide bubbles ───────── */

.guide-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
}
/* The spotlight is a hole: everything outside it is dimmed by its huge shadow. */
.guide-spot {
  position: fixed;
  border: var(--line) solid var(--amber);
  border-radius: 14px;
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--amber) 30%, transparent),
    0 0 0 9999px color-mix(in srgb, var(--bg) 72%, transparent);
  pointer-events: none;
  transition:
    left 0.3s var(--bounce),
    top 0.3s var(--bounce),
    width 0.3s var(--bounce),
    height 0.3s var(--bounce);
}
.guide-bubble {
  --tail: 50%;
  position: fixed;
  width: min(360px, calc(100vw - 24px));
  padding: 16px 18px 16px;
  border: var(--line) solid var(--ink-2);
  border-radius: 18px;
  color: var(--text-2);
  background: var(--tone), linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: 6px 6px 0 var(--pri-deep);
}
/* The speech-bubble tail, pointing up at the target (or down when the bubble sits above it). */
.guide-bubble::before {
  content: '';
  position: absolute;
  top: -10px;
  left: var(--tail);
  width: 18px;
  height: 18px;
  border-top: var(--line) solid var(--ink-2);
  border-left: var(--line) solid var(--ink-2);
  background: var(--surface-2);
  transform: translateX(-50%) rotate(45deg);
}
.guide-bubble.above::before {
  top: auto;
  bottom: -10px;
  background: var(--surface);
  transform: translateX(-50%) rotate(225deg);
}
.guide-bubble.pop {
  animation: impact 0.32s var(--bounce);
}
.guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.guide-count {
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--amber-on);
  background: var(--amber);
  font: 700 11px/1 var(--body);
  letter-spacing: 0.08em;
  transform: rotate(-2deg);
  box-shadow: 2px 2px 0 var(--amber-deep);
}
.guide-skip {
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  color: var(--mute);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.guide-skip:hover {
  color: var(--text);
}
.guide-bubble h2 {
  margin-bottom: 6px;
  font-size: 19px;
  text-shadow: 2px 2px 0 var(--pri-deep);
}
.guide-text {
  font-size: 14px;
  line-height: 1.55;
}
.guide-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.guide-actions button {
  padding: 8px 16px;
}
/* Gojo, the guide's mascot, beside the speech bubble. */
.guide-chibi {
  position: fixed;
  width: 118px;
  height: 180px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(4px 5px 0 color-mix(in srgb, var(--pri-deep) 80%, transparent));
  transition:
    left 0.35s var(--bounce),
    top 0.35s var(--bounce);
  animation: chibi-idle 2.6s ease-in-out infinite;
}
.guide-chibi.face-left {
  transform: scaleX(-1);
}
.guide-chibi.hop {
  animation:
    chibi-hop 0.5s var(--bounce),
    chibi-idle 2.6s ease-in-out 0.5s infinite;
}
@keyframes chibi-idle {
  50% {
    translate: 0 -5px;
  }
}
@keyframes chibi-hop {
  0% {
    translate: 0 26px;
    scale: 0.8;
    opacity: 0;
  }
  55% {
    translate: 0 -14px;
    scale: 1.04;
    opacity: 1;
  }
}
.motion-off .guide-chibi {
  animation: none;
  transition: none;
}


/* ───────── reset checklist ───────── */

.checklist {
  display: grid;
  gap: 16px;
  margin-top: 34px;
}
.checklist-head {
  display: grid;
  gap: 10px;
}
.checklist-head h2 {
  font-size: 28px;
  font-weight: 800;
  text-shadow: 2px 2px 0 var(--pri-deep);
}
.checklist-head p {
  color: var(--mute);
}
.checklist-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}
.checklist-col {
  --accent: var(--amber);
  --accent-deep: var(--amber-deep);
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px 18px 16px;
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--pop);
  transition: border-color 0.2s;
}
.checklist-col[data-list='weekly'] {
  --accent: var(--teal);
  --accent-deep: var(--teal-deep);
}
.checklist-col.all-done {
  border-color: var(--accent);
}
.checklist-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.checklist-col-head h3 {
  font-size: 19px;
}
.checklist-count:not(:empty) {
  padding: 4px 9px;
  border-radius: 6px;
  color: var(--accent-on, #120f1c);
  background: var(--accent);
  font: 700 12px/1 var(--body);
  box-shadow: 2px 2px 0 var(--accent-deep);
  transform: rotate(2deg);
}
.checklist-when {
  color: var(--mute);
  font-size: 12.5px;
}
.checklist-items {
  display: grid;
  gap: 2px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}
.checklist-items li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 2px 4px 2px 8px;
  border-radius: 9px;
  transition: background 0.14s;
}
.checklist-items li:hover {
  background: rgba(var(--fg-rgb), 0.05);
}
.checklist-items label {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
}
.checklist-items label span {
  overflow-wrap: anywhere;
}
.checklist-items input {
  flex: none;
  accent-color: var(--accent);
}
.checklist-items li.done label span {
  color: var(--mute);
  text-decoration: line-through;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}
.checklist-remove {
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--mute);
  background: transparent;
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.14s;
}
.checklist-items li:hover .checklist-remove,
.checklist-remove:focus-visible {
  opacity: 1;
}
.checklist-remove:hover {
  color: var(--rose);
  background: rgba(var(--fg-rgb), 0.06);
}
.checklist-empty {
  color: var(--mute);
  font-size: 13.5px;
}
.checklist-add {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.checklist-add input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: var(--line) dashed var(--ink);
  border-radius: 10px;
  color: var(--text);
  background: var(--bg-2);
}
.checklist-add input:focus {
  outline: none;
  border-style: solid;
  border-color: var(--accent);
  box-shadow: 3px 3px 0 var(--accent-deep);
}

/* ───────── my timers ───────── */

#mytimers-view {
  max-width: 1180px;
  margin: 0 auto;
  padding: 44px 16px 30px;
}
.mytimers-lead {
  max-width: 560px;
  color: var(--mute);
}
.mytimer-form {
  display: grid;
  gap: 16px;
  margin-bottom: 26px;
  padding: 20px 22px;
  border: var(--line) solid var(--pri);
  border-radius: var(--radius);
  background: var(--tone), linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: 5px 5px 0 var(--pri-deep);
  animation: impact 0.3s var(--bounce);
}
.mytimer-form h2 {
  font-size: 22px;
}
.mytimer-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px 18px;
}
.mytimer-form fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.mytimer-form legend {
  margin-bottom: 8px;
  padding: 0;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
.duration-inputs {
  display: flex;
  gap: 10px;
}
.duration-inputs label {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  color: var(--mute);
}
.field .duration-inputs input {
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.mytimer-days {
  grid-column: 1 / -1;
}
.day-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.day-pick {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  color: var(--text);
  background: var(--bg-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.day-pick:has(input:checked) {
  border-color: var(--pri);
  background: color-mix(in srgb, var(--pri) 16%, var(--bg-2));
}
.day-pick input {
  width: 15px;
  height: 15px;
}
.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.swatch-row .swatch {
  width: 34px;
}
.check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.mytimer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.mytimer-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}
.my-timer {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-content: start;
  align-items: center;
  gap: 4px 14px;
  padding: 20px 20px 18px;
  overflow: hidden;
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--pop);
  animation: panel-in 0.35s var(--bounce);
  transition:
    transform 0.18s var(--bounce),
    box-shadow 0.18s;
}
.my-timer:hover {
  transform: translate(-1px, -3px);
  box-shadow: 6px 8px 0 var(--accent-deep);
}
.my-timer .timer-name h2 {
  overflow-wrap: anywhere;
}
.my-timer-tools {
  align-self: start;
  display: flex;
  align-items: center;
  gap: 6px;
}
.overlay-pill {
  height: 32px;
  padding: 0 10px;
  border: var(--line) dashed var(--ink-2);
  border-radius: 9px;
  color: var(--mute);
  background: transparent;
  font: 700 10px/1 var(--body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition:
    transform 0.14s var(--bounce),
    background 0.14s;
}
.overlay-pill[aria-pressed='true'] {
  border-style: solid;
  border-color: var(--accent);
  color: var(--accent-on);
  background: var(--accent);
  box-shadow: 2px 2px 0 var(--accent-deep);
  transform: rotate(2deg);
}
.my-timer .card-tool.remove-tool.confirm {
  color: #fff;
  border-color: var(--rose);
  background: var(--rose);
}
.my-timer .time {
  margin-top: 14px;
}
.my-timer.idle .time strong {
  color: var(--mute);
  text-shadow: 3px 3px 0 rgba(var(--fg-rgb), 0.08);
}
.my-timer.done {
  border-color: var(--accent);
  animation: impact 0.5s var(--bounce);
}
.my-timer.done .time strong {
  color: var(--accent);
}
.my-timer.done .time span {
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.04em;
}
.my-timer.imminent {
  border-color: var(--rose);
  animation: glow 1.6s ease-in-out infinite;
}
.my-timer.imminent .time strong {
  color: var(--rose);
}
.my-timer-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.my-timer-actions button {
  padding: 8px 18px;
}
.mytimer-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 44px 20px;
  border: var(--line) dashed var(--ink-2);
  border-radius: var(--radius);
  color: var(--mute);
  text-align: center;
}
.mytimer-empty strong {
  color: var(--text);
  font: 700 20px/1.2 var(--display);
}
#mytimer-status,
#checklist-status {
  margin-top: 12px;
}

/* ───────── reminders + compact overlay ───────── */

.reminder-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px 14px;
}
.reminders-group .toggle-row {
  min-height: 56px;
}
#remind-test {
  justify-self: start;
}
.compact-row {
  min-height: 60px;
}
.overlay-tuning .field select {
  font-size: 14px;
}


/* ───────── web app ───────── */

/* The four pages sit in their own group: inline in the top bar on wide screens, a tab bar at the bottom on phones. */
.nav-pages {
  display: contents;
}
.app-nav button[hidden] {
  display: none;
}
.install-button {
  margin-inline-start: auto;
  color: var(--pri) !important;
}
.install-button:not([hidden]) + .theme-button {
  margin-inline-start: 0;
}
@media (max-width: 680px) {
  /* A blurred bar would become the frame the tab bar is fixed to, so the top bar is solid here. */
  .app-nav {
    backdrop-filter: none;
    background: var(--bg);
  }
  .nav-pages {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 70;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: var(--line) solid var(--ink);
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: blur(16px) saturate(1.4);
  }
  .app-nav .nav-pages button {
    width: auto;
    height: 52px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
  }
  .app-nav .nav-pages button span {
    position: static;
    width: auto;
    height: auto;
    overflow: hidden;
    clip-path: none;
    max-width: 100%;
    font-size: 10.5px;
    text-overflow: ellipsis;
  }
  .install-button {
    margin-inline-start: 0;
  }
  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }
  .hex-assistant-launcher {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }
  .hex-assistant {
    bottom: calc(146px + env(safe-area-inset-bottom));
    height: min(520px, calc(100vh - 190px));
  }
}
