:root {
  font-size: 16px;
  line-height: 1.5;
  font-family: system-ui, sans-serif;
  color: #1a1a1a;
  background: #faf8f5;
}

/* Skins set body font-size in px — keep rem math stable when a skin is active */
html:has(body[data-skin]:not([data-skin="default"])) {
  font-size: 16px;
  line-height: 1.45;
}

.skin-controls {
  display: flex;
  gap: 0.525rem;
  margin-left: auto;
  align-items: center;
  flex-shrink: 0;
}

.skin-disable {
  font: inherit;
  font-size: 1.05rem;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  border: 1px solid #bbb;
  background: #f0f0f0;
  border-radius: 6px;
  color: #555;
}

.skin-disable:disabled {
  opacity: 0.45;
  cursor: default;
}

* { box-sizing: border-box; }

main {
  max-width: 56rem;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

h1 { font-size: 1.875rem; margin: 0; flex: 1 1 auto; }

h2 {
  font-size: 1.125rem;
  margin: 0 0 0.75rem;
  color: #555;
}

.hint { font-size: 0.975rem; color: #666; margin: 0 0 1.5rem; line-height: 1.4; }

.hidden { display: none !important; }

textarea, input {
  width: 100%;
  font: inherit;
  padding: 0.75rem 1.125rem;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.row {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.row input { flex: 1; min-width: 8rem; }

.capture-field {
  flex: 1;
  min-width: 8rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.capture-field input { width: 100%; }

.suggestion-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  min-height: 0;
}

.suggestion-cloud:empty { display: none; }

.cloud-chip {
  font-size: 0.675rem;
  line-height: 1.3;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--chip-color, #999);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.cloud-chip.active {
  background: color-mix(in srgb, var(--chip-color) 22%, white);
  font-weight: 600;
}

.cloud-chip .count {
  opacity: 0.65;
  font-weight: 400;
  margin-left: 0.225rem;
}

button {
  font: inherit;
  padding: 0.525rem 1.125rem;
  cursor: pointer;
  border: 1px solid #333;
  border-radius: 6px;
  background: #fff;
}

button:focus-visible {
  outline: 2px solid #6688ff;
  outline-offset: 2px;
}

.status { font-size: 0.975rem; min-height: 1.8rem; display: flex; gap: 0.75rem; align-items: baseline; flex-wrap: wrap; }

.time-hint {
  color: #888;
  font-variant-numeric: tabular-nums;
}

.time-hint:not(:empty)::after {
  content: "·";
  margin-left: 0.75rem;
  color: #ccc;
}

.capture-zone { margin-bottom: 1.5rem; }

/* Resurface */
.resurface-zone {
  margin: 1.5rem 0;
  padding: 1.125rem;
  background: #f0ebe3;
  border-radius: 8px;
  border: 1px dashed #bbb;
}

.resurface-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.resurface-card {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 0.525rem 0;
}

.resurface-card p { flex: 1; margin: 0; }

.resurface-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.225rem;
}

.resurface-body .idea-title {
  font-size: 0.9rem;
}

/* Filters + palette */
.filters-zone {
  margin: 1.5rem 0;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.525rem;
  margin-bottom: 0.75rem;
}

.filter-chip {
  font-size: 0.825rem;
  line-height: 1.4;
  padding: 0.225rem 0.75rem;
  border: 2px solid var(--chip-color, #999);
  border-radius: 999px;
  background: #fff;
}

.filter-chip.active {
  background: color-mix(in srgb, var(--chip-color) 20%, white);
  font-weight: 600;
}

.counter-palette {
  display: flex;
  gap: 0.75rem;
  font-size: 1.5rem;
  line-height: 1;
}

.counter-palette-item {
  cursor: grab;
  padding: 0.375rem;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #fff;
}

.counter-palette-item:active { cursor: grabbing; }

/* Tabs */
.tabs {
  display: flex;
  gap: 0.375rem;
  margin: 1.5rem 0 0.75rem;
  border-bottom: 1px solid #ddd;
}

.tabs button {
  font-size: 0.9rem;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
  background: transparent;
  margin-bottom: -1px;
}

.tabs button[aria-selected="true"] {
  border-bottom-color: #333;
  font-weight: 600;
}

.tab-panel { margin-top: 0.75rem; }

/* Idea cards */
.ideas-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.idea-card {
  border-top: 1px solid #ddd;
  padding: 1.125rem 0;
}

.idea-card.filter-match {
  background: #fffbe6;
  margin: 0 -0.75rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  border-radius: 6px;
}

.idea-card.drop-target,
.cycle-column-cards.drop-target {
  outline: 2px dashed #6688ff;
  background: #f0f4ff;
}

.idea-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.375rem;
}

.idea-title {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.35;
  font-weight: 600;
}

.idea-time {
  font-size: 0.75rem;
  color: #888;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.idea-text { margin: 0 0 0.525rem; line-height: 1.5; font-size: 1.275rem; }

.npc-whisper {
  font-size: 0.825rem;
  color: #666;
  font-style: italic;
  margin: 0 0 0.375rem;
  line-height: 1.4;
}

.npc-source {
  font-style: normal;
  background: #eee;
  padding: 0.075rem 0.45rem;
  border-radius: 4px;
}

.meta {
  font-size: 0.825rem;
  line-height: 1.6;
  display: flex;
  flex-wrap: wrap;
  gap: 0.525rem;
  align-items: center;
}

.tag, .proj, .maturity-badge {
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  border: 1px solid transparent;
}

.proj { background: #eee; }

.maturity-badge { background: #e8e0f0; }

.relay.ok { color: #0a6; }
.relay.err { color: #c33; }

.counters-row {
  display: flex;
  gap: 0.75rem;
  margin: 0.525rem 0;
  flex-wrap: wrap;
}

.counter {
  font-size: 1.275rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.225rem 0.45rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
}

.counter-dot {
  display: inline-block;
  width: 0.525rem;
  height: 0.525rem;
  border-radius: 50%;
  background: #ddd;
}

.counter[data-counter="score_heart"] .counter-dot.filled { background: #e85d75; }
.counter[data-counter="score_time"] .counter-dot.filled { background: #44aa99; }
.counter[data-counter="score_money"] .counter-dot.filled { background: #6688ff; }
.counter[data-counter="score_vomi"] .counter-dot.filled { background: #7a9e3a; }
.counter[data-counter="score_spark"] .counter-dot.filled { background: #f5c542; }
.counter[data-counter="score_fire"] .counter-dot.filled { background: #e85d04; }
.counter[data-counter="score_difficulty"] .counter-dot.filled { background: #9b59b6; }
.counter[data-counter="score_fun"] .counter-dot.filled { background: #ff6b9d; }

.counter-group {
  display: inline-flex;
  gap: 0.375rem;
  align-items: center;
  padding-right: 0.525rem;
  border-right: 1px solid #ddd;
}

.counter-group:last-child { border-right: none; }

.counter-palette-group {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-right: 0.75rem;
}

.counter-palette-label {
  font-size: 0.675rem;
  color: #888;
  margin-right: 0.225rem;
}

.counter-palette-item {
  font-size: 1.5rem;
  cursor: grab;
  padding: 0.225rem 0.375rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
}

.counter-palette-item:hover {
  border-color: #ccc;
  background: #fff;
}

.tab-badge {
  font-size: 0.75rem;
  color: #666;
}

.empty-state {
  padding: 1.5rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #666;
}

.empty-state strong {
  display: block;
  font-style: normal;
  color: #333;
}

.cycle-zone {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid #ddd;
}

.cycle-toggle {
  width: 100%;
  text-align: left;
  font-size: 0.975rem;
  padding: 0.75rem 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.cycle-toggle-hint {
  color: #888;
  font-weight: normal;
}

.cycle-board-wrap.hidden {
  display: none;
}

.actions, .promote-row {
  display: flex;
  gap: 0.525rem;
  flex-wrap: wrap;
}

.actions button, .promote-row button {
  font-size: 0.75rem;
}

.empty-msg, .empty {
  font-size: 0.9rem;
  color: #999;
  font-style: italic;
}

/* Cycle board */
.maturity-band {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  margin-bottom: 1.125rem;
  padding: 0.75rem;
  background: #f0ebe3;
  border-radius: 6px;
}

.maturity-step { opacity: 0.7; }

.cycle-board {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
}

.cycle-column {
  flex: 0 0 9rem;
  min-height: 6rem;
  background: #f5f3ef;
  border-radius: 8px;
  padding: 0.525rem;
}

.cycle-column-title {
  font-size: 0.675rem;
  margin: 0 0 0.525rem;
  text-align: center;
  line-height: 1.3;
  color: #555;
}

.cycle-column-cards {
  display: flex;
  flex-direction: column;
  gap: 0.525rem;
  min-height: 4rem;
}

.cycle-card {
  font-size: 0.675rem;
  line-height: 1.4;
  padding: 0.525rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: grab;
}

.cycle-card.dragging { opacity: 0.5; }

.cycle-card .npc-header {
  font-weight: 600;
  margin-bottom: 0.3rem;
  display: flex;
  gap: 0.375rem;
  align-items: baseline;
}

.cycle-card .idea-title {
  font-size: inherit;
  flex: 1;
}

.cycle-card .cycle-text {
  margin: 0.225rem 0 0.3rem;
  opacity: 0.85;
}

.cycle-card .idea-time {
  display: block;
  margin-bottom: 0.225rem;
}

.cycle-card .counter { font-size: 0.6rem; }

.btn-promote {
  font-size: 0.57rem !important;
  padding: 0.15rem 0.375rem !important;
}

/* Explorer tab */
.explorer-root {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.explorer-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  background: #f5f3ef;
  border-radius: 8px;
  border: 1px solid #e0dcd4;
}

.explorer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.525rem;
  align-items: flex-start;
}

.explorer-row-head {
  align-items: flex-end;
}

.explorer-label {
  flex: 0 0 5.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #666;
  padding-top: 0.375rem;
}

.explorer-search-wrap,
.explorer-sort-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.225rem;
  flex: 1;
  min-width: 10rem;
}

.explorer-search-wrap input,
.explorer-sort-wrap select {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
}

.explorer-sort-wrap {
  flex: 0 1 12rem;
}

.explorer-reset {
  font-size: 0.75rem;
  padding: 0.45rem 0.75rem;
  align-self: flex-end;
  border-color: #bbb;
  color: #555;
}

.explorer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  flex: 1;
}

.explorer-chip {
  font-size: 0.75rem;
  line-height: 1.35;
  padding: 0.2rem 0.6rem;
  border: 2px solid var(--chip-color, #999);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.explorer-chip.active {
  background: color-mix(in srgb, var(--chip-color, #6688ff) 22%, white);
  font-weight: 600;
}

.explorer-chip.status-chip {
  --chip-color: #888;
}

.explorer-chip .count {
  opacity: 0.65;
  font-weight: 400;
  margin-left: 0.2rem;
}

.explorer-tag-head {
  flex: 1 1 100%;
  margin-left: 5.5rem;
}

.explorer-tag-mode {
  font: inherit;
  font-size: 0.75rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #ccc;
}

.explorer-min-row {
  align-items: center;
}

.explorer-min-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.525rem;
  flex: 1;
}

.explorer-min-score {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
}

.explorer-min-score input {
  width: 3rem;
  padding: 0.225rem 0.375rem;
  font: inherit;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.explorer-hint {
  font-size: 0.75rem;
  color: #999;
  font-style: italic;
}

.explorer-summary {
  margin: 0;
  font-size: 0.825rem;
  color: #666;
}

.explorer-summary strong {
  color: #333;
  font-size: 1rem;
}
