@font-face {
  font-family: Outfit;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("outfit-400.woff2") format("woff2");
}
@font-face {
  font-family: Outfit;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("outfit-500.woff2") format("woff2");
}
@font-face {
  font-family: Outfit;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("outfit-600.woff2") format("woff2");
}
@font-face {
  font-family: Outfit;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("outfit-700.woff2") format("woff2");
}

:root {
  --ink: #191C1F;
  --cobalt: #494FDF;
  --lime: #BFFF37;
  --white: #FFFFFF;
  --mute: #505A63;
  --bezel: 208px;
  --soft: rgba(255, 255, 255, 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: Outfit, "Avenir Next", "Segoe UI", sans-serif;
  color: var(--white);
  background: var(--ink) url("bg-night.jpg") center / cover no-repeat;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

img { -webkit-user-drag: none; }

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

::selection { background: var(--cobalt); color: var(--white); }

[hidden] { display: none !important; }

#app {
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background: var(--ink);
}

@media (min-width: 561px) {
  body { background-attachment: fixed; }
  #app {
    max-width: 430px;
    margin: 0 auto;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 30px 80px rgba(0, 0, 0, 0.45);
  }
}

.splash {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: var(--ink);
  overflow: hidden;
}

.splash-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.42) saturate(0.85);
}

.splash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(25, 28, 31, 0.15), rgba(25, 28, 31, 0.78));
}

.splash-svg {
  position: absolute;
  z-index: 1;
  left: 7%;
  right: 7%;
  top: 24%;
  width: 86%;
  overflow: visible;
}

.splash-svg path {
  fill: none;
  stroke: var(--lime);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  filter: url(#arcglow);
  animation: draw 1.05s cubic-bezier(0.45, 0.05, 0.2, 1) forwards;
}

.splash-dot {
  fill: var(--cobalt);
  opacity: 0;
  animation: pop 0.3s ease 1s forwards;
}

.splash-pin {
  position: absolute;
  z-index: 2;
  width: 68px;
  left: 70%;
  top: 31%;
  opacity: 0;
  pointer-events: none;
  animation: pop 0.35s ease 0.95s forwards;
}

.splash-name {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 15%;
  margin: 0;
  text-align: center;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.045em;
  opacity: 0;
  animation: rise 0.4s ease 0.72s forwards;
}

.splash.is-out {
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

@keyframes draw { to { stroke-dashoffset: 0; } }

@keyframes pop { to { opacity: 1; } }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.onboard, .shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.onboard {
  padding: calc(46px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom));
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(25, 28, 31, 0.42), rgba(25, 28, 31, 0.9) 55%, var(--ink)),
    url("bg-night.jpg") center / cover no-repeat;
}

.skip {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: 10px;
  z-index: 2;
  background: none;
  border: 0;
  color: var(--white);
  font-weight: 600;
  font-size: 16px;
  padding: 8px 10px;
}

.onboard-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 140px;
  margin-bottom: 10px;
}

.onboard-stage > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.onboard-stage canvas {
  display: block;
  border-radius: 28px;
  touch-action: none;
  background: var(--ink);
}

.onboard-copy, .dots, .onboard > .pill { flex-shrink: 0; }

.onboard-copy h2 {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 600;
}

.onboard-copy p { margin: 0; }

#scene-body {
  color: var(--soft);
  line-height: 1.4;
  font-size: 16px;
}

.status {
  min-height: 1.2em;
  margin-top: 8px;
  color: var(--lime);
  font-weight: 600;
  font-size: 14px;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 10px 0;
}

.dots i, .pips i {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--mute);
  display: block;
}

.dots i.is-on { width: 22px; background: var(--lime); }

.pips { display: flex; gap: 6px; }

.pips i.is-on { background: var(--lime); }

.chip-board {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: 28px;
  background: rgba(25, 28, 31, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chip-source { display: flex; gap: 10px; }

.chip-source .chip { flex: 1; height: 52px; }

.well {
  flex: 1;
  min-height: 120px;
  border-radius: 24px;
  border: 1.5px dashed rgba(191, 255, 55, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 12px;
}

.well img { width: 72px; height: 72px; object-fit: contain; }

.well p { margin: 0; font-weight: 600; }

.well.is-in { border-style: solid; border-color: var(--lime); background: rgba(191, 255, 55, 0.08); }

.shell {
  background:
    linear-gradient(180deg, rgba(25, 28, 31, 0.78), rgba(25, 28, 31, 0.94) 30%, rgba(25, 28, 31, 0.96)),
    url("bg-night.jpg") center top / cover no-repeat;
}

.top {
  padding: calc(12px + env(safe-area-inset-top)) 16px 8px;
}

.brand-lock {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-lock img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
}

.brand {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--soft);
}

.top h1 {
  margin: 4px 0 0;
  font-size: 34px;
  line-height: 0.95;
  letter-spacing: -0.05em;
  font-weight: 600;
}

.kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--soft);
}

.banner {
  margin: 0 16px 8px;
  background: var(--cobalt);
  color: var(--white);
  border-radius: 18px;
  padding: 12px 12px 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.banner p { margin: 0; font-weight: 600; }

.banner button {
  background: var(--white);
  color: var(--ink);
  border: 0;
  border-radius: 999px;
  height: 36px;
  padding: 0 14px;
  font-weight: 600;
}

.view {
  display: none;
  min-height: 0;
  flex: 1;
}

.view.is-on { display: block; }

#view-map.is-on, #view-trace.is-on {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#view-map.is-on { padding: 0 16px 12px; gap: 12px; }

#view-trace.is-on { padding: 0 16px 8px; gap: 8px; }

#view-log.is-on {
  overflow: auto;
  padding: 4px 16px calc(var(--bezel) + 28px);
  scrollbar-width: none;
}

#view-log.is-on::-webkit-scrollbar { display: none; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: var(--white);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 14px;
}

.chip.is-on {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--ink);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-style: normal;
}

.tag.fare { background: var(--lime); color: var(--ink); }

.tag.show { background: var(--cobalt); color: var(--white); }

.map-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 240px;
  border-radius: 28px;
  overflow: hidden;
  background: #121416;
}

.map-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.78) saturate(0.9);
}

.map-coast {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-coast path { fill: rgba(25, 28, 31, 0.55); }

.map-stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30%;
  background: linear-gradient(180deg, transparent, rgba(25, 28, 31, 0.88));
  pointer-events: none;
  z-index: 2;
}

#pins { position: absolute; inset: 0; z-index: 1; }

.pin {
  position: absolute;
  width: 78px;
  transform: translate(-50%, -86%);
  background: none;
  border: 0;
  color: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  font-size: 11px;
  font-weight: 600;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9);
}

.pin img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.45));
}

.pin.is-dim { opacity: 0.18; pointer-events: none; }

.pin.is-open img { filter: drop-shadow(0 0 12px rgba(191, 255, 55, 0.9)); }

.trace-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.trace-head img { width: 48px; height: 48px; object-fit: contain; }

.trace-head p { margin: 0; }

#trace-msg {
  margin-top: 2px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pace {
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.pace span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--lime);
  transform-origin: left center;
  transform: scaleX(1);
}

#trace-canvas, #scene-trial, #scene-shore {
  border-radius: 28px;
  touch-action: none;
}

#trace-canvas {
  flex: 1 1 auto;
  width: 100%;
  min-height: 220px;
  display: block;
  background: #10141c;
}

#trace-canvas.is-warn, #scene-trial.is-warn, #scene-shore.is-warn {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75);
}

.panel {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 16px;
  margin-bottom: 12px;
}

.panel h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.soft {
  color: var(--soft);
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.35;
}

.streak-num {
  margin: 2px 0 0;
  font-size: 64px;
  line-height: 0.85;
  letter-spacing: -0.06em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.days {
  display: flex;
  gap: 4px;
  margin: 14px 0 8px;
}

.day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.day b {
  width: 12px;
  height: 12px;
  border-radius: 99px;
  border: 2px solid var(--mute);
  display: block;
}

.day.is-trace b { background: var(--lime); border-color: var(--lime); }

.day.is-skip b { background: var(--cobalt); border-color: var(--cobalt); }

.day span {
  font-size: 11px;
  font-weight: 600;
  color: var(--soft);
}

.day.is-today span { color: var(--white); }

.cap-read {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 12px;
}

.bar span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--lime);
  transform-origin: left center;
  transform: scaleX(0);
}

.bar.is-over span { background: var(--cobalt); }

.stepper { display: flex; gap: 8px; margin-top: 12px; }

.stepper button {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: var(--white);
  font-size: 22px;
}

.switch {
  width: 52px;
  height: 32px;
  border-radius: 999px;
  border: 0;
  background: var(--mute);
  position: relative;
  padding: 0;
  flex: none;
}

.switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--white);
  transition: transform 0.2s ease;
}

.switch.is-on { background: var(--cobalt); }

.switch.is-on i { transform: translateX(20px); background: var(--lime); }

.time-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  font-weight: 600;
}

input[type="time"] {
  background: transparent;
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 8px 12px;
}

.mini { width: 56px; height: 56px; object-fit: contain; }

.spark { width: 100%; height: 72px; display: block; }

.count {
  font-weight: 600;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
}

#log-chips { margin: 12px 0 4px; }

.log-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.log-row img { width: 44px; height: 44px; object-fit: contain; }

.log-row strong {
  display: block;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.log-row em {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-style: normal;
  color: var(--soft);
  font-size: 13px;
}

.log-amt {
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.empty { color: var(--soft); margin: 12px 0 4px; }

.pill {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 999px;
  background: var(--lime);
  color: var(--ink);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.pill.slim {
  width: auto;
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
  flex: none;
}

.pill.ghost {
  background: transparent;
  color: var(--white);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.2);
}

.pill:disabled { opacity: 0.4; }

.pill.is-ready { box-shadow: 0 0 0 6px rgba(191, 255, 55, 0.22); }

.bezel {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: var(--bezel);
  height: var(--bezel);
  transform: translateX(-50%);
  touch-action: none;
  cursor: grab;
}

.bezel:active { cursor: grabbing; }

.bezel-rotor {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(25, 28, 31, 0.2) 0 42%, rgba(255, 255, 255, 0.03) 43% 68%, transparent 69%);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.1), 0 18px 40px rgba(0, 0, 0, 0.35);
}

.notch, .pip {
  position: absolute;
  left: 50%;
  top: 0;
  width: 14px;
  height: 50%;
  margin-left: -7px;
  transform-origin: center bottom;
  transform: rotate(var(--a, 0deg));
  pointer-events: none;
}

.notch::before {
  content: "";
  display: block;
  width: 2px;
  height: 8px;
  margin: 10px auto 0;
  border-radius: 2px;
  background: var(--mute);
}

.notch.is-major::before {
  width: 3px;
  height: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.pip::before {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  margin: 7px auto 0;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 14px rgba(191, 255, 55, 0.9);
  transition: transform 0.12s ease;
}

.pip.is-hot::before { transform: scale(1.45); }

.bezel-hub {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 34%;
  height: 34%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.bezel-hub img { width: 70%; height: 70%; object-fit: contain; }

.bezel-hit {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 22%;
  width: 76px;
  height: 28%;
  margin-left: -38px;
  transform-origin: center bottom;
  transform: rotate(var(--a));
  background: none;
  border: 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.bezel-hit span {
  display: inline-block;
  transform: rotate(calc(var(--a) * -1));
}

.bezel-hit.is-on { color: var(--lime); }

.sheet {
  position: absolute;
  z-index: 7;
  left: 16px;
  right: 16px;
  bottom: calc(var(--bezel) + 18px);
  background: #23282d;
  border-radius: 28px;
  padding: 16px 16px 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.sheet-top { display: flex; gap: 12px; align-items: center; }

.sheet-top img { width: 52px; height: 52px; object-fit: contain; }

.sheet-top h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.04em;
  font-weight: 600;
}

.sheet-amt {
  margin: 8px 0;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.055em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sheet-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.sheet-close {
  display: block;
  margin: 8px auto 0;
  background: none;
  border: 0;
  color: var(--soft);
  font-weight: 600;
  padding: 8px 12px;
}

.toast {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: calc(76px + env(safe-area-inset-top));
  transform: translateX(-50%) translateY(-8px);
  background: var(--lime);
  color: var(--ink);
  font-weight: 600;
  border-radius: 999px;
  padding: 10px 16px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  white-space: nowrap;
  max-width: calc(100% - 32px);
}

.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-height: 740px) {
  :root { --bezel: 176px; }
  .streak-num { font-size: 52px; }
  .top h1 { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .splash-svg path { animation: none; stroke-dashoffset: 0; }
  .splash-dot, .splash-pin, .splash-name { animation: none; opacity: 1; }
  .view.is-on { animation: none; }
  .pip::before, .switch i, .toast { transition: none; }
}
