/* ===== Reset & tokens ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colors chosen to feel warm, romantic, and safe:
     rose/pink = affection, peach = warmth, violet = depth,
     deep plum background = intimacy and calm. */
  --bg: #1a0d1c;
  --bg-2: #24112a;
  --surface: #2b1533;
  --surface-2: #3a1d45;
  --border: #4a2757;
  --text: #fff0f6;
  --muted: #d4b9d8;
  --rose: #ff4d7d;
  --pink: #ff7eb6;
  --peach: #ffb26b;
  --violet: #b06bff;
  --gradient: linear-gradient(135deg, #ff4d7d 0%, #ff7eb6 45%, #b06bff 100%);
  --gradient-soft: linear-gradient(160deg, #ff4d7d22, #b06bff22);
  --radius: 18px;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at 15% 0%, #4a1a3a 0%, transparent 55%),
    radial-gradient(circle at 90% 10%, #2a1150 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 16px
           max(20px, env(safe-area-inset-bottom));
}

#app { width: 100%; max-width: 460px; }
.screen { display: flex; flex-direction: column; gap: 20px; }
.hidden { display: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ===== Hero ===== */
.hero { text-align: center; padding-top: 8px; }

.logo {
  font-size: 3.2rem;
  line-height: 1;
  filter: drop-shadow(0 0 22px rgba(255, 77, 125, 0.55));
  animation: pulse 3s ease-in-out infinite;
}
.logo.small { font-size: 2.4rem; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

h1 {
  font-size: clamp(2.2rem, 9vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 8px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.share-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-top: 6px;
  color: var(--pink);
}

.tagline {
  color: var(--peach);
  font-weight: 600;
  margin-top: 4px;
  letter-spacing: 0.02em;
}

.pitch {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
  margin: 14px auto 0;
  max-width: 40ch;
}

/* ===== How it works ===== */
.how-it-works {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}
.step-num {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gradient);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

/* ===== Buttons ===== */
button { font-family: inherit; cursor: pointer; border: none; }

.btn-primary {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--gradient);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 28px rgba(255, 77, 125, 0.35);
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s;
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled {
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-secondary {
  padding: 16px 22px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  border: 1px solid var(--border);
}
.btn-secondary:active { background: var(--border); }

.btn-copy {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--pink);
  font-weight: 700;
  border: 1px solid var(--rose);
  transition: background 0.2s, transform 0.1s;
}
.btn-copy:active { transform: scale(0.97); }
.btn-copy.copied {
  background: var(--rose);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 10px;
  text-decoration: underline;
}

/* ===== Divider ===== */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 4px 0;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===== Inputs ===== */
input, textarea {
  width: 100%;
  padding: 15px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(176, 107, 255, 0.25);
}
::placeholder { color: #8a6d94; }

.join-row { display: flex; gap: 10px; }
.join-row input {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  font-weight: 700;
}

textarea { min-height: 110px; resize: vertical; }

.code {
  margin-top: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--peach);
  text-align: center;
  min-height: 1.2em;
  font-size: 0.95rem;
}

/* ===== SHARE SCREEN ===== */
.code-card {
  background: var(--gradient-soft);
  border: 2px solid var(--rose);
  border-radius: 24px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: 0 14px 44px rgba(255, 77, 125, 0.18);
  position: relative;
  overflow: hidden;
}
.code-card::before {
  content: "";
  position: absolute;
  inset: -50% -50% auto auto;
  width: 200px; height: 200px;
  background: radial-gradient(circle, #ff7eb655 0%, transparent 70%);
  pointer-events: none;
}

.code-label {
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--peach);
  margin-bottom: 6px;
}

.big-code {
  font-size: clamp(2.4rem, 12vw, 3.2rem);
  font-weight: 900;
  letter-spacing: 0.25em;
  color: #fff;
  text-shadow: 0 0 24px rgba(255, 126, 182, 0.6);
  margin: 6px 0 8px;
  font-variant-numeric: tabular-nums;
  user-select: all;
}

.copy-status {
  color: var(--peach);
  font-size: 0.85rem;
  min-height: 1.2em;
  margin-bottom: 10px;
}

.instructions {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.instructions h3 {
  font-size: 0.95rem;
  color: var(--pink);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.instructions ol {
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}
.instructions strong { color: var(--text); }
.instructions em { color: var(--peach); font-style: normal; }

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  min-height: 1.2em;
}

/* ===== GAME SCREEN ===== */
.game-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.level-pill, .turn-pill {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.level-pill { background: var(--gradient); color: #fff; }
.turn-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}
.turn-pill.yours {
  background: rgba(255, 178, 107, 0.15);
  border-color: var(--peach);
  color: var(--peach);
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 25%;
  border-radius: 999px;
  background: var(--gradient);
  transition: width 0.5s ease;
}

.card {
  position: relative;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 34px 22px;
  min-height: 170px;
  display: flex;
  align-items: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  animation: cardIn 0.35s ease;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-suit {
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 2.4rem;
  color: rgba(255, 77, 125, 0.35);
}
.card p {
  font-size: 1.18rem;
  line-height: 1.45;
  font-weight: 500;
}

/* Bond action card */
.action-card {
  background: linear-gradient(160deg, #4a1a3a, #2b1533);
  border: 2px solid var(--rose);
  border-radius: 22px;
  padding: 26px 22px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(255, 77, 125, 0.25);
  animation: cardIn 0.35s ease;
}
.action-emoji {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 4px;
}
.action-label {
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--peach);
  margin-bottom: 10px;
}
.action-text {
  font-size: 1.1rem;
  line-height: 1.5;
  color: #fff;
  margin-bottom: 18px;
}

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 8px 0 4px;
}

/* ===== Larger screens ===== */
@media (min-width: 520px) {
  .steps { grid-template-columns: 1fr 1fr 1fr 1fr; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}