/* Flip Clock — split-flap clock + countdown. 80s neon / synthwave tone. */

:root {
  --bg: #08060f;
  --board: #150e28;
  --flap-a: #241640;   /* upper half */
  --flap-b: #190f2e;   /* lower half */
  --digit: #eaf2ff;

  /* neon palette */
  --blue: #2de2ff;      --blue-a: 45, 226, 255;
  --purple: #b14aff;    --purple-a: 177, 74, 255;
  --red: #ff2d6b;       --red-a: 255, 45, 107;
  --magenta: #ff2d95;   --magenta-a: 255, 45, 149;

  --accent: var(--magenta);
  --accent-a: var(--magenta-a);

  --text: #cdc2e8;
  --muted: #8b7fae;
  --line: #2c1f4a;
  --ok: var(--blue);
  --danger: var(--red);
  --radius: 10px;
}

* { box-sizing: border-box; }

/* Our display:flex rules would otherwise beat the UA stylesheet's [hidden]. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(var(--purple-a), 0.20), transparent 70%),
    radial-gradient(ellipse 60% 40% at 15% 40%, rgba(var(--blue-a), 0.10), transparent 70%),
    radial-gradient(ellipse 60% 40% at 85% 45%, rgba(var(--magenta-a), 0.12), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

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

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ============================== login ============================== */

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.login-card {
  width: min(92vw, 360px);
  background: linear-gradient(160deg, rgba(36, 22, 64, 0.9), rgba(14, 9, 26, 0.9));
  border: 1px solid rgba(var(--purple-a), 0.4);
  border-radius: 14px;
  padding: 36px 32px 30px;
  text-align: center;
  box-shadow:
    0 0 30px rgba(var(--purple-a), 0.25),
    0 0 80px rgba(var(--magenta-a), 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow:
    0 0 6px rgba(var(--magenta-a), 0.9),
    0 0 18px rgba(var(--magenta-a), 0.6),
    0 0 40px rgba(var(--purple-a), 0.4);
}

.login-sub { margin: 0 0 22px; color: var(--muted); font-size: 0.87rem; }

.login-card input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  background: rgba(8, 6, 15, 0.8);
  border: 1px solid rgba(var(--purple-a), 0.35);
  border-radius: 8px;
  color: var(--digit);
}
.login-card input:focus {
  outline: none;
  border-color: rgba(var(--blue-a), 0.8);
  box-shadow: 0 0 0 3px rgba(var(--blue-a), 0.15), 0 0 18px rgba(var(--blue-a), 0.25);
}

.login-card button {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--magenta), var(--purple));
  color: #12071f;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(var(--magenta-a), 0.5);
}
.login-card button:hover { filter: brightness(1.12); }

.login-error {
  margin: 16px 0 0;
  color: var(--red);
  font-size: 0.85rem;
  text-shadow: 0 0 12px rgba(var(--red-a), 0.6);
}

/* ============================== stage ============================== */

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;         /* dodges mobile browser chrome */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: clamp(24px, 4vh, 48px) 16px;
  overflow: hidden;
}

/* Outrun horizon grid — atmosphere only, kept well behind the digits. */
.stage::before {
  content: "";
  position: absolute;
  left: -50%; right: -50%; bottom: 0;
  height: 42%;
  background-image:
    repeating-linear-gradient(to right,
      rgba(var(--magenta-a), 0.5) 0 1px, transparent 1px 62px),
    repeating-linear-gradient(to bottom,
      rgba(var(--blue-a), 0.45) 0 1px, transparent 1px 44px);
  transform: perspective(200px) rotateX(62deg);
  transform-origin: bottom center;
  opacity: 0.42;
  mask-image: linear-gradient(to bottom, transparent, #000 65%);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 65%);
  pointer-events: none;
  z-index: 0;
}

.stage-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.stage-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}
.stage-label.is-live {
  color: var(--magenta);
  text-shadow: 0 0 10px rgba(var(--magenta-a), 0.8), 0 0 26px rgba(var(--magenta-a), 0.45);
}

/* --------------------------- the flip clock --------------------------- */

/* Every row inside .timepiece shares these columns, so each dial and the start
   button line up with the pair of flaps above them. */
.timepiece {
  /* Sized off whichever of width or height is the tighter constraint, so the
     clock fills the page without ever pushing the controls off-screen. */
  --flap-w: clamp(46px, min(12.4vw, 17.5vh), 190px);
  --flap-h: clamp(74px, min(19vw, 27vh), 288px);
  --gap: clamp(3px, 0.7vw, 10px);
  --row-gap: clamp(6px, 1.4vw, 22px);
  --sep-w: clamp(5px, 1vw, 13px);
  --tail-w: clamp(18px, 2.2vw, 34px);
  --cell-w: calc(var(--flap-w) * 2 + var(--gap));
  --item-h: clamp(28px, min(3.2vw, 4.6vh), 42px);
  --fold: 300ms;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 1.6vw, 20px);
}

.clock {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: var(--row-gap);
}

/* One neon tone per unit — blue hours, purple minutes, red seconds. Applied to
   both the flap group and the dial below it, so a column reads as one colour.
   --tone-light is the tube's hot core: tinted, not white, so the colour reads. */
.group, .dial-cell { --tone: var(--blue); --tone-a: var(--blue-a); --tone-light: #cbf4ff; }
.tone-blue   { --tone: var(--blue);   --tone-a: var(--blue-a);   --tone-light: #cbf4ff; }
.tone-purple { --tone: var(--purple); --tone-a: var(--purple-a); --tone-light: #ecd4ff; }
.tone-red    { --tone: var(--red);    --tone-a: var(--red-a);    --tone-light: #ffd0dd; }

.group {
  position: relative;
  display: flex;
  gap: var(--gap);
  padding-bottom: 20px;
}

.unit-tag {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  text-align: center;
  font-size: clamp(0.5rem, 1vw, 0.66rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tone);
  opacity: 0.85;
  text-shadow: 0 0 10px rgba(var(--tone-a), 0.7);
}

.colon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: calc(var(--flap-h) * 0.22);
  height: var(--flap-h);
}
.colon i {
  width: clamp(5px, 1vw, 11px);
  height: clamp(5px, 1vw, 11px);
  border-radius: 50%;
  background: var(--magenta);
  box-shadow: 0 0 8px rgba(var(--magenta-a), 0.95), 0 0 20px rgba(var(--magenta-a), 0.6);
}

.meridiem {
  align-self: flex-start;
  margin-top: 4px;
  font-size: clamp(0.62rem, 1.2vw, 0.9rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--magenta);
  text-shadow: 0 0 10px rgba(var(--magenta-a), 0.85), 0 0 24px rgba(var(--magenta-a), 0.5);
  width: var(--tail-w);
  flex: 0 0 var(--tail-w);
}

/* ---------------------------- spin dials ---------------------------- */

.dial-row,
.action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--row-gap);
  width: 100%;
}

.dial-row.nudge { animation: nudge 420ms ease; }
@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

.dial-cell { flex: 0 0 var(--cell-w); width: var(--cell-w); }
.dial-sep  { flex: 0 0 var(--sep-w);  width: var(--sep-w); }

/* Mirrors .meridiem so every row centres on the same axis. */
.tail { flex: 0 0 var(--tail-w); width: var(--tail-w); }

/* The button and presets centre over the three dials, not the whole row. */
.action-slot { flex: 1 1 auto; display: flex; justify-content: center; }

.dial {
  position: relative;
  height: calc(var(--item-h) * 5);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(10, 7, 20, 0.9), rgba(26, 15, 46, 0.75));
  box-shadow:
    inset 0 0 0 1px rgba(var(--tone-a), 0.3),
    inset 0 0 26px rgba(var(--tone-a), 0.1),
    0 0 16px rgba(var(--tone-a), 0.12);
  overflow: hidden;
  perspective: 620px;
  cursor: grab;
  touch-action: none;          /* we own the vertical drag */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  mask-image: linear-gradient(to bottom, transparent, #000 26%, #000 74%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 26%, #000 74%, transparent);
}
.dial.is-dragging { cursor: grabbing; }
.dial:focus-visible { outline: 2px solid var(--tone); outline-offset: 2px; }

.dial-wheel {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.dial-item {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: var(--item-h);
  margin-top: calc(var(--item-h) / -2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--item-h) * 0.62);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--tone-light);
  text-shadow: 0 0 8px rgba(var(--tone-a), 0.7);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform, opacity;
}

/* the lit slot marking the selected number */
.dial-window {
  position: absolute;
  left: 6px; right: 6px;
  top: 50%;
  height: var(--item-h);
  margin-top: calc(var(--item-h) / -2);
  border-top: 1px solid rgba(var(--tone-a), 0.55);
  border-bottom: 1px solid rgba(var(--tone-a), 0.55);
  background: linear-gradient(90deg,
    transparent, rgba(var(--tone-a), 0.14), transparent);
  box-shadow: 0 0 18px rgba(var(--tone-a), 0.22);
  pointer-events: none;
}

/* one digit card */

.flap {
  position: relative;
  width: var(--flap-w);
  height: var(--flap-h);
  perspective: 500px;
  border-radius: var(--radius);
  background: var(--flap-b);
  box-shadow:
    inset 0 0 0 1px rgba(var(--tone-a), 0.32),
    0 0 22px rgba(var(--tone-a), 0.16),
    0 8px 26px rgba(0, 0, 0, 0.7);
  font-variant-numeric: tabular-nums;
}

/* hairline where the two halves meet */
.flap::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  margin-top: -1px;
  background: rgba(0, 0, 0, 0.7);
  z-index: 5;
  pointer-events: none;
}

.half {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.half span {
  display: block;
  width: 100%;
  height: var(--flap-h);
  line-height: var(--flap-h);
  text-align: center;
  font-size: calc(var(--flap-h) * 0.74);
  font-weight: 600;
  color: var(--tone-light, #fbfdff);
  text-shadow:
    0 0 4px rgba(var(--tone-a), 0.85),
    0 0 14px rgba(var(--tone-a), 0.85),
    0 0 34px rgba(var(--tone-a), 0.55),
    0 0 68px rgba(var(--tone-a), 0.3);
  font-family: "Inter", system-ui, sans-serif;
}

.top {
  top: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(180deg, var(--flap-a), #1d1236);
}

.bottom {
  bottom: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: linear-gradient(180deg, #160d2a, var(--flap-b));
}
.bottom span { margin-top: calc(var(--flap-h) * -0.5); }

/* the two moving leaves */
.fold-front, .fold-back { visibility: hidden; }
.fold-front { transform-origin: 50% 100%; z-index: 4; }
.fold-back  { transform-origin: 50% 0%;   z-index: 3; transform: rotateX(90deg); }

.flap.flipping .fold-front,
.flap.flipping .fold-back { visibility: visible; }

.flap.flipping .fold-front {
  animation: fold-down var(--fold) cubic-bezier(0.36, 0, 0.66, 0.3) forwards;
}
.flap.flipping .fold-back {
  animation: fold-up var(--fold) cubic-bezier(0.34, 0.7, 0.64, 1) var(--fold) forwards;
}

@keyframes fold-down {
  from { transform: rotateX(0deg); }
  to   { transform: rotateX(-90deg); }
}
@keyframes fold-up {
  from { transform: rotateX(90deg); }
  to   { transform: rotateX(0deg); }
}

/* countdown finished — hot red neon pulse */
.clock.is-finished .flap { animation: alarm 1.1s ease-in-out infinite; }
@keyframes alarm {
  0%, 100% {
    box-shadow:
      inset 0 0 0 1px rgba(var(--red-a), 0.4),
      0 0 22px rgba(var(--red-a), 0.25),
      0 8px 26px rgba(0, 0, 0, 0.7);
  }
  50% {
    box-shadow:
      inset 0 0 0 2px rgba(var(--red-a), 1),
      0 0 40px rgba(var(--red-a), 0.75),
      0 0 90px rgba(var(--red-a), 0.4),
      0 8px 26px rgba(0, 0, 0, 0.7);
  }
}

.clock.is-paused .flap { opacity: 0.55; }
.clock.is-paused .half span { text-shadow: 0 0 6px rgba(var(--tone-a), 0.35); }

@media (prefers-reduced-motion: reduce) {
  .flap.flipping .fold-front,
  .flap.flipping .fold-back { animation: none; visibility: hidden; }
  .clock.is-finished .flap {
    animation: none;
    box-shadow: inset 0 0 0 2px rgba(var(--red-a), 1), 0 0 40px rgba(var(--red-a), 0.6);
  }
  .start-btn.is-armed {
    animation: none;
    box-shadow: 0 0 24px rgba(var(--magenta-a), 0.7);
  }
  .log-modal[open],
  .log-modal[open]::backdrop { animation: none; }
}

/* ============================= controls ============================= */

.btn {
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.03em;
  border-radius: 7px;
  border: 1px solid rgba(var(--purple-a), 0.45);
  background: rgba(36, 22, 64, 0.7);
  color: var(--text);
  cursor: pointer;
}
.btn:hover {
  border-color: rgba(var(--blue-a), 0.7);
  color: #fff;
  box-shadow: 0 0 16px rgba(var(--blue-a), 0.28);
}
.btn.primary {
  background: linear-gradient(135deg, var(--magenta), var(--purple));
  color: #12071f;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 0 18px rgba(var(--magenta-a), 0.45);
}
.btn.primary:hover { filter: brightness(1.12); box-shadow: 0 0 26px rgba(var(--magenta-a), 0.6); }

/* The start button is the one call to action up here — bigger, and it breathes
   until it is pressed. .is-armed is dropped the moment a countdown starts. */
.start-btn {
  padding: clamp(13px, 1.5vw, 18px) clamp(30px, 4.5vw, 58px);
  font-size: clamp(0.95rem, 1.35vw, 1.16rem);
  letter-spacing: 0.05em;
  border-radius: 10px;
}
.start-btn.is-armed { animation: armed 2.2s ease-in-out infinite; }
.start-btn:hover { animation: none; }

/* Pause / Resume. The min-width is the point: both labels render at exactly
   the same size, so the button never resizes as you toggle it. */
.toggle-btn {
  padding: clamp(12px, 1.4vw, 17px) clamp(24px, 3.4vw, 40px);
  font-size: clamp(0.92rem, 1.25vw, 1.1rem);
  min-width: clamp(164px, 17vw, 220px);
  justify-content: center;
  border-radius: 10px;
}

@keyframes armed {
  0%, 100% {
    box-shadow:
      0 0 16px rgba(var(--magenta-a), 0.5),
      0 0 36px rgba(var(--magenta-a), 0.22);
  }
  50% {
    box-shadow:
      0 0 28px rgba(var(--magenta-a), 0.85),
      0 0 66px rgba(var(--magenta-a), 0.5),
      0 0 110px rgba(var(--purple-a), 0.3);
  }
}

.presets { display: flex; gap: 7px; }
.presets button {
  padding: 7px 13px;
  font-size: 0.78rem;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(var(--purple-a), 0.35);
  border-radius: 999px;
  cursor: pointer;
}
.presets button:hover {
  color: var(--blue);
  border-color: rgba(var(--blue-a), 0.7);
  box-shadow: 0 0 14px rgba(var(--blue-a), 0.25);
}

.running-controls { display: flex; gap: 10px; }

.conn {
  position: absolute;
  left: 14px; top: 12px;   /* top-right belongs to the sound toggle */
  margin: 0;
  z-index: 2;
  font-size: 0.72rem;
  color: var(--red);
  text-shadow: 0 0 12px rgba(var(--red-a), 0.7);
}

/* =========================== sound toggle =========================== */

.sound-toggle {
  position: fixed;
  top: clamp(14px, 2vw, 28px);
  right: clamp(14px, 2vw, 28px);
  z-index: 40;
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--magenta);
  background: rgba(14, 9, 26, 0.82);
  border: 1px solid rgba(var(--magenta-a), 0.4);
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 16px rgba(var(--magenta-a), 0.18);
}
.sound-toggle:hover {
  border-color: rgba(var(--magenta-a), 0.85);
  box-shadow: 0 0 24px rgba(var(--magenta-a), 0.4);
}

.sound-toggle svg {
  width: 21px; height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sound-toggle .spk { fill: currentColor; stroke-width: 1.2; }

/* muted: drop the waves, show the cross */
.sound-toggle .slash { display: none; }
.sound-toggle.is-muted { color: var(--muted); border-color: var(--line); box-shadow: none; }
.sound-toggle.is-muted .wave { display: none; }
.sound-toggle.is-muted .slash { display: block; }

/* ========================== corner buttons ========================== */

.corner-btn {
  position: fixed;
  bottom: clamp(14px, 2vw, 28px);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--corner);
  background: rgba(14, 9, 26, 0.82);
  border: 1px solid rgba(var(--corner-a), 0.45);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 18px rgba(var(--corner-a), 0.2);
}
.corner-btn:hover {
  color: #fff;
  border-color: rgba(var(--corner-a), 0.9);
  box-shadow: 0 0 26px rgba(var(--corner-a), 0.4);
}

.log-launch {
  --corner: var(--blue);
  --corner-a: var(--blue-a);
  left: clamp(14px, 2vw, 28px);
}

.reset-btn {
  --corner: var(--red);
  --corner-a: var(--red-a);
  right: clamp(14px, 2vw, 28px);
}

.log-launch-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px rgba(var(--blue-a), 0.9);
}

.log-count {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #12071f;
  background: var(--blue);
}

/* ============================= log popup ============================= */

.log-modal {
  width: min(94vw, 940px);
  height: min(86vh, 820px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid rgba(var(--purple-a), 0.45);
  border-radius: 16px;
  background: linear-gradient(165deg, #1a1030, #0c0818);
  color: var(--text);
  box-shadow:
    0 0 60px rgba(var(--purple-a), 0.3),
    0 0 140px rgba(var(--magenta-a), 0.12),
    0 30px 80px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
.log-modal::backdrop {
  background: rgba(4, 2, 10, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.log-modal[open] { animation: modal-in 180ms cubic-bezier(0.2, 0.8, 0.3, 1); }
.log-modal[open]::backdrop { animation: backdrop-in 180ms ease; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

.log-modal-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.log-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 20px clamp(16px, 3vw, 30px) 14px;
  border-bottom: 1px solid var(--line);
}

.log-modal-head h2 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--blue);
  text-shadow: 0 0 12px rgba(var(--blue-a), 0.55);
}

.ledger-tools {
  display: flex;
  align-items: center;
  gap: 16px;
}

.log-close {
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  line-height: 1;
  font-family: inherit;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.log-close:hover { color: #fff; border-color: rgba(var(--magenta-a), 0.7); }

.logout button {
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  font-size: 0.76rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.logout button:hover { color: var(--magenta); }

.ledger-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px clamp(16px, 3vw, 30px) 26px;
}

.empty { color: var(--muted); font-size: 0.88rem; padding: 22px 0; }

.day-head {
  margin: 22px 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--purple);
  text-shadow: 0 0 12px rgba(var(--purple-a), 0.5);
}

.row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 8px 16px;
  align-items: baseline;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
}

.row-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  color: var(--text);
}

.row-main { min-width: 0; }

.row-label { font-size: 0.94rem; color: #f0e9ff; }
.row-label.untitled { color: var(--muted); font-style: italic; }

.row-meta {
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.row-events {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 0.73rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.row-events span::before { content: "· "; color: var(--line); }
.row-events span:first-child::before { content: ""; }

.badge {
  justify-self: end;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.badge.completed { color: var(--blue);    box-shadow: 0 0 12px rgba(var(--blue-a), 0.3); }
.badge.cancelled { color: var(--red);     box-shadow: 0 0 12px rgba(var(--red-a), 0.3); }
.badge.running   { color: var(--magenta); box-shadow: 0 0 12px rgba(var(--magenta-a), 0.35); }
.badge.paused    { color: var(--muted); }

@media (max-width: 560px) {
  /* Narrow enough that the corner launcher can reach the centred controls. */
  .stage { padding-bottom: 84px; }
  .log-modal { width: 100vw; height: 100svh; border-radius: 0; border: 0; }
  .row { grid-template-columns: 1fr auto; }
  .row-time { grid-column: 1 / -1; color: var(--muted); font-size: 0.78rem; }
}
