@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Barlow:wght@400;500;600;700;800;900&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%;
  min-height: 100vh;
  background: #07080f;
  color: #fff;
  font-family: 'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(255,200,0,.07) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 20% 80%, rgba(255,30,80,.04) 0%, transparent 50%);
  pointer-events: none;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(72px, 14vw, 96px) clamp(12px, 4vw, 24px) clamp(16px, 4vw, 28px);
}

.ee-header {
  position: fixed;
  left: 0; right: 0; top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 40%, transparent 100%);
  pointer-events: none;
  z-index: 10;
}
.ee-header a {
  pointer-events: auto;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0.9;
  transition: opacity 0.15s;
}
.ee-header a:hover { opacity: 1; }
.ee-header img { height: 36px; width: auto; display: block; }

.screen {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  text-align: center;
}
.screen.wide { max-width: 600px; }
.screen.hidden { display: none; }
.hidden { display: none !important; }

.logo { margin-bottom: 8px; }
.logo-the {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(18px, 5vw, 24px);
  letter-spacing: 6px;
  color: #ffd700;
  line-height: 1;
}
.logo-percent {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(72px, 22vw, 110px);
  line-height: .85;
  background: linear-gradient(180deg, #fff8cc 0%, #ffd700 35%, #ff8800 80%, #ff4400 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 25px rgba(255,180,0,.55));
  letter-spacing: -3px;
}
.logo-club {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(24px, 7vw, 32px);
  letter-spacing: 12px;
  color: #fff;
  line-height: 1;
}

h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 400;
  letter-spacing: 4px;
  color: #ffd700;
  margin-bottom: 4px;
}

.subtitle { color: #aaa; font-size: clamp(13px, 3.6vw, 15px); margin-bottom: 8px; }

input {
  font-family: inherit;
  font-size: clamp(20px, 5.5vw, 26px);
  font-weight: 700;
  text-align: center;
  padding: clamp(12px, 3.5vw, 16px) 16px;
  background: rgba(255,255,255,.05);
  color: #fff;
  border: 2px solid rgba(255,255,255,.15);
  border-radius: 10px;
  outline: none;
  width: 100%;
  letter-spacing: 4px;
}
input:focus { border-color: #ffd700; background: rgba(255,215,0,.06); }

button { font-family: inherit; cursor: pointer; }
button:focus, button:focus-visible { outline: none; }
.q-option:focus { outline: none; }

.btn-primary {
  font-size: 18px;
  font-weight: 800;
  padding: 16px;
  background: #ffd700;
  color: #000;
  border: none;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 3px;
  box-shadow: 0 0 18px rgba(255,215,0,.35);
  transition: transform .1s;
}
.btn-primary:disabled { background: #333; color: #777; box-shadow: none; cursor: not-allowed; }
.btn-primary:active:not(:disabled) { transform: translateY(2px); }

.btn-secondary {
  font-size: 15px;
  font-weight: 700;
  padding: 14px;
  background: rgba(255,255,255,.06);
  color: #fff;
  border: 2px solid rgba(255,255,255,.2);
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.btn-text {
  background: none;
  color: #888;
  border: none;
  font-size: 13px;
  padding: 10px;
  text-decoration: underline;
  cursor: pointer;
}
.btn-text:hover { color: #ddd; }

.error { color: #ff5252; font-size: 14px; min-height: 20px; }

/* ---- Selfie capture ---- */
.selfie-stage {
  width: 240px;
  height: 240px;
  margin: 8px auto 4px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  border: 3px dashed rgba(255,215,0,.4);
  overflow: hidden;
  position: relative;
}
.selfie-stage img,
.selfie-stage video,
.selfie-placeholder {
  width: 100%; height: 100%;
}
.selfie-stage img {
  object-fit: cover;
  display: block;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;        /* let our touch handlers own the gesture */
  will-change: transform;
}
/* During preview the circle is the gesture surface (pinch + drag) */
.selfie-stage.editing { cursor: grab; touch-action: none; }
.selfie-stage.editing:active { cursor: grabbing; }
.selfie-edit-hint {
  margin: 6px auto 0;
  color: #888;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.selfie-edit-hint.hidden { display: none; }
/* Live camera: cover the circle, mirrored so it feels like a real mirror */
.selfie-stage video {
  object-fit: cover;
  display: block;
  transform: scaleX(-1);
  background: #000;
}
.selfie-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.selfie-icon { font-size: 48px; }
.selfie-hint { color: #888; font-size: 13px; padding: 0 16px; }
/* Tap-affordance on the placeholder circle (only when in initial state) */
.selfie-stage.tappable { cursor: pointer; transition: border-color .15s, transform .08s; }
.selfie-stage.tappable:hover { border-color: rgba(255,215,0,.7); }
.selfie-stage.tappable:active { transform: scale(0.98); }
.selfie-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.selfie-buttons .hidden { display: none; }

/* ---- Lobby ---- */
.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}
.player-avatar {
  width: 120px; height: 120px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 56px;
  letter-spacing: 2px;
  color: #fff;
  border: 3px solid rgba(255,215,0,.5);
}
.player-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.player-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  letter-spacing: 4px;
  color: #ffd700;
}

.status { color: #ddd; font-size: 22px; font-weight: 700; letter-spacing: 1px; margin-top: 12px; }
.status-sub { color: #888; font-size: 14px; }

/* ---- Question phase ---- */
.q-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Barlow', sans-serif;
  font-size: 12px;
  letter-spacing: 2px;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.q-status {
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 3px;
  border: 1px solid;
}
.q-status.in { color: #00e676; border-color: #00e676; }
.q-status.out { color: #ff2244; border-color: #ff2244; background: rgba(255,34,68,.1); }

.q-timer {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 1px;
  color: #ddd;
  padding: 2px 10px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px;
  min-width: 50px;
  text-align: center;
}
.q-timer.low {
  color: #ff7788;
  border-color: #ff2244;
  background: rgba(255,34,68,.1);
  animation: timerPulse 1s infinite;
}
.q-timer.expired { color: #ff2244; border-color: #ff2244; background: rgba(255,34,68,.2); }
@keyframes timerPulse { 50% { opacity: .55; } }

.q-pct {
  text-align: center;
  margin: 2px 0 6px;
}
.q-pct-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(48px, 14vw, 72px);
  line-height: .9;
  background: linear-gradient(180deg, #fff8cc 0%, #ffd700 50%, #ff8800 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -2px;
}
.q-pct-pct {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(26px, 8vw, 40px);
  color: #ffd700;
  margin-left: 2px;
}
.q-pct-label {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  color: #888;
  text-transform: uppercase;
  margin-top: 2px;
}

.q-text {
  font-size: clamp(15px, 4.4vw, 20px);
  font-weight: 600;
  line-height: 1.4;
  padding: clamp(12px, 3.6vw, 16px) clamp(8px, 2.4vw, 12px);
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
}

.q-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 2.4vw, 12px);
}
.q-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: clamp(14px, 4vw, 20px) clamp(10px, 3.2vw, 14px);
  background: rgba(255,255,255,.05);
  border: 2px solid rgba(255,255,255,.15);
  border-radius: 8px;
  color: #fff;
  text-align: left;
  font-size: clamp(13px, 3.8vw, 16px);
  font-weight: 600;
  min-height: clamp(60px, 16vw, 76px);
  transition: all .15s;
}
.q-option:disabled { cursor: default; }
.q-option:active:not(:disabled) { transform: scale(0.97); }
.q-option .q-letter {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid currentColor;
  border-radius: 4px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  color: #ffd700;
}
.q-option .q-text-opt { flex: 1; }
.q-option.selected {
  background: rgba(30,159,255,.15);
  border-color: #1e9fff;
  box-shadow: 0 0 10px rgba(30,159,255,.35);
}
.q-option.selected .q-letter { color: #1e9fff; }
.q-option.locked {
  background: rgba(255,215,0,.18);
  border-color: #ffd700;
  box-shadow: 0 0 12px rgba(255,215,0,.4);
}
.q-option.correct {
  background: rgba(0,230,118,.18);
  border-color: #00e676;
  box-shadow: 0 0 12px rgba(0,230,118,.4);
}
.q-option.wrong {
  background: rgba(255,34,68,.18);
  border-color: #ff2244;
  box-shadow: 0 0 12px rgba(255,34,68,.4);
}
.q-option.dim { opacity: .35; }

.btn-lock {
  margin-top: 4px;
  padding: clamp(14px, 4vw, 20px);
  font-family: 'Barlow', sans-serif;
  font-size: clamp(15px, 4.4vw, 19px);
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #000;
  background: #ffd700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .1s, background .15s;
  box-shadow: 0 0 18px rgba(255,215,0,.35);
}
.btn-lock:disabled {
  background: #2a2a2a;
  color: #666;
  box-shadow: none;
  cursor: not-allowed;
}
.btn-lock:active:not(:disabled) { transform: translateY(2px); }
.btn-lock.locked {
  background: rgba(255,215,0,.18);
  color: #ffd700;
  border: 2px solid #ffd700;
  box-shadow: none;
}
.btn-lock.expired {
  background: rgba(255,34,68,.15);
  color: #ff7788;
  border: 2px solid #ff2244;
  box-shadow: none;
}

.q-result {
  margin-top: 4px;
  padding: 16px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 3px;
  border-radius: 8px;
}
.q-result.survived { background: rgba(0,230,118,.15); color: #00e676; border: 1px solid #00e676; }
.q-result.warned   { background: rgba(255,180,0,.15); color: #ffb000; border: 1px solid #ffb000; }
.q-result.out      { background: rgba(255,34,68,.15); color: #ff2244; border: 1px solid #ff2244; }

.survivor-banner {
  margin-top: 8px;
  padding: 12px 14px;
  background: rgba(255,180,0,.12);
  border: 1px solid rgba(255,180,0,.45);
  border-radius: 8px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  letter-spacing: 2px;
  color: #ffb000;
  text-align: center;
}

.eliminated-banner {
  margin-top: 6px;
  padding: 10px;
  background: rgba(255,34,68,.1);
  border: 1px solid rgba(255,34,68,.4);
  border-radius: 6px;
  font-size: 13px;
  color: #ff7788;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
}
