:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --glass: rgba(241, 244, 242, 0.78);
  --ink: #f4f5f3;
  --muted: rgba(244, 245, 243, 0.66);
  --panel: rgba(19, 21, 20, 0.86);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #111;
  font-family: "Helvetica Neue", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  overscroll-behavior: none;
  touch-action: none;
}

button, select, input {
  font: inherit;
}

button {
  color: inherit;
}

#app {
  position: fixed;
  inset: 0;
  background: #111;
  isolation: isolate;
}

#camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
}

#glass {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.panel {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(8, 10, 9, 0.28), rgba(8, 10, 9, 0.64)),
    radial-gradient(circle at 28% 18%, rgba(190, 198, 193, 0.19), transparent 48%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.panel[hidden] {
  display: none;
}

.panel--center {
  place-items: end stretch;
  padding:
    calc(28px + var(--safe-top))
    calc(24px + var(--safe-right))
    calc(34px + var(--safe-bottom))
    calc(24px + var(--safe-left));
}

.start-copy,
.error-copy {
  max-width: 520px;
}

.eyebrow {
  margin: 0 0 13px;
  color: rgba(244, 245, 243, 0.58);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

h1, h2, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 20px;
  font-size: clamp(38px, 10.5vw, 66px);
  font-weight: 500;
  line-height: 1.07;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 14px;
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.lead,
.error-copy p {
  margin-bottom: 28px;
  color: rgba(244, 245, 243, 0.72);
  font-size: 14px;
  line-height: 1.8;
}

.primary,
.secondary {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  min-height: 52px;
  padding: 0 22px;
  font-weight: 600;
}

.primary {
  width: 100%;
  color: #171918;
  background: rgba(249, 250, 248, 0.93);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
}

.secondary {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
}

.privacy {
  margin: 15px 2px 0;
  color: rgba(244, 245, 243, 0.44);
  font-size: 10px;
  line-height: 1.55;
}

.hint {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 48px);
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.74);
  background: rgba(15, 17, 16, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 12px;
  letter-spacing: 0.04em;
  opacity: 1;
  transition: opacity 1.2s ease;
  pointer-events: none;
}

.hint.is-fading {
  opacity: 0;
}

.icon-button {
  border: 0;
  background: rgba(15, 17, 16, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.menu-button {
  position: absolute;
  z-index: 10;
  top: calc(14px + var(--safe-top));
  right: calc(14px + var(--safe-right));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  gap: 3px;
}

.menu-button span {
  display: block;
  width: 15px;
  height: 1px;
  background: rgba(255, 255, 255, 0.84);
}

.settings {
  position: absolute;
  z-index: 30;
  left: 10px;
  right: 10px;
  bottom: calc(10px + var(--safe-bottom));
  max-height: min(620px, calc(100vh - 20px - var(--safe-top)));
  overflow: auto;
  padding: 10px 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 26px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(30px) saturate(1.08);
  -webkit-backdrop-filter: blur(30px) saturate(1.08);
  transform: translateY(calc(100% + 30px));
  transition: transform 360ms cubic-bezier(.2,.8,.2,1);
  touch-action: pan-y;
}

.settings.is-open {
  transform: translateY(0);
}

.settings__handle {
  width: 34px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.2);
}

.settings__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.settings__header h2 {
  margin-bottom: 0;
}

.text-button {
  border: 0;
  padding: 4px 0;
  color: rgba(255, 255, 255, 0.58);
  background: transparent;
  font-size: 13px;
}

.control {
  display: grid;
  gap: 11px;
  padding: 17px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
}

.control select {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 14px;
  padding: 0 13px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.08);
}

.control input[type="range"] {
  width: 100%;
  accent-color: rgba(255, 255, 255, 0.88);
}

.settings__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 7px;
}

@media (min-width: 700px) {
  .panel--center {
    place-items: center;
  }

  .start-copy,
  .error-copy {
    width: min(520px, 100%);
  }

  h1 {
    font-size: 64px;
  }

  .settings {
    left: auto;
    right: 18px;
    width: 390px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .settings,
  .hint {
    transition: none;
  }
}
