/* Sõbrapildid — rakenduse stiilid (töötab nii heledas kui tumedas režiimis)

   Loend, vooru kaart, koodiala, lülitid, nupud ja vormielemendid on TEADLIKULT
   samad, mis sõbravärvides — kaks õdesrakendust, mis erinevad ainult selle
   poolest, mida osaleja kaaslasele annab (värv vs pilt), ei tohi näha välja
   nagu kaks eri saiti.

   Joonistusala enda stiil tuleb jagatud moodulist css/joonistus.css. */

/* DISAIN.md §1 tokenid, mida globaalne css/style.css veel ei defineeri.
   Laetakse ainult selle rakenduse lehtedel. */
:root {
  --sp-shadow-1: 0 1px 2px rgba(17, 17, 26, 0.06), 0 4px 12px rgba(17, 17, 26, 0.08);
  --sp-shadow-2: 0 2px 4px rgba(17, 17, 26, 0.08), 0 12px 24px rgba(17, 17, 26, 0.12);
  --sp-dur-fast: 150ms;
  --sp-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --sp-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.30);
  --sp-shadow-2: 0 2px 4px rgba(0, 0, 0, 0.40), 0 12px 24px rgba(0, 0, 0, 0.40);
}

/* ── Lehe päis ──────────────────────────────────────────────────── */
.sp-page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.sp-app-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  font-size: 24px;
  color: #fff;
  background: var(--accent-color, #3273dc);
}

.sp-page-title {
  margin: 0 0 4px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--text-primary, #363636);
}

.sp-page-sub {
  margin: 0;
  max-width: 620px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-muted, #7a7a7a);
}

/* ── Kahe veeru paigutus: loend + uue vooru kaart ───────────────── */
.sp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  align-items: start;
}

.sp-col-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.sp-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sp-section-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary, #363636);
}

.sp-muted {
  font-size: 12px;
  color: var(--text-muted, #7a7a7a);
}

/* ── Kaardid ────────────────────────────────────────────────────── */
.sp-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-light, #ededed);
  border-radius: 12px;
  box-shadow: var(--sp-shadow-1);
  padding: 20px;
}

.sp-create-card {
  border-radius: 16px;
}

.sp-card-title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary, #363636);
}

/* ── Värvivooru kaart ───────────────────────────────────────────── */
.sp-round-card + .sp-round-card {
  margin-top: 16px;
}

.sp-round-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.sp-round-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary, #363636);
  word-break: break-word;
}

.sp-round-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted, #7a7a7a);
}

.sp-dot {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: var(--border-color, #dbdbdb);
}

.sp-round-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text-secondary, #4a4a4a);
  font-variant-numeric: tabular-nums;
}

.sp-round-count i {
  font-size: 10px;
  color: var(--accent-color, #3273dc);
}

.sp-round-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sp-progress-track {
  height: 6px;
  margin: 16px 0;
  border-radius: 999px;
  background: var(--bg-hover, #f5f5f5);
  overflow: hidden;
}

.sp-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-color, #3273dc);
  transition: width 250ms var(--sp-ease);
}

.sp-round-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-light, #ededed);
}

.sp-code-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 16px;
}

/* Kitsal ekraanil oma reana koodipilli all — muidu jääks viimane lingi-nupp orvuks */
@media (max-width: 480px) {
  .sp-code-actions { flex: 1 1 100%; }
}

.sp-code-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  background: var(--bg-hover, #f5f5f5);
}

.sp-code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-primary, #363636);
  background: var(--bg-card, #fff);
  border-radius: 999px;
  padding: 4px 14px;
}

.sp-round-card.is-closed .sp-code {
  color: var(--text-muted, #7a7a7a);
}

/* Aegunud koodi peitmine: display:flex võidaks brauseri [hidden] reegli */
.sp-code-pill[hidden],
.sp-btn[hidden] {
  display: none;
}

.sp-code-host {
  font-size: 12px;
  color: var(--text-muted, #7a7a7a);
}

/* Koodi aegumine on püsivalt nähtav (mitte tooltipis) — läheb koodirea alla */
.sp-code-note {
  flex: 1 1 100%;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted, #7a7a7a);
}

.sp-code-note i {
  margin-top: 2px;
  font-size: 11px;
  flex: 0 0 auto;
}

/* Aegunud kood — ei ole viga, aga peab silma jääma */
.sp-code-note.is-expired {
  color: #b45309;
}

[data-theme="dark"] .sp-code-note.is-expired {
  color: #fbbf24;
}

/* ── QR-kood projektorile ───────────────────────────────────────── */
.sp-qr-image {
  display: flex;
  justify-content: center;
}

/* Teek annab GIF-i — pikseldatud skaleerimine hoiab servad teravad */
.sp-qr-image img {
  width: 100%;
  max-width: 320px;
  height: auto;
  image-rendering: pixelated;
  background: #fff;
  border-radius: 8px;
}

.sp-qr-code {
  margin: 12px 0 0;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-primary, #363636);
}

.sp-qr-url {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted, #7a7a7a);
  word-break: break-all;
}

.sp-switches {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding-top: 16px;
}

/* ── Lüliti ─────────────────────────────────────────────────────── */
.sp-switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-primary, #363636);
  cursor: pointer;
  user-select: none;
}

.sp-switch {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.sp-switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: var(--border-color, #dbdbdb);
  transition: background-color var(--sp-dur-fast) var(--sp-ease);
}

.sp-switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform var(--sp-dur-fast) var(--sp-ease);
}

.sp-switch:checked + .sp-switch-track {
  background: var(--accent-color, #3273dc);
}

.sp-switch:checked + .sp-switch-track::after {
  transform: translateX(24px);
}

.sp-switch:focus-visible + .sp-switch-track {
  outline: 2px solid var(--accent-color, #3273dc);
  outline-offset: 2px;
}

/* ── Nupud ──────────────────────────────────────────────────────── */
.sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #363636);
  background: var(--bg-secondary, #f5f5f5);
  border: 1px solid var(--border-color, #dbdbdb);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--sp-dur-fast) var(--sp-ease),
              border-color var(--sp-dur-fast) var(--sp-ease);
}

.sp-btn:hover {
  background: var(--bg-hover, #eee);
  color: var(--text-primary, #363636);
  text-decoration: none;
}

.sp-btn-primary {
  color: #fff;
  background: var(--accent-color, #3273dc);
  border-color: transparent;
}

.sp-btn-primary:hover {
  color: #fff;
  background: var(--accent-hover, #276cda);
}

.sp-btn-light {
  background: transparent;
}

.sp-btn-small {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.sp-btn-block {
  width: 100%;
}

.sp-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.sp-btn.is-busy {
  pointer-events: none;
  opacity: 0.7;
}

.sp-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 14px;
  color: var(--text-secondary, #4a4a4a);
  background: var(--bg-secondary, #f5f5f5);
  border: 1px solid var(--border-color, #dbdbdb);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color var(--sp-dur-fast) var(--sp-ease);
}

.sp-icon-btn:hover {
  background: var(--bg-hover, #eee);
}

.sp-icon-btn-quiet {
  color: var(--text-muted, #7a7a7a);
  background: transparent;
}

.sp-icon-btn-quiet:hover {
  color: #f14668;
  border-color: #f14668;
  background: transparent;
}

/* ── Vormielemendid ─────────────────────────────────────────────── */
.sp-field {
  margin-bottom: 16px;
}

.sp-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #363636);
}

.sp-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.sp-label-row .sp-label {
  margin-bottom: 0;
}

.sp-count {
  font-size: 12px;
  color: var(--text-muted, #7a7a7a);
  font-variant-numeric: tabular-nums;
}

.sp-input,
.sp-select select,
.sp-textarea {
  box-sizing: border-box;
  width: 100%;
  font-family: inherit;
  color: var(--text-primary, #363636);
  background: var(--bg-secondary, #f5f5f5);
  border: 1px solid var(--border-color, #dbdbdb);
  border-radius: 6px;
}

.sp-input {
  height: 40px;
  padding: 0 12px;
  font-size: 16px;
}

.sp-textarea {
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

.sp-input:focus,
.sp-textarea:focus {
  outline: 2px solid var(--accent-color, #3273dc);
  outline-offset: -1px;
  border-color: var(--accent-color, #3273dc);
}

.sp-help {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted, #7a7a7a);
}

.sp-name-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.sp-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.sp-name-row .sp-input {
  height: 40px;
  padding: 0 10px;
  font-size: 14px;
  min-width: 0;
}

.sp-name-remove {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted, #7a7a7a);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.sp-name-remove:hover {
  color: #f14668;
  background: var(--bg-hover, #f5f5f5);
}

.sp-tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.sp-select {
  position: relative;
  display: inline-flex;
}

.sp-select select {
  height: 32px;
  padding: 0 28px 0 10px;
  font-size: 13px;
  width: auto;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.sp-select::after {
  content: '';
  position: absolute;
  right: 11px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -4px;
  border-right: 2px solid var(--text-muted, #7a7a7a);
  border-bottom: 2px solid var(--text-muted, #7a7a7a);
  transform: rotate(45deg);
  pointer-events: none;
}

/* ── Sildid ─────────────────────────────────────────────────────── */
.sp-tag {
  display: inline-flex;
  align-items: center;
  height: 2em;
  padding: 0 0.75em;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-secondary, #4a4a4a);
  vertical-align: middle;
}

[data-theme="dark"] .sp-tag {
  background: rgba(255, 255, 255, 0.08);
}

/* display:inline-flex võidaks brauseri [hidden] reegli — taastame selle */
.sp-tag[hidden] {
  display: none;
}

.sp-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-light, #ededed);
  color: var(--text-secondary, #4a4a4a);
}

.sp-stat-pill i {
  font-size: 11px;
  color: var(--text-muted, #7a7a7a);
}

/* ── Osaleja: joonistamine ──────────────────────────────────────── */
.sp-join-wrap {
  max-width: 640px;
  margin: 0 auto;
}

.sp-join-head {
  text-align: center;
  margin-bottom: 20px;
}

.sp-join-head h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary, #363636);
}

.sp-join-head p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted, #7a7a7a);
}

.sp-progress-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary, #363636);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sp-progress-remain {
  font-size: 12px;
  color: var(--text-muted, #7a7a7a);
  white-space: nowrap;
}

.sp-submit-btn {
  flex: 0 0 auto;
  height: 44px;
  padding: 0 24px;
  font-size: 16px;
}

/* ── Joonistamise paigutus ──────────────────────────────────────
   Kolm ala. Kitsal ekraanil üksteise all, tööriistad lõuendi KOHAL (sõrm katab
   alumise serva). Laial ekraanil kõrvuti: ruudukujuline lõuend ja nupurida ei
   mahu muidu koos madalale vaateavale (FullHD 150 % skaalal ~630 px kõrgust). */
.sp-draw-layout {
  display: grid;
  gap: 12px;
  grid-template-areas:
    "tools"
    "paper"
    "foot";
}

.sp-draw-tools { grid-area: tools; }
.sp-draw-canvas { grid-area: paper; min-width: 0; }

.sp-draw-foot {
  grid-area: foot;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light, #ededed);
}

.sp-save-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 20px;
  font-size: 12px;
  color: var(--text-muted, #7a7a7a);
}

.sp-save-state.is-saved { color: #2a9d8f; }
.sp-save-state.is-error { color: #f14668; }

[data-theme="dark"] .sp-save-state.is-saved { color: #63d3c4; }

/* Juhis tööriistaveerus — laial ekraanil päise asemel (vt allpool) */
.sp-panel-prompt {
  display: none;
}

@media (min-width: 900px) {
  /* Joonistamise ajal on leht laiem kui liitumisvorm — lõuend ja tööriistad kõrvuti */
  .sp-drawing.sp-join-wrap {
    max-width: 1180px;
    /* Sektsiooni ülapolster on globaalne ja !important-iga lukus (vt DISAIN.md);
       joonistusvaates võtame osa sellest tagasi lõuendi kõrguse kasuks */
    margin-top: -20px;
  }

  /* Pealkiri ja juhend on loetud enne alustamist. Joonistamise ajal on nende
     kõrgus otse lõuendi arvelt — juhis ilmub tööriistaveergu. */
  .sp-drawing .sp-join-head {
    display: none;
  }

  .sp-drawing .sp-panel-prompt {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--bg-hover, #f5f5f5);
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary, #4a4a4a);
  }

  .sp-drawing .sp-panel-prompt i {
    margin-top: 2px;
    color: #f5a623;
  }

  /* Veerud hoiavad kokku: lõuendi mõõt tuleb JS-ist (vt spFitCanvas), seega
     `min-content` laseb tulbal täpselt lõuendi järgi kahaneda ja kogu plokk
     jääb keskele, mitte laiali venitatuks. */
  .sp-draw-layout {
    grid-template-columns: min-content 260px;
    grid-template-areas:
      "paper tools"
      "paper foot";
    justify-content: center;
    align-items: start;
  }

  .sp-draw-canvas .dkj-paper {
    width: var(--dkj-max, 100%);
    max-width: none;
  }

  .sp-draw-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .sp-draw-foot .sp-submit-btn {
    width: 100%;
  }

  .sp-save-state {
    justify-content: center;
  }
}

/* ── Tulemused ──────────────────────────────────────────────────── */
.sp-results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.sp-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted, #7a7a7a);
  margin-bottom: 8px;
}

.sp-results-title {
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary, #363636);
  word-break: break-word;
}

.sp-pill-row,
.sp-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sp-pending-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  font-size: 12px;
  color: var(--text-muted, #7a7a7a);
}

.sp-settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.sp-settings-row .sp-label {
  margin: 0;
}

/* ── Jaotuse valik loomisvormis ─────────────────────────────────── */
.sp-optional {
  font-weight: 400;
  color: var(--text-muted, #7a7a7a);
}

.sp-radio-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border-color, #dbdbdb);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color var(--sp-dur-fast) var(--sp-ease),
              background-color var(--sp-dur-fast) var(--sp-ease);
}

/* Globaalne puuteseadmete reegel (css/style.css `label:has(> input[type=radio])`)
   surub sildi `inline-flex; align-items: center` peale ja lükkaks mitmerealise
   kirjelduse raadionupuga kohakuti. Sama kujuga selektor võidab ta ära. */
label.sp-radio-row:has(> input[type="radio"]) {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.sp-radio-row:hover {
  border-color: var(--accent-color, #3273dc);
}

.sp-radio-row:has(> input:checked) {
  border-color: var(--accent-color, #3273dc);
  background: var(--bg-hover, #f5f5f5);
}

.sp-radio-row > input[type="radio"] {
  flex: none;
  margin-top: 3px;
}

.sp-radio-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: var(--text-primary, #363636);
}

.sp-radio-note {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted, #7a7a7a);
}

.sp-per-giver {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary, #4a4a4a);
}

.sp-input-num {
  width: 72px;
  flex: none;
}

/* Töömahu hoiatus: "kõik kõigile" suures rühmas on tundide töö */
.sp-help.is-warning {
  color: #b25000;
  font-weight: 600;
}

[data-theme="dark"] .sp-help.is-warning {
  color: #ffb27a;
}

/* ── Osaleja: juhis ja sihtmärgid ───────────────────────────────── */
.sp-prompt {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px auto 0;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--bg-hover, #f5f5f5);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-secondary, #4a4a4a);
  text-align: left;
}

.sp-prompt i {
  margin-top: 3px;
  color: #f5a623;
}

.sp-draw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.sp-target-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.sp-target-label {
  font-size: 13px;
  color: var(--text-muted, #7a7a7a);
}

.sp-target-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary, #363636);
  word-break: break-word;
}

.sp-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.sp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-color, #dbdbdb);
  border-radius: 999px;
  background: var(--bg-card, #fff);
  color: var(--text-secondary, #4a4a4a);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.sp-chip i {
  font-size: 10px;
  color: var(--text-muted, #7a7a7a);
}

.sp-chip.is-current {
  border-color: var(--accent-color, #3273dc);
  color: var(--accent-color, #3273dc);
  font-weight: 600;
}

.sp-chip.is-current i {
  color: var(--accent-color, #3273dc);
}

/* Valmis pilt jääb klõpsatavaks — selle juurde saab tagasi minna ja muuta */
.sp-chip.is-done i {
  color: #2a9d8f;
}

.sp-chip.is-done.is-current {
  border-color: #2a9d8f;
  color: #2a9d8f;
}

/* Lukus = pildi joonistas selle nime all keegi teine (teine seade) */
.sp-chip.is-locked {
  cursor: default;
  opacity: 0.55;
}

.sp-chip.is-locked i {
  color: var(--text-muted, #7a7a7a);
}

/* ── Kollaažid ──────────────────────────────────────────────────── */
.sp-collage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.sp-collage-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-light, #ededed);
  box-shadow: var(--sp-shadow-1);
}

.sp-collage-card.is-empty {
  opacity: 0.7;
}

.sp-collage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.sp-collage-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #363636);
  word-break: break-word;
}

.sp-collage-count {
  flex: none;
  font-size: 12px;
  color: var(--text-muted, #7a7a7a);
  white-space: nowrap;
}

.sp-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

/* Joonistuse taust on ALATI hele — vt css/joonistus.css päist */
.sp-tile {
  border: 1px solid var(--border-light, #ededed);
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
}

.sp-tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 6px;
  border-top: 1px solid var(--border-light, #ededed);
  background: var(--bg-secondary, #fafafa);
}

.sp-tile-giver {
  font-size: 11px;
  color: var(--text-muted, #7a7a7a);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-tile-del {
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted, #7a7a7a);
  font-size: 11px;
  cursor: pointer;
}

.sp-tile-del:hover {
  background: rgba(241, 70, 104, 0.12);
  color: #f14668;
}

.sp-collage-foot {
  display: flex;
  justify-content: flex-end;
}

.sp-empty-note {
  grid-column: 1 / -1;
  margin: 0;
  padding: 20px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted, #7a7a7a);
}

/* ── Kitsad ekraanid ────────────────────────────────────────────── */
@media (max-width: 1023px) {
  .sp-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .sp-page-title,
  .sp-results-title {
    font-size: 24px;
  }

  .sp-app-badge {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .sp-round-foot,
  .sp-results-head {
    gap: 12px;
  }

  .sp-switches {
    gap: 12px 24px;
  }
}

@media (max-width: 480px) {
  .sp-card {
    padding: 16px;
  }

  .sp-name-grid {
    grid-template-columns: 1fr;
  }

  .sp-collage-grid {
    grid-template-columns: 1fr;
  }

  .sp-draw-foot {
    flex-wrap: wrap;
  }

  .sp-submit-btn {
    width: 100%;
    height: 48px;
  }

  .sp-round-actions {
    width: 100%;
  }

  .sp-round-actions .sp-btn {
    flex: 1 1 auto;
  }
}

