html {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100dvh;
  overflow: hidden;
  font: 14px/1.6 ui-monospace, Menlo, Consolas, monospace;
}

.time-rewind-overlay {
  --rewind-progress: 0;
  position: fixed;
  z-index: 2000;
  display: grid;
  place-items: center;
  inset: 0;
  overflow: hidden;
  padding: clamp(16px, 4vw, 48px);
  background:
    radial-gradient(circle at 50% 46%, rgb(31 42 69 / 42%), transparent 38%),
    linear-gradient(180deg, #02040a 0%, #060912 55%, #010207 100%);
  color: #dce7ff;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.time-rewind-overlay[hidden] {
  display: none;
}

.time-rewind-overlay.is-active {
  opacity: 1;
}

.time-rewind-overlay.is-closing {
  opacity: 0;
}

.time-rewind-stars,
.time-rewind-stars::before,
.time-rewind-stars::after {
  position: absolute;
  inset: -12%;
  background-image:
    radial-gradient(circle, rgb(210 226 255 / 72%) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgb(126 164 255 / 48%) 0 1px, transparent 1.8px);
  background-position: 0 0, 37px 53px;
  background-size: 83px 83px, 127px 127px;
  content: "";
  opacity: 0.46;
  transform: scale(calc(1 + var(--rewind-progress) * 0.12));
}

.time-rewind-stars::before {
  background-position: 19px 31px, 71px 11px;
  background-size: 149px 149px, 193px 193px;
  opacity: 0.34;
  transform: rotate(16deg) scale(calc(1 + var(--rewind-progress) * 0.2));
}

.time-rewind-stars::after {
  background-position: 43px 7px, 13px 89px;
  background-size: 211px 211px, 257px 257px;
  filter: blur(0.3px);
  opacity: 0.28;
  transform: rotate(-11deg) scale(calc(1 + var(--rewind-progress) * 0.28));
}

.time-rewind-content {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(100%, 720px);
  text-align: center;
}

.time-rewind-kicker {
  margin: 0 0 clamp(8px, 2vh, 18px);
  color: rgb(157 181 231 / 74%);
  font-size: clamp(10px, 1.4vw, 12px);
  letter-spacing: 0.34em;
}

.time-rewind-moon-shell {
  position: relative;
  display: grid;
  width: min(46vh, 68vw, 360px);
  aspect-ratio: 1;
  place-items: center;
  filter: drop-shadow(0 0 28px rgb(126 164 255 / 16%));
}

.time-rewind-moon-shell canvas {
  position: relative;
  z-index: 2;
  width: 86%;
  height: 86%;
}

.time-rewind-moon-aura {
  position: absolute;
  width: 76%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgb(176 199 242 / 14%);
  box-shadow:
    0 0 50px 18px rgb(140 177 255 / 13%),
    0 0 120px 48px rgb(68 99 173 / 9%);
  transition: background 0.5s, box-shadow 0.5s;
}

.time-rewind-orbit {
  position: absolute;
  width: 98%;
  aspect-ratio: 1;
  border: 1px solid rgb(126 164 255 / 18%);
  border-radius: 50%;
  transform: rotate(calc(var(--rewind-progress) * -340deg));
}

.time-rewind-orbit::before {
  position: absolute;
  top: 7%;
  left: 18%;
  width: 5px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #91adf4;
  box-shadow: 0 0 10px #7fa4ff;
  content: "";
}

.time-rewind-overlay[data-eclipse="true"] .time-rewind-moon-aura {
  background: rgb(142 39 24 / 16%);
  box-shadow:
    0 0 54px 20px rgb(190 57 31 / 15%),
    0 0 130px 52px rgb(118 29 20 / 12%);
}

.time-rewind-date {
  margin-top: clamp(-8px, -1vh, -2px);
  color: #f2f5ff;
  font-size: clamp(26px, 6vw, 52px);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.1;
  text-shadow: 0 0 22px rgb(127 164 255 / 34%);
}

.time-rewind-phase {
  min-height: 1.7em;
  margin: 8px 0 14px;
  color: #9db4e8;
  font-size: clamp(11px, 2vw, 14px);
  letter-spacing: 0.17em;
}

.time-rewind-overlay[data-state="complete"] .time-rewind-date,
.time-rewind-overlay[data-state="complete"] .time-rewind-phase {
  color: #ff8d72;
  text-shadow: 0 0 24px rgb(217 64 39 / 42%);
}

.time-rewind-track {
  width: min(84vw, 460px);
  height: 2px;
  overflow: hidden;
  background: rgb(126 164 255 / 18%);
}

.time-rewind-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #b43e2b, #7fa4ff);
  box-shadow: 0 0 10px rgb(127 164 255 / 45%);
  transform: scaleX(0);
  transform-origin: right;
}

.time-rewind-caption {
  margin: 12px 0 0;
  color: rgb(157 181 231 / 62%);
  font-size: clamp(9px, 1.7vw, 11px);
  letter-spacing: 0.1em;
  line-height: 1.6;
}

.time-rewind-skip {
  margin-top: clamp(12px, 2.5vh, 22px);
  padding: 7px 14px;
  border: 1px solid rgb(126 164 255 / 28%);
  border-radius: 999px;
  background: rgb(6 9 18 / 58%);
  color: rgb(197 213 246 / 72%);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.time-rewind-skip:hover,
.time-rewind-skip:focus-visible {
  border-color: rgb(127 255 212 / 55%);
  color: var(--ok);
  outline: none;
  box-shadow: 0 0 18px rgb(127 255 212 / 12%);
}

.time-rewind-skip:disabled {
  border-color: rgb(126 164 255 / 16%);
  color: rgb(197 213 246 / 38%);
  cursor: wait;
  box-shadow: none;
}

.umbra-wrap {
  display: flex;
  width: min(100%, 1012px);
  height: 100dvh;
  margin: 0 auto;
  padding: clamp(8px, 2vh, 16px);
  padding-bottom: calc(clamp(8px, 2vh, 16px) + var(--site-footer-height));
}

.umbra-term {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 18px 18px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow:
    0 10px 40px rgb(0 0 0 / 50%),
    inset 0 0 0 1px rgb(255 255 255 / 4%),
    0 0 40px rgb(111 177 255 / 18%);
}

.umbra-term::before {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(120deg, transparent 0 40%, rgb(127 164 255 / 22%) 60%, transparent 75%);
  content: "";
  pointer-events: none;
}

.hud {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 4px 2px 12px;
  letter-spacing: 0.04em;
}

.hud-brand {
  flex: 1;
  color: var(--muted);
}

.hud-brand strong {
  color: var(--fg);
  letter-spacing: 0.08em;
}

.hud-pill {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

.led {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
}

#umbra-root[data-link="idle"] .led {
  background: #9aa8bf;
  box-shadow: 0 0 8px #9aa8bf;
}

#umbra-root[data-link="open"] .led {
  background: var(--ok);
  box-shadow: 0 0 12px var(--ok);
}

#umbra-root[data-link="closed"] .led {
  background: var(--bad);
  box-shadow: 0 0 10px var(--bad);
}

#umbra-root[data-link="locked"] .led {
  background: #ff3366;
  box-shadow: 0 0 12px #ff3366;
}

.umbra-feed-frame {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgb(118 144 214 / 20%);
  border-radius: 12px;
  background: rgb(4 7 15 / 35%);
  box-shadow: inset 0 8px 24px rgb(0 0 0 / 18%);
}

.umbra-feed-toolbar {
  display: flex;
  justify-content: space-between;
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
  background: rgb(20 26 44 / 55%);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
}

#umbra-root[data-search-mode="archive"] #umbra-mode-state {
  color: var(--ok);
  text-shadow: 0 0 10px rgb(127 255 212 / 30%);
}

#umbra-root[data-console-locked="true"] #umbra-mode-state {
  color: var(--bad);
  text-shadow: 0 0 10px rgb(255 123 123 / 30%);
}

.umbra-feed {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 10px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
  scrollbar-color: rgb(127 164 255 / 50%) rgb(20 26 44 / 35%);
  scrollbar-gutter: stable;
}

.umbra-feed:focus-visible {
  outline-offset: -3px;
}

.umbra-log {
  white-space: pre-wrap;
}

.umbra-ok { color: var(--ok); }
.umbra-warn { color: var(--warn); }
.umbra-bad { color: var(--bad); }
.umbra-muted { color: var(--muted); }
.umbra-noise { color: var(--muted); letter-spacing: 0.04em; }
.umbra-strong { font-weight: 700; }
.umbra-blank { line-height: 1.2; }

.umbra-action {
  margin: 16px 0;
  border: 1px solid rgb(118 144 214 / 30%);
  border-left: 3px solid rgb(127 164 255 / 65%);
  border-radius: 8px;
  background: rgb(16 22 39 / 48%);
  box-shadow: 0 6px 18px rgb(0 0 0 / 12%);
}

.umbra-action-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.8rem;
  align-items: baseline;
  padding: 7px 10px;
  border-bottom: 1px solid rgb(118 144 214 / 24%);
  border-radius: 7px 7px 0 0;
  background: rgb(25 34 56 / 96%);
  box-shadow: 0 4px 10px rgb(0 0 0 / 18%);
}

.umbra-action-label {
  color: var(--ok);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.umbra-action-query {
  color: var(--fg);
  font-weight: 700;
}

.umbra-action-body {
  padding: 10px 12px 12px;
}

.umbra-action-body:empty::after {
  color: var(--muted);
  content: "receiving…";
}

.umbra-prompt-power {
  float: right;
  margin-left: 1rem;
}

.umbra-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.umbra-command-line {
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgb(118 144 214 / 28%);
  border-left: 3px solid rgb(127 164 255 / 58%);
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgb(127 164 255 / 5%), transparent 28%),
    rgb(6 10 20 / 72%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 3%),
    inset 0 -8px 20px rgb(0 0 0 / 12%);
  transition: border-color 0.18s, box-shadow 0.18s;
}

.umbra-command-line:focus-within {
  border-color: rgb(127 255 212 / 62%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 4%),
    0 0 0 1px rgb(127 255 212 / 16%),
    0 0 18px rgb(127 255 212 / 10%);
}

.umbra-shell-prompt {
  color: var(--ok);
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.umbra-mode-hint {
  flex: 0 0 100%;
  margin: 0;
  padding-bottom: 5px;
  border-bottom: 1px dashed rgb(127 255 212 / 18%);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-align: right;
}

#umbra-root[data-search-mode="archive"] .umbra-command-line {
  border-left-color: var(--ok);
}

#umbra-root[data-search-mode="archive"] .umbra-shell-prompt,
#umbra-root[data-search-mode="archive"] .umbra-mode-hint {
  text-shadow: 0 0 10px rgb(127 255 212 / 24%);
}

.umbra-button,
.umbra-input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(20 26 44 / 70%);
  color: var(--fg);
}

.umbra-button {
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.umbra-button:hover {
  box-shadow: 0 0 0 1px rgb(127 164 255 / 35%), 0 0 24px rgb(127 164 255 / 25%);
}

.umbra-button-secondary {
  background: transparent;
  color: var(--muted);
}

.umbra-input {
  flex: 1;
  min-width: 220px;
}

.umbra-command-line .umbra-input {
  min-width: 0;
  padding: 3px 2px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  caret-color: var(--ok);
}

.umbra-command-line .umbra-input::placeholder {
  color: rgb(141 160 191 / 58%);
  letter-spacing: 0.02em;
}

.umbra-command-line .umbra-input:focus-visible {
  outline: 0;
}

.umbra-command-submit {
  align-self: stretch;
  padding: 2px 4px 2px 10px;
  border: 0;
  border-left: 1px solid rgb(118 144 214 / 24%);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.umbra-command-submit:hover,
.umbra-command-submit:focus-visible {
  color: var(--ok);
  box-shadow: none;
  text-shadow: 0 0 10px rgb(127 255 212 / 36%);
}

.umbra-divider {
  height: 1px;
  margin: 12px 0;
  background: var(--line);
}

.umbra-blink {
  animation: blink 1.2s steps(2, end) infinite;
}

.note {
  color: var(--muted);
  font-size: 12px;
}

.share-row {
  margin-top: 20px;
  text-align: center;
}

.share-link {
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(20 26 44 / 70%);
  color: var(--fg);
  text-decoration: none;
}

.umbra-fade {
  position: fixed;
  z-index: 999;
  inset: 0;
  background: #000;
  opacity: 0;
  transition: opacity 2.4s ease;
  pointer-events: none;
}

.umbra-fade.is-visible {
  opacity: 1;
}

@keyframes blink {
  50% { opacity: 0.35; }
}

@media (max-width: 640px) {
  .time-rewind-overlay {
    padding-inline: 12px;
  }

  .time-rewind-kicker {
    letter-spacing: 0.22em;
  }

  .time-rewind-moon-shell {
    width: min(42vh, 82vw, 320px);
  }

  .time-rewind-date {
    letter-spacing: 0.06em;
  }

  .time-rewind-phase {
    letter-spacing: 0.1em;
  }

  .time-rewind-caption {
    max-width: 34em;
  }

  .umbra-wrap {
    margin: 0 auto;
    padding: 8px 10px calc(8px + var(--site-footer-height));
  }

  .umbra-feed {
    min-height: 0;
    padding-inline: 8px;
  }

  .umbra-action {
    margin: 12px 0;
  }

  .umbra-action-body {
    padding-inline: 10px;
  }

  .umbra-command-line .umbra-input {
    min-width: 0;
  }

  .umbra-mode-hint {
    text-align: left;
  }

  .hud {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .hud-brand {
    order: -1;
    flex-basis: 100%;
  }

  .umbra-prompt-power {
    display: block;
    float: none;
    margin: 0.35rem 0 0;
  }
}

@media (max-height: 700px) {
  .time-rewind-moon-shell {
    width: min(38vh, 68vw, 300px);
  }

  .time-rewind-phase {
    margin-block: 5px 8px;
  }

  .time-rewind-caption {
    margin-top: 7px;
  }

  .time-rewind-skip {
    margin-top: 8px;
  }

  .umbra-term {
    padding-block: 10px 12px;
  }

  .hud {
    margin-bottom: 6px;
  }

  .umbra-divider {
    margin-block: 6px;
  }

  .spectrum {
    height: 30px;
    margin-top: 4px;
  }

  .note {
    margin-block: 6px 0;
    font-size: 11px;
    line-height: 1.4;
  }
}
