:root {
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --panel: rgba(12, 14, 20, 0.58);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.55);
  --accent: #f2b166;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0a0d14; color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.hud {
  position: fixed; z-index: 5;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 14px;
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.28);
}
.eyebrow { margin: 0; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.hud-title { top: 22px; left: 22px; padding: 16px 20px 15px; max-width: 360px; }
.hud-title h1 { margin: 4px 0 6px; font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.hud-title .meta { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.hud-title .meta b { color: var(--text); font-weight: 500; }

.hud-help { top: 22px; right: 22px; margin: 0; padding: 10px 14px; display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); }
.hud-help b { color: var(--text); font-weight: 500; margin-left: 4px; }

.hud-time {
  left: 50%; bottom: 26px; transform: translateX(-50%);
  display: grid; grid-template-columns: auto auto minmax(260px, 440px) auto; align-items: center; gap: 18px;
  padding: 14px 18px; width: min(760px, calc(100vw - 32px));
}
.play, .reset {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08); color: var(--text); display: grid; place-items: center; cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.play:hover, .reset:hover { background: rgba(255, 255, 255, 0.16); }
.play:active, .reset:active { transform: scale(0.95); }
.play .icon-pause { display: none; }
.play.is-playing .icon-play { display: none; }
.play.is-playing .icon-pause { display: block; }
.reset { width: 36px; height: 36px; color: var(--muted); }
.clock { display: flex; flex-direction: column; min-width: 96px; }
.clock output { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.clock span { margin-top: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }

.slider { display: flex; flex-direction: column; gap: 6px; }
.slider input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 8px; margin: 0; border-radius: 4px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, #0a1020 0%, #0e1a3a 18%, #6a4a70 23%, #f0a060 26.5%, #cfe0f0 34%, #d8e6f2 64%, #f4a860 73%, #6a3a50 77%, #101a3a 82%, #0a1020 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.35); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
.slider input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid rgba(0, 0, 0, 0.35); }
.ticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; padding: 0 2px; }

#labels { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.label {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); will-change: transform, opacity;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), 0 0 12px rgba(0, 0, 0, 0.5); white-space: nowrap; padding-bottom: 22px;
}
.label::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 1px; height: 18px; background: rgba(255, 255, 255, 0.55); }
.label::before { content: ""; position: absolute; left: 50%; bottom: -2px; width: 5px; height: 5px; margin-left: -2px; border-radius: 50%; background: #fff; }
.label.is-water { text-transform: none; letter-spacing: 0.04em; font-style: italic; font-size: 13px; color: rgba(220, 235, 245, 0.75); padding-bottom: 0; }
.label.is-water::before, .label.is-water::after { display: none; }

.tooltip {
  position: fixed; z-index: 6; pointer-events: none; padding: 9px 12px; border-radius: 10px; max-width: 280px;
  background: var(--panel); border: 1px solid var(--panel-border); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-size: 12.5px; line-height: 1.45; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.tooltip b { display: block; font-weight: 600; font-size: 13px; }
.tooltip span { color: var(--muted); }

.loading { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: #0a0d14; transition: opacity 0.6s; }
.loading.is-hidden { opacity: 0; pointer-events: none; }
.loading-inner { width: min(360px, 80vw); text-align: center; }
.loading .bar { height: 2px; background: rgba(255, 255, 255, 0.1); margin: 18px 0 14px; border-radius: 1px; overflow: hidden; }
.loading .bar i { display: block; height: 100%; width: 0%; background: var(--accent); transition: width 0.2s; }
.loading p:last-child { margin: 0; font-size: 13px; color: var(--muted); }
.loading.is-error p:last-child { color: #ff8a7a; }

@media (max-width: 760px) {
  .hud-help { display: none; }
  .hud-title { top: 14px; left: 14px; padding: 12px 14px; }
  .hud-title h1 { font-size: 24px; }
  .hud-time { grid-template-columns: auto auto 1fr; bottom: 14px; padding: 12px; gap: 12px; }
  .reset { display: none; }
  .clock output { font-size: 22px; }
}
