:root {
  --bg: #0c0a09;
  --ink: #faf7f2;
  --muted: rgba(250, 247, 242, 0.62);
  --accent: #ff5a36;
  --accent-ink: #1a0904;
  font-family: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body,
#app {
  height: 100%;
  max-width: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: pan-y;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.hidden {
  display: none;
}

[hidden] {
  display: none !important;
}

.screen--welcome {
  background:
    radial-gradient(120% 80% at 100% 0%, #3a1a12 0%, transparent 46%),
    radial-gradient(90% 60% at 0% 100%, #1c2a3a 0%, transparent 50%),
    var(--bg);
}

.welcome-mark {
  position: absolute;
  top: 12%;
  left: 8%;
  width: min(42vw, 220px);
  aspect-ratio: 1;
  border-radius: 38% 62% 70% 30% / 40% 30% 70% 60%;
  background: conic-gradient(from 200deg, #ff5a36, #f4c430, #3ecfb2, #6f7dff, #ff5a36);
  filter: blur(0.4px);
  opacity: 0.92;
}

.eyebrow {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.8rem;
}

h1,
h2 {
  font-size: clamp(2.4rem, 8vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  max-width: 11ch;
  font-weight: 700;
}

.lede {
  margin: 1.1rem 0 2.2rem;
  max-width: 28ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

button {
  appearance: none;
  border: 0;
  cursor: pointer;
  align-self: flex-start;
  background: var(--ink);
  color: var(--bg);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.95rem 1.5rem;
  border-radius: 999px;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(250, 247, 242, 0.28);
  padding: 0.7rem 1.15rem;
}

.account-bar {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  right: clamp(1.5rem, 5vw, 3.5rem);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.55rem;
  z-index: 2;
}

.account-bar span {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.account-bar .btn-ghost {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
}

.account-facts {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 22rem;
  margin: 1.6rem 0 1.2rem;
}

.account-facts div {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.account-facts dt {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.account-facts dd {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.screen--account .btn-ghost + .btn-ghost,
.screen--auth .btn-ghost + .btn-ghost {
  margin-top: 0.65rem;
}

.screen--account .form-error,
.screen--account .form-success {
  margin: 0.75rem 0 0.35rem;
  max-width: 22rem;
}

.screen--auth,
.screen--account {
  background:
    radial-gradient(120% 80% at 100% 0%, #3a1a12 0%, transparent 46%),
    radial-gradient(90% 60% at 0% 100%, #1c2a3a 0%, transparent 50%),
    var(--bg);
  overflow: auto;
  touch-action: pan-y;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-width: 22rem;
  margin-top: 1.6rem;
  margin-bottom: 1rem;
  touch-action: manipulation;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-form input {
  appearance: none;
  border: 0;
  border-radius: 14px;
  background: rgba(250, 247, 242, 0.08);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 0;
  text-transform: none;
  padding: 0.85rem 0.95rem;
  outline: 1px solid transparent;
}

.auth-form input:focus {
  outline-color: rgba(255, 90, 54, 0.7);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 3rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  align-self: auto;
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--ink);
  transform: translateY(-50%);
}

.password-toggle::before {
  content: "";
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0 auto;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.password-toggle[aria-pressed="true"]::before {
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3l18 18'/%3E%3Cpath d='M10.6 10.6a2 2 0 0 0 2.8 2.8'/%3E%3Cpath d='M9.9 5.1A11 11 0 0 1 12 5c6.5 0 10 7 10 7a18 18 0 0 1-4.2 4.6'/%3E%3Cpath d='M6.1 6.1C3.9 7.7 2 12 2 12s3.5 7 10 7a10 10 0 0 0 4.4-1'/%3E%3C/svg%3E") center / contain no-repeat;
}

.auth-form input[inputmode="numeric"] {
  letter-spacing: 0.28em;
  font-size: 1.35rem;
  font-weight: 700;
}

.form-error,
.form-success {
  font-size: 0.92rem;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.4;
}

.form-error {
  color: #ff8a72;
}

.form-success {
  color: #7ddeb8;
}

.screen--swipe {
  position: fixed;
  top: var(--vvy, 0px);
  left: var(--vvx, 0px);
  right: auto;
  bottom: auto;
  width: var(--vvw, 100%);
  height: var(--vvh, 100dvh);
  max-width: 100%;
  max-height: 100%;
  box-sizing: border-box;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: #070707;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.play-stage {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 9 / 16;
  width: min(100%, calc(var(--vvh, 100dvh) * 9 / 16));
  height: auto;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  clip-path: inset(0);
  background: #111;
}

.swipe-track {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.color-slide {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: flex-end;
  padding: 1.25rem;
  padding-bottom: 6.5rem;
  overflow: hidden;
}

.tap-spot {
  position: absolute;
  left: clamp(52px, calc(var(--sx, 0.5) * 100%), calc(100% - 52px));
  top: clamp(52px, calc(var(--sy, 0.4) * 100%), calc(100% - 7rem));
  width: 64px;
  height: 64px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.16);
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 6px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  animation: target-pulse 1.4s ease-in-out infinite;
}

.tap-spot::after {
  content: "";
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.tap-spot.is-armed {
  animation: none;
  background: #fff;
  box-shadow:
    0 0 0 3px #111,
    0 0 0 7px #fff;
}

.tap-spot.is-armed::after {
  inset: 18px;
  background: #111;
}

.color-hex {
  pointer-events: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

.swipe-chrome {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  pointer-events: none;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

.swipe-chrome span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swipe-hint {
  animation: pulse 1.8s ease-in-out infinite;
}

.mode-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0 0 1.1rem;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 28rem;
  margin: 1.4rem 0 1.2rem;
  overflow: auto;
}

.history-item {
  padding: 0.95rem 0;
  border-bottom: 1px solid rgba(250, 247, 242, 0.1);
}

.history-item strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.history-meta {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.4;
}

.complete-note {
  margin: 0 0 1.2rem;
}

.screen--complete .btn-ghost {
  margin-bottom: 0.65rem;
}

.screen--complete {
  background:
    radial-gradient(80% 50% at 80% 10%, #234032 0%, transparent 55%),
    var(--bg);
}

.time-label {
  margin-top: 2.4rem;
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.time-value {
  margin: 0.35rem 0 2rem;
  font-size: clamp(3.4rem, 12vw, 6.5rem);
  letter-spacing: -0.06em;
  font-weight: 700;
  line-height: 1;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.45;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

@keyframes target-pulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@media (min-width: 720px) {
  .screen {
    justify-content: center;
  }

  .welcome-mark {
    left: auto;
    right: 12%;
    top: 18%;
  }
}
