@property --ambient-h { syntax: "<number>"; inherits: true; initial-value: 220; }
@property --ambient-s { syntax: "<percentage>"; inherits: true; initial-value: 12%; }
@property --ambient-l { syntax: "<percentage>"; inherits: true; initial-value: 11%; }

:root {
  --ambient-h: 220;
  --ambient-s: 12%;
  --ambient-l: 11%;
  --ink: #ece9e2;
  --ink-soft: #b8b3a9;
  --ink-faint: #8f8b82;
  --line: rgba(255, 255, 255, 0.1);
  --glass: rgba(8, 9, 11, 0.5);
  --accent: #f1eee7;
  color-scheme: dark;
  transition: --ambient-h 1.2s ease, --ambient-s 1.2s ease, --ambient-l 1.2s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: #0a0b0d;
  color: var(--ink);
  font: 400 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--ink);
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.75);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 65% at 50% -8%, hsl(var(--ambient-h) var(--ambient-s) var(--ambient-l)) 0%, rgba(10, 11, 13, 0) 70%),
    #0a0b0d;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 0 max(1rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.75rem;
  padding-top: env(safe-area-inset-top);
}

.brand {
  text-decoration: none;
  border-radius: 8px;
}

.wordmark {
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
}

.eye {
  display: inline-block;
  width: 0.84em;
  height: 0.54em;
  margin: 0 0.04em;
  overflow: visible;
  vertical-align: baseline;
  color: var(--ink);
}

.header-actions {
  display: flex;
  gap: 0.25rem;
  margin-right: -0.6rem;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--ink);
}

.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.play {
  margin-top: 0.5rem;
}

.frame-wrap {
  display: grid;
  justify-items: center;
}

.frame {
  position: relative;
  overflow: hidden;
  width: min(100%, calc(70vh * var(--ratio, 1.5)));
  width: min(100%, calc(70svh * var(--ratio, 1.5)));
  aspect-ratio: var(--ratio, 1.5);
  border-radius: 10px;
  background: #060607;
}

.photo {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  opacity: 0;
  transition: opacity 0.5s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.photo.is-loaded {
  opacity: 1;
}

.panel-stack {
  display: grid;
  margin-top: 1rem;
}

.panel-stack > * {
  grid-area: 1 / 1;
}

.glass {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  backdrop-filter: blur(12px) saturate(1.1);
}

.guess-layer,
.result-layer {
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
}

.result-layer {
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
}

.play.is-finished .result-layer {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.play.is-finished .guess-layer {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
}

.counter {
  margin: 0 0 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.guess-form {
  display: flex;
  gap: 0.5rem;
}

.guess-form input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.guess-form input::placeholder {
  color: var(--ink-faint);
}

.guess-form input:focus {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 1px;
}

.btn-primary,
.btn-ghost {
  height: 48px;
  padding: 0 1.1rem;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  border: 0;
  background: var(--accent);
  color: #111;
}

.btn-ghost {
  height: 48px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

button:disabled,
input:disabled {
  opacity: 0.45;
  cursor: default;
}

.feedback {
  min-height: 1.5em;
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.result-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  outline: none;
}

.result-answer,
.result-detail {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.result-actions .btn-primary {
  height: 44px;
}

.muted {
  color: var(--ink-soft);
}

.small {
  font-size: 0.85rem;
}

.section {
  margin-top: 2.5rem;
}

.section p {
  margin: 0 0 0.6rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.credit p {
  font-size: 0.9rem;
}

.site-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
}

.site-footer p {
  margin: 0 0 0.5rem;
  color: var(--ink-faint);
}

.footer-links a {
  margin-right: 1.25rem;
}

dialog {
  width: min(100% - 2rem, 560px);
  max-height: 85vh;
  max-height: 85svh;
  margin: auto;
  padding: 1.25rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #101114;
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.tab {
  height: 36px;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.tab[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #111;
}

.scores {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.score-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: 0.5rem;
  padding: 0.6rem 0.5rem;
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.score-row.is-you {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.score-row .value {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.name-form {
  display: grid;
  gap: 0.5rem;
  margin-top: 1.1rem;
}

.name-form label {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.archive-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.archive-item {
  display: grid;
  gap: 0.4rem;
  width: 100%;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.archive-item img {
  width: 100%;
  border-radius: 8px;
  background: #060607;
}

.archive-meta {
  font-size: 0.85rem;
}

.archive-status {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.past-photo {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #060607;
}

@media (min-width: 900px) {
  .shell {
    width: min(100%, 920px);
  }

  .frame {
    width: min(100%, calc(76vh * var(--ratio, 1.5)));
  }

  .wordmark {
    font-size: 1.45rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    transition: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}
