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

:root {
  --bg: #0a1230;
  --card: #121a3a;
  --accent: #2f7bff;   /* blu (prima era viola) */
  --accent2: #18d4ff;  /* azzurro/ciano */
  --text: #e8edf8;
  --muted: #94a0c8;
  --green: #2ecc71;
  --red: #e74c3c;
  --btn-fill: rgba(10, 18, 44, 0.55); /* riempimento interno dei pulsanti */
}

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  /* cielo notturno profondo */
  background:
    radial-gradient(900px 600px at 80% -10%, #143a99 0%, transparent 60%),
    radial-gradient(1000px 700px at 10% 110%, #0e3a7a 0%, transparent 55%),
    linear-gradient(180deg, #03060f 0%, #061232 50%, #03060f 100%);
  color: var(--text);
  min-height: 100vh;
  padding: 32px 20px;
  overflow-x: hidden;
}

/* ====================  CIELO STELLATO  ==================== */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;            /* dietro a tutto il contenuto */
  overflow: hidden;
  pointer-events: none;   /* non intercetta i click */
}
.star-layer {
  position: absolute;
  inset: 0;
  /* ogni strato scorre lentamente verso l'alto e si ripete (parallasse) */
  animation-name: drift;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  /* alone morbido */
  box-shadow: 0 0 6px 1px rgba(255,255,255,0.5);
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes drift {
  from { transform: translateY(0); }
  to   { transform: translateY(-50%); } /* metà dei 200% di altezza: loop continuo */
}
@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.15); }
}

/* stelle cadenti */
.shooting-star {
  position: absolute;
  width: 2px; height: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px 2px rgba(255,255,255,0.9);
  animation: shoot 1.1s ease-out forwards;
}
.shooting-star::after {       /* la scia */
  content: "";
  position: absolute;
  top: 50%; right: 0;
  width: 120px; height: 1.5px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(255,255,255,0.9), transparent);
}
@keyframes shoot {
  0%   { opacity: 0; transform: translate(0, 0) rotate(18deg); }
  10%  { opacity: 1; }
  100% { opacity: 0; transform: translate(320px, 140px) rotate(18deg); }
}

.layout {
  position: relative;       /* sopra il cielo */
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

/* ====================  LOGO + TITOLO  ==================== */
.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 6px;
}
.logo { width: 72px; height: 72px; flex-shrink: 0; filter: drop-shadow(0 4px 14px rgba(47,123,255,0.5)); }
.logo-q {
  font: 700 34px "Segoe UI", sans-serif;
  fill: #fff;
}
.brand-text h1 {
  font-size: 2.3rem;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: 0.5px;
}

h1 { font-size: 2.2rem; }
.subtitle { color: var(--muted); margin: 4px 0 20px; max-width: 52ch; }

.card {
  background: rgba(26, 31, 58, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}

.progress-track {
  height: 6px; background: rgba(255,255,255,0.08);
  border-radius: 99px; overflow: hidden; margin-bottom: 14px;
}
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width .3s ease;
}

.count { color: var(--muted); font-size: .85rem; margin-bottom: 8px; }
.question { font-size: 1.5rem; line-height: 1.3; margin-bottom: 22px; min-height: 2.6em; }

.answers { display: flex; flex-direction: column; gap: 10px; }
.answer-btn {
  --c: #8b93c0;                       /* colore del bordo (per-pulsante sotto) */
  padding: 14px 18px; font-size: 1rem; font-weight: 600;
  border: 2px solid var(--c); border-radius: 12px; cursor: pointer;
  color: var(--c);                    /* testo dello stesso colore del bordo */
  background: var(--btn-fill);        /* dentro: blu notte translucido */
  text-align: left;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
}
.answer-btn:hover {
  /* si "accende": riempimento tinto col colore del bordo + alone */
  background: color-mix(in srgb, var(--c) 16%, var(--btn-fill));
  box-shadow: 0 0 16px color-mix(in srgb, var(--c) 45%, transparent);
  transform: translateY(-1px);
}
.answer-btn:active { transform: translateY(0); }
.answer-btn.yes      { --c: #2ecc71; }
.answer-btn.probYes  { --c: #36a8e0; }
.answer-btn.dontKnow { --c: #8b93c0; }
.answer-btn.probNo   { --c: #e0922f; }
.answer-btn.no       { --c: #e74c3c; }

/* Schermata del tentativo */
.guess { text-align: center; }
.guess-intro { color: var(--muted); }
.guess-name {
  font-size: 2.4rem; margin: 12px 0;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.guess-conf { color: var(--muted); margin-bottom: 20px; }
.guess-actions button {
  --c: var(--accent);
  padding: 12px 28px; font-size: 1rem; font-weight: 600; cursor: pointer;
  border: 2px solid var(--c); border-radius: 12px;
  color: var(--c); background: var(--btn-fill);
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
}
.guess-actions button:hover {
  background: color-mix(in srgb, var(--c) 16%, var(--btn-fill));
  box-shadow: 0 0 16px color-mix(in srgb, var(--c) 45%, transparent);
  transform: translateY(-1px);
}

/* Pannello didattico */
.debug {
  background: rgba(26, 31, 58, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px; padding: 20px; font-size: .9rem;
}
.debug h3 { margin-bottom: 12px; font-size: 1rem; }
.metric { color: var(--muted); margin-bottom: 10px; line-height: 1.5; }
.metric b { color: var(--text); }
.rank { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.rank li { display: grid; grid-template-columns: 110px 1fr 48px; align-items: center; gap: 8px; }
.rank-name { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 8px; background: rgba(255,255,255,0.08); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.rank-pct { font-size: .78rem; color: var(--muted); text-align: right; }

/* Conferma / apprendimento */
.guess-q { color: var(--muted); margin: 18px 0 14px; }
.guess-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.guess-actions button { padding: 12px 24px; }
.guess-actions .ok   { --c: #2ecc71; }
.guess-actions .ko   { --c: #e74c3c; }
.guess-actions .skip { --c: #8b93c0; }
.name-input {
  width: 100%; padding: 13px 16px; font-size: 1rem; margin: 8px 0 16px;
  border-radius: 12px; border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06); color: var(--text);
}
.name-input:focus { outline: none; border-color: var(--accent); }
.hint { color: var(--muted); font-size: .82rem; margin-top: 14px; }
.end-msg { font-size: 1.15rem; line-height: 1.5; margin-bottom: 20px; }
.end-msg b { color: var(--accent2); }

.forget {
  background: rgba(255,255,255,0.06); color: var(--muted);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 10px;
  padding: 6px 12px; font-size: .8rem; cursor: pointer; margin-bottom: 18px;
}
.forget:hover { color: var(--text); border-color: var(--accent); }

.hidden { display: none; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
}
