/* Quizzy — tema "quiz-game": viola sfumato, card bianche, risposte colorate.
   Design scritto da zero: nessun asset, codice o marchio di terzi. */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;700;800;900&display=swap');

:root {
  --bg1: #7c3aed;
  --bg2: #5b21b6;
  --accent: #fbbf24;
  --accent-dark: #b45309;
  --blue-btn: #2563eb;
  --danger: #dc2626;
  --text: #2d2640;
  --muted: #6b6480;
  --card: #ffffff;
  /* colori delle risposte (palette generica) */
  --c0: #e5484d;   /* rosso   ★ */
  --c1: #3e63dd;   /* blu     ● */
  --c2: #f5b90d;   /* giallo  ▲ */
  --c3: #46a758;   /* verde   ■ */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Montserrat", "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(160deg, var(--bg1) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- barra superiore (bianca) ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 22px;
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.logo {
  font-size: 1.5rem;
  font-weight: 900;
  text-decoration: none;
  color: var(--bg1);
  letter-spacing: 0.5px;
}

.topbar nav a {
  color: #554a7a;
  text-decoration: none;
  margin-left: 18px;
  font-weight: 700;
}

.topbar nav a:hover { color: var(--bg1); }

/* ---------- layout ---------- */
.container {
  width: min(1000px, 94vw);
  margin: 0 auto;
  padding: 30px 0 60px;
  flex: 1;
}

.container.wide { width: min(1280px, 96vw); }

.hero { text-align: center; }

.hero h1 {
  font-size: 2.5rem;
  font-weight: 900;
  margin: 34px 0 12px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}

.hero > p { color: #e6dcff; margin-bottom: 32px; font-size: 1.1rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.card {
  background: var(--card);
  color: var(--text);
  border-radius: 14px;
  padding: 26px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
  text-align: left;
}

.card h2 { margin-bottom: 14px; }
.card p { color: var(--muted); margin-bottom: 16px; }

/* ---------- form ---------- */
input[type="text"],
input[type="number"],
input:not([type]),
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #d9d2e8;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  margin-bottom: 12px;
  background: #fff;
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--bg1);
}

label { font-weight: 700; color: var(--text); }

/* ---------- bottoni (press-effect) ---------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 13px 24px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
}

.btn:hover { filter: brightness(1.06); }

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
}

.btn.primary { background: var(--blue-btn); color: #fff; }
.btn.secondary { background: var(--c3); color: #fff; }
.btn.ghost { background: #ece7f7; color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.info { background: var(--c1); color: #fff; }
.btn.small { padding: 8px 14px; font-size: 0.85rem; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.btn.big { padding: 16px 36px; font-size: 1.15rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn + .btn { margin-left: 8px; }

/* ---------- messaggi ---------- */
.alert {
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-weight: 700;
  display: none;
}

.alert.error { background: #ffe0e0; color: #9c1f1f; }
.alert.ok { background: #dff5e3; color: #14532d; }

/* ---------- schermate di gioco ---------- */
.screen { display: none; }
.screen.active { display: block; }
.center { text-align: center; }

/* PIN: card bianca con testo viola */
.pin-display {
  font-size: clamp(3rem, 12vw, 5.5rem);
  font-weight: 900;
  letter-spacing: 10px;
  background: #ffffff;
  color: var(--bg1);
  border-radius: 14px;
  padding: 14px 34px;
  display: inline-block;
  margin: 18px 0;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
}

/* nomi dei giocatori: card bianche */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
  min-height: 46px;
}

.chip {
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
  border-radius: 8px;
  padding: 10px 20px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
  animation: pop 0.25s ease;
}

@keyframes pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- domande ---------- */
/* testo della domanda: card bianca centrata */
.question-text {
  font-size: clamp(1.3rem, 3.6vw, 1.9rem);
  font-weight: 900;
  color: var(--text);
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
  text-align: center;
  padding: 20px 26px;
  margin: 16px auto 12px;
  max-width: 760px;
}

.question-meta {
  text-align: center;
  color: #e6dcff;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.question-image {
  display: block;
  max-width: min(440px, 88%);
  max-height: 230px;
  object-fit: cover;
  border-radius: 12px;
  margin: 0 auto 16px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
}

.timer-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

/* contatore: cerchio bianco */
.timer-number {
  font-size: 1.5rem;
  font-weight: 900;
  min-width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg1);
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
}

.timer-bar {
  flex: 1;
  height: 14px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s linear;
}

/* ---------- griglia risposte ---------- */
.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .answers-grid { grid-template-columns: 1fr; }
}

.ans {
  border: none;
  border-radius: 8px;
  padding: 20px 16px;
  min-height: 76px;
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
  transition: transform 0.08s ease, filter 0.15s ease, opacity 0.2s, box-shadow 0.08s;
  word-break: break-word;
}

.ans:hover { filter: brightness(1.07); }

.ans:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
}

/* forma geometrica bianca accanto al testo */
.ans .letter {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
  min-width: 30px;
  text-align: center;
}

.ans-0 { background: var(--c0); }
.ans-1 { background: var(--c1); }
.ans-2 { background: var(--c2); color: #453400; }
.ans-2 .letter { color: #453400; }
.ans-3 { background: var(--c3); }

.ans.readonly { cursor: default; }
.ans.correct-mark { outline: 5px solid #ffffff; outline-offset: 2px; }
.ans.dim { opacity: 0.3; }
.ans:disabled { cursor: default; opacity: 0.85; }

.answers-grid.two { grid-template-columns: 1fr 1fr; }

.count-bar {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  height: 10px;
  margin-top: 6px;
  overflow: hidden;
}

.count-fill { height: 100%; background: #ffffff; }

/* ---------- risposte testuali / sequenza / slider ---------- */
.open-answer {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
}

.open-answer input { margin-bottom: 0; font-size: 1.15rem; }

.seq-list {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.seq-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  color: var(--text);
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}

.seq-item .seq-pos {
  background: var(--bg1);
  color: #fff;
  border-radius: 6px;
  min-width: 34px;
  text-align: center;
  padding: 4px 6px;
  font-weight: 900;
}

.seq-item .seq-btns { margin-left: auto; display: flex; gap: 6px; }

.seq-item .seq-btns button {
  border: none;
  border-radius: 6px;
  background: #ece7f7;
  color: var(--bg1);
  font-size: 1rem;
  font-weight: 900;
  width: 36px;
  height: 36px;
  cursor: pointer;
}

.seq-item .seq-btns button:hover { background: #ddd2f3; }

.slider-box {
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
}

.slider-box input[type="range"] {
  width: 100%;
  height: 40px;
  accent-color: var(--bg1);
  cursor: pointer;
}

.slider-value {
  font-size: 3rem;
  font-weight: 900;
  color: var(--bg1);
  margin-bottom: 8px;
}

.slider-limits {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 14px;
}

.note-box {
  max-width: 560px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
}

/* ---------- classifica e podio ---------- */
.board { list-style: none; margin: 18px auto; max-width: 480px; }

.board li {
  display: flex;
  justify-content: space-between;
  background: #ffffff;
  color: var(--text);
  border-radius: 8px;
  padding: 12px 18px;
  margin-bottom: 8px;
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15);
}

.board li.me { background: var(--accent); color: #453400; }

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  margin: 28px 0;
}

.podium .step {
  border-radius: 10px 10px 0 0;
  width: 122px;
  text-align: center;
  padding: 14px 8px;
  font-weight: 900;
}

.podium .step .medal { font-size: 2rem; }
.podium .s1 { height: 155px; background: linear-gradient(180deg, #ffe08a, #e0a800); color: #453400; }
.podium .s2 { height: 112px; background: linear-gradient(180deg, #f8f9fa, #adb5bd); color: #222; }
.podium .s3 { height: 88px; background: linear-gradient(180deg, #f0ae78, #9c5a1e); color: #2b1600; }

/* ---------- lista quiz ---------- */
.quiz-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.quiz-card h3 { margin-bottom: 4px; }
.quiz-card .meta { color: var(--muted); font-size: 0.9rem; }
.quiz-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- editor a 3 colonne ---------- */
.editor {
  display: grid;
  grid-template-columns: 210px 1fr 250px;
  gap: 18px;
  align-items: start;
}

@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
}

.editor-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.thumb {
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  border: 3px solid transparent;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15);
  transition: border-color 0.15s;
}

.thumb.active { border-color: var(--accent); }

.thumb .thumb-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.thumb .thumb-text {
  font-weight: 800;
  font-size: 0.92rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.thumb .thumb-type { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }

.editor-main .q-text-big {
  font-size: 1.3rem;
  font-weight: 800;
  text-align: center;
  padding: 18px;
}

.editor-props .prop-block { margin-bottom: 18px; }

.editor-props .prop-block > label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.type-card {
  border: 2px solid #d9d2e8;
  border-radius: 8px;
  background: #fff;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--text);
}

.type-card .t-icon { font-size: 1.4rem; display: block; margin-bottom: 2px; }
.type-card.selected { border-color: var(--bg1); background: #f3efff; }

/* editor risposte */
.answers-edit {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .answers-edit { grid-template-columns: 1fr; }
}

.ans-edit {
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}

.ans-edit input { margin-bottom: 0; background: rgba(255, 255, 255, 0.95); }

.ans-edit label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #fff;
}

.ans-edit.ans-2 label { color: #453400; }

.ans-edit input[type="checkbox"] { width: 20px; height: 20px; margin: 0; }

.ans-edit.plain {
  background: #f2eefb;
  box-shadow: none;
}

.ans-edit.plain label { color: var(--text); }

.time-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.time-row select { width: auto; margin-bottom: 0; }

.hint { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }

/* ---------- tabella risultati ---------- */
table.results {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
}

table.results th, table.results td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #ece7f7;
}

table.results th { background: #f7f4fc; }

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.8rem;
  font-weight: 800;
}

.badge.live { background: #ffe3c2; color: #7a4a00; }
.badge.async { background: #d2f0ec; color: #0b4f47; }

/* ---------- utilità ---------- */
.hidden { display: none !important; }
.mt { margin-top: 18px; }
.mb { margin-bottom: 18px; }
.muted { color: #e6dcff; }
.big-emoji { font-size: 4rem; text-align: center; }

footer {
  text-align: center;
  padding: 18px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.85rem;
}
