/* Little Worlds: shared design tokens and components. Every mode uses these. */
:root {
  --bg: #f7f1e8; --paper: #fffdf9; --paper-2: #f9f4ec; --ink: #2a2320; --muted: #7c6f66;
  --line: rgba(42, 35, 32, .12); --line-2: rgba(42, 35, 32, .24);
  --accent: #d6536d; --accent-weak: rgba(214, 83, 109, .1); --accent-line: rgba(214, 83, 109, .45);
  --r: 14px; --r-sm: 10px; --ease: cubic-bezier(.2, .7, .2, 1);
  --font: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --hand: 'Caveat', 'Bradley Hand', cursive;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.4 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { display: block; }

/* Buttons */
.btn, .ib { height: 40px; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px;
  border: 1px solid var(--line); background: var(--paper); border-radius: 12px; cursor: pointer; white-space: nowrap;
  transition: border-color .15s var(--ease), transform .15s var(--ease), background-color .15s var(--ease); }
.ib { padding: 0; }
.btn svg, .ib svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn:hover:not(:disabled), .ib:hover:not(:disabled) { border-color: var(--line-2); transform: translateY(-1px); }
.btn:disabled, .ib:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm, .ib.sm { height: 32px; min-width: 32px; border-radius: 9px; font-size: 13px; padding: 0 10px; }
.ib.sm { padding: 0; }
.btn.danger:hover { color: var(--accent); border-color: var(--accent-line); }
.btn.on, .ib.on { border-color: var(--accent-line); background: var(--accent-weak); color: var(--accent); }
:where(.btn, .ib, .chip, .sw, .tile, .card):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Chips (category filters, small labels): hairline + ~10% same-hue fill */
.chip { height: 30px; padding: 0 12px; border: 1px solid var(--line); background: transparent; border-radius: 8px; cursor: pointer;
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); white-space: nowrap;
  transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease); }
.chip:hover { color: var(--ink); border-color: var(--line-2); }
.chip.on { color: var(--accent); border-color: var(--accent-line); background: var(--accent-weak); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }

/* Color swatches */
.sws { display: flex; flex-wrap: wrap; gap: 7px; }
.sw { width: 28px; height: 28px; border-radius: 50%; background: var(--c); border: 1px solid var(--line-2); cursor: pointer; padding: 0; position: relative; transition: transform .15s var(--ease); }
.sw:hover { transform: translateY(-1px); }
.sw.on { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent); }
.sw.custom { background: conic-gradient(#f2b8c6, #e2b75f, #9ccf9a, #8fb8de, #b9a3e3, #f2b8c6); overflow: hidden; }
.sw.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Tiles (catalog items) */
.tile { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper-2);
  cursor: pointer; transition: border-color .15s var(--ease), transform .15s var(--ease); text-align: center; }
.tile:hover { border-color: var(--line-2); transform: translateY(-1px); }
.tile img, .tile canvas { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }
.tile .nm { font-size: 12px; color: var(--muted); line-height: 1.2; }

/* Panels, sheets, cards */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.sec-h { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }
.input { height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--paper); }
.input:focus { outline: none; border-color: var(--accent-line); }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* Top bar used by every mode */
.topbar { position: absolute; top: 0; left: 0; right: 0; height: 60px; display: flex; align-items: center; gap: 10px; padding: 0 16px; z-index: 10; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.topbar .title { font-weight: 650; font-size: 17px; letter-spacing: -.01em; }
.spacer { flex: 1; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 8px); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .18s var(--ease), transform .18s var(--ease); z-index: 100; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(42, 35, 32, .32); display: grid; place-items: center; z-index: 90; padding: 16px; }
.modal { background: var(--paper); border-radius: 18px; border: 1px solid var(--line); padding: 20px; max-width: 520px; width: 100%; max-height: 90dvh; overflow: auto; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.modal.ask { max-width: 380px; }
.ask-msg { margin: 0 0 18px; font-size: 16px; line-height: 1.45; }
.ask-acts { display: flex; justify-content: flex-end; gap: 8px; }
