:root {
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --ink: rgba(255, 255, 255, 0.94);
  --ink-soft: rgba(255, 255, 255, 0.62);
  /* Always dark glass: the mirror under the UI is often near-white, whatever the
     system appearance, so light glass would leave white text unreadable. */
  --glass: rgba(16, 18, 22, 0.52);
  --glass-edge: rgba(255, 255, 255, 0.2);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--ink);
  font-family: var(--font); overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }

#glass {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100lvh;
  display: block; touch-action: none; background: #000;
}

/* ---------- splash ---------- */
.splash {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center;
  padding: calc(var(--safe-t) + 24px) 28px calc(var(--safe-b) + 24px);
  background:
    radial-gradient(120% 70% at 50% 18%, rgba(160, 172, 190, 0.20), transparent 60%),
    radial-gradient(90% 60% at 50% 110%, rgba(90, 104, 122, 0.30), transparent 70%),
    #06070a;
  transition: opacity 0.9s ease, visibility 0.9s;
}
.splash.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-inner { max-width: 26rem; text-align: center; }
.wordmark {
  margin: 0 0 0.35em; font-size: clamp(3.4rem, 17vw, 5.4rem); font-weight: 200;
  letter-spacing: 0.08em; line-height: 1;
  background: linear-gradient(100deg, #6d7580 0%, #f4f6f9 22%, #8c949f 38%, #ffffff 52%,
              #7b838d 66%, #e9edf2 84%, #6d7580 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 7s ease-in-out infinite alternate;
}
@keyframes sheen { from { background-position: 0% 0; } to { background-position: 100% 0; } }
.lede { margin: 0 auto 2.2em; font-size: 1.06rem; line-height: 1.5; color: var(--ink-soft); max-width: 20rem; }
.enter {
  appearance: none; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 999px;
  padding: 0.95em 2.1em; font-size: 1.05rem; font-weight: 500; letter-spacing: 0.02em;
  color: #0b0c0e; cursor: pointer;
  background: linear-gradient(180deg, #ffffff, #cfd5dc 55%, #eef1f4);
  box-shadow: 0 10px 40px rgba(170, 190, 215, 0.25), inset 0 1px 0 #fff;
}
.enter:active { transform: scale(0.97); }
.fine { margin: 1.6em auto 0; font-size: 0.8rem; color: rgba(255, 255, 255, 0.42); max-width: 18rem; line-height: 1.45; }
.fine.tip { margin-top: 0.6em; }

/* ---------- coach marks ---------- */
.coach {
  position: fixed; z-index: 20; left: 50%; top: calc(var(--safe-t) + 18%);
  transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px;
  align-items: center; pointer-events: none; animation: coach 5.2s ease forwards;
}
.coach span {
  padding: 8px 16px; border-radius: 999px; font-size: 0.9rem; white-space: nowrap;
  background: var(--glass); border: 0.5px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
@keyframes coach { 0% { opacity: 0; } 10%, 82% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- dock ---------- */
.dock {
  position: fixed; z-index: 10; left: calc(var(--safe-l) + 10px); right: calc(var(--safe-r) + 10px);
  bottom: calc(var(--safe-b) + 10px); padding: 8px; border-radius: 28px;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--glass); border: 0.5px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(22px) saturate(1.7); backdrop-filter: blur(22px) saturate(1.7);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dock.hidden { opacity: 0; transform: translateY(24px); pointer-events: none; }
.row { display: flex; gap: 6px; align-items: center; }
.finishes { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.finishes::-webkit-scrollbar { display: none; }
.tools { justify-content: space-between; }

.chip {
  appearance: none; flex: none; display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px 8px 9px; border-radius: 999px; border: 0.5px solid transparent;
  background: rgba(255, 255, 255, 0.08); font-size: 0.86rem; font-weight: 500;
  color: var(--ink); cursor: pointer; scroll-snap-align: center; position: relative;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.chip.ghost { padding: 8px 13px; background: rgba(255, 255, 255, 0.07); color: rgba(255, 255, 255, 0.8); }
.chip[aria-checked="true"] { background: rgba(255, 255, 255, 0.9); color: #111; text-shadow: none; }
.chip .dot {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.35), 0 0 0 0.5px rgba(255, 255, 255, 0.4);
}
/* The switch inside each chip exists only so a real tap triggers Safari's haptic tick. */
.chip input[switch], .haptic input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

.slider { display: inline-flex; align-items: center; gap: 8px; flex: 1; font-size: 0.8rem; color: rgba(255, 255, 255, 0.8); padding: 0 6px; }
.slider[hidden] { display: none; }
.slider input { flex: 1; min-width: 0; width: 100%; accent-color: #f3f5f8; }
.slider span { flex: none; }

/* ---------- toast / fallback ---------- */
.toast {
  position: fixed; z-index: 25; left: 50%; top: calc(var(--safe-t) + 14px);
  transform: translate(-50%, -8px); opacity: 0; pointer-events: none;
  padding: 8px 16px; border-radius: 999px; font-size: 0.86rem; white-space: nowrap;
  background: var(--glass); border: 0.5px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.nogl { position: fixed; inset: 0; display: grid; place-items: center; padding: 2rem; text-align: center; color: var(--ink-soft); z-index: 40; background: #07080a; }
.nogl p { max-width: 22rem; margin: 0; line-height: 1.5; }
.nogl small { display: block; margin-top: 1em; font: 11px ui-monospace, Menlo, monospace; opacity: 0.6; white-space: pre-wrap; text-align: left; }
.nogl[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .wordmark { animation: none; }
  .coach { animation-duration: 7s; }
}
