/* ============ The Mingle — cocktail lounge styling ============ */
:root {
  --bg0: #17111c;
  --bg1: #241826;
  --gold: #e9c46a;
  --gold-soft: #f0d68c;
  --ink: #f4ece4;
  --muted: #b9a9b6;
  --card: rgba(42, 30, 46, 0.72);
  --card-line: rgba(233, 196, 106, 0.22);
  --good: #43d17a;
  --bad: #ef6f6f;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 80% -10%, #3a2440 0%, transparent 55%),
    radial-gradient(900px 600px at 0% 110%, #2a1836 0%, transparent 50%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px 24px;
  overflow-x: hidden;
}

/* soft floating party lights */
.ambiance { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ambiance::before, .ambiance::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(60px); opacity: 0.35;
}
.ambiance::before { width: 340px; height: 340px; left: -80px; top: 8%;
  background: radial-gradient(circle, #c0446b, transparent 70%); animation: float1 14s ease-in-out infinite; }
.ambiance::after { width: 380px; height: 380px; right: -100px; bottom: 4%;
  background: radial-gradient(circle, #2980b9, transparent 70%); animation: float2 17s ease-in-out infinite; }
@keyframes float1 { 50% { transform: translate(40px, 30px); } }
@keyframes float2 { 50% { transform: translate(-30px, -40px); } }

#app { position: relative; z-index: 1; width: 100%; max-width: 460px; }

/* ============ screens ============ */
.screen { display: none; }
.screen.is-active { display: block; animation: rise 0.4s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 24px;
  padding: 28px 26px 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  text-align: center;
}

.logo { font-size: 48px; line-height: 1; margin-bottom: 6px;
  filter: drop-shadow(0 6px 14px rgba(233,196,106,.3)); }

h1 {
  margin: 4px 0 10px; font-size: 40px; letter-spacing: 0.5px; font-weight: 800;
  font-family: "Georgia", "Times New Roman", serif;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

.tagline { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 0 auto 20px; max-width: 34ch; }

.how { list-style: none; padding: 0; margin: 0 0 22px; text-align: left; display: grid; gap: 11px; }
.how li { display: flex; gap: 11px; align-items: flex-start; font-size: 14px; color: #e3d7cf; line-height: 1.4; }
.how li span { font-size: 18px; flex: none; line-height: 1.3; }
.how b { color: var(--gold-soft); }

/* difficulty segmented control */
.difficulty { margin-bottom: 22px; }
.diff-label { display: block; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px; }
.seg { display: flex; gap: 6px; background: rgba(0,0,0,0.25); padding: 5px; border-radius: 14px; }
.seg-btn {
  flex: 1; padding: 10px 6px; border: 0; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 600;
  transition: all 0.18s ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-on { background: linear-gradient(180deg, rgba(233,196,106,.95), rgba(214,166,74,.95));
  color: #2a1a10; box-shadow: 0 4px 14px -4px rgba(233,196,106,.6); }

/* ============ buttons ============ */
.btn {
  display: inline-block; width: 100%; border: 0; cursor: pointer;
  padding: 15px 20px; border-radius: 14px; font-size: 16px; font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn:active { transform: translateY(1px) scale(0.995); }
.btn-primary {
  color: #2a1a10;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  box-shadow: 0 10px 26px -10px rgba(233,196,106,.8);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { filter: grayscale(0.4) brightness(0.8); cursor: default; }
.btn-ghost {
  background: transparent; color: var(--muted); border: 1px solid rgba(255,255,255,0.12);
  margin-top: 10px; font-weight: 600; font-size: 14px; padding: 12px;
}
.btn-ghost:hover { color: var(--ink); border-color: rgba(255,255,255,0.25); }

.best-line { margin: 16px 0 0; color: var(--muted); font-size: 14px; }
.best-line b { color: var(--gold-soft); }

/* ============ HUD ============ */
.hud {
  display: flex; align-items: center; gap: 14px;
  max-width: 460px; margin: 0 auto 14px; padding: 12px 16px;
  background: rgba(30, 20, 34, 0.7); border: 1px solid var(--card-line);
  border-radius: 16px; backdrop-filter: blur(10px);
  position: relative; z-index: 1;
}
.hud-stat { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.hud-k { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.hud-v { font-size: 18px; font-weight: 800; color: var(--gold-soft); }
.hud-vibe { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 110px; }
.hud-vibe-bar { width: 110px; height: 8px; border-radius: 6px; background: rgba(255,255,255,0.12); overflow: hidden; }
.hud-vibe-bar i { display: block; height: 100%; width: 62%; border-radius: 6px;
  background: linear-gradient(90deg,#43d17a,#8be36a); transition: width 0.4s ease, background 0.4s ease; }

/* HUD sits above the play card */
#app:has(#hud:not([hidden])) { display: block; }

/* ============ avatar ============ */
.avatar {
  width: 168px; height: 168px; margin: 6px auto 4px;
  border-radius: 22px; overflow: hidden;
  box-shadow: 0 16px 40px -14px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,255,255,0.06) inset;
  animation: pop 0.42s cubic-bezier(.2,1.3,.4,1);
}
.avatar svg { display: block; width: 100%; height: 100%; }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }

.badge {
  display: inline-block; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 700; padding: 5px 12px; border-radius: 999px; margin-bottom: 14px;
}
.badge-new { color: #a7f3c6; background: rgba(67,209,122,0.14); border: 1px solid rgba(67,209,122,0.3); }
.badge-back { color: #f6d365; background: rgba(240,180,41,0.14); border: 1px solid rgba(240,180,41,0.3); }

.meet-hi { color: var(--muted); font-size: 15px; margin: 12px 0 0; }
.name {
  font-family: "Georgia", serif; font-size: 38px; font-weight: 800; margin: 2px 0 8px;
  background: linear-gradient(180deg, #fff, var(--gold-soft));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.quip { color: var(--muted); font-size: 14px; font-style: italic; line-height: 1.45;
  margin: 0 auto 18px; max-width: 30ch; min-height: 40px; }

.meet-timer { max-width: 240px; margin: 0 auto 20px; }
.meet-timer-bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,0.12); overflow: hidden; }
.meet-timer-bar i { display: block; height: 100%; width: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft)); }
.meet-timer-label { display: block; margin-top: 8px; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* ============ quiz ============ */
.prompt { font-size: 20px; font-weight: 700; line-height: 1.35; margin: 14px auto 18px; max-width: 26ch; }
#quiz-form { display: flex; flex-direction: column; gap: 10px; }
#quiz-input {
  width: 100%; padding: 15px 18px; font-size: 20px; text-align: center;
  border-radius: 14px; border: 1.5px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.28); color: var(--ink); outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: "Georgia", serif; letter-spacing: 0.5px;
}
#quiz-input::placeholder { color: #7d6f7c; font-family: -apple-system, sans-serif; font-size: 15px; letter-spacing: 0; }
#quiz-input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(233,196,106,0.18); }

.feedback { margin-top: 6px; animation: rise 0.3s ease; }
.feedback p { font-size: 18px; line-height: 1.4; margin: 8px 0 16px; }
.feedback b { font-family: "Georgia", serif; }
.feedback.good p { color: #b6f0cf; }
.feedback.good b { color: var(--good); }
.feedback.close p { color: #f6e2b0; }
.feedback.close b { color: var(--gold-soft); }
.feedback.bad p { color: #f4c3c3; }
.feedback.bad b { color: var(--bad); }
.feedback .pen { display: inline-block; margin-left: 6px; font-weight: 800;
  color: #ff9a9a; font-size: 15px; }

/* ============ game over ============ */
.over-sub { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 6px auto 22px; max-width: 32ch; }
.over-stats { display: flex; gap: 10px; margin-bottom: 8px; }
.over-stats > div {
  flex: 1; background: rgba(0,0,0,0.24); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px; padding: 14px 6px;
}
.over-stats b { display: block; font-size: 26px; color: var(--gold-soft); font-weight: 800; }
.over-stats span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.over .best-line { margin-bottom: 20px; }

@media (max-width: 400px) {
  .card { padding: 24px 20px 26px; }
  h1 { font-size: 34px; }
  .avatar { width: 150px; height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
