:root {
  color-scheme: dark;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  background: #101210;
  color: #f5f4ed;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }

html,
body,
.camera {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
}

body { background: #101210; }

.camera {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  isolation: isolate;
  touch-action: manipulation;
  user-select: none;
}

#preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #101210;
}

.answer-wrap {
  position: absolute;
  z-index: 2;
  top: max(18px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  display: grid;
  justify-items: center;
  gap: 7px;
  pointer-events: none;
}

.answer-wrap[hidden],
.answer-hint[hidden],
.spinner[hidden],
.camera-message[hidden],
.token-gate[hidden] { display: none; }

.answer-pill {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 22px;
  background: rgb(12 14 12 / 78%);
  color: #fffef8;
  box-shadow: 0 8px 26px rgb(0 0 0 / 22%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.answer-letter {
  font-size: 48px;
  font-weight: 750;
  line-height: 1;
}

.answer-hint {
  max-width: min(250px, calc(100vw - 32px));
  padding: 6px 10px;
  border-radius: 7px;
  background: rgb(12 14 12 / 82%);
  color: #f5f4ed;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.spinner {
  width: 25px;
  height: 25px;
  border: 2px solid rgb(255 255 255 / 35%);
  border-top-color: #fffef8;
  border-radius: 50%;
  animation: spin 650ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.camera-message {
  position: absolute;
  z-index: 1;
  inset: auto 28px max(34px, env(safe-area-inset-bottom));
  margin: 0 auto;
  max-width: 430px;
  color: #f5f4ed;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  text-shadow: 0 1px 10px #000;
}

.token-gate {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 35%, #29312d 0, #181d1a 42%, #101210 78%);
  user-select: text;
}

.gate-content {
  display: grid;
  width: min(100%, 340px);
  gap: 12px;
}

.gate-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgb(202 223 171 / 40%);
  border-radius: 14px;
  color: #cce5a9;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.gate-content h1 {
  margin: 14px 0 0;
  font-size: 29px;
  font-weight: 650;
  letter-spacing: 0;
}

.gate-content p {
  margin: 0 0 10px;
  color: #aeb8b0;
  font-size: 14px;
}

.gate-content label {
  color: #d7ddd7;
  font-size: 12px;
  font-weight: 600;
}

.gate-content input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid #48534b;
  border-radius: 8px;
  outline: none;
  background: #171b18;
  color: #fffef8;
  font: inherit;
}

.gate-content input:focus { border-color: #c5dc9d; }

.gate-content button {
  min-height: 48px;
  margin-top: 4px;
  border: 0;
  border-radius: 8px;
  background: #c5dc9d;
  color: #192016;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 1.5s; }
}

@media (orientation: landscape) {
  .camera {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    min-height: 0;
  }

  .answer-wrap {
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    display: grid;
    width: 50%;
    height: 100%;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 16px;
    border: 1px solid rgb(255 255 255 / 15%);
    border-radius: 22px;
    background: rgb(12 14 12 / 55%);
    box-shadow: 0 8px 26px rgb(0 0 0 / 22%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .answer-pill {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .answer-letter { font-size: 160px; }

  .answer-hint {
    width: 100%;
    max-width: none;
    padding: 8px 10px;
    background: rgb(255 255 255 / 10%);
  }
}