* {
  box-sizing: border-box;
}

:root {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  color: #172033;
  background: #f5f7fb;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
.button {
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 700;
  background: #2637d8;
  color: white;
}

button.secondary,
.button.secondary {
  background: #eef1ff;
  color: #2637d8;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #d7dce7;
  border-radius: 10px;
  padding: 11px 12px;
  background: white;
  color: #172033;
}

textarea {
  resize: vertical;
}

label {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  margin: 14px 0 6px;
}

h1,
h2 {
  margin-top: 0;
}

p {
  color: #637083;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  padding: 14px 24px;

  background: white;
  border-bottom: 1px solid #e4e8f0;

  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar strong {
  font-size: 1.2rem;
}

.topbar nav {
  display: flex;
  gap: 8px;
}

.nav-btn {
  background: transparent;
  color: #637083;
}

.nav-btn.active {
  background: #172033;
  color: white;
}

.badge {
  margin-left: 8px;
  font-size: .72rem;
  background: #eef1ff;
  color: #2637d8;
  padding: 3px 7px;
  border-radius: 999px;
}

main {
  width:
    min(
      1120px,
      calc(100% - 28px)
    );

  margin:
    32px auto 64px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.hero h1 {
  margin-bottom: 4px;
}

.hero p {
  margin: 0;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.file-button input {
  display: none;
}

.grid.two {
  display: grid;
  grid-template-columns:
    repeat(
      2,
      minmax(0, 1fr)
    );

  gap: 20px;
}

.card {
  background: white;
  border: 1px solid #e5e9f1;
  border-radius: 16px;
  padding: 22px;

  box-shadow:
    0 8px 28px
    rgba(30, 42, 80, .05);

  margin-bottom: 20px;
}

.card > button {
  margin-top: 16px;
}

.hint {
  margin: 12px 0 0;
  min-height: 22px;
  color: #637083;
}

.message {
  min-height: 22px;
  margin-top: 10px;
  color: #a12626;
}

.message.ok {
  color: #187448;
}

.hidden {
  display: none !important;
}

.session-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  padding-bottom: 18px;
  border-bottom: 1px solid #edf0f5;
  margin-bottom: 20px;
}

.eyebrow {
  text-transform: uppercase;
  font-size: .74rem;
  letter-spacing: .08em;
  color: #7b8493;
  font-weight: 800;
}

.session-code {
  font-size: 2.4rem;
  letter-spacing: .18em;
  font-weight: 900;
}

.status-pill {
  background: #eef1ff;
  color: #2637d8;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
}

.players-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.player-row {
  display: grid;

  grid-template-columns:
    minmax(150px, 1fr)
    minmax(220px, 1.3fr);

  align-items: center;
  gap: 12px;

  padding: 12px;

  border:
    1px solid #e5e9f1;

  border-radius: 12px;
}

.player-name {
  font-weight: 800;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  color: #637083;
  font-weight: 700;
  margin-bottom: 10px;
}

.options {
  display: grid;

  grid-template-columns:
    repeat(
      2,
      minmax(0, 1fr)
    );

  gap: 12px;
  margin: 18px 0;
}

.option {
  padding: 16px;

  border-radius: 12px;
  border: 1px solid #dce1eb;

  background: #f9fafc;
  color: #172033;

  text-align: left;
}

.option.correct {
  border-color: #4fb27b;
  background: #edf9f2;
}

.option.selected {
  outline:
    3px solid #8791ef;
}

.student-shell {
  max-width: 660px;
  margin: 60px auto;
}

.student-card {
  text-align: center;
  padding: 32px;
}

.join-code {
  font-size: 2rem;
  text-align: center;
  letter-spacing: .2em;
  margin: 10px 0 4px;
}

.student-id {
  margin-bottom: 24px;
  color: #637083;
}

.student-id strong {
  color: #172033;
}

.feedback {
  min-height: 28px;
  font-weight: 800;
}

.feedback.good {
  color: #187448;
}

.feedback.bad {
  color: #a12626;
}

.score-box {
  font-size: 1.5rem;
  margin-top: 20px;
}

.rank-row,
.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #edf0f5;
}

.rank-row:last-child,
.history-item:last-child {
  border-bottom: 0;
}

.muted {
  color: #7b8493;
  font-size: .9rem;
}

@media (max-width: 760px) {

  .grid.two,
  .options {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
  }

  .player-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 12px 14px;
  }

  main {
    margin-top: 20px;
  }

  .session-code {
    font-size: 2rem;
  }
}

/* ===== APPELLO SMART ===== */

.attendance-board {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 18px 0 24px;
}

.attendance-column {
  padding: 16px;
  border: 1px solid #e5e9f1;
  border-radius: 14px;
  background: #f9fafc;
}

.attendance-column h3 {
  margin: 0 0 12px;
}

.attendance-choice {
  display: block;
  width: 100%;
  margin: 8px 0;
  padding: 13px 14px;
  border-radius: 10px;
  text-align: left;

  background: white;
  color: #172033;

  border: 1px solid #dce1eb;

  font-weight: 700;
}

.attendance-choice:hover:not(:disabled) {
  border-color: #2637d8;
  background: #f1f3ff;
}

.attendance-choice.selected {
  background: #2637d8;
  border-color: #2637d8;
  color: white;
}

.attendance-choice:disabled {
  opacity: .45;
  cursor: default;
}

.attendance-assigned {
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid #e5e9f1;
}

.attendance-pair {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;

  margin: 8px 0;
  padding: 12px 14px;

  background: #edf9f2;
  color: #172033;

  border: 1px solid #b8e1c8;
  border-radius: 10px;

  text-align: left;
}

.attendance-pair:hover {
  background: #e2f5ea;
}

.attendance-remove {
  font-size: 1.4rem;
  color: #a12626;
  font-weight: 900;
}

@media (max-width: 760px) {
  .attendance-board {
    grid-template-columns: 1fr;
  }
}

/* ===== SESSIONE MULTI-QUIZ ===== */

.danger {
  background: #b42318;
  color: white;
}

#endSession {
  margin-top: 24px;
}

#readyPanel {
  padding-top: 4px;
}

#readyPanel #startRound {
  margin-top: 16px;
}
