@import url('./tokens.css');

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100dvh;
  line-height: 1.5;
}

/* ── Nav ──────────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-6);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-logo {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.25rem;
  color: var(--c-brand);
  text-decoration: none;
  letter-spacing: -.5px;
}

.nav-right { display: flex; align-items: center; gap: var(--sp-3); }

.nav-user {
  font-size: .875rem;
  font-weight: 600;
  color: var(--c-text-muted);
}

/* ── Landing ─────────────────────────────────────────────────── */
.landing-wrap {
  min-height: 100dvh;
  background: linear-gradient(135deg, #2d1b69 0%, #5c35bb 60%, #7c4dff 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: var(--sp-12) var(--sp-10);
  gap: var(--sp-10);
}

@media (max-width: 768px) {
  .landing-wrap {
    grid-template-columns: 1fr;
    padding: var(--sp-10) var(--sp-6) var(--sp-8);
    justify-items: center;
    text-align: center;
  }
  .landing-right { display: none; }
  .landing-btns  { margin: 0 auto; }
}

.landing-left {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.landing-logo {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: clamp(2.5rem, 6vw, 4rem);
  color: #fff;
  letter-spacing: -1px;
  text-shadow: 0 2px 12px rgba(0,0,0,.3);
  line-height: 1;
}

.landing-sub {
  font-size: 1.125rem;
  color: rgba(255,255,255,.75);
}

.landing-btns {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: 100%;
  max-width: 280px;
  margin-top: var(--sp-2);
}

.landing-right {
  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-mock {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  width: 100%;
  max-width: 360px;
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), var(--shadow-lg);
}

.landing-mock-q {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  text-align: center;
  margin-bottom: var(--sp-4);
  line-height: 1.35;
  padding: 0 var(--sp-2);
}

.landing-mock-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
}

.landing-mock-ans {
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-3);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .875rem;
  color: #fff;
  text-align: center;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  opacity: .92;
}

.landing-lang {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-5);
  z-index: 10;
}

/* ── Botons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: .625rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .9375rem;
  cursor: pointer;
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform 80ms var(--ease), box-shadow 120ms var(--ease), background 120ms;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--c-brand);
  color: #fff;
  box-shadow: 0 3px 10px rgba(92,53,187,.35);
}
.btn-primary:hover { background: var(--c-brand-dark); box-shadow: 0 4px 14px rgba(92,53,187,.45); }

.btn-outline {
  background: transparent;
  border-color: #fff;
  color: #fff;
}
.btn-outline:hover { background: rgba(255,255,255,.15); }

.btn-outline-brand {
  background: transparent;
  border-color: var(--c-brand);
  color: var(--c-brand);
}
.btn-outline-brand:hover { background: var(--c-brand-light); }

.btn-ghost {
  background: transparent;
  color: var(--c-text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--c-surface-2); color: var(--c-text); }

.btn-danger {
  background: var(--c-error);
  color: #fff;
}
.btn-danger:hover { filter: brightness(.9); }

.btn-lg { padding: .875rem 1.75rem; font-size: 1.0625rem; border-radius: var(--radius-lg); width: 100%; }
.btn-sm { padding: .375rem .75rem; font-size: .8125rem; border-radius: var(--radius-sm); }

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Cards / panels ───────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow);
}

.card-sm { padding: var(--sp-4); border-radius: var(--radius); }

/* ── Auth layout ──────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  background: var(--c-bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl);
  padding: var(--sp-8);
  box-shadow: var(--shadow-lg);
}

.auth-head {
  text-align: center;
  margin-bottom: var(--sp-8);
}

.auth-brand {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.75rem;
  color: var(--c-brand);
  display: block;
  margin-bottom: var(--sp-1);
}

.auth-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--c-text);
}

/* ── Formularis ───────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-5); }

.field label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--c-text);
}

.field input, .field select, .field textarea {
  padding: .6875rem .875rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .9375rem;
  color: var(--c-text);
  background: var(--c-surface);
  transition: border-color 150ms;
  outline: none;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(92,53,187,.15);
}

.field-error {
  font-size: .8125rem;
  color: var(--c-error);
  display: none;
}

.field.has-error input,
.field.has-error select { border-color: var(--c-error); }
.field.has-error .field-error { display: block; }

.form-footer {
  text-align: center;
  margin-top: var(--sp-5);
  font-size: .875rem;
  color: var(--c-text-muted);
}

.form-footer a { color: var(--c-brand); font-weight: 600; text-decoration: none; }
.form-footer a:hover { text-decoration: underline; }

/* ── Alertes ──────────────────────────────────────────────────── */
.alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: var(--sp-5);
  display: none;
}
.alert.visible { display: block; }
.alert-error   { background: var(--c-error-bg);   color: var(--c-error); }
.alert-success { background: var(--c-correct-bg); color: var(--c-correct); }
.alert-warn    { background: var(--c-warn-bg);    color: var(--c-warn); }

/* ── Spinner ──────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}
.spinner.visible { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Dashboard layout ─────────────────────────────────────────── */
.page-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-6);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-8);
  flex-wrap: wrap;
  gap: var(--sp-4);
}

.page-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--c-text);
}

/* ── Language selector ────────────────────────────────────────── */
.lang-sel {
  padding: .3rem .5rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: .8125rem;
  font-family: var(--font-body);
  background: var(--c-surface);
  color: var(--c-text-muted);
  cursor: pointer;
  outline: none;
}
.lang-sel:focus { border-color: var(--c-brand); }

/* Landing lang selector override */
.landing-lang .lang-sel {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.4);
  color: #fff;
}

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  color: var(--c-text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--sp-4);
  opacity: .4;
}

.empty-state p {
  font-size: 1rem;
  margin-bottom: var(--sp-6);
}

/* ── Utils ────────────────────────────────────────────────────── */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.hidden { display: none !important; }

/* ── Test grid / cards ────────────────────────────────────────── */
.test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-4);
}

.test-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  transition: box-shadow 150ms;
}
.test-card { transition: box-shadow 150ms, transform 150ms var(--ease); }
.test-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.test-card-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  color: var(--c-text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.test-card-desc {
  font-size: .8125rem;
  color: var(--c-text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.test-card-meta {
  font-size: .75rem;
  color: var(--c-text-muted);
  display: flex;
  gap: var(--sp-3);
}

.test-card-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ── Modal ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  z-index: 200;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--c-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-lg { max-width: 680px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--c-text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--c-text-muted);
  cursor: pointer;
  padding: var(--sp-1);
  border-radius: var(--radius-sm);
  line-height: 1;
}
.modal-close:hover { background: var(--c-surface-2); color: var(--c-text); }

.modal-body {
  padding: var(--sp-5) var(--sp-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--c-border);
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
  flex-shrink: 0;
}

.modal-errors {
  margin-top: var(--sp-3);
  font-size: .8125rem;
  color: var(--c-error);
  background: var(--c-error-bg);
  border-radius: var(--radius);
  padding: var(--sp-3);
  display: none;
}
.modal-errors.visible { display: block; }
.modal-errors li { margin-left: var(--sp-4); }

/* ── Editor ───────────────────────────────────────────────────── */
.editor-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-6);
}

.editor-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  margin-bottom: var(--sp-5);
  box-shadow: var(--shadow);
}

.editor-section-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .9375rem;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: var(--sp-5);
}

.editor-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
@media (max-width: 500px) { .editor-row { grid-template-columns: 1fr; } }

/* ── Question cards ───────────────────────────────────────────── */
.q-list { display: flex; flex-direction: column; gap: var(--sp-4); }

.q-card {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.q-card-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
}

.q-card-num {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: .8125rem;
  color: var(--c-brand);
  min-width: 1.5rem;
}

.q-card-type-sel {
  flex: 1;
  padding: .3rem .5rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: .8125rem;
  font-family: var(--font-body);
  background: var(--c-surface);
  color: var(--c-text);
  cursor: pointer;
  outline: none;
  max-width: 180px;
}
.q-card-type-sel:focus { border-color: var(--c-brand); }

.q-card-move {
  display: flex;
  gap: var(--sp-1);
}

.q-card-body {
  padding: var(--sp-4);
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: .25rem .4rem;
  border-radius: var(--radius-sm);
  color: var(--c-text-muted);
  font-size: .9rem;
  line-height: 1;
}
.btn-icon:hover { background: var(--c-surface-2); color: var(--c-text); }
.btn-icon.danger:hover { background: var(--c-error-bg); color: var(--c-error); }

/* ── Option rows (MC / MS) ────────────────────────────────────── */
.opt-list { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-3); }

.opt-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.opt-row input[type="text"] {
  flex: 1;
  padding: .5rem .75rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .9rem;
  color: var(--c-text);
  background: var(--c-surface);
  outline: none;
}
.opt-row input[type="text"]:focus { border-color: var(--c-brand); box-shadow: 0 0 0 3px rgba(92,53,187,.1); }

.opt-row input[type="radio"],
.opt-row input[type="checkbox"] { accent-color: var(--c-brand); width: 1rem; height: 1rem; cursor: pointer; }

.editor-add-q {
  text-align: center;
  padding: var(--sp-4);
  border: 2px dashed var(--c-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  color: var(--c-text-muted);
  font-size: .9375rem;
  font-family: var(--font-head);
  font-weight: 600;
  transition: border-color 150ms, color 150ms;
  background: none;
  width: 100%;
}
.editor-add-q:hover { border-color: var(--c-brand); color: var(--c-brand); }

.editor-toolbar {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}

.prompt-output {
  width: 100%;
  min-height: 280px;
  font-family: monospace;
  font-size: .8125rem;
  padding: var(--sp-3);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  resize: vertical;
  background: var(--c-surface-2);
  color: var(--c-text);
  outline: none;
  line-height: 1.6;
}

.inline-row {
  display: flex;
  gap: var(--sp-4);
  align-items: center;
  flex-wrap: wrap;
}

.inline-row .field { margin-bottom: 0; flex: 1; min-width: 120px; }

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: .875rem;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] { accent-color: var(--c-brand); }

/* ── Pàgines de joc (tema fosc) ───────────────────────────────── */
.game-wrap {
  min-height: 100dvh;
  background: var(--c-bg);
  display: flex;
  flex-direction: column;
}

/* PIN gran */
.pin-display {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: clamp(3rem, 12vw, 6rem);
  letter-spacing: .18em;
  color: var(--c-brand);
  line-height: 1;
}

/* Llista de jugadors al lobby */
.player-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: center;
  min-height: 48px;
}

.player-chip {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  padding: .35rem .85rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--c-text);
  animation: pop-in 200ms var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

@keyframes pop-in {
  from { transform: scale(.6); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

/* Barra de temps */
.timer-bar-wrap {
  width: 100%;
  height: 10px;
  background: var(--c-border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: var(--sp-4);
}

.timer-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--c-brand);
  transition: width 1s linear, background 500ms;
}

.timer-bar.danger { background: var(--c-error); }

.timer-num {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 2rem;
  color: var(--c-text);
  min-width: 2.5rem;
  text-align: center;
}

/* Pregunta central */
.question-prompt {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  text-align: center;
  line-height: 1.3;
  color: var(--c-text);
  padding: var(--sp-4) var(--sp-6);
}

/* Grid de respostes */
.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6) var(--sp-8);
}

@media (max-width: 480px) {
  .answer-grid { grid-template-columns: 1fr; padding: var(--sp-3); }
}

.ans-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-lg);
  border: none;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(.9rem, 2.5vw, 1.1rem);
  color: #fff;
  cursor: pointer;
  min-height: 72px;
  text-align: center;
  transition: transform 80ms var(--ease), filter 120ms;
  word-break: break-word;
}

.ans-btn:active  { transform: scale(.96); }
.ans-btn:disabled { opacity: .45; cursor: not-allowed; }
.ans-btn.selected { box-shadow: 0 0 0 4px #fff, 0 0 0 7px rgba(255,255,255,.4); }
.ans-btn.correct  { filter: brightness(1.15); }
.ans-btn.wrong    { opacity: .45; }

.ans-btn-0 { background: var(--c-ans-red); }
.ans-btn-1 { background: var(--c-ans-blue); }
.ans-btn-2 { background: var(--c-ans-yellow); }
.ans-btn-3 { background: var(--c-ans-green); }

.ans-icon { font-size: 1.4rem; flex-shrink: 0; }

/* True/False */
.tf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-6) var(--sp-8);
  max-width: 600px;
  margin: 0 auto;
}

.tf-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-6);
  border-radius: var(--radius-xl);
  border: none;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.25rem;
  color: #fff;
  cursor: pointer;
  min-height: 100px;
  transition: transform 80ms var(--ease);
}
.tf-btn:active { transform: scale(.96); }
.tf-btn:disabled { opacity: .45; cursor: not-allowed; }
.tf-btn.true-btn  { background: var(--c-correct); }
.tf-btn.false-btn { background: var(--c-ans-red); }

/* Resposta curta */
.short-text-form {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  max-width: 480px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.short-text-form input {
  flex: 1;
  min-width: 200px;
  padding: .75rem 1rem;
  border: 2px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font-body);
  outline: none;
  color: var(--c-text);
  background: var(--c-surface);
}
.short-text-form input:focus { border-color: var(--c-brand); }

/* Multi-select */
.ms-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  max-width: 540px;
  margin: 0 auto;
}

.ms-opt {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 2px solid var(--c-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
  font-size: .9375rem;
  user-select: none;
}
.ms-opt:hover         { border-color: var(--c-brand); background: var(--c-brand-light); }
.ms-opt.selected      { border-color: var(--c-brand); background: var(--c-brand-light); }
.ms-opt input[type="checkbox"] { accent-color: var(--c-brand); width: 1.1rem; height: 1.1rem; }

/* Feedback immediatèn (ack) */
.score-popup {
  text-align: center;
  padding: var(--sp-8) var(--sp-6);
  animation: fade-up 300ms var(--ease) both;
}

@keyframes fade-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.score-popup .score-val {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: clamp(2.5rem, 10vw, 4rem);
  color: var(--c-brand);
  line-height: 1;
}

.score-popup .score-label {
  font-size: 1rem;
  color: var(--c-text-muted);
  margin-top: var(--sp-2);
}

/* Leaderboard */
.leaderboard {
  width: 100%;
  border-collapse: collapse;
  font-size: .9375rem;
}

.leaderboard th {
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-muted);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--c-border);
}

.leaderboard td {
  padding: var(--sp-3);
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
}

.leaderboard tr.rank-1 td { background: rgba(251,191,36,.14); font-weight: 800; border-left: 3px solid #fbbf24; }
.leaderboard tr.rank-2 td { background: rgba(148,163,184,.1);  font-weight: 700; border-left: 3px solid #94a3b8; }
.leaderboard tr.rank-3 td { background: rgba(194,120,53,.08);  font-weight: 700; border-left: 3px solid #c27835; }

.rank-medal { font-size: 1.2rem; }

/* Progrés respostes (host) */
.answers-bar-wrap {
  width: 100%;
  background: var(--c-border);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.answers-bar { height: 100%; background: var(--c-correct); border-radius: 999px; transition: width 300ms var(--ease); }

/* Connex status dot */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c-error);
  margin-right: var(--sp-1);
}
.status-dot.connected { background: var(--c-correct); }

/* Game nav */
.game-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-5);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}

.game-nav-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  color: var(--c-text);
}

/* ── Imatge de pregunta (editor + joc) ────────────────────────── */

/* Secció dins la targeta de l'editor */
.q-img-section {
  margin-bottom: var(--sp-3);
}

.q-img-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

/* Quadre miniatura — sempre visible */
.q-img-thumb {
  flex-shrink: 0;
  width: 108px;
  height: 72px;
  border-radius: var(--radius);
  border: 2px dashed var(--c-border);
  background: var(--c-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, opacity .15s;
}
.q-img-thumb:hover {
  border-color: var(--c-brand);
}
.q-img-thumb.has-img {
  border-style: solid;
  border-color: var(--c-border);
}
.q-img-thumb.loading {
  opacity: .45;
  cursor: wait;
}
.q-img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.q-img-ph {
  font-size: 1.5rem;
  opacity: .35;
  pointer-events: none;
  user-select: none;
}

/* Columna de botons al costat del thumb */
.q-img-btns {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  justify-content: center;
  padding-top: .15rem;
}

/* Imatge en les vistes de joc (host + play) */
.question-img {
  display: block;
  max-width: 100%;
  max-height: 280px;
  width: auto;
  border-radius: var(--radius-lg);
  margin: 0 auto var(--sp-4);
  object-fit: contain;
  box-shadow: var(--shadow);
}

/* Atribució Unsplash (ToS) */
.img-attribution {
  font-size: .7rem;
  color: var(--c-text-muted);
  text-align: center;
  margin-top: calc(var(--sp-1) * -1);
  margin-bottom: var(--sp-4);
  letter-spacing: .01em;
}
.img-attribution a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Atribució Unsplash dins de l'editor (sota la miniatura) */
.q-img-credit {
  font-size: .7rem;
  color: var(--c-text-muted);
  margin-top: var(--sp-2);
  letter-spacing: .01em;
}
.q-img-credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.q-img-credit a:hover { color: var(--c-brand); }

/* Peu de la landing — enllaços About / Privacitat */
.landing-footer {
  position: fixed;
  bottom: var(--sp-3);
  left: 0;
  right: 0;
  text-align: center;
  font-size: .75rem;
  color: var(--c-text-muted);
  letter-spacing: .02em;
  z-index: 5;
}
.landing-footer a {
  color: inherit;
  text-decoration: none;
  padding: 0 var(--sp-2);
  transition: color .15s ease-out;
}
.landing-footer a:hover { color: var(--c-brand); }
.landing-footer span { opacity: .5; }

@media (max-width: 480px) {
  .q-img-thumb { width: 88px; height: 60px; }
  .question-img { max-height: 180px; }
}

/* ── Answer button shapes ───────────────────────────────────── */
.ans-btn-0::before { content: '▲'; flex-shrink: 0; font-size: 1.05rem; opacity: .9; }
.ans-btn-1::before { content: '◆'; flex-shrink: 0; font-size: 1.05rem; opacity: .9; }
.ans-btn-2::before { content: '●'; flex-shrink: 0; font-size: 1.05rem; opacity: .9; }
.ans-btn-3::before { content: '■'; flex-shrink: 0; font-size: 1.05rem; opacity: .9; }

/* ── TF button symbols ───────────────────────────────────────── */
.true-btn::before  { content: '✓'; font-size: 1.6rem; flex-shrink: 0; line-height: 1; }
.false-btn::before { content: '✗'; font-size: 1.6rem; flex-shrink: 0; line-height: 1; }

/* ── Timer danger pulse ──────────────────────────────────────── */
@keyframes timer-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.12); }
}
.timer-num.danger {
  color: var(--c-error);
  animation: timer-pulse 500ms ease-in-out infinite;
}

/* ── View entrance animation ─────────────────────────────────── */
@keyframes view-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.view-entering { animation: view-enter 250ms var(--ease) both; }

/* ── Waiting state (SVG animated checkmark) ─────────────────── */
.view-waiting-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
  min-height: 40dvh;
}

.ack-icon-wrap {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--sp-4);
}

.ack-svg { width: 100%; height: 100%; overflow: visible; }

.ack-circle {
  fill: none;
  stroke: var(--c-correct);
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: dash-in 600ms var(--ease) forwards;
}

.ack-check {
  fill: none;
  stroke: var(--c-correct);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: dash-in 400ms 450ms var(--ease) forwards;
}

@keyframes dash-in { to { stroke-dashoffset: 0; } }

.ack-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--c-text);
  margin-bottom: var(--sp-2);
}

.view-waiting-hint {
  font-size: 1rem;
  color: var(--c-text-muted);
  margin-top: var(--sp-4);
}

/* ── Rank badges ─────────────────────────────────────────────── */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  font-size: .75rem;
  font-weight: 900;
  font-family: var(--font-head);
  flex-shrink: 0;
}
.rank-badge.gold   { background: #fbbf24; color: #78350f; }
.rank-badge.silver { background: #cbd5e1; color: #334155; }
.rank-badge.bronze { background: #c27835; color: #fff; }

.rank-badge-lg {
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.375rem;
}

/* ── Student lobby ───────────────────────────────────────────── */
.lobby-student-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-12) var(--sp-6) var(--sp-8);
  gap: var(--sp-5);
  text-align: center;
}

.lobby-game-title {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  color: var(--c-text);
  letter-spacing: -.5px;
}

.dot-bounce {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}

.dot-bounce span {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-brand);
  animation: dot-up 900ms ease-in-out infinite;
}
.dot-bounce span:nth-child(2) { animation-delay: 150ms; }
.dot-bounce span:nth-child(3) { animation-delay: 300ms; }

@keyframes dot-up {
  0%, 80%, 100% { transform: translateY(0); opacity: .5; }
  40%            { transform: translateY(-8px); opacity: 1; }
}

/* ── Host lobby PIN box ──────────────────────────────────────── */
.pin-box {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  background: var(--c-brand-deeper);
  border-radius: var(--radius-xl);
  padding: var(--sp-5) var(--sp-10);
  margin: var(--sp-2) auto var(--sp-4);
  box-shadow: var(--shadow-md);
}
.pin-box .pin-label {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.6);
}
.pin-box .pin-display { color: #fff; }

/* ── Host lobby layout ───────────────────────────────────────── */
.host-lobby-wrap {
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

/* ── Landing responsive landing-right hiding ─────────────────── */
/* (defined in .landing-wrap @media above) */

/* ── Empty state SVG ─────────────────────────────────────────── */
.empty-state-svg {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--sp-4);
  opacity: .35;
  display: block;
}

/* ── Visibility badge (dashboard cards) ─────────────────────────── */
.visibility-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  padding: .2rem .55rem;
  border-radius: var(--r-full);
  line-height: 1.4;
}
.visibility-badge.public  { background: var(--c-correct-bg); color: var(--c-correct); }
.visibility-badge.private { background: var(--c-surface-2);  color: var(--c-text-muted); }

/* ── Tags display ────────────────────────────────────────────────── */
.test-card-tags {
  font-size: .78rem;
  color: var(--c-text-muted);
  margin-top: var(--sp-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Editor: visibility + tags fields ───────────────────────────── */
.field-hint {
  font-size: .8125rem;
  color: var(--c-text-muted);
  margin: var(--sp-1) 0 0;
}
.visibility-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: .9375rem;
  cursor: pointer;
  user-select: none;
}
.visibility-label input[type="checkbox"] { width: 1rem; height: 1rem; cursor: pointer; }

/* ── Editor section head (with action button) ────────────────────── */
.editor-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.editor-section-head .editor-section-title { margin-bottom: 0; }

/* ── Explore search bar ──────────────────────────────────────────── */
/* ── Explore search bar ─────────────────────────────────────────── */
.explore-search-bar {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  align-items: stretch;
}
.explore-search-input {
  flex: 1;
  min-width: 0;
  padding: .625rem .8125rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .9375rem;
  color: var(--c-text);
  background: var(--c-surface);
  transition: border-color .15s ease-out, box-shadow .15s ease-out;
}
.explore-search-input::placeholder { color: var(--c-text-muted); opacity: .7; }
.explore-search-input:hover { border-color: #cdd3dc; }
.explore-search-input:focus {
  outline: none;
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(92, 53, 187, .12);
}

/* ── Explore results list ────────────────────────────────────────── */
.explore-results {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  max-height: 430px;
  overflow-y: auto;
  padding-right: var(--sp-1);
}
.explore-test-item {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface);
  overflow: hidden;
  transition: border-color .15s ease-out, box-shadow .15s ease-out;
}
.explore-test-item:hover {
  border-color: #cdd3dc;
  box-shadow: var(--shadow-sm);
}
.explore-test-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface);
}
.explore-test-info { flex: 1; min-width: 0; }
.explore-test-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.explore-test-meta {
  font-size: .8125rem;
  color: var(--c-text-muted);
  margin-top: 2px;
  line-height: 1.35;
}
.explore-test-actions {
  display: flex;
  gap: var(--sp-2);
  flex-shrink: 0;
}
.explore-test-body {
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
  padding: var(--sp-2) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.explore-q-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--c-border);
  font-size: .875rem;
}
.explore-q-item:last-child { border-bottom: none; }
.explore-q-item > .btn { flex-shrink: 0; }
.explore-q-prompt {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-text);
  line-height: 1.4;
}

/* ── Carpetes ───────────────────────────────────────────────────── */
.folder-pills {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--c-border);
}
.folder-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border-radius: 999px;
  font-size: .8125rem;
  font-weight: 600;
  border: 1.5px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-muted);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  white-space: nowrap;
  user-select: none;
}
.folder-pill:hover { border-color: var(--c-brand); color: var(--c-brand); }
.folder-pill.active {
  background: var(--c-brand);
  border-color: var(--c-brand);
  color: #fff;
}
.folder-pill-new {
  background: transparent;
  border-style: dashed;
  color: var(--c-text-muted);
}
.folder-pill-new:hover { border-color: var(--c-brand); color: var(--c-brand); background: transparent; }

.folder-pill-actions {
  display: inline-flex;
  gap: 2px;
  margin-left: var(--sp-1);
}
.folder-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: .7rem;
  opacity: .7;
  cursor: pointer;
  transition: opacity .15s, background .15s;
}
.folder-pill-icon:hover { opacity: 1; background: rgba(0,0,0,.1); }
.folder-pill.active .folder-pill-icon:hover { background: rgba(255,255,255,.25); }

/* Dropdown "Moure a" en test-card */
.test-card-move {
  position: relative;
}
.move-dropdown {
  position: absolute;
  top: calc(100% + var(--sp-1));
  right: 0;
  z-index: 50;
  min-width: 160px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  padding: var(--sp-1) 0;
  animation: fadeIn .12s ease;
}
.move-dropdown-item {
  padding: var(--sp-2) var(--sp-3);
  font-size: .875rem;
  color: var(--c-text);
  cursor: pointer;
  transition: background .1s;
  white-space: nowrap;
}
.move-dropdown-item:hover { background: var(--c-bg); }
.move-dropdown-item.active { font-weight: 700; color: var(--c-brand); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Question-level tags picker ──────────────────────────────────── */
.q-tags-wrap {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--c-border);
  position: relative;
}
.q-tags-label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--c-text-muted);
  margin-bottom: var(--sp-2);
}
.q-tags-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-bottom: var(--sp-2);
}
.q-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--c-brand);
  color: #fff;
}
.q-tag-chip[data-group="ciencies"]    { background: #2563eb; }
.q-tag-chip[data-group="humanitats"]  { background: #7c3aed; }
.q-tag-chip[data-group="llengua"]     { background: #059669; }
.q-tag-chip[data-group="idiomes"]     { background: #0891b2; }
.q-tag-chip[data-group="economia"]    { background: #d97706; }
.q-tag-chip[data-group="arts"]        { background: #db2777; }
.q-tag-chip[data-group="general"]     { background: #64748b; }
.q-tag-chip-rm {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: .9rem;
  line-height: 1;
  padding: 0;
  opacity: .75;
}
.q-tag-chip-rm:hover { opacity: 1; }
.q-tags-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  z-index: 60;
  width: 270px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  padding: var(--sp-1) 0;
  animation: fadeIn .12s ease;
}
.q-tags-group { padding: var(--sp-1) 0; }
.q-tags-group + .q-tags-group { border-top: 1px solid var(--c-border); }
.q-tags-group-title {
  padding: var(--sp-1) var(--sp-3);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-text-muted);
}
.q-tags-option {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  font-size: .875rem;
  cursor: pointer;
  color: var(--c-text);
  transition: background .1s;
}
.q-tags-option:hover { background: var(--c-bg); }
.explore-tag-sel {
  padding: .625rem .8125rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .875rem;
  background: var(--c-surface);
  color: var(--c-text);
  cursor: pointer;
  min-width: 150px;
  transition: border-color .15s ease-out, box-shadow .15s ease-out;
}
.explore-tag-sel:hover { border-color: #cdd3dc; }
.explore-tag-sel:focus {
  outline: none;
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(92, 53, 187, .12);
}
.explore-q-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: var(--sp-2);
}
.explore-q-tags .q-tag-chip {
  font-size: .7rem;
  padding: 1px 8px;
  opacity: .92;
}

/* ── Prompt-IA modal (scoped: .pt-* — only inside #prompt-modal) ────── */

.pt-modal .pt-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  color: var(--c-text);
}

.pt-body { padding: var(--sp-6); }

.pt-section {
  padding-top: var(--sp-6);
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.pt-section + .pt-section,
.pt-cta-row,
.pt-output {
  margin-top: var(--sp-6);
}
.pt-section--first {
  border-top: 0;
  padding-top: 0;
}

.pt-section-label {
  font-family: var(--font-head);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-text-muted);
  margin: 0;
}

.pt-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3) var(--sp-4);
}
@media (max-width: 520px) {
  .pt-grid-2 { grid-template-columns: 1fr; }
}

.pt-field { margin-bottom: 0; gap: var(--sp-2); }
.pt-field--full { margin-top: var(--sp-1); }

.pt-field label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--c-text);
  letter-spacing: 0;
}

.pt-field input {
  padding: .625rem .8125rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface);
  font-size: .9375rem;
  color: var(--c-text);
  transition: border-color .15s ease-out, box-shadow .15s ease-out;
}
.pt-field input::placeholder { color: var(--c-text-muted); opacity: .7; }
.pt-field input:hover { border-color: #cdd3dc; }
.pt-field input:focus {
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(92, 53, 187, .12);
  outline: none;
}

/* Pill-style segmented controls (checkboxes + radios) */
.pt-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.pt-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.pt-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.pt-pill-label {
  display: inline-flex;
  align-items: center;
  padding: .4375rem .875rem;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--c-text-muted);
  background: var(--c-surface);
  line-height: 1.2;
  transition: border-color .15s ease-out, color .15s ease-out, background .15s ease-out;
}

.pt-pill:hover .pt-pill-label {
  border-color: var(--c-brand);
  color: var(--c-text);
}

.pt-pill input:checked + .pt-pill-label {
  background: var(--c-brand-light);
  border-color: var(--c-brand);
  color: var(--c-brand);
}

.pt-pill input:focus-visible + .pt-pill-label {
  box-shadow: 0 0 0 3px rgba(92, 53, 187, .18);
}

.pt-hint {
  font-size: .8125rem;
  color: var(--c-text-muted);
  margin: 0;
  line-height: 1.45;
}

/* CTA row */
.pt-cta-row {
  display: flex;
  justify-content: flex-end;
}

.pt-cta {
  padding: .6875rem 1.5rem;
  font-size: .9375rem;
  border-radius: var(--radius);
  box-shadow: none;
  transition: background .15s ease-out, transform .08s ease-out;
}
.pt-cta:hover {
  background: var(--c-brand-dark);
  box-shadow: none;
}
.pt-cta:active { transform: translateY(1px); }

/* Output surface (textarea as code block) */
.pt-output {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.pt-output-label {
  font-family: var(--font-head);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-text-muted);
}

.pt-textarea {
  width: 100%;
  min-height: 240px;
  font-family: ui-monospace, "JetBrains Mono", "Geist Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: .8125rem;
  line-height: 1.6;
  padding: var(--sp-4);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface-2);
  color: var(--c-text);
  resize: vertical;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(15, 20, 40, .04);
  transition: border-color .15s ease-out, box-shadow .15s ease-out;
}
.pt-textarea:focus {
  border-color: var(--c-brand);
  box-shadow: inset 0 1px 0 rgba(15, 20, 40, .04), 0 0 0 3px rgba(92, 53, 187, .12);
}
.pt-textarea::-webkit-scrollbar { width: 10px; }
.pt-textarea::-webkit-scrollbar-thumb {
  background: var(--c-border);
  border-radius: 999px;
  border: 2px solid var(--c-surface-2);
}
