/* Aproquo+ : styles des nouveautés (tableau de bord, outils, fiches, impression). */

:root {
  --plus-teal: #176b87;
  --plus-teal-soft: #e4f4f2;
  --plus-pink: #ff8da1;
  --plus-pink-dark: #c2547a;
  --plus-ink: #2f3b4c;
  --plus-muted: #6b7a90;
  --plus-card: rgba(255, 255, 255, 0.86);
  --plus-line: rgba(23, 107, 135, 0.12);
  --plus-ok: #2fae7a;
  --plus-warn: #f1a33b;
  --plus-bad: #e45b72;
}

/* ---------- Accueil avec tableau de bord ---------- */
.welcome-screen.has-dashboard {
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: max(20px, env(safe-area-inset-top)) 16px
    max(28px, env(safe-area-inset-bottom));
}
.welcome-screen.has-dashboard .welcome-card {
  flex-shrink: 0;
}

.dashboard {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: plusRise 0.5s ease-out both;
}

/* Une fois connecté, sur téléphone/tablette : menu compact en grille pour voir le tableau de bord plus vite. */
@media (max-width: 999px) {
  .has-dashboard .welcome-card {
    padding: 22px 16px 18px;
    max-width: 760px;
  }
  .has-dashboard .welcome-stars {
    display: none;
  }
  .has-dashboard .welcome-title {
    font-size: 28px;
  }
  .has-dashboard .welcome-title br:first-of-type {
    display: none;
  }
  .has-dashboard .welcome-title span {
    font-size: 26px;
    margin-left: 6px;
  }
  .has-dashboard .welcome-title strong {
    font-size: 32px;
  }
  .has-dashboard .main-menu-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
  }
  .has-dashboard .main-menu-buttons .menu-btn {
    flex-direction: column;
    gap: 6px;
    padding: 14px 8px;
    font-size: 14px;
    border-radius: 18px;
    text-align: center;
  }
  .has-dashboard .toolkit-launch {
    margin-top: 12px;
    padding-top: 12px;
  }
}

@media (min-width: 1000px) {
  .welcome-screen.has-dashboard {
    display: grid;
    grid-template-columns: 380px minmax(0, 780px);
    justify-content: center;
    align-items: start;
    gap: 32px;
    padding: 40px 32px;
  }
  .welcome-screen.has-dashboard .welcome-card {
    position: sticky;
    top: 0;
  }
  .dashboard {
    max-width: none;
  }
}

@keyframes plusRise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  color: #fff;
  padding: 4px 4px 0;
}
.dash-date {
  text-transform: capitalize;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.4px;
  opacity: 0.85;
}
.dash-greeting {
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: clamp(24px, 6vw, 34px);
  line-height: 1.15;
  margin: 2px 0 4px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.12);
}
.dash-sub {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.92;
}
.wave {
  display: inline-block;
  transform-origin: 70% 70%;
  animation: wave 2.4s ease-in-out 0.6s 2;
}
@keyframes wave {
  0%,
  60%,
  100% {
    transform: rotate(0);
  }
  10%,
  30% {
    transform: rotate(14deg);
  }
  20%,
  40% {
    transform: rotate(-8deg);
  }
}

.dash-icon-btn {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.dash-icon-btn.small {
  width: 34px;
  height: 34px;
  background: var(--plus-teal-soft);
  color: var(--plus-teal);
  border-color: transparent;
}
.dash-icon-btn svg {
  width: 20px;
  height: 20px;
}
.dash-icon-btn.small svg {
  width: 17px;
  height: 17px;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.dash-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px;
  border-radius: 20px;
  background: var(--plus-card);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 26px rgba(23, 107, 135, 0.12);
  color: var(--plus-teal);
  animation: plusRise 0.45s ease-out both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.dash-stat svg {
  width: 18px;
  height: 18px;
  opacity: 0.8;
}
.dash-stat strong {
  font-family: "Fredoka", sans-serif;
  font-size: 28px;
  line-height: 1.1;
  color: var(--plus-ink);
  font-variant-numeric: tabular-nums;
}
.dash-stat span {
  font-size: 12px;
  font-weight: 700;
  color: var(--plus-muted);
}
.dash-stat.is-alert {
  background: linear-gradient(150deg, #fff, #ffe6ec);
  color: var(--plus-bad);
}
.dash-stat.is-alert strong {
  color: var(--plus-bad);
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}
@media (min-width: 700px) {
  .dash-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dash-classes,
  .dash-quick {
    grid-column: 1 / -1;
  }
}

.dash-card {
  padding: 16px;
  border-radius: 24px;
  background: var(--plus-card);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 30px rgba(23, 107, 135, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--plus-ink);
  min-width: 0;
  animation: plusRise 0.5s ease-out both;
}
.dash-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.dash-card-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: var(--plus-teal);
}
.dash-card-head h3 svg {
  width: 18px;
  height: 18px;
}
.dash-link {
  border: 0;
  background: none;
  color: var(--plus-pink-dark);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 0;
}
.dash-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--plus-teal-soft);
  color: var(--plus-teal);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.dash-empty {
  color: var(--plus-muted);
  font-size: 14px;
}

.class-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.class-chip {
  display: flex;
  align-items: stretch;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--plus-line);
  overflow: hidden;
}
.class-chip-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}
.class-chip-face {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(140deg, #ffd88a, #ffb7c5);
  color: #5a3b2e;
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
}
.class-chip:nth-child(3n + 2) .class-chip-face {
  background: linear-gradient(140deg, #a7f0e2, #8fd3f4);
  color: #18505e;
}
.class-chip:nth-child(3n + 3) .class-chip-face {
  background: linear-gradient(140deg, #d9c8ff, #ffc6e5);
  color: #4d3474;
}
.class-chip-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.class-chip-text strong {
  color: var(--plus-ink);
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.class-chip-text small {
  color: var(--plus-muted);
  font-weight: 600;
}
.class-chip-side {
  display: grid;
  place-items: center;
  width: 46px;
  border: 0;
  border-left: 1px solid var(--plus-line);
  background: var(--plus-teal-soft);
  color: var(--plus-teal);
  cursor: pointer;
}
.class-chip-side svg {
  width: 18px;
  height: 18px;
}

.dash-list,
.dash-recent {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-row,
.dash-recent-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  text-align: left;
  color: var(--plus-ink);
}
.dash-row:hover,
.dash-recent-row:hover {
  background: #fff;
}
.dash-row-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--plus-ok);
}
.dash-row-dot.today {
  background: var(--plus-warn);
}
.dash-row-dot.late {
  background: var(--plus-bad);
  box-shadow: 0 0 0 4px rgba(228, 91, 114, 0.18);
}
.dash-row-text,
.dash-recent-row > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.dash-row-text strong,
.dash-recent-row strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-row-text small,
.dash-recent-row small {
  font-size: 12px;
  color: var(--plus-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-row-due {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--plus-teal);
}
.dash-row-due.late {
  color: var(--plus-bad);
}
.dash-recent {
  margin-top: 12px;
}
.dash-recent-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--tab-color);
  background: color-mix(in srgb, var(--tab-color) 14%, white);
}
.dash-recent-icon svg {
  width: 16px;
  height: 16px;
}

.activity-chart {
  width: 100%;
  height: 74px;
  display: block;
}
.activity-chart .bar-on {
  fill: url(#none);
  fill: #4797ab;
}
.activity-chart .bar-off {
  fill: rgba(71, 151, 171, 0.16);
}
.dash-mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.dash-mini-stats div {
  display: flex;
  flex-direction: column;
  padding: 10px;
  border-radius: 14px;
  background: var(--plus-teal-soft);
}
.dash-mini-stats strong {
  font-family: "Fredoka", sans-serif;
  font-size: 20px;
  color: var(--plus-teal);
}
.dash-mini-stats span {
  font-size: 12px;
  font-weight: 600;
  color: var(--plus-muted);
}

.dash-word {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), #fff3f6);
}
.word-of-day {
  font-family: "Fredoka", sans-serif;
  font-size: 28px;
  color: var(--plus-pink-dark);
  line-height: 1.1;
  word-break: break-word;
}
.word-of-day em {
  font-family: "Quicksand", sans-serif;
  font-style: normal;
  font-size: 13px;
  color: var(--plus-muted);
  font-weight: 700;
  margin-left: 4px;
}
.word-def {
  margin: 8px 0 6px;
  font-size: 14px;
  line-height: 1.45;
  color: #4a5568;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 700px) {
  .quick-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px;
  border-radius: 18px;
  border: 1px solid var(--plus-line);
  background: #fff;
  color: var(--plus-teal);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.quick-btn svg {
  width: 24px;
  height: 24px;
}
.quick-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(23, 107, 135, 0.14);
}

.dash-skeleton {
  height: 120px;
  border-radius: 24px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(255, 255, 255, 0.75) 50%,
    rgba(255, 255, 255, 0.4) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  margin-bottom: 12px;
}
.dash-skeleton.short {
  height: 60px;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- Notifications ---------- */
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(420px, calc(100vw - 32px));
}
.toast {
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(47, 59, 76, 0.94);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition:
    opacity 0.3s,
    transform 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast-success {
  background: rgba(36, 138, 98, 0.95);
}
.toast-error {
  background: rgba(200, 64, 90, 0.96);
}

/* ---------- Cartes du cartable ---------- */
.pastel-card {
  animation: plusRise 0.35s ease-out both;
  animation-delay: calc(var(--card-index, 0) * 35ms);
}
.pastel-card .card-title {
  padding-right: 70px;
}
.card-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
}
.card-actions .delete-item-btn {
  position: static;
}
.edit-item-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  color: #7a8aa3;
  cursor: pointer;
}
.edit-item-btn svg {
  width: 13px;
  height: 13px;
}
.edit-item-btn:hover {
  background: #fff;
  color: var(--plus-teal);
}
.pastel-card:has(.todo-check) {
  padding-left: 62px;
}
.todo-check {
  position: absolute;
  left: 16px;
  top: 18px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #e8a7b8;
  background: #fff;
  color: transparent;
  cursor: pointer;
}
.todo-check svg {
  width: 18px;
  height: 18px;
  stroke-width: 3;
}
.todo-check:hover {
  color: #e8a7b8;
}
.todo-check.checked {
  border-color: var(--plus-ok);
  background: var(--plus-ok);
  color: #fff;
  animation: checkPop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes checkPop {
  0% {
    transform: scale(0.6);
  }
  100% {
    transform: scale(1);
  }
}
.pastel-card.is-done {
  opacity: 0.62;
}
.pastel-card.is-done .card-title {
  text-decoration: line-through;
  text-decoration-color: rgba(74, 85, 104, 0.45);
}
.due-badge {
  display: inline-flex;
  margin-bottom: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.due-late {
  background: #ffe1e7;
  color: #c43c5c;
}
.due-today {
  background: #fff1d6;
  color: #a86a07;
}
.due-soon {
  background: #e3f4ef;
  color: #23785a;
}

.tab-count {
  margin-left: auto;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #ffe5ec;
  color: #b3476a;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.tab-item.active .tab-count {
  background: rgba(255, 255, 255, 0.85);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  margin: 48px auto 0;
  max-width: 280px;
  color: var(--plus-muted);
  animation: plusRise 0.4s ease-out both;
}
.empty-state-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(140deg, #ffe5ec, #e4f4f2);
  color: var(--plus-pink-dark);
  margin-bottom: 6px;
}
.empty-state-title {
  font-family: "Fredoka", sans-serif;
  font-size: 18px;
  color: var(--plus-ink);
}
.empty-state-text {
  font-size: 14px;
}

/* ---------- Dictionnaire ---------- */
.dict-speak-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: 6px;
  vertical-align: middle;
  border: 0;
  border-radius: 50%;
  background: var(--plus-teal-soft);
  color: var(--plus-teal);
  cursor: pointer;
}
.dict-speak-btn svg {
  width: 15px;
  height: 15px;
}
.dict-def-list {
  padding-left: 20px;
}
.dict-def-list li + li {
  margin-top: 4px;
}

/* ---------- Administration ---------- */
.admin-user-meta {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--plus-muted);
}

/* ---------- Fenêtres des outils ---------- */
.plus-overlay {
  z-index: 120;
}
.plus-panel h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.plus-panel h3 svg {
  width: 20px;
  height: 20px;
}
.plus-panel .close-btn {
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.plus-panel .close-btn svg {
  width: 18px;
  height: 18px;
}

.tool-circle-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px 10px;
  justify-items: center;
}
.picker-icon {
  background: linear-gradient(135deg, #ff8da1, #ffb36b);
}
.teams-icon {
  background: linear-gradient(135deg, #40c9b8, #4f9fe6);
}
.noise-icon {
  background: linear-gradient(135deg, #8f7ae5, #d26bd8);
}
.signal-icon {
  background: linear-gradient(135deg, #2fae7a, #e4b53b);
}

.tool-source {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.source-label {
  font-size: 12px;
  font-weight: 700;
  color: #a3536a;
  letter-spacing: 0.4px;
}
.source-select,
.source-custom,
.overview-toolbar select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid #f2d9df;
  background: #fff;
  color: var(--plus-ink);
  font-size: 16px;
  font-weight: 600;
}
.source-custom {
  min-height: 90px;
  resize: vertical;
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-weight: 600;
  font-size: 14px;
  color: #6b4d57;
  cursor: pointer;
}
.settings-toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--plus-pink);
}

/* Roue */
.wheel-wrap {
  position: relative;
  width: min(320px, 78vw);
  margin: 6px auto 0;
}
.wheel-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow:
    0 0 0 6px #fff,
    0 14px 36px rgba(163, 83, 106, 0.25);
}
.wheel-pointer {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 26px solid #2f3b4c;
  z-index: 2;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.2));
}
.picker-result {
  margin: 16px 0 6px;
  text-align: center;
  font-family: "Fredoka", sans-serif;
  font-size: 30px;
  font-weight: 600;
  color: var(--plus-pink-dark);
  min-height: 40px;
}
.picker-result.pop {
  animation: namePop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes namePop {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Équipes */
.teams-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 14px;
  font-weight: 600;
  font-size: 14px;
  color: #6b4d57;
}
.teams-settings label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 4px;
  border-radius: 999px;
  background: #fff0f4;
}
.stepper-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--plus-pink-dark);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
}
.stepper output {
  min-width: 28px;
  text-align: center;
  font-family: "Fredoka", sans-serif;
  font-size: 20px;
  color: var(--plus-ink);
}
.teams-result {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.team-card {
  padding: 12px;
  border-radius: 18px;
  background: #fff;
  border-top: 5px solid var(--team-color);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
  animation: plusRise 0.4s ease-out both;
  animation-delay: calc(var(--i) * 70ms);
}
.team-card h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: var(--plus-ink);
  margin-bottom: 6px;
}
.team-card h4 span {
  font-size: 22px;
}
.team-card ul {
  list-style: none;
  font-size: 14px;
  color: #4a5568;
  display: grid;
  gap: 3px;
}

/* Sonomètre */
.noise-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px 16px;
  border-radius: 22px;
  background: #eef9f4;
  transition: background 0.4s;
}
.noise-stage[data-level="ok"] {
  background: #eaf5ff;
}
.noise-stage[data-level="warn"] {
  background: #fff4dd;
}
.noise-stage[data-level="loud"] {
  background: #ffe1e7;
  animation: shake 0.4s linear infinite;
}
@keyframes shake {
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}
.noise-face {
  font-size: 84px;
  line-height: 1;
}
.noise-meter {
  position: relative;
  width: 100%;
  height: 22px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.noise-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #2fae7a, #f1c33b 60%, #e45b72);
  background-size: 400px 100%;
}
.noise-limit {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 3px;
  background: #2f3b4c;
  border-radius: 2px;
}
.noise-label {
  font-family: "Fredoka", sans-serif;
  font-size: 22px;
  color: var(--plus-ink);
}
.noise-threshold {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  font-weight: 700;
  font-size: 14px;
  color: #6b4d57;
}
.noise-threshold input {
  flex: 1;
  accent-color: var(--plus-pink);
}

/* Signal plein écran */
.signal-stage {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--signal, #e45b72);
  color: #fff;
  transition: background 0.45s ease;
  padding: max(20px, env(safe-area-inset-top)) 20px
    max(20px, env(safe-area-inset-bottom));
}
.signal-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  width: 100%;
  flex: 1;
  justify-content: center;
}
.signal-main.bump {
  animation: namePop 0.5s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.signal-emoji {
  font-size: min(32vw, 30vh);
  line-height: 1;
  filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.18));
}
.signal-label {
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: min(13vw, 12vh);
  line-height: 1;
  text-align: center;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.signal-hint {
  font-size: min(5vw, 4vh);
  font-weight: 700;
  opacity: 0.9;
}
.signal-dots {
  display: flex;
  gap: 12px;
}
.signal-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  background: var(--dot);
  cursor: pointer;
}
.signal-dot.active {
  transform: scale(1.25);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35);
}
.signal-tip {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.75;
}
.signal-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  cursor: pointer;
}

/* Minuteur : anneau et grand écran */
.timer-ring {
  position: relative;
  width: min(250px, 70vw);
  aspect-ratio: 1;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
}
.timer-ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}
.timer-ring circle {
  fill: none;
  stroke-width: 9;
}
.ring-track {
  stroke: #f6dde4;
}
.ring-fill {
  stroke: #2fae7a;
  stroke-linecap: round;
  transition:
    stroke-dashoffset 0.3s linear,
    stroke 0.6s;
}
.timer-ring[data-phase="mid"] .ring-fill {
  stroke: #f1a33b;
}
.timer-ring[data-phase="end"] .ring-fill,
.timer-ring[data-phase="done"] .ring-fill {
  stroke: #e45b72;
}
.timer-ring .timer-display {
  position: relative;
  padding: 0;
  font-size: min(56px, 15vw);
}
.timer-panel.timer-flash {
  animation: flash 0.6s ease-in-out 4;
}
@keyframes flash {
  50% {
    background: #ffd2dc;
  }
}
.timer-fullscreen-btn {
  flex-basis: 100%;
}
.timer-panel .tool-modal-actions {
  flex-wrap: wrap;
}
.timer-panel.timer-big {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.modal-overlay:has(.timer-big) {
  padding: 0;
}
.timer-big .timer-ring {
  width: min(78vmin, 640px);
}
.timer-big .timer-ring .timer-display {
  font-size: min(18vmin, 160px);
}
.timer-big .timer-presets,
.timer-big .timer-settings-form {
  max-width: 560px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.timer-big .tool-modal-actions {
  max-width: 560px;
  width: 100%;
  margin: 12px auto 0;
}

/* ---------- Gestion d'une classe ---------- */
.class-toolbar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
  scrollbar-width: none;
}
.class-toolbar::-webkit-scrollbar {
  display: none;
}
.class-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid rgba(23, 107, 135, 0.18);
  background: var(--plus-teal-soft);
  color: var(--plus-teal);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.class-tool-btn svg {
  width: 16px;
  height: 16px;
}

.overview-panel {
  width: min(760px, 100%);
}
.overview-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.overview-kpis div {
  display: flex;
  flex-direction: column;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #f2d9df;
}
.overview-kpis strong {
  font-family: "Fredoka", sans-serif;
  font-size: 22px;
  color: var(--plus-ink);
}
.overview-kpis span {
  font-size: 12px;
  font-weight: 700;
  color: var(--plus-muted);
}
.settings-title {
  margin: 16px 0 8px;
  font-size: 14px;
  color: #a3536a;
}
.subject-bars {
  display: grid;
  gap: 8px;
}
.subject-bar {
  display: grid;
  grid-template-columns: minmax(80px, 140px) 1fr 62px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #4a5568;
}
.subject-bar span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subject-bar strong {
  text-align: right;
}
.subject-track {
  height: 12px;
  border-radius: 999px;
  background: #f6e6ea;
  overflow: hidden;
}
.subject-fill {
  height: 100%;
  border-radius: inherit;
  animation: grow 0.8s ease-out both;
  transform-origin: left;
}
@keyframes grow {
  from {
    transform: scaleX(0);
  }
}
.band-high {
  --band: #2fae7a;
}
.band-mid {
  --band: #f1a33b;
}
.band-low {
  --band: #e45b72;
}
.band-none {
  --band: #a0aec0;
}
.subject-fill {
  background: var(--band);
}
.tab-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0;
}
.tab-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tab-color) 12%, white);
  color: var(--tab-color);
  font-size: 12px;
  font-weight: 700;
}
.tab-chip svg {
  width: 14px;
  height: 14px;
}
.overview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.overview-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #a3536a;
  flex: 1;
  min-width: 180px;
}
.overview-list {
  display: grid;
  gap: 6px;
}
.overview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid #f4e3e8;
  background: #fff;
  cursor: pointer;
  text-align: left;
}
.overview-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--band) 18%, white);
  color: var(--band);
  font-weight: 700;
  font-size: 14px;
}
.overview-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.overview-name strong {
  color: var(--plus-ink);
  font-size: 15px;
}
.overview-name small {
  color: var(--plus-muted);
  font-size: 12px;
  font-weight: 600;
}
.overview-score {
  font-family: "Fredoka", sans-serif;
  font-size: 18px;
  color: var(--band);
  white-space: nowrap;
}

/* ---------- Fiche élève ---------- */
.student-stats-header {
  gap: 10px;
}
.student-print-btn {
  margin-left: auto;
  min-height: 36px;
  padding: 7px 12px;
}
.student-extra {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #f4dde3;
}
.student-chart-card {
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #f4e3e8;
}
.chart-head {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 14px;
  color: #a3536a;
  margin-bottom: 6px;
}
.trend.up {
  color: var(--plus-ok);
}
.trend.down {
  color: var(--plus-bad);
}
.progress-chart {
  width: 100%;
  height: auto;
  display: block;
}
.chart-grid {
  stroke: #f3e4e8;
  stroke-width: 1;
}
.chart-pass {
  stroke: #f1a33b;
  stroke-width: 1;
  stroke-dasharray: 4 4;
}
.chart-axis {
  font-size: 9px;
  fill: #a0aec0;
  text-anchor: end;
  font-family: Quicksand, sans-serif;
}
.chart-line {
  fill: none;
  stroke: #e26d8c;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart-dot {
  fill: #fff;
  stroke: #e26d8c;
  stroke-width: 2.5;
}
.chart-empty {
  font-size: 14px;
  color: var(--plus-muted);
}
.student-timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 18px 0 10px;
}
.student-timeline-head h4 {
  color: #9d5267;
}
.student-timeline {
  position: relative;
  display: grid;
  gap: 8px;
}
.timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid #f4e3e8;
  border-left: 4px solid var(--tab-color);
  background: #fff;
  text-align: left;
  cursor: pointer;
  color: var(--plus-ink);
}
.timeline-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--tab-color) 14%, white);
  color: var(--tab-color);
}
.timeline-icon svg {
  width: 17px;
  height: 17px;
}
.timeline-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.timeline-body small {
  color: var(--tab-color);
  font-weight: 700;
  font-size: 12px;
}
.timeline-body strong {
  font-size: 14px;
}
.timeline-body span {
  font-size: 13px;
  color: #5a6a85;
  overflow-wrap: anywhere;
}

/* ---------- Réglages ---------- */
.settings-account {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #f2d9df;
}
.settings-account strong {
  display: block;
  color: var(--plus-ink);
}
.settings-account small {
  color: var(--plus-muted);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.settings-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(140deg, #ff8da1, #ffc27a);
  color: #fff;
  font-family: "Fredoka", sans-serif;
  font-size: 19px;
}
.settings-form {
  display: grid;
  gap: 8px;
}
.settings-form input {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid #f2d9df;
  font-size: 16px;
}
.settings-help {
  font-size: 13px;
  color: var(--plus-muted);
  margin-bottom: 8px;
}
.settings-wide {
  width: 100%;
  text-decoration: none;
}
.install-hint {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  background: var(--plus-teal-soft);
  color: var(--plus-teal);
  font-size: 13px;
}
.install-hint svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  vertical-align: middle;
}
.install-hint p svg {
  width: 14px;
  height: 14px;
}

/* ---------- Divers ---------- */
.offline-banner {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 410;
  padding: 8px 14px;
  border-radius: 999px;
  background: #2f3b4c;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 420;
}

/* iPhone : champs à 16px pour éviter le zoom automatique de Safari. */
@media (max-width: 600px) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
  .dash-stat {
    padding: 10px 8px;
  }
  .dash-stat strong {
    font-size: 24px;
  }
  .dash-stat span {
    font-size: 11px;
  }
}
@media (max-width: 360px) {
  .dash-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

html.calm *,
html.calm *::before,
html.calm *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Impression du rapport d'élève ---------- */
#print-report {
  display: none;
}
@media print {
  body.printing-report {
    height: auto;
    overflow: visible;
    background: #fff;
  }
  body.printing-report > *:not(#print-report) {
    display: none !important;
  }
  body.printing-report #print-report {
    display: block;
    color: #222;
    font-size: 12pt;
  }
  #print-report header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #e26d8c;
    padding-bottom: 10px;
    margin-bottom: 14px;
  }
  #print-report h1 {
    font-family: "Fredoka", sans-serif;
    font-size: 24pt;
    color: #9d5267;
  }
  #print-report h2 {
    font-size: 14pt;
    color: #176b87;
    margin: 16px 0 6px;
  }
  #print-report h3 {
    font-size: 11pt;
    margin-top: 8px;
  }
  #print-report p {
    margin: 2px 0;
    white-space: pre-wrap;
  }
  #print-report table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 10.5pt;
  }
  #print-report th,
  #print-report td {
    border: 1px solid #ddd;
    padding: 4px 6px;
    text-align: left;
  }
  #print-report .print-average {
    text-align: right;
  }
  #print-report .print-average strong {
    display: block;
    font-size: 22pt;
    color: #e26d8c;
  }
  #print-report .print-item {
    break-inside: avoid;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
  }
  #print-report .progress-chart {
    max-width: 420px;
  }
  #print-report .chart-head {
    font-weight: 700;
  }
}
