:root {
  --purple: #46178f;
  --purple-dark: #25076b;
  --red: #e21b3c;
  --blue: #1368ce;
  --yellow: #d89e00;
  --green: #26890c;
  --ok: #66bf39;
  --bad: #f35;
  --ink: #333;
  --muted: #6e6e6e;
  --paper: #fff;
  --soft: #f2f2f2;
  --radius: 4px;
  --shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Montserrat", "Noto Sans", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--soft);
}
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }

/* ---------- botons ---------- */
.btn {
  border: 0;
  border-radius: var(--radius);
  padding: 0.7em 1.2em;
  font-weight: 700;
  cursor: pointer;
  background: #333;
  color: #fff;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25);
}
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.light { background: #fff; color: var(--ink); }
.btn.green { background: var(--green); }
.btn.purple { background: var(--purple); }
.btn.red { background: var(--red); }
.btn.small { padding: 0.4em 0.8em; font-size: 0.9em; }

/* ---------- pantalla del jugador i de l'amfitrió ---------- */
.stage {
  min-height: 100vh;
  background: var(--purple);
  color: #fff;
  display: flex;
  flex-direction: column;
}
.stage.correct { background: var(--ok); }
.stage.wrong { background: var(--bad); }
.center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  text-align: center;
}
.logo { font-size: clamp(2.5rem, 8vw, 4rem); font-weight: 900; letter-spacing: -0.03em; margin: 0; }
.card {
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 1rem;
  width: min(320px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: var(--shadow);
}
.card input {
  border: 2px solid #ccc;
  border-radius: var(--radius);
  padding: 0.6em;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
}
.card .btn { font-size: 1.1rem; }
.error { background: #fff; color: var(--bad); font-weight: 700; padding: 0.5em 1em; border-radius: var(--radius); }
.big { font-size: clamp(1.5rem, 5vw, 2.5rem); font-weight: 800; margin: 0; }
.huge { font-size: clamp(3rem, 12vw, 6rem); font-weight: 900; margin: 0; }
.muted { opacity: 0.8; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  gap: 1rem;
}
.bottombar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}
.pill { background: #333; color: #fff; padding: 0.2em 0.8em; border-radius: var(--radius); }
.spinner {
  width: 56px; height: 56px; border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.3); border-top-color: #fff;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- respostes de colors ---------- */
.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.5rem;
}
.answers.player { flex: 1; }
.answer {
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  font-weight: 700;
  font-size: clamp(1rem, 2.5vw, 1.6rem);
  text-align: left;
  box-shadow: var(--shadow);
  min-height: 72px;
}
.answers.player .answer { justify-content: center; cursor: pointer; min-height: 120px; }
.answers.player .answer svg { width: 30%; max-width: 110px; height: auto; }
.answer svg { width: 36px; height: 36px; flex: none; }
.answer.c0 { background: var(--red); }
.answer.c1 { background: var(--blue); }
.answer.c2 { background: var(--yellow); }
.answer.c3 { background: var(--green); }
.answer.dim { opacity: 0.25; }
.answer .tick { margin-left: auto; font-size: 1.6em; }

/* ---------- amfitrió ---------- */
.host-question {
  background: #fff;
  color: var(--ink);
  margin: 1rem auto 0;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius);
  font-size: clamp(1.2rem, 3vw, 2.2rem);
  font-weight: 800;
  text-align: center;
  width: min(1100px, calc(100% - 2rem));
  box-shadow: var(--shadow);
}
.host-middle {
  flex: 1;
  display: grid;
  grid-template-columns: 110px 1fr 110px;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}
.host-media { display: flex; justify-content: center; align-items: center; min-height: 0; }
.host-media img { max-width: 100%; max-height: 40vh; border-radius: var(--radius); }
.reveal { position: relative; width: min(60vw, 560px, 53vh); aspect-ratio: 4 / 3; }
.reveal img { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; object-fit: cover; border-radius: 0; }
.reveal .tiles { position: absolute; inset: 0; display: grid; }
.reveal .tile { background: var(--purple-dark); outline: 1px solid var(--purple); transition: opacity 0.4s; }
.reveal .tile.gone { opacity: 0; }
.circle {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--purple-dark); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; font-weight: 900;
}
.counter { text-align: center; font-weight: 800; font-size: 2rem; }
.counter small { display: block; font-size: 0.9rem; font-weight: 700; }
.pinbox {
  background: #fff; color: var(--ink); border-radius: 8px;
  display: flex; align-items: center; gap: 1.5rem; padding: 0.8rem 1.5rem;
  box-shadow: var(--shadow);
}
.pinbox .pin { font-size: clamp(2.5rem, 7vw, 4.5rem); font-weight: 900; letter-spacing: 0.05em; }
.pinbox canvas, .pinbox img { width: 110px; height: 110px; }
.players { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; max-width: 1000px; }
.players button {
  background: rgba(0, 0, 0, 0.3); color: #fff; border: 0; border-radius: var(--radius);
  padding: 0.5em 1em; font-weight: 800; font-size: 1.1rem; cursor: pointer;
}
.players button:hover { text-decoration: line-through; }
.chart { display: flex; align-items: flex-end; justify-content: center; gap: 1rem; height: 30vh; }
.bar { width: 90px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.bar .fill { width: 100%; border-radius: var(--radius) var(--radius) 0 0; min-height: 6px; }
.bar .label {
  width: 100%; color: #fff; font-weight: 800; padding: 0.3em; display: flex; gap: 0.3em;
  align-items: center; justify-content: center;
}
.bar .label svg { width: 20px; height: 20px; }
.scoreboard { width: min(800px, 100%); display: flex; flex-direction: column; gap: 0.5rem; }
.scoreboard .row {
  background: #fff; color: var(--ink); display: flex; justify-content: space-between;
  padding: 0.8rem 1.2rem; font-weight: 800; font-size: 1.4rem; border-radius: var(--radius);
}
.scoreboard .row:first-child { background: var(--purple-dark); color: #fff; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 0.5rem; }
.podium .step {
  width: min(28vw, 220px); background: var(--purple-dark); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 1rem; font-weight: 900; border-radius: var(--radius) var(--radius) 0 0;
}
.podium .step .who { font-size: 1.4rem; padding: 0 0.5rem; word-break: break-word; }
.podium .step .medal { font-size: 3rem; }
.timebar { height: 8px; background: rgba(255, 255, 255, 0.3); }
.timebar div { height: 100%; background: #fff; transition: width 0.2s linear; }

/* ---------- editor ---------- */
.editor { display: grid; grid-template-columns: 240px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.editor header, .page-header {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 1rem;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.brand { font-weight: 900; color: var(--purple); font-size: 1.5rem; text-decoration: none; }
.grow { flex: 1; }
.page-header input.title {
  flex: 1; min-width: 0; border: 2px solid #ddd; border-radius: var(--radius); padding: 0.5em; font-weight: 700;
}
.sidebar { background: #fff; padding: 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; overflow-y: auto; }
.slide {
  border: 2px solid transparent; border-radius: var(--radius); background: var(--soft);
  padding: 0.5rem; cursor: pointer; text-align: left; display: flex; gap: 0.5rem; align-items: flex-start;
}
.slide.active { border-color: var(--blue); background: #e8f0fb; }
.slide .n { font-weight: 800; color: var(--muted); }
.slide .t { font-size: 0.85rem; font-weight: 700; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.slide .k { font-size: 0.75rem; color: var(--muted); }
.slide-actions { display: flex; gap: 0.3rem; margin-left: auto; }
.slide-actions button { border: 0; background: transparent; cursor: pointer; padding: 0 0.2rem; font-size: 1rem; }
.canvas { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; }
.qtext {
  width: 100%; border: 0; border-radius: var(--radius); padding: 0.8rem; text-align: center;
  font-size: 1.4rem; font-weight: 700; box-shadow: var(--shadow);
}
.settings { display: flex; flex-wrap: wrap; gap: 1rem; }
.settings label { display: flex; flex-direction: column; font-size: 0.85rem; font-weight: 700; gap: 0.2rem; }
.settings select, .settings input { padding: 0.4em; border: 2px solid #ddd; border-radius: var(--radius); background: #fff; }
.settings input[type="url"] { min-width: 260px; }
.preview-img { max-height: 180px; max-width: 100%; align-self: center; border-radius: var(--radius); }
.edit-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.edit-answer { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; border-radius: var(--radius); color: #fff; }
.edit-answer svg { width: 28px; height: 28px; flex: none; }
.edit-answer input[type="text"] {
  flex: 1; min-width: 0; border: 0; border-radius: var(--radius); padding: 0.6em; font-weight: 700; background: rgba(255, 255, 255, 0.95);
}
.edit-answer label { display: flex; align-items: center; gap: 0.2rem; font-size: 0.8rem; font-weight: 700; }
.edit-answer input[type="checkbox"], .edit-answer input[type="radio"] { width: 22px; height: 22px; }
.notice { padding: 0.6rem 1rem; border-radius: var(--radius); font-weight: 700; }
.notice.bad { background: #fde3e7; color: #a0122a; }
.notice.good { background: #e3f6d9; color: #2d6a12; }

/* ---------- llistat de qüestionaris ---------- */
.library { width: min(900px, 100%); margin: 1rem auto; padding: 0 1rem; display: flex; flex-direction: column; gap: 0.8rem; }
.quiz-row {
  background: #fff; border-radius: 8px; padding: 0.8rem 1rem; display: flex; align-items: center; gap: 0.8rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); flex-wrap: wrap;
}
.quiz-row h3 { margin: 0; font-size: 1.1rem; }
.quiz-row p { margin: 0; color: var(--muted); font-size: 0.85rem; }

@media (max-width: 720px) {
  .editor { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; }
  .slide { min-width: 160px; }
  .edit-answers { grid-template-columns: 1fr; }
  .host-middle { grid-template-columns: 70px 1fr 70px; }
  .reveal { position: relative; width: min(60vw, 560px, 53vh); aspect-ratio: 4 / 3; }
.reveal img { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; object-fit: cover; border-radius: 0; }
.reveal .tiles { position: absolute; inset: 0; display: grid; }
.reveal .tile { background: var(--purple-dark); outline: 1px solid var(--purple); transition: opacity 0.4s; }
.reveal .tile.gone { opacity: 0; }
.circle { width: 64px; height: 64px; font-size: 1.6rem; }
  .answers { grid-template-columns: 1fr; }
  .answers.player { grid-template-columns: 1fr 1fr; }
}

/* ---------- editor tipus Kahoot ---------- */
.k-editor {
  height: 100vh;
  display: grid;
  grid-template-columns: 180px 1fr 320px 80px;
  grid-template-rows: 56px 1fr;
  background: #fff;
}
.k-editor.panel-closed { grid-template-columns: 180px 1fr 0 80px; }
.k-editor.panel-closed .k-panel { display: none; }
.k-top {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 0.8rem; padding: 0 1rem;
  border-bottom: 1px solid #e5e5e5; background: #fff;
}
.k-title { border: 1px solid #ccc; border-radius: var(--radius); width: min(340px, 40vw); }
.k-title input { border: 0; padding: 0.6em 0.8em; width: 100%; font-weight: 700; background: transparent; }
.k-slides {
  background: #fff; border-right: 1px solid #e5e5e5; overflow-y: auto;
  padding: 0.6rem; display: flex; flex-direction: column; gap: 0.6rem;
}
.thumb-wrap { cursor: pointer; padding: 0.3rem; border-radius: var(--radius); }
.thumb-wrap.active { background: #eaf0fb; }
.thumb-wrap.dragging { opacity: 0.4; }
.thumb-label { font-size: 0.75rem; font-weight: 700; margin-bottom: 0.2rem; }
.thumb {
  border: 2px solid #ddd; border-radius: 6px; background: #f2f2f2; padding: 0.3rem;
  display: flex; flex-direction: column; gap: 0.25rem; aspect-ratio: 16 / 10;
}
.thumb-wrap.active .thumb { border-color: var(--blue); }
.thumb-q { font-size: 0.7rem; text-align: center; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb-mid { flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 0; }
.thumb-time {
  width: 20px; height: 20px; border-radius: 50%; border: 1px solid #ccc; font-size: 0.55rem;
  display: flex; align-items: center; justify-content: center; color: var(--muted); background: #fff;
}
.thumb-img { width: 34px; height: 24px; border: 1px dashed #bbb; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; overflow: hidden; }
.thumb-img img { width: 100%; height: 100%; object-fit: cover; }
.thumb-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.thumb-answers span { height: 6px; border: 1px solid #ccc; border-radius: 2px; background: #fff; }
.thumb-answers span.ok { background: var(--ok); border-color: var(--ok); }
.k-add { background: var(--blue); width: 100%; }

.k-canvas {
  position: relative; overflow-y: auto; padding: 1.2rem;
  display: flex; flex-direction: column; gap: 1rem; align-items: stretch;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.12), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(0, 0, 0, 0.2), transparent 45%),
    linear-gradient(160deg, #6a3fb5, #46178f 60%, #381272);
}
.k-question {
  border: 0; border-radius: var(--radius); background: #fff; padding: 0.7em; text-align: center;
  font-size: clamp(1.2rem, 2.2vw, 1.8rem); font-weight: 700; box-shadow: var(--shadow);
}
.k-media {
  align-self: center; width: min(520px, 100%); aspect-ratio: 16 / 10; border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.75); display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.k-media.drop { outline: 4px dashed #fff; }
.k-media.has-image { background: rgba(0, 0, 0, 0.15); }
.k-media img { max-width: 100%; max-height: 100%; object-fit: contain; }
.k-media-actions { position: absolute; top: 0.5rem; right: 0.5rem; display: flex; gap: 0.4rem; }
.k-media-empty { text-align: center; color: var(--ink); }
.k-media-empty p { margin: 0.4rem 0; font-size: 1.2rem; }
.k-media-empty p.small { font-size: 0.95rem; }
.k-media-empty u { cursor: pointer; font-weight: 700; }
.k-plus {
  width: 48px; height: 48px; border: 0; border-radius: var(--radius); background: #fff;
  font-size: 1.8rem; cursor: pointer; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.k-hint { color: #fff; margin: 0; text-align: center; font-weight: 700; }
.k-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.e-answer {
  background: #fff; border-radius: var(--radius); display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem; min-height: 96px; box-shadow: var(--shadow);
}
.e-answer.filled.c0 { background: var(--red); }
.e-answer.filled.c1 { background: var(--blue); }
.e-answer.filled.c2 { background: var(--yellow); }
.e-answer.filled.c3 { background: var(--green); }
.e-answer.filled input { color: #fff; }
.e-answer.filled input::placeholder { color: rgba(255, 255, 255, 0.7); }
.e-shape {
  width: 40px; align-self: stretch; border-radius: var(--radius); flex: none;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.4rem;
}
.e-shape.c0 { background: var(--red); }
.e-shape.c1 { background: var(--blue); }
.e-shape.c2 { background: var(--yellow); }
.e-shape.c3 { background: var(--green); }
.e-shape svg { width: 30px; height: 30px; }
.e-answer input {
  flex: 1; min-width: 0; border: 0; background: transparent; font-size: 1.15rem; font-weight: 700; padding: 0.4em;
}
.e-answer input:focus { outline: none; }
.e-count { color: var(--muted); font-size: 0.8rem; padding-right: 0.4rem; }
.e-correct {
  width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; background: transparent;
  color: transparent; font-size: 1.3rem; font-weight: 900; cursor: pointer; flex: none;
}
.e-correct.on { background: var(--ok); color: #fff; }

.k-panel {
  border-left: 1px solid #e5e5e5; background: #fff; padding: 1rem;
  display: flex; flex-direction: column; gap: 1rem; overflow-y: auto;
}
.k-panel-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 0.8rem; border-bottom: 1px solid #e5e5e5; }
.k-x { border: 0; background: transparent; font-size: 1.1rem; cursor: pointer; }
.k-field { display: flex; flex-direction: column; gap: 0.4rem; font-weight: 700; font-size: 0.95rem; }
.k-field select { padding: 0.6em; border: 1px solid #ccc; border-radius: var(--radius); background: #fff; font-weight: 400; }
.k-field small { font-weight: 400; color: var(--muted); }
.k-link { border: 0; background: transparent; color: var(--blue); text-decoration: underline; cursor: pointer; text-align: left; padding: 0; margin-top: -0.6rem; font-size: 0.85rem; }
.k-panel-foot { display: flex; justify-content: center; gap: 0.8rem; padding-top: 0.8rem; border-top: 1px solid #e5e5e5; }
.k-panel-toggle {
  grid-column: 4; grid-row: 2; border: 0; border-left: 1px solid #e5e5e5; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 1rem; gap: 0.2rem; font-size: 1.3rem; cursor: pointer;
}
.k-panel-toggle small { font-size: 0.7rem; font-weight: 700; }
.k-canvas .notice { align-self: stretch; }

@media (max-width: 900px) {
  .k-editor, .k-editor.panel-closed { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto; height: auto; min-height: 100vh; }
  .k-top { flex-wrap: wrap; padding: 0.5rem; }
  .k-slides { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid #e5e5e5; }
  .thumb-wrap { min-width: 130px; }
  .k-add { min-width: 110px; width: auto; }
  .k-panel-toggle { display: none; }
  .k-editor.panel-closed .k-panel { display: flex; }
  .k-answers { grid-template-columns: 1fr; }
}

/* ---------- logotip ---------- */
.ghoot { display: inline-flex; align-items: center; font-weight: 900; letter-spacing: -0.02em; line-height: 1; }
.ghoot-g { display: inline-flex; align-items: center; justify-content: center; }
.ghoot-g img { height: 1.25em; width: auto; display: block; margin-right: -0.08em; transform: translateY(0.12em); filter: drop-shadow(0 0 1px #1d3c8f) drop-shadow(0 0 1px #1d3c8f); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.save-status { color: var(--muted); font-size: 0.85rem; font-weight: 700; white-space: nowrap; }

/* ---------- tauler del professorat (com create.kahoot.it) ---------- */
.btn.blue { background: var(--blue); }
a.btn { text-decoration: none; display: inline-block; }
.btn .ico { width: 1.1em; height: 1.1em; vertical-align: -0.2em; }
.ico { width: 20px; height: 20px; flex: none; }
.dash {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 216px 1fr;
  grid-template-rows: 64px 1fr;
  background: var(--soft);
}
.d-top {
  grid-column: 1 / -1; position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem; padding: 0 1rem;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.d-top .brand { font-size: 1.6rem; }
.d-search {
  display: flex; align-items: center; gap: 0.5rem; width: min(360px, 34vw); margin-left: 12vw;
  border: 1px solid #ccc; border-radius: var(--radius); padding: 0 0.6rem; background: #fff; color: var(--muted);
}
.d-search input { border: 0; padding: 0.55em 0; flex: 1; min-width: 0; outline: none; color: var(--ink); }
.d-avatar {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: #ffa602; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none;
}
.d-avatar.mini { width: 28px; height: 28px; }
.d-avatar .ico { width: 18px; height: 18px; }
.d-burger { display: none; border: 0; background: transparent; cursor: pointer; padding: 0.3rem; }
.d-nav {
  position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  display: flex; flex-direction: column; gap: 2px; padding: 0.4rem 0.25rem; z-index: 10;
}
.d-nav a {
  display: flex; align-items: center; gap: 0.7rem; height: 40px; padding: 4px 12px; border-radius: var(--radius);
  color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 700;
}
.d-nav a .ico { color: var(--purple); }
.d-nav a:hover { background: #f2f2f2; }
.d-nav a.active { background: var(--purple); color: #fff; }
.d-nav a.active .ico { color: #fff; }
.d-nav .d-nav-foot { font-weight: 500; border-top: 1px solid #e5e5e5; border-radius: 0; }
.d-main { min-width: 0; }
.d-main[aria-busy="true"] { opacity: 0.6; transition: opacity 0.2s 0.15s; }
.d-page { padding: 1.5rem clamp(1rem, 3vw, 2.5rem); max-width: 1240px; margin: 0 auto; }

/* columna secundària (Biblioteca, Informes, Grups) */
.d-split { display: grid; grid-template-columns: 180px 1fr; min-height: calc(100vh - 64px); }
.d-sub {
  background: #fff; border-right: 1px solid #e5e5e5; padding: 0.8rem 0.3rem;
  display: flex; flex-direction: column; gap: 2px;
}
.d-sub a, .d-sub .link-btn {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.6rem; border-radius: var(--radius);
  color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; border: 0; background: transparent;
  text-align: left; cursor: pointer;
}
.d-sub a:hover, .d-sub .link-btn:hover { background: #f2f2f2; }
.d-sub a.active { background: #e8f0fb; color: var(--blue); font-weight: 700; }
.d-sub .indent { padding-left: 1.2rem; font-weight: 500; }
.d-sub .ico { width: 18px; height: 18px; }
.d-sub hr { border: 0; border-top: 1px solid #e5e5e5; width: 100%; margin: 0.6rem 0; }
.d-sub-title { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.6rem; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.d-content { padding: 1.2rem clamp(1rem, 3vw, 2.5rem); min-width: 0; }
.d-content.narrow { max-width: 1060px; width: 100%; margin: 0 auto; }
.d-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.d-head h1 { margin: 0; font-size: 1.6rem; font-weight: 800; display: flex; align-items: center; gap: 0.6rem; }

.d-tabs { display: inline-flex; border: 1px solid #ccc; border-radius: var(--radius); background: #fff; overflow: hidden; margin-bottom: 1rem; }
.d-tabs a { padding: 0.55rem 1rem; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 14px; border-right: 1px solid #ccc; }
.d-tabs a:last-child { border-right: 0; }
.d-tabs a.active { background: #e8f0fb; color: var(--blue); }
.d-toolbar { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.d-field-search { display: flex; align-items: center; gap: 0.5rem; background: #fff; border: 1px solid #ccc; border-radius: var(--radius); padding: 0 0.6rem; color: var(--muted); width: min(260px, 100%); }
.d-field-search input { border: 0; outline: none; padding: 0.55em 0; flex: 1; min-width: 0; color: var(--ink); }
.d-toggle { display: flex; gap: 2px; }
.d-toggle button { border: 0; background: transparent; padding: 0.35rem; border-radius: var(--radius); cursor: pointer; color: #999; }
.d-toggle button.on { color: var(--purple); background: #ece5f6; }

/* targetes de qüestionari */
.q-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 0.6rem; }
.q-card { background: #fff; border-radius: var(--radius); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column; overflow: hidden; }
.q-card:hover { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18); }
.q-kind { display: flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; color: var(--muted); padding: 0.2rem 0.4rem; }
.q-kind .ico { width: 12px; height: 12px; color: var(--purple); }
.q-cover, .q-thumb { position: relative; display: block; aspect-ratio: 3 / 2; background: #e9e4f2; overflow: hidden; }
.q-cover img, .q-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.q-cover-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #6a3fb5, #46178f); color: #fff; font-size: 1.4rem; }
.q-thumb .q-cover-empty { font-size: 0.8rem; }
.q-cover-empty .ghoot-g img { width: auto; height: 1.25em; object-fit: initial; }
.q-count { position: absolute; right: 4px; bottom: 4px; background: rgba(0, 0, 0, 0.75); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.35rem; border-radius: var(--radius); }
.q-body { display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 0.2rem; padding: 0.4rem 0.2rem 0.5rem 0.5rem; }
.q-title { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.9rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.q-title:hover { text-decoration: underline; }
.q-sub { font-size: 0.75rem; color: var(--muted); grid-column: 1; }
.kebab { border: 0; background: transparent; cursor: pointer; font-size: 1.2rem; font-weight: 900; line-height: 1; padding: 0.15rem 0.35rem; border-radius: var(--radius); color: var(--ink); align-self: start; }
.kebab:hover { background: #f2f2f2; }
.kebab.big { font-size: 1.4rem; padding: 0.35rem 0.55rem; }
.kebab .ico { width: 22px; height: 22px; }
.q-table { background: #fff; border-radius: var(--radius); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.q-row { display: grid; grid-template-columns: 64px 1fr 160px 120px 36px; align-items: center; gap: 0.8rem; padding: 0.35rem 0.8rem; border-bottom: 1px solid #eee; }
.q-row.head { background: #f5f5f5; font-size: 0.8rem; font-weight: 700; padding: 0.5rem 0.8rem; }
.q-row .q-thumb { border-radius: var(--radius); }
.q-row .q-count { font-size: 0.55rem; white-space: nowrap; right: 2px; bottom: 2px; }
.q-row-main { display: flex; flex-direction: column; min-width: 0; }
.q-row-date { font-size: 0.85rem; color: var(--muted); }
.q-row-groups { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.tag { display: inline-block; background: #ece5f6; color: var(--purple); font-weight: 700; font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 999px; text-decoration: none; }
.muted-ink { color: var(--muted); }
.empty-big { background: #fff; border-radius: 8px; padding: 2.5rem 1rem; text-align: center; color: var(--muted); font-weight: 600; line-height: 1.8; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08); }
.empty-big .btn { margin-top: 0.6rem; }
.empty { color: var(--muted); font-size: 0.9rem; margin: 0.4rem 0; }
.huge-ico { width: 48px; height: 48px; color: var(--purple); }

/* menús i finestres */
.d-menu {
  position: absolute; z-index: 100; background: #fff; border-radius: var(--radius); min-width: 210px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); padding: 0.3rem 0; display: flex; flex-direction: column;
}
.d-menu button { display: flex; align-items: center; gap: 0.7rem; border: 0; background: transparent; padding: 0.5rem 1rem; cursor: pointer; text-align: left; font-size: 0.9rem; color: var(--ink); }
.d-menu button:hover, .d-menu button:focus { background: #f2f2f2; outline: none; }
.d-menu button.danger { color: var(--red); }
.d-menu .ico { width: 18px; height: 18px; }
.d-menu hr { border: 0; border-top: 1px solid #eee; margin: 0.3rem 0; }
.d-modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.d-modal { background: #fff; border-radius: 8px; padding: 1.2rem 1.4rem; width: min(440px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.d-modal h2 { margin: 0 0 0.6rem; font-size: 1.3rem; }
.d-modal p { margin: 0 0 0.8rem; }
.d-modal-foot { display: flex; justify-content: center; gap: 0.8rem; margin-top: 1.2rem; }
.d-label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 700; font-size: 0.9rem; }
.d-count-input { display: flex; align-items: center; border: 1px solid #ccc; border-radius: var(--radius); padding-right: 0.6rem; }
.d-count-input input { border: 0; outline: none; padding: 0.6em; flex: 1; min-width: 0; }
.d-count-input small { color: var(--muted); font-weight: 400; }
.d-choices { display: flex; flex-direction: column; gap: 0.3rem; }
.d-choices.scroll { max-height: 50vh; overflow-y: auto; }
.d-choice { display: flex; align-items: center; gap: 0.7rem; padding: 0.45rem 0.6rem; border: 1px solid #e5e5e5; border-radius: var(--radius); cursor: pointer; }
.d-choice:hover { background: #f7f7f7; }
.d-choice input { width: 18px; height: 18px; flex: none; }
.d-choice small { display: block; color: var(--muted); }
.d-inline-form { display: flex; gap: 0.5rem; margin-top: 0.8rem; }
.d-inline-form input { flex: 1; min-width: 0; border: 1px solid #ccc; border-radius: var(--radius); padding: 0.45em 0.6em; }
.q-thumb.tiny { width: 54px; flex: none; border-radius: var(--radius); }
.g-avatar {
  width: 40px; height: 40px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 0.85rem;
  display: inline-flex; align-items: center; justify-content: center; flex: none; letter-spacing: -0.02em;
}
.g-avatar.small { width: 30px; height: 30px; font-size: 0.7rem; }
.g-avatar.none { background: #ccc; }

/* inici */
.panel { background: #fff; border-radius: 8px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); padding: 0.9rem 1rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.panel-head h3 { margin: 0; font-size: 1rem; font-weight: 800; }
.panel-head.plain { margin: 0.6rem 0; }
.link, .link-ico { border: 0; background: transparent; color: var(--blue); font-weight: 700; cursor: pointer; font-size: 0.85rem; text-decoration: none; padding: 0; }
.link:hover { text-decoration: underline; }
.link-ico { color: var(--ink); }
.link-ico .ico { width: 20px; height: 20px; }
.center-link { display: block; text-align: center; margin-top: 0.6rem; text-decoration: underline; }
.h-toolbar h2 { margin: 0 0 0.8rem; font-size: 1.1rem; font-weight: 800; }
.h-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.6rem; margin-bottom: 1.2rem; }
.h-card {
  border: 0; border-radius: 8px; padding: 1rem; text-align: left; cursor: pointer; text-decoration: none;
  background: linear-gradient(120deg, #46178f, #864cbf); color: #fff; display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.7rem; align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}
.h-card:hover { filter: brightness(1.1); }
.h-card .ico { grid-row: span 2; width: 26px; height: 26px; }
.h-card span { font-size: 0.85rem; opacity: 0.9; }
.h-cols { display: grid; grid-template-columns: 1fr 300px; gap: 1rem; align-items: start; }
.h-side { display: flex; flex-direction: column; gap: 1rem; }
.h-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.5rem; }
.h-group { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem; border: 1px solid #eee; border-radius: 8px; color: var(--ink); text-decoration: none; }
.h-group:hover { background: #f7f7f7; }
.h-group small, .h-quiz small { display: block; color: var(--muted); font-size: 0.75rem; }
.h-quiz { display: grid; grid-template-columns: 90px 1fr; border: 1px solid #ddd; border-radius: var(--radius); overflow: hidden; margin-bottom: 0.4rem; color: var(--ink); text-decoration: none; }
.h-quiz > span:last-child { padding: 0.4rem 0.6rem; display: flex; flex-direction: column; justify-content: space-between; font-size: 0.85rem; }
.h-quiz b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-quiz .q-count { font-size: 0.6rem; }
.h-report { display: flex; gap: 0.6rem; align-items: center; padding: 0.5rem; border: 1px solid #eee; border-radius: var(--radius); margin-bottom: 0.4rem; color: var(--ink); text-decoration: none; font-size: 0.85rem; }
.h-report .ico { color: var(--purple); }
.h-report small.ok { display: block; color: var(--green); font-weight: 700; font-size: 0.75rem; }

/* fitxa d'un qüestionari */
.quiz-detail { display: grid; grid-template-columns: 340px 1fr; gap: 1.2rem; align-items: start; }
.qd-side { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 0.6rem; }
.qd-cover { position: relative; aspect-ratio: 3 / 2; border-radius: var(--radius); overflow: hidden; }
.qd-cover img { width: 100%; height: 100%; object-fit: cover; }
.qd-side h1 { margin: 0; font-size: 1.4rem; }
.qd-side p { margin: 0; font-size: 0.85rem; }
.qd-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.qd-actions .btn { text-decoration: none; }
.qd-groups { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; font-size: 0.9rem; }
.qd-questions h2 { margin: 0 0 0.6rem; font-size: 1.1rem; }
.qd-q { margin-bottom: 0.5rem; padding: 0; overflow: hidden; }
.qd-q summary { display: grid; grid-template-columns: 1fr auto auto; grid-template-rows: auto auto; gap: 0.2rem 0.8rem; padding: 0.7rem 1rem; cursor: pointer; align-items: center; list-style: none; }
.qd-q summary::-webkit-details-marker { display: none; }
.qd-n { font-size: 0.75rem; color: var(--muted); grid-column: 1; }
.qd-q summary b { grid-column: 1; }
.qd-meta { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 0.3rem; align-items: center; color: var(--muted); font-size: 0.85rem; }
.qd-meta .ico { width: 16px; height: 16px; }
.qd-q summary img { grid-row: 1 / span 2; grid-column: 3; width: 90px; height: 60px; object-fit: cover; border-radius: var(--radius); }
.qd-q ul { margin: 0; padding: 0.4rem 1rem 0.8rem; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem 1rem; border-top: 1px solid #eee; }
.qd-q li { color: var(--red); font-weight: 600; }
.qd-q li.ok { color: var(--green); }

/* informes */
.d-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }
.d-pills a { padding: 0.3rem 0.7rem; border-radius: var(--radius); background: #fff; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.85rem; border: 1px solid #ddd; }
.d-pills a.on { background: #e8f0fb; color: var(--blue); border-color: #bcd3f2; font-weight: 700; }
.r-list { display: flex; flex-direction: column; background: #fff; border-radius: var(--radius); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); overflow: hidden; }
.r-list .empty-big { box-shadow: none; }
.r-row { display: grid; grid-template-columns: 1fr auto 70px 60px 36px; align-items: center; gap: 0.8rem; padding: 0.6rem 0.8rem; border-bottom: 1px solid #eee; color: var(--ink); text-decoration: none; }
.r-row:hover { background: #fafafa; }
.r-main { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.r-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-main > span { font-size: 0.8rem; color: var(--muted); }
.pill-ok { border: 1px solid var(--green); color: var(--green); font-weight: 700; font-size: 0.75rem; padding: 0 0.35rem; border-radius: 3px; margin-right: 0.3rem; }
.r-players { display: flex; align-items: center; gap: 0.25rem; justify-content: flex-end; font-weight: 700; }
.r-players .ico { width: 16px; height: 16px; color: var(--muted); }
.donut { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 700; font-size: 0.85rem; }
.donut svg { transform: none; flex: none; }
.report .rp-head {
  display: grid; grid-template-columns: 1fr 260px; gap: 1rem; background: #fff; margin: -1.5rem calc(-1 * clamp(1rem, 3vw, 2.5rem)) 1.2rem;
  padding: 1.2rem clamp(1rem, 3vw, 2.5rem) 0; border-bottom: 1px solid #e5e5e5;
}
.rp-title small { font-weight: 700; }
.rp-title h1 { margin: 0.2rem 0 0.9rem; font-size: 1.8rem; font-weight: 800; display: flex; align-items: center; gap: 0.4rem; }
.rp-title .d-tabs { border: 0; border-radius: 0; margin: 0; background: transparent; }
.rp-title .d-tabs a { border: 0; border-bottom: 3px solid transparent; padding: 0.6rem 0.8rem; background: transparent; color: #666; }
.rp-title .d-tabs a.active { border-bottom-color: var(--purple); color: var(--ink); background: transparent; }
.rp-meta { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.85rem; padding-bottom: 0.8rem; }
.rp-meta > div { border-bottom: 1px solid #e5e5e5; padding-bottom: 0.5rem; }
.rp-meta .link { align-self: flex-start; color: var(--ink); }
.rp-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; }
.rp-hero { display: flex; gap: 1.2rem; align-items: center; }
.rp-hero .donut { flex-direction: column; position: relative; }
.rp-hero .donut span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 900; }
.rp-hero h2 { margin: 0 0 0.4rem; font-size: 1.6rem; font-weight: 900; }
.rp-hero p { margin: 0 0 0.8rem; }
.rp-hero .btn { text-decoration: none; display: inline-block; }
.rp-stats { display: flex; flex-direction: column; justify-content: center; }
.rp-stats div { display: grid; grid-template-columns: 24px 1fr auto; gap: 0.5rem; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid #eee; }
.rp-stats div:last-child { border-bottom: 0; }
.rp-stats .ico { color: var(--purple); }
.rp-podium { display: flex; align-items: flex-end; justify-content: center; gap: 0.4rem; background: linear-gradient(160deg, #e8f0fb, #cfe0f7); }
.rp-step { display: flex; flex-direction: column; align-items: center; text-align: center; background: var(--purple); color: #fff; border-radius: 6px 6px 0 0; padding: 0.4rem; width: 31%; min-width: 0; }
.rp-step b { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.rp-step small { font-size: 0.7rem; opacity: 0.85; }
.rp-step.s1 { order: 2; min-height: 130px; }
.rp-step.s2 { order: 1; min-height: 100px; }
.rp-step.s3 { order: 3; min-height: 80px; }
.rp-step span { font-size: 1.6rem; }
.rp-box .hint { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.75rem; cursor: help; }
.rp-dq { display: flex; flex-direction: column; gap: 0.2rem; border: 1px solid #eee; border-radius: var(--radius); padding: 0.6rem; margin-bottom: 0.5rem; color: var(--ink); text-decoration: none; }
.rp-dq-foot { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; background: #f5f5f5; margin: 0.3rem -0.6rem -0.6rem; padding: 0.4rem 0.6rem; }
.rp-line { display: flex; justify-content: space-between; align-items: center; padding: 0.45rem 0; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; }
.rp-line small { color: var(--muted); }
.rp-table { padding: 0; overflow-x: auto; }
.rp-table table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.rp-table th { text-align: left; background: #f5f5f5; padding: 0.6rem 1rem; font-size: 0.8rem; }
.rp-table td { padding: 0.55rem 1rem; border-bottom: 1px solid #eee; }
.rp-table .num { text-align: right; }
.d-subtabs { display: flex; gap: 1rem; padding: 0 1rem; border-bottom: 1px solid #eee; }
.d-subtabs a { padding: 0.7rem 0; color: #666; text-decoration: none; font-weight: 700; font-size: 0.9rem; border-bottom: 3px solid transparent; }
.d-subtabs a.on { color: var(--ink); border-bottom-color: var(--ink); }

/* grups */
.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 0.6rem; }
.g-card { background: #fff; border-radius: var(--radius); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); padding: 0.8rem; min-height: 110px; display: flex; flex-direction: column; gap: 0.3rem; color: var(--ink); text-decoration: none; }
.g-card:hover { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18); }
.g-card b { margin-top: auto; font-size: 1rem; }
.g-card small { color: var(--muted); font-size: 0.75rem; }
.d-tabbar { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; margin-bottom: 1rem; flex-wrap: wrap; }
.d-seg { display: inline-flex; border: 1px solid #ccc; border-radius: var(--radius); overflow: hidden; background: #fff; }
.d-seg a { padding: 0.55rem 0.9rem; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.9rem; border-right: 1px solid #ccc; }
.d-seg a:last-child { border-right: 0; }
.d-seg a.on { background: #e8f0fb; color: var(--blue); font-weight: 700; }
.feed-item { margin-bottom: 0.8rem; }
.feed-head { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; margin-bottom: 0.6rem; }
.feed-head small { margin-left: auto; color: var(--muted); white-space: nowrap; }
.feed-quiz, .feed-report { display: flex; align-items: center; gap: 0.8rem; border: 1px solid #eee; border-radius: var(--radius); padding: 0.4rem; }
.feed-quiz .q-thumb { width: 100px; flex: none; border-radius: var(--radius); }
.feed-quiz small { display: block; color: var(--muted); font-size: 0.8rem; }
.feed-quiz .btn, .feed-report .btn { text-decoration: none; }
.setup { margin-bottom: 0.8rem; }
.setup-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.setup-card { border: 1px solid #ddd; border-radius: var(--radius); background: #fff; padding: 1.2rem 0.6rem; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; cursor: pointer; text-decoration: none; color: var(--ink); text-align: center; }
.setup-card:hover { background: #fafafa; }
.setup-card small { color: var(--muted); }
.setup-card.done { cursor: default; }

@media (max-width: 1000px) {
  .h-cols, .quiz-detail { grid-template-columns: 1fr; }
  .qd-side { position: static; }
  .rp-grid { grid-template-columns: 1fr 1fr; }
  .rp-hero { grid-column: 1 / -1; }
  .report .rp-head { grid-template-columns: 1fr; }
  .d-search { margin-left: 0; }
}
@media (max-width: 760px) {
  .dash { grid-template-columns: 1fr; grid-template-rows: 56px 1fr; }
  .d-top { gap: 0.5rem; padding: 0 0.6rem; }
  .d-burger { display: inline-flex; }
  .d-search { display: none; }
  .d-nav { position: fixed; top: 56px; left: 0; width: 240px; height: calc(100vh - 56px); transform: translateX(-105%); transition: transform 0.2s; }
  .dash.nav-open .d-nav { transform: none; }
  .d-split { grid-template-columns: 1fr; }
  .d-sub { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid #e5e5e5; padding: 0.4rem; }
  .d-sub hr, .d-sub-title { display: none; }
  .d-sub a, .d-sub .link-btn { white-space: nowrap; }
  .q-row { grid-template-columns: 56px 1fr 36px; }
  .q-row-groups, .q-row-date, .q-row.head { display: none; }
  .r-row { grid-template-columns: 1fr 50px 36px; }
  .r-group, .r-pct { display: none; }
  .rp-grid, .setup-cards { grid-template-columns: 1fr; }
  .rp-hero { flex-direction: column; text-align: center; }
  .qd-q ul { grid-template-columns: 1fr; }
}

/* ---------- avatars dels alumnes ---------- */
svg.avatar { display: block; width: 100%; height: auto; overflow: visible; }
.me { display: inline-flex; align-items: center; gap: 0.5rem; }
.me svg.avatar { width: 32px; height: 32px; flex: none; }
.scoreboard .me svg.avatar { width: 44px; height: 44px; }
.scoreboard .row { align-items: center; }
.rp-table .me svg.avatar { width: 28px; height: 28px; }
.av-screen { justify-content: flex-start; padding-top: 1.2rem; }
.av-preview { position: relative; width: 150px; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.av-preview b { font-size: 1.3rem; }
.av-preview.small { width: 110px; }
.av-edit {
  position: absolute; right: -4px; top: 96px; width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--purple);
  background: #fff; font-size: 1.2rem; cursor: pointer; box-shadow: var(--shadow);
}
.av-panel { background: #fff; color: var(--ink); border-radius: 8px; padding: 0.6rem 0.8rem 0.8rem; width: min(560px, 100%); box-shadow: var(--shadow); text-align: left; }
.av-panel h3 { margin: 0.5rem 0 0.3rem; font-size: 0.95rem; }
.av-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 0.4rem; }
.av-row.colors { grid-template-columns: repeat(6, 1fr); }
.av-opt {
  border: 3px solid transparent; background: #f2f2f2; border-radius: 8px; padding: 0.3rem 0.2rem 0.2rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 0.1rem; color: var(--ink);
}
.av-opt svg.avatar { width: 52px; height: 52px; }
.av-opt small { font-size: 0.7rem; font-weight: 700; }
.av-opt.on { border-color: var(--blue); background: #e8f0fb; }
.av-row.colors small { display: none; }
.av-swatch { width: 36px; height: 36px; border-radius: 50%; display: block; }
.av-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }
.av-actions .btn { font-size: 1.1rem; }
.link-white { border: 0; background: transparent; color: #fff; opacity: 0.85; text-decoration: underline; cursor: pointer; }
.players button { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.35em 0.9em 0.35em 0.35em; }
.players button svg.avatar { width: 44px; height: 44px; }
.podium .podium-av { width: min(90px, 70%); margin-top: -60px; }
.podium { margin-top: 4rem; }
.podium .step { overflow: visible; }
.bottombar .me svg.avatar { width: 30px; height: 30px; }

/* ---------- música de l'amfitrió ---------- */
.music-btn {
  position: fixed; right: 14px; bottom: 14px; z-index: 50; width: 52px; height: 52px; border-radius: 50%;
  border: 0; background: #fff; font-size: 1.5rem; cursor: pointer; box-shadow: var(--shadow);
}
.music-pick { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 700; }
.music-pick select { border: 0; border-radius: var(--radius); padding: 0.45em 0.5em; font-weight: 700; background: #fff; color: var(--ink); }

/* ---------- revelació del podi ---------- */
.podium-screen { justify-content: flex-start; padding-top: 1.5rem; }
.podium .step { transition: opacity 0.6s, transform 0.6s cubic-bezier(.2,1.4,.4,1); }
.podium .step.hidden { opacity: 0; transform: translateY(60px) scale(0.9); }
.podium-rest {
  list-style: none; margin: 0.4rem 0 0; padding: 0; width: min(560px, 100%);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.35rem;
  counter-reset: pos 3; transition: opacity 0.6s;
}
.podium-rest li {
  counter-increment: pos; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  background: rgba(0, 0, 0, 0.25); border-radius: var(--radius); padding: 0.25rem 0.7rem 0.25rem 0.4rem; font-weight: 700; font-size: 0.95rem;
}
.podium-rest li::before { content: counter(pos) "."; opacity: 0.7; min-width: 1.6em; }
.podium-rest li .me { flex: 1; min-width: 0; }
.podium-rest li .me svg.avatar { width: 28px; height: 28px; }
.podium-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; transition: opacity 0.6s; }
.podium-rest.hidden, .podium-actions.hidden { opacity: 0; visibility: hidden; }
.drum { animation: drum 0.25s ease-in-out infinite alternate; }
@keyframes drum { from { transform: rotate(-8deg) scale(1); } to { transform: rotate(8deg) scale(1.08); } }

/* ---------- comptes i configuració ---------- */
.d-me-name { font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.d-avatar { font-weight: 900; font-size: 1rem; }
.owner-tag { background: #eee; color: var(--muted); border-radius: 999px; padding: 0 0.45rem; font-size: 0.7rem; font-weight: 700; margin-left: 0.3rem; }
.settings { max-width: 900px; display: flex; flex-direction: column; gap: 1rem; }
.settings h1 { margin: 0; font-size: 1.6rem; font-weight: 800; }
.set-form { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: flex-end; }
.set-form input[type="text"], .set-form input[type="password"], .set-form input:not([type]) { border: 1px solid #ccc; border-radius: var(--radius); padding: 0.55em 0.6em; min-width: 170px; font-weight: 400; }
.d-check { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; font-size: 0.9rem; padding-bottom: 0.5rem; }
.d-check input { width: 18px; height: 18px; }
.set-msg { margin: 0.6rem 0 0; font-weight: 700; min-height: 1.2em; }
.set-msg.good { color: var(--green); }
.set-msg.bad { color: var(--red); }
.users-table { margin-top: 1rem; box-shadow: none; border: 1px solid #eee; border-radius: var(--radius); }
.login-card input { text-align: left; }
@media (max-width: 760px) { .d-me-name { display: none; } }

/* ---------- comptador de punts a la classificació ---------- */
.score-cell { display: inline-flex; align-items: center; gap: 0.6rem; font-variant-numeric: tabular-nums; }
.score-cell .gain { background: var(--green); color: #fff; font-size: 0.9rem; padding: 0.1rem 0.45rem; border-radius: var(--radius); }
.scoreboard .row:first-child .gain { background: #fff; color: var(--green); }
.counting .count { display: inline-block; transform: scale(1.12); transition: transform 0.15s; color: var(--blue); }
.scoreboard .row:first-child .counting .count, .counting .row:first-child .count { color: #ffd84d; }
#count { font-variant-numeric: tabular-nums; }

/* nota 🎵 de la sala d'espera: clica per silenciar */
.music-note { border: 0; background: rgba(255, 255, 255, 0.15); color: #fff; border-radius: 50%; width: 38px; height: 38px; font-size: 1.2rem; cursor: pointer; }
.music-note:hover { background: rgba(255, 255, 255, 0.3); }
.music-note[aria-pressed="true"] { background: rgba(0, 0, 0, 0.35); }

/* ---------- logo AV ---------- */
.av-logo { display: block; height: 44px; width: auto; opacity: 0.9; }
.av-logo.light { filter: brightness(0) invert(1); margin-top: 0.4rem; }
.av-logo.header { height: 30px; opacity: 0.85; }

/* botons de la barra superior de l'amfitrió (Finalitza + Següent/Salta) */
.top-actions { display: inline-flex; gap: 0.5rem; align-items: center; }
