/* =====================================================================
   QUIZ VOTING - Mobile-first stylesheet  (Neural Edition)
   ===================================================================== */

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

:root {
  --bg:     #06030f;
  --ac:     #7b9fff;
  --ac2:    #a78bfa;
  --cf:     #4a8fff;
  --ct:     #7c5af5;
  --border: rgba(255,255,255,0.09);
  --bh:     rgba(120,160,255,0.38);
  --bg-s:   rgba(255,255,255,0.045);
  --bg-s2:  rgba(255,255,255,0.08);
  --t1:     #f0eeff;
  --t2:     rgba(190,200,230,0.72);
  --t3:     rgba(130,145,190,0.48);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--t1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* ── Neural canvas ── */
canvas.neural-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

#app {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  position: relative;
  z-index: 10;
}

/* ---------- Top Bar ---------- */
#topBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
  background: rgba(6,3,15,0.75);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
}
#logo {
  font-weight: 900;
  letter-spacing: 3px;
  font-size: 16px;
  background: linear-gradient(135deg, var(--ac), var(--ac2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
#topRight {
  display: flex;
  align-items: center;
  gap: 12px;
}

#voteTimer {
  display: none;
  background: linear-gradient(135deg, rgba(0,70,180,.9), rgba(0,170,255,.85));
  border: 2px solid rgba(185,230,255,.95);
  border-radius: 999px;
  padding: 4px 14px;
  font-weight: 900;
  font-size: 18px;
  color: white;
  min-width: 48px;
  text-align: center;
  text-shadow: 0 0 8px rgba(255,255,255,.5);
  box-shadow: 0 0 12px rgba(0,170,255,.65);
  font-variant-numeric: tabular-nums;
  transition: .2s;
}
#voteTimer.active { display: inline-block; animation: timerPop 0.3s ease; }
#voteTimer.danger {
  background: linear-gradient(135deg, #b00, #ff2020);
  border-color: #ff8a8a;
  box-shadow: 0 0 18px rgba(255,32,32,.85);
  animation: timerDanger 0.55s infinite alternate;
}
#voteTimer.ended {
  background: linear-gradient(135deg, #444, #777);
  border-color: #aaa;
  box-shadow: none;
  animation: none;
}
@keyframes timerPop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
@keyframes timerDanger {
  from { transform: scale(1);   }
  to   { transform: scale(1.1); }
}

#connectionDot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6e7681;
  transition: background 0.3s;
}
#connectionDot.connected {
  background: #2ea043;
  box-shadow: 0 0 8px rgba(46,160,67,0.6);
}
#connectionDot.disconnected {
  background: #f85149;
  animation: pulseDot 1s infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1;   }
  50%       { opacity: 0.4; }
}

/* ---------- Main / Screens ---------- */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  min-height: 0;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
}
.screen.active {
  display: flex;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

#waitingScreen, #closedScreen {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}
.bigEmoji { font-size: 72px; line-height: 1; margin-bottom: 4px; opacity: 0.85; }
h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 4px;
  background: linear-gradient(135deg, var(--ac), var(--ac2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.subtitle {
  font-size: 15px;
  color: var(--t2);
  max-width: 360px;
  line-height: 1.5;
  margin: 0 0 18px;
}
.badge {
  padding: 8px 18px;
  background: rgba(123,159,255,0.10);
  border: 0.5px solid rgba(123,159,255,0.22);
  border-radius: 100px;
  font-size: 13px;
  letter-spacing: 1px;
  color: rgba(160,190,255,0.88);
}
.myVoteBadge {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  background: rgba(46,160,67,0.12);
  border: 0.5px solid rgba(46,160,67,0.35);
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  color: #56d364;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.myVoteBadge.show { display: inline-flex; }

/* ---------- Voting screen ---------- */
.qHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.qNum {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--t3);
  text-transform: uppercase;
}
.qStatus {
  font-size: 12px;
  font-weight: 700;
  color: #56d364;
  letter-spacing: 0.5px;
}
.question {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--t1);
  margin-bottom: 22px;
  padding: 18px;
  background: var(--bg-s);
  border: 0.5px solid var(--border);
  border-radius: 18px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px;
  background: var(--bg-s);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--t1);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 64px;
  touch-action: manipulation;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.opt:active  { transform: scale(0.97); }
.opt:hover   { border-color: var(--bh); background: rgba(123,159,255,0.08); }
.opt .letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, rgba(74,143,255,0.18), rgba(124,90,245,0.12));
  border: 1px solid rgba(123,159,255,0.3);
  border-radius: 50%;
  font-size: 18px;
  font-weight: 800;
  color: var(--ac2);
  flex-shrink: 0;
  transition: all 0.2s;
}
.opt .label { flex: 1; line-height: 1.35; }
.opt.selected {
  background: linear-gradient(135deg, rgba(74,143,255,0.18), rgba(124,90,245,0.12));
  border-color: var(--ac);
  box-shadow: 0 0 0 3px rgba(123,159,255,0.15), 0 4px 20px rgba(74,143,255,0.12);
}
.opt.selected .letter {
  background: linear-gradient(135deg, var(--cf), var(--ct));
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(74,143,255,0.4);
}
.opt.selected::after {
  content: "✓";
  position: absolute;
  right: 18px;
  color: var(--ac);
  font-size: 22px;
  font-weight: 800;
}

.hint { font-size: 13px; color: var(--t3); text-align: center; line-height: 1.5; padding: 0 8px; }

/* ---------- Bottom Bar ---------- */
#bottomBar {
  padding: 12px 18px;
  border-top: 0.5px solid var(--border);
  font-size: 12px;
  color: var(--t3);
  text-align: center;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  background: rgba(6,3,15,0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.opt.flash {
  animation: flashGreen 0.4s ease;
}
@keyframes flashGreen {
  0%   { background: var(--bg-s); }
  50%  { background: rgba(46,160,67,0.3); }
  100% { background: linear-gradient(135deg, rgba(74,143,255,0.18), rgba(124,90,245,0.12)); }
}

@media (min-width: 700px) {
  .question { font-size: 22px; padding: 24px; }
  .opt      { font-size: 17px; padding: 22px; min-height: 72px; }
  h1        { font-size: 28px; }
}
