/* Chromacode — app-specific styles. Uses tokens.css vars only. */

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

body { padding: var(--sp-6) var(--sp-8); background:
  radial-gradient(1200px 600px at 10% -10%, rgba(124,108,255,.16), transparent 60%),
  radial-gradient(1000px 500px at 110% 10%, rgba(244,182,64,.10), transparent 55%),
  var(--bg);
}

.cc-shell { max-width: 1360px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--sp-8); }

/* header */
.cc-header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-6); flex-wrap: wrap; }
.cc-brand { display: flex; align-items: center; gap: var(--sp-4); }
.cc-brand-mark {
  width: 44px; height: 44px; border-radius: var(--r-md); flex-shrink: 0;
  background: conic-gradient(from 220deg, var(--accent), var(--primary), var(--success), var(--danger), var(--accent));
  box-shadow: var(--shadow-glow);
}
.cc-brand h1 { font-family: var(--font-display); font-size: var(--fs-2xl); margin: 0; letter-spacing: -0.02em; }
.cc-tag { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.cc-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.cc-actions .btn { display: inline-flex; align-items: center; gap: var(--sp-2); }
.cc-actions .ico { display: inline-flex; width: 16px; height: 16px; }

/* main layout */
.cc-main { display: grid; grid-template-columns: minmax(320px, 460px) 1fr; gap: var(--sp-8); align-items: start; }
@media (max-width: 980px) { .cc-main { grid-template-columns: 1fr; } }

.cc-paint-col, .cc-preview-col { display: flex; flex-direction: column; gap: var(--sp-6); }

/* paint card */
.cc-paint-head { margin-bottom: var(--sp-4); }
.cc-hint { color: var(--muted); font-size: var(--fs-sm); margin: 0; }

.cc-palette { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin: var(--sp-4) 0; }
.cc-swatch {
  width: 36px; height: 36px; border-radius: var(--r-sm); border: 2px solid transparent;
  cursor: pointer; transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  position: relative;
}
.cc-swatch:hover { transform: translateY(-2px) scale(1.05); }
.cc-swatch[aria-selected="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--border-strong); }

.cc-grid-wrap { display: flex; justify-content: center; margin: var(--sp-4) 0; }
.cc-grid {
  display: grid; grid-template-columns: repeat(8, minmax(28px, 42px)); grid-template-rows: repeat(8, minmax(28px, 42px));
  gap: 4px; padding: var(--sp-3); background: var(--surface-2); border-radius: var(--r-md); border: 1px solid var(--border);
  user-select: none;
}
.cc-cell {
  border-radius: 4px; cursor: pointer; border: 1px solid var(--border);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.cc-cell:hover { transform: scale(1.08); box-shadow: 0 0 0 2px var(--border-strong); z-index: 2; }

.cc-legend { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-2); }
.cc-legend-item { display: flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-xs); color: var(--muted); }
.cc-legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* why card */
.cc-why-head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.cc-why-head .ico { display: inline-flex; width: 20px; height: 20px; color: var(--primary); }
.cc-why-head h2 { margin: 0; }
.cc-why-list { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-4); }
.cc-why-item {
  display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3); border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border);
}
.cc-why-swatch { width: 22px; height: 22px; border-radius: var(--r-sm); flex-shrink: 0; margin-top: 2px; }
.cc-why-text strong { color: var(--text); }
.cc-why-text { color: var(--muted); font-size: var(--fs-sm); }
.cc-why-empty { color: var(--muted); font-size: var(--fs-sm); padding: var(--sp-4); text-align: center; }

/* preview frame */
.cc-preview-frame {
  border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-md);
  background: var(--surface); display: flex; flex-direction: column; min-height: 560px;
}
.cc-preview-chrome {
  display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.cc-dots { display: flex; gap: 6px; }
.cc-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.cc-dots span:nth-child(1) { background: var(--danger); }
.cc-dots span:nth-child(2) { background: var(--warn); }
.cc-dots span:nth-child(3) { background: var(--success); }
.cc-preview-title { font-weight: 600; font-size: var(--fs-sm); flex: 1; }
.cc-preview-archetype {
  font-size: var(--fs-xs); color: var(--primary-ink); background: var(--primary); padding: 2px var(--sp-2);
  border-radius: var(--r-full); font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.cc-preview-body { flex: 1; padding: var(--sp-8); display: flex; align-items: stretch; }
.cc-preview-body > * { width: 100%; }

/* skeleton */
.cc-skel { display: flex; flex-direction: column; gap: var(--sp-4); width: 100%; }
.cc-skel-line, .cc-skel-block {
  border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-2) 25%, var(--border-strong) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
}
.cc-skel-line { height: 18px; }
.cc-skel-line.w60 { width: 60%; } .cc-skel-line.w80 { width: 80%; }
.cc-skel-block { height: 90px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* params card */
.cc-params-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--sp-4); }
.cc-param { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); }
.cc-param-label { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.cc-param-value { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg); }

/* generated mini-app internals (rendered inside preview body) */
.gapp { display: flex; flex-direction: column; gap: var(--sp-4); height: 100%; }
.gapp-header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.gapp-title { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 700; margin: 0; }
.gapp-sub { color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.gapp-body { flex: 1; display: flex; flex-direction: column; gap: var(--sp-3); }

.gapp-row { display: flex; align-items: center; gap: var(--sp-3); background: var(--gsurface, var(--surface-2)); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3); transition: transform var(--dur) var(--ease); }
.gapp-row:hover { transform: translateX(2px); }
.gapp-check { width: 20px; height: 20px; border-radius: var(--r-sm); border: 2px solid var(--gaccent, var(--primary)); flex-shrink: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.gapp-check.done { background: var(--gaccent, var(--primary)); color: var(--primary-ink); }
.gapp-row.done .gapp-text { text-decoration: line-through; opacity: .55; }
.gapp-text { flex: 1; font-size: var(--fs-sm); }
.gapp-del { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: var(--r-sm); display: flex; }
.gapp-del:hover { color: var(--danger); background: var(--surface); }
.gapp-add { display: flex; gap: var(--sp-2); }
.gapp-add input { flex: 1; }

.gapp-timer { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4); flex: 1; }
.gapp-ring { position: relative; width: 180px; height: 180px; display: flex; align-items: center; justify-content: center; }
.gapp-ring svg { transform: rotate(-90deg); }
.gapp-ring-num { position: absolute; font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 700; }
.gapp-controls { display: flex; gap: var(--sp-2); }

.gapp-quote { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4); flex: 1; text-align: center; padding: var(--sp-4); }
.gapp-quote-text { font-family: var(--font-display); font-size: var(--fs-lg); font-style: italic; line-height: 1.4; }
.gapp-quote-author { color: var(--muted); font-size: var(--fs-sm); }

.gapp-mood-row { display: flex; gap: var(--sp-2); justify-content: center; flex-wrap: wrap; }
.gapp-mood-btn { width: 48px; height: 48px; border-radius: var(--r-full); display: flex; align-items: center; justify-content: center; cursor: pointer; border: 2px solid transparent; font-size: 22px; background: var(--surface-2); transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.gapp-mood-btn:hover { transform: scale(1.1); }
.gapp-mood-btn.active { border-color: var(--gaccent, var(--primary)); }
.gapp-mood-log { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: var(--sp-2); }
.gapp-mood-chip { width: 14px; height: 14px; border-radius: 4px; }

.gapp-journal textarea { width: 100%; min-height: 120px; resize: vertical; }
.gapp-journal-entries { display: flex; flex-direction: column; gap: var(--sp-2); max-height: 160px; overflow-y: auto; }
.gapp-journal-entry { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); }
.gapp-journal-date { color: var(--muted); font-size: var(--fs-xs); display: block; margin-bottom: 2px; }

.gapp-counter { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4); flex: 1; }
.gapp-counter-num { font-family: var(--font-display); font-size: 4rem; font-weight: 700; }
.gapp-counter-btns { display: flex; gap: var(--sp-3); }
.gapp-counter-btn { width: 56px; height: 56px; border-radius: var(--r-full); font-size: var(--fs-xl); display: flex; align-items: center; justify-content: center; }

.gapp-mixer { display: flex; flex-direction: column; gap: var(--sp-4); flex: 1; }
.gapp-mixer-preview { flex: 1; border-radius: var(--r-lg); min-height: 100px; border: 1px solid var(--border); }
.gapp-mixer-sliders { display: flex; flex-direction: column; gap: var(--sp-3); }
.gapp-mixer-slider { display: flex; align-items: center; gap: var(--sp-3); }
.gapp-mixer-slider label { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; }
.gapp-mixer-slider input[type=range] { flex: 1; }

.gapp-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-3); flex: 1; color: var(--muted); text-align: center; padding: var(--sp-8); }
.gapp-empty .ico { width: 32px; height: 32px; opacity: .6; }

.cc-seed { font-family: monospace; color: var(--muted); }
.cc-footer { text-align: center; color: var(--muted); font-size: var(--fs-sm); padding-top: var(--sp-4); }
