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

:root {
  --bg: #F5F3EB;
  --card: #656E50;
  --card-border: rgba(255, 255, 255, 0.13);
  --accent: #EEEADE;
  --accent-fg: #3a4528;
  --white: #F5F3EB;
  --muted: rgba(245, 243, 235, 0.55);
}

body {
  min-height: 100dvh;
  font-family: 'Inter', sans-serif;
  color: var(--white);
  overflow-x: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: -1;
}

/* ── Screens ── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: max(24px, env(safe-area-inset-top))
           max(24px, env(safe-area-inset-right))
           max(24px, env(safe-area-inset-bottom))
           max(24px, env(safe-area-inset-left));
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

/* ── Card ── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.10);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

/* ── Type ── */
.title {
  font-family: 'Sora', sans-serif;
  font-size: clamp(72px, 20vw, 100px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -4px;
}

.heading {
  font-family: 'Sora', sans-serif;
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 700;
}

.tagline {
  font-size: 15px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.sub {
  font-size: 14px;
  color: var(--muted);
}

.hint {
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 14px;
  padding: 16px 32px;
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  min-height: 52px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.btn-primary:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 28px rgba(245, 243, 235, 0.22);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-ghost {
  background: var(--bg);
  color: var(--accent-fg);
  border: 1px solid var(--bg);
  border-radius: 14px;
  padding: 12px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  min-height: 48px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color 140ms ease, border-color 140ms ease;
}

.btn-ghost:hover {
  opacity: 0.88;
}

.btn-ghost:active {
  opacity: 0.76;
}

/* ── Textarea ── */
textarea {
  width: 100%;
  background: rgba(245, 243, 235, 0.08);
  border: 1px solid rgba(245, 243, 235, 0.22);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--white);
  font-family: 'Inter', sans-serif;
  font-size: 16px; /* 16px prevents iOS auto-zoom on focus */
  resize: none;
  min-height: 96px;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

textarea::placeholder {
  color: rgba(245, 243, 235, 0.30);
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(238, 234, 222, 0.14);
}

/* ── Link box ── */
.link-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(245, 243, 235, 0.08);
  border: 1px solid rgba(245, 243, 235, 0.20);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
}

.link-box span {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.btn-copy {
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  min-height: 36px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 140ms ease;
}

.btn-copy:hover {
  transform: scale(1.05);
}

.btn-copy:active {
  transform: scale(0.96);
}

/* ── Pulse dot ── */
.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

/* ── Number grid ── */
.number-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  width: 100%;
}

.num-btn {
  aspect-ratio: 1;
  background: rgba(245, 243, 235, 0.08);
  border: 1px solid rgba(245, 243, 235, 0.18);
  border-radius: 12px;
  color: var(--white);
  font-family: 'Sora', sans-serif;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 140ms ease, transform 140ms ease, border-color 140ms ease;
}

.num-btn:hover:not(:disabled) {
  background: rgba(245, 243, 235, 0.16);
  transform: scale(1.06);
}

.num-btn:active:not(:disabled) {
  transform: scale(0.94);
  background: rgba(245, 243, 235, 0.22);
}

.num-btn.selected {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.num-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

/* ── Dare box ── */
.dare-box {
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  background: rgba(245, 243, 235, 0.10);
  border: 1px solid rgba(245, 243, 235, 0.24);
  border-radius: 14px;
  padding: 18px 22px;
  width: 100%;
  word-break: break-word;
}

.dare-box:empty {
  display: none;
}

/* ── Result ── */
.numbers-reveal {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.player-number {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.player-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.big-number {
  font-family: 'Sora', sans-serif;
  font-size: clamp(64px, 18vw, 88px);
  font-weight: 800;
  line-height: 1;
}

.colon {
  font-family: 'Sora', sans-serif;
  font-size: 40px;
  font-weight: 800;
  color: var(--muted);
  padding-bottom: 8px;
}

.result-message {
  font-family: 'Sora', sans-serif;
  font-size: clamp(18px, 5vw, 22px);
  font-weight: 700;
}

.result-message.match {
  color: #ffffff;
}

.result-message.no-match {
  color: var(--muted);
}

/* ── Tablet (481px – 768px) ── */
@media (min-width: 481px) and (max-width: 768px) {
  .card {
    max-width: 480px;
    padding: 44px 36px;
  }

  .number-grid {
    gap: 12px;
  }
}

/* ── Mobile (≤ 480px) ── */
@media (max-width: 480px) {
  .card {
    padding: 32px 20px;
    border-radius: 20px;
    gap: 16px;
  }

  .title {
    letter-spacing: -2px;
  }

  .dare-box {
    font-size: 16px;
    padding: 14px 16px;
  }

  .number-grid {
    gap: 8px;
  }

  .num-btn {
    font-size: 18px;
    border-radius: 10px;
  }

  .colon {
    font-size: 32px;
  }

  .btn-primary {
    padding: 14px 24px;
  }
}

/* ── Not found ── */
.notfound-emoji {
  font-size: 48px;
  line-height: 1;
}

/* ── Very small screens (≤ 360px) ── */
@media (max-width: 360px) {
  .card {
    padding: 24px 16px;
    gap: 14px;
  }

  .number-grid {
    gap: 6px;
  }

  .num-btn {
    font-size: 16px;
    border-radius: 8px;
  }
}
