/* ─────────────────────────────────────────────────────────────────
   Coloring beta page styles. Builds on main.css design tokens.
   ───────────────────────────────────────────────────────────────── */

.coloring-view { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.small-muted { color: var(--muted); font-size: 14px; }

.quiet-note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: var(--muted);
  font-size: 14px;
}

/* ── Picker grid ─────────────────────────────────────────────── */
.picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 720px) {
  .picker-grid { grid-template-columns: 1fr; }
}

.picker-card {
  display: flex;
  flex-direction: column;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
  text-align: left;
  font: inherit;
  color: inherit;
}
.picker-card:hover, .picker-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary-soft);
  outline: none;
}
.picker-thumb {
  width: 100%;
  aspect-ratio: 4 / 5;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  padding: 16px;
}
.picker-thumb img, .picker-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.picker-meta {
  padding: 14px 18px 18px;
}
.picker-card h3 {
  margin: 0 0 4px;
  font-size: 18px;
  color: var(--text);
}
.picker-card .picker-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.picker-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 40px;
}

/* ── Narrative ────────────────────────────────────────────────── */
.narrative-shell {
  max-width: 720px;
  margin: 24px auto 0;
}
.narrative-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.link-back {
  background: none;
  border: 0;
  color: var(--primary);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
}
.link-back:hover { background: rgba(58,123,213,0.08); }

.narrative-progress {
  flex: 1;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.narrative-progress span {
  font-size: 13px;
  color: var(--muted);
}
.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(31,42,58,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width .25s ease;
}

.narrative-card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}
.narrative-context {
  background: rgba(31,42,58,0.04);
  border-left: 3px solid rgba(58,123,213,0.35);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  font-style: italic;
}
.narrative-context[hidden] { display: none; }
.narrative-context .filled-slot {
  background: rgba(58,123,213,0.10);
  border-radius: 4px;
  padding: 1px 4px;
  color: var(--primary-dark);
  font-style: normal;
  font-weight: 500;
}
.narrative-context .blank-here {
  display: inline-block;
  min-width: 60px;
  border-bottom: 2px solid var(--primary);
  padding: 0 6px;
  color: var(--primary);
  font-style: normal;
  font-weight: 600;
}

.narrative-slot-label {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.4;
}
.narrative-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: #fff;
  resize: vertical;
  min-height: 56px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.narrative-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(58,123,213,0.15);
}
.narrative-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.suggestion-chip {
  background: rgba(58,123,213,0.08);
  border: 1px solid rgba(58,123,213,0.2);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--primary-dark);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s ease;
}
.suggestion-chip:hover { background: rgba(58,123,213,0.16); }

.narrative-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.narrative-actions .btn { flex: 0 0 auto; }
.narrative-actions .btn-primary { margin-left: auto; }

.readback-text {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
}
.readback-text .filled-slot {
  background: rgba(58,123,213,0.10);
  border-radius: 4px;
  padding: 1px 4px;
  color: var(--primary-dark);
  font-weight: 500;
}
.readback-text .empty-slot {
  background: rgba(31,42,58,0.06);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--muted);
  font-style: italic;
}

/* ── Coloring view ────────────────────────────────────────────── */
.coloring-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0 14px;
  flex-wrap: wrap;
}
.coloring-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  color: var(--muted);
}
.coloring-tools {
  display: flex;
  gap: 6px;
}
.tool-btn {
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  font-size: 18px;
  cursor: pointer;
  color: var(--text);
  transition: background .15s ease;
}
.tool-btn:hover { background: rgba(58,123,213,0.08); }
.tool-btn:disabled { opacity: 0.4; cursor: default; }

.coloring-mode-toggle {
  display: inline-flex;
  background: rgba(31,42,58,0.06);
  border-radius: 999px;
  padding: 4px;
  margin: 0 auto 14px;
  display: flex;
  width: fit-content;
}
.mode-btn {
  border: 0;
  background: transparent;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  transition: all .15s ease;
}
.mode-btn.active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 1px 3px rgba(31,42,58,0.1);
}

.canvas-stage {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 4 / 5;
  box-shadow: var(--shadow);
}
#coloring-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
.canvas-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: rgba(255,255,255,0.9);
  font-size: 15px;
}
.canvas-loading[hidden] { display: none; }

.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 16px auto 0;
  max-width: 720px;
}
.palette-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.7);
  outline: 1px solid rgba(31,42,58,0.15);
  cursor: pointer;
  padding: 0;
  transition: transform .15s ease;
}
.palette-swatch:hover { transform: scale(1.1); }
.palette-swatch.active {
  outline: 3px solid var(--primary);
  transform: scale(1.15);
}

.brush-size-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}
.brush-size-row[hidden] { display: none; }
.brush-size-row input[type=range] { width: 200px; }

.coloring-hint {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
}

/* ── Quote toggle switch ──────────────────────────────────────── */
.quote-toggle-row {
  display: flex;
  justify-content: center;
  margin: 0 auto 12px;
}
.quote-toggle-row[hidden] { display: none; }

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border-radius: 999px;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-slider {
  width: 36px;
  height: 20px;
  background: rgba(31,42,58,0.18);
  border-radius: 999px;
  position: relative;
  transition: background .18s ease;
  flex-shrink: 0;
}
.switch-slider::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transition: transform .18s ease;
}
.switch input:checked + .switch-slider {
  background: var(--primary);
}
.switch input:checked + .switch-slider::after {
  transform: translateX(16px);
}
.switch input:focus-visible + .switch-slider {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.switch-label { font-weight: 500; color: var(--text); }

/* Hovering description tooltip — shown on hover/focus of the switch */
.switch-help {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(31,42,58,0.95);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  padding: 8px 12px;
  border-radius: 8px;
  width: max-content;
  max-width: 260px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 5;
}
.switch-help::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(31,42,58,0.95);
}
.switch:hover .switch-help,
.switch:focus-within .switch-help {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* ── Dev-only quote-position nudger ───────────────────────────── */
#dev-quote-overlay {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: rgba(31,42,58,0.94);
  color: #fff;
  padding: 12px 14px;
  border-radius: 10px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  z-index: 50;
  max-width: 240px;
  box-shadow: 0 8px 22px rgba(0,0,0,.25);
}
#dev-quote-overlay[hidden] { display: none; }
#dev-quote-overlay strong {
  display: block;
  margin-bottom: 6px;
  font-family: Georgia, serif;
  font-weight: 600;
  font-size: 13px;
  color: #FFD180;
}
#dev-quote-overlay #dev-quote-values {
  font-size: 14px;
  margin-bottom: 6px;
  color: #fff;
}
#dev-quote-overlay .dev-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  line-height: 1.4;
}

/* ── Nudge banner ─────────────────────────────────────────────── */
.nudge {
  margin: 18px auto 0;
  max-width: 720px;
  background: linear-gradient(135deg, rgba(58,123,213,.10), rgba(255,255,255,.92));
  border: 1px solid rgba(58,123,213,.22);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  animation: nudgeIn .25s ease;
}
.nudge[hidden] { display: none; }
@keyframes nudgeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.nudge-text {
  flex: 1 1 240px;
  font-size: 14px;
  color: var(--primary-dark);
  line-height: 1.5;
}
.nudge-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}
.btn-sm {
  padding: 6px 14px !important;
  font-size: 13px !important;
}

/* ── Hidden tile on providers page ────────────────────────────── */
.hidden-tile-row {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px dashed rgba(31,42,58,0.12);
  display: flex;
  justify-content: center;
}
.hidden-tile {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: all .2s ease;
}
.hidden-tile:hover {
  background: rgba(58,123,213,0.08);
  border-color: var(--primary-soft);
  color: var(--primary-dark);
  transform: translateY(-1px);
}
.hidden-tile::before { content: "🌱"; font-size: 16px; }

/* ── Locked picker cards ─────────────────────────────────────── */
.picker-card--locked {
  cursor: pointer;
}
.picker-card--locked .picker-thumb img {
  filter: blur(6px);
  opacity: 0.5;
  transition: filter .2s ease, opacity .2s ease;
}
.picker-card--locked:hover .picker-thumb img {
  filter: blur(4px);
  opacity: 0.65;
}
.picker-lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: inherit;
  z-index: 2;
}
.picker-thumb {
  position: relative;
}
.lock-icon {
  font-size: 64px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.25));
}
.lock-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark, #1a3a5c);
  background: rgba(255,255,255,0.85);
  padding: 4px 14px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.picker-unlock-hint {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  margin: 4px 0 0;
}

/* ── Signup modal ────────────────────────────────────────────── */
.signup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: rgba(31,42,58,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn .2s ease;
}
.signup-overlay[hidden] { display: none !important; }

.signup-modal {
  position: relative;
  background: #fff;
  border-radius: var(--radius-lg, 14px);
  padding: 40px 36px 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.25), 0 0 0 1px rgba(255,255,255,0.1);
  text-align: center;
  animation: slideUp .3s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.signup-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
  line-height: 1;
  border-radius: 6px;
  transition: background .15s ease;
}
.signup-close:hover {
  background: rgba(31,42,58,0.08);
  color: var(--text);
}

.signup-modal h2 {
  margin: 0 0 10px;
  font-size: 22px;
  color: var(--text);
}
.signup-modal > p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 20px;
}

.signup-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.signup-form[hidden] { display: none; }

.signup-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color .15s ease;
  font-family: inherit;
  box-sizing: border-box;
}
.signup-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(58,123,213,0.12);
}

.signup-submit {
  width: 100%;
}

.signup-fine-print {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 4px;
}

.signup-error {
  margin-top: 10px;
  font-size: 13px;
  color: #c0392b;
}
.signup-error[hidden] { display: none; }

.signup-success {
  margin-top: 10px;
  font-size: 15px;
  color: var(--primary-dark);
  font-weight: 500;
}
.signup-success[hidden] { display: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

@media (max-width: 480px) {
  .signup-form {
    flex-direction: column;
  }
  .signup-modal {
    padding: 28px 20px 22px;
  }
}
