:root {
  --corner-radius: 12px;
  color-scheme: dark;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #050708;
  color: #f4f1e8;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: linear-gradient(180deg, #071113 0%, #050708 62%, #030404 100%);
}

canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

canvas:active {
  cursor: grabbing;
}

.hud {
  pointer-events: none;
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1rem, 3vw, 2rem);
}

.summary,
.controls,
.map-cta,
.share-prompt {
  border: 1px solid rgba(244, 241, 232, 0.14);
  border-radius: var(--corner-radius);
  background: rgba(5, 7, 8, 0.74);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.summary {
  pointer-events: none;
  width: min(27rem, calc(100vw - 2rem));
  padding: 1.15rem;
}

.summary,
.controls,
.status-stack {
  opacity: 1;
  transform: translate(0, 0);
  visibility: visible;
}

body.is-intro-hidden .summary,
body.is-intro-hidden .controls,
body.is-intro-hidden .status-stack {
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 720ms ease,
    transform 820ms cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s linear 720ms;
  visibility: hidden;
}

body.is-intro-hidden .summary {
  transform: translateX(-1.8rem);
}

body.is-intro-hidden .controls {
  transform: translateY(1.6rem);
}

body.is-intro-hidden .status-stack {
  transform: translateX(1.4rem);
}

.label {
  margin: 0 0 0.6rem;
  color: #f0bd5f;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  max-width: 100%;
  margin: 0;
  font-size: clamp(1.55rem, 2.2rem, 3.25rem);
  line-height: 1.04;
  letter-spacing: 0;
}

body.is-embed .summary {
  width: min(21rem, calc(100vw - 2rem));
  padding: 0.95rem;
}

body.is-embed h1 {
  font-size: clamp(1.25rem, 5.4vw, 1.85rem);
  line-height: 1.08;
}

body.is-embed dl {
  margin-top: 0.95rem;
}

dl {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.8fr);
  gap: 0.75rem;
  align-items: start;
  margin: 1.2rem 0 0;
}

dl div {
  min-width: 0;
}

dt {
  color: rgba(244, 241, 232, 0.52);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

dd {
  margin: 0.2rem 0 0;
  color: #fffaf0;
  font-size: clamp(0.82rem, 3.5vw, 0.96rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.18;
  white-space: nowrap;
}

.timeline-stat {
  grid-column: 1 / -1;
  margin-top: 0.25rem;
}

.timeline-stat dd {
  margin-bottom: 0.55rem;
}

.timeline-value {
  display: grid;
  grid-template-columns: 11.5ch auto;
  gap: 0.45rem;
  align-items: baseline;
}

.timeline-value span {
  min-width: 0;
}

.about-map {
  margin-top: 1rem;
  border-top: 1px solid rgba(244, 241, 232, 0.12);
  padding-top: 0.85rem;
}

.about-map summary {
  pointer-events: auto;
  width: fit-content;
  cursor: pointer;
  user-select: none;
  color: rgba(244, 241, 232, 0.72);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  list-style: none;
  text-transform: uppercase;
}

.about-map summary::-webkit-details-marker {
  display: none;
}

.about-map summary::before {
  content: "+";
  display: inline-block;
  width: 1.1em;
  color: #f0bd5f;
}

.about-map[open] summary::before {
  content: "-";
}

.about-map summary:hover,
.about-map summary:focus-visible {
  color: #fff8e8;
  outline: none;
}

.about-map-content {
  margin-top: 0.75rem;
}

.about-map-content p {
  max-width: 23rem;
  margin: 0;
  color: rgba(244, 241, 232, 0.72);
  font-size: 0.88rem;
  line-height: 1.45;
}

.about-map-content p + p {
  margin-top: 0.55rem;
}

.about-map-content .inspiration {
  color: rgba(244, 241, 232, 0.56);
  font-size: 0.78rem;
}

.inspiration a {
  pointer-events: auto;
  color: #f0bd5f;
  font-weight: 750;
  text-decoration: none;
}

.inspiration a:hover,
.inspiration a:focus-visible {
  color: #fff8e8;
  text-decoration: underline;
  outline: none;
}

.profile-links {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.profile-links a {
  pointer-events: auto;
  display: grid;
  width: 2.1rem;
  height: 2.1rem;
  place-items: center;
  border: 1px solid rgba(244, 241, 232, 0.16);
  border-radius: var(--corner-radius);
  background: rgba(244, 241, 232, 0.07);
  color: rgba(244, 241, 232, 0.84);
}

.profile-links a:hover,
.profile-links a:focus-visible {
  border-color: rgba(240, 189, 95, 0.72);
  background: rgba(240, 189, 95, 0.14);
  color: #fff8e8;
  outline: none;
}

.profile-links svg {
  width: 1rem;
  height: 1rem;
  fill: currentcolor;
}

.status-stack {
  pointer-events: none;
  display: grid;
  justify-items: end;
  width: min(21rem, calc(100vw - 2rem));
}

.meter {
  height: 0.35rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(244, 241, 232, 0.14);
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #56d6c8, #f0bd5f, #ffffff);
}

.controls {
  pointer-events: none;
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  left: clamp(1rem, 3vw, 2rem);
  display: grid;
  grid-template-columns: 5.35rem auto minmax(12rem, 1fr);
  gap: 0.65rem;
  align-items: center;
  padding: 0.75rem;
}

button {
  pointer-events: auto;
  min-height: 2.55rem;
  border: 1px solid rgba(244, 241, 232, 0.18);
  border-radius: 10px;
  background: rgba(244, 241, 232, 0.08);
  color: #fff8e8;
  padding: 0 0.9rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 750;
}

button:hover,
button:focus-visible {
  border-color: rgba(240, 189, 95, 0.75);
  background: rgba(240, 189, 95, 0.16);
  outline: none;
}

label {
  pointer-events: auto;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: center;
  color: rgba(244, 241, 232, 0.68);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

input[type="range"] {
  width: 100%;
  accent-color: #f0bd5f;
}

.share-fab {
  pointer-events: auto;
  display: inline-grid;
  width: 2.85rem;
  min-height: 2.85rem;
  margin-top: 0.65rem;
  place-items: center;
  border-radius: 999px;
  padding: 0;
  background: rgba(5, 7, 8, 0.82);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.map-cta {
  position: relative;
  pointer-events: auto;
  width: min(20rem, 100%);
  padding: 1rem 3rem 1rem 1rem;
  transition:
    padding 180ms ease,
    width 180ms ease;
}

.map-cta .icon-button {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 2rem;
  min-height: 2rem;
  border-radius: 999px;
  padding: 0;
  color: rgba(244, 241, 232, 0.72);
}

.map-cta p {
  margin: 0;
  color: rgba(244, 241, 232, 0.72);
  font-size: 0.86rem;
  line-height: 1.4;
}

.map-cta a {
  display: inline-flex;
  min-height: 2.45rem;
  align-items: center;
  justify-content: center;
  margin-top: 0.85rem;
  border: 1px solid rgba(240, 189, 95, 0.58);
  border-radius: 10px;
  background: rgba(240, 189, 95, 0.18);
  color: #fff8e8;
  padding: 0 0.9rem;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
}

.map-cta a:hover,
.map-cta a:focus-visible {
  border-color: rgba(240, 189, 95, 0.82);
  background: rgba(240, 189, 95, 0.26);
  outline: none;
}

.map-cta.is-collapsed {
  width: fit-content;
  max-width: 100%;
  justify-self: end;
  padding: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.map-cta.is-collapsed p,
.map-cta.is-collapsed .icon-button {
  display: none;
}

.map-cta.is-collapsed a {
  margin-top: 0;
  background: rgba(5, 7, 8, 0.82);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.share-fab svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.share-prompt {
  pointer-events: auto;
  position: relative;
  width: min(20rem, 100%);
  margin-top: 0.9rem;
  padding: 1rem;
  animation: share-prompt-enter 200ms ease-out both;
  transform-origin: calc(100% - 1.4rem) -0.9rem;
}

.share-prompt.is-dismissing {
  animation: share-prompt-exit 220ms ease-in both;
}

.share-prompt::before {
  position: absolute;
  top: -0.9rem;
  right: 1.35rem;
  width: 1px;
  height: 0.9rem;
  background: rgba(244, 241, 232, 0.18);
  content: "";
}

.share-prompt::after {
  position: absolute;
  top: -0.26rem;
  right: 1.02rem;
  width: 0.62rem;
  height: 0.62rem;
  border-top: 1px solid rgba(244, 241, 232, 0.14);
  border-left: 1px solid rgba(244, 241, 232, 0.14);
  background: rgba(5, 7, 8, 0.74);
  content: "";
  transform: rotate(45deg);
}

.share-prompt .icon-button {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 2rem;
  min-height: 2rem;
  border-radius: 999px;
  padding: 0;
  color: rgba(244, 241, 232, 0.72);
}

.share-title {
  margin: 0 2.4rem 0.35rem 0;
  color: #fff8e8;
  font-weight: 800;
}

.share-copy,
.share-feedback {
  margin: 0;
  color: rgba(244, 241, 232, 0.68);
  font-size: 0.86rem;
  line-height: 1.4;
}

.share-prompt button:not(.icon-button) {
  width: 100%;
  margin-top: 0.85rem;
  background: rgba(240, 189, 95, 0.18);
}

.share-feedback {
  margin-top: 0.65rem;
  color: #8be8dc;
  font-weight: 750;
}

@keyframes share-prompt-enter {
  from {
    opacity: 0;
    transform: translateY(-0.45rem) scale(0.86);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes share-prompt-exit {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-0.45rem) scale(0.84);
  }
}

.error {
  position: fixed;
  inset: auto 1rem 1rem;
  margin: 0;
  border: 1px solid rgba(255, 121, 91, 0.45);
  border-radius: var(--corner-radius);
  background: rgba(82, 18, 14, 0.84);
  color: #ffe8df;
  padding: 1rem;
  font-weight: 700;
}

@media (max-width: 760px) {
  .hud {
    display: block;
  }

  .summary {
    width: 100%;
  }

  dl {
    grid-template-columns: 1fr 1fr;
  }

  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .controls button {
    width: 100%;
    padding: 0 0.35rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  label {
    grid-column: 1 / -1;
  }

  .status-stack {
    width: 100%;
    margin-top: 0.75rem;
  }

  .share-prompt {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .share-prompt,
  .share-prompt.is-dismissing {
    animation: none;
  }
}
