/* Ring Light — styles */

/* Registering --ring-color lets the light's gradient interpolate smoothly
   when intensity/color jump (e.g. presets, taps). Unsupported browsers
   simply apply changes instantly. */
@property --ring-color {
  syntax: "<color>";
  inherits: false;
  initial-value: #000000;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  width: 100%;
  background: #000000;
  overflow: hidden;
  overscroll-behavior: none;            /* kill pull-to-refresh / rubber-banding */
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  color: #f2f2f2;
  -webkit-user-select: none;
  user-select: none;
}

/* ---- The light surface ---------------------------------------------------
   A ring is an annulus drawn with a radial-gradient: transparent hole,
   a band of --ring-color, transparent outside. The body background shows
   through the hole and around the ring. Geometry is in vmin units so the
   ring stays a true circle in any orientation without JS on resize. */
.light {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0;
  touch-action: none;          /* drags drive our gesture handler, not browser scroll/zoom */

  --max-r: 50vmin;                                              /* edge-touching radius */
  --outer: calc(var(--radius) / 100 * var(--max-r));
  --band:  calc(var(--thick)  / 100 * var(--max-r));
  --inner: max(0px, calc(var(--outer) - var(--band)));
  --feather: calc(var(--soft) / 100 * var(--band) / 2);         /* <= band/2, keeps stops ordered */

  background: radial-gradient(circle at 50% 50%,
    #00000000 0,
    #00000000 var(--inner),
    var(--ring-color) calc(var(--inner) + var(--feather)),
    var(--ring-color) calc(var(--outer) - var(--feather)),
    #00000000 var(--outer));

  transition: opacity .3s ease, --ring-color .14s linear;
}
.light.ready { opacity: 1; }
.light.flood { background: var(--ring-color); }

/* ---- Drag HUD ------------------------------------------------------------ */
.hud {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  padding: 14px 22px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none;
}
.hud.show { opacity: 1; }

/* ---- Controls panel ------------------------------------------------------ */
.controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  margin: 0 auto;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 20px calc(18px + env(safe-area-inset-bottom));
  max-height: 72vh;
  overflow-y: auto;
  background: rgba(18, 18, 20, .82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  transition: opacity .25s ease, transform .25s ease;
}
.controls.hidden {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

.grip {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .25);
  margin: 4px auto 2px;
}

.row { display: flex; flex-direction: column; gap: 8px; }
.row-inline,
.row.footer { flex-direction: row; align-items: center; justify-content: space-between; }

label, .row-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .72);
  display: flex;
  justify-content: space-between;
}

output {
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  text-transform: none;
  letter-spacing: 0;
}

input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: #f4f4f4;
  height: 26px;
  cursor: pointer;
}

input[type="color"] {
  width: 52px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 8px;
  background: none;
  cursor: pointer;
}

/* Segmented toggles */
.seg {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: rgba(255, 255, 255, .07);
  border-radius: 10px;
}
.seg-btn {
  flex: 1;
  appearance: none;
  border: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, .6);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.seg-btn[aria-pressed="true"] {
  background: #f4f4f4;
  color: #111;
}

.text-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .06);
  color: #f2f2f2;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
}
.text-btn:active { background: rgba(255, 255, 255, .14); }

.hidden { display: none !important; }

/* ---- First-run hint ------------------------------------------------------ */
.hint {
  position: fixed;
  inset: 0;
  z-index: 10;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
/* Only flex when shown — otherwise an author `display` would override the
   `hidden` attribute's built-in `display: none` and the modal would never close. */
.hint:not([hidden]) {
  display: flex;
}
.hint-card {
  max-width: 360px;
  background: #1c1c1f;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 18px;
  padding: 24px;
}
.hint-card h1 { margin: 0 0 12px; font-size: 22px; }
.hint-card ul { margin: 0 0 8px; padding-left: 20px; }
.hint-card li { margin: 8px 0; font-size: 15px; line-height: 1.45; color: rgba(255, 255, 255, .85); }
.hint-ios {
  font-size: 14px;
  line-height: 1.45;
  color: rgba(255, 255, 255, .7);
  background: rgba(255, 255, 255, .06);
  padding: 10px 12px;
  border-radius: 10px;
}
.primary-btn {
  width: 100%;
  margin-top: 16px;
  appearance: none;
  border: 0;
  padding: 13px;
  border-radius: 12px;
  background: #f4f4f4;
  color: #111;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .light, .controls, .hud { transition: none; }
}
