:root {
  --bg: #faf7f2; --ink: #1f1d1a; --muted: #6b665e; --line: #e2dcd2; --card: #fff;
  --accent: #1a56b0; --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
button:hover { border-color: #bdb5a8; }
button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
button.link { border: 0; background: none; color: var(--accent); padding: 4px 0; text-decoration: underline; }
.spacer { flex: 1; }

.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--card); }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; }

.hero { max-width: 760px; margin: 0 auto; padding: 64px 24px; text-align: center; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); margin: 0 0 12px; }
.hero p { color: var(--muted); font-size: 18px; margin: 0 0 36px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.choice { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 24px; border-radius: var(--radius); background: var(--card); border: 2px solid var(--ink); color: var(--ink); text-decoration: none; }
.choice strong { font-size: 20px; }
.choice span { color: var(--muted); }
.choice.disabled { border-color: var(--line); opacity: .55; cursor: not-allowed; }

#make { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 54px); }
.side { border-right: 1px solid var(--line); padding: 20px; background: var(--card); }
.upload { display: flex; flex-direction: column; gap: 4px; padding: 18px; border: 2px dashed #bdb5a8; border-radius: var(--radius); cursor: pointer; text-align: center; }
.upload span { font-size: 13px; color: var(--muted); }
.upload.over { border-color: var(--accent); background: #eef3fb; }
.pictures { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.pictures button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 6px; }
.pictures button[aria-current="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.pictures img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.pictures span { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note { font-size: 12px; color: var(--muted); }

.work { padding: 20px 24px; min-width: 0; }
.controls { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin-bottom: 16px; }
.count { display: flex; flex-direction: column; gap: 4px; min-width: 240px; }
.count output { font-weight: 700; }
.count input { width: 100%; }
.hand { border: 0; padding: 0; margin: 0; display: flex; gap: 10px; align-items: center; }
.hand legend { float: left; margin-right: 6px; color: var(--muted); }
.mypaints { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.dot { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); margin-right: 3px; vertical-align: middle; }

.stage { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.picture { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.tabs { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.tabs [role="tab"][aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.status { font-size: 12px; color: var(--muted); }
.canvas-wrap { width: 100%; }
#canvas { width: 100%; height: auto; display: block; cursor: pointer; border-radius: 6px; }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.palette { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: sticky; top: 12px; }
.working { text-align: center; font-weight: 700; font-size: 18px; min-height: 26px; }
#ring { width: 100%; display: block; user-select: none; }
#ring .chip { cursor: pointer; transition: transform .35s cubic-bezier(.3,1.4,.5,1); }
#ring .chip text { font-weight: 700; pointer-events: none; }
#ring .centre.flash { animation: flash .35s ease-out; }
@keyframes flash { from { filter: brightness(1.8); } to { filter: none; } }
.recipe { font-size: 14px; line-height: 1.45; min-height: 60px; }
.recipe .mix { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 13px; }
.recipe .warn { color: #9a5b00; font-size: 13px; margin-top: 4px; }
.tip { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; margin-bottom: 0; }

.keyhead { font-size: 18px; margin: 28px 0 10px; }
.key { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.key li button { display: grid; grid-template-columns: 36px 1fr; gap: 10px; width: 100%; text-align: left; align-items: center; padding: 8px; }
.key li button[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.key .sw { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; border: 1px solid rgba(0,0,0,.2); }
.key small { color: var(--muted); display: block; font-size: 12px; }

dialog { border: 0; border-radius: var(--radius); padding: 20px 24px; width: min(920px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog h2 { margin-top: 0; }
dialog p { color: var(--muted); }
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 10px 2px 14px; touch-action: pan-y; }
.strip .swatch { flex: 0 0 52px; height: 72px; border-radius: 8px; border: 1px solid rgba(0,0,0,.2); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font-weight: 700; cursor: grab; touch-action: none; user-select: none; transition: transform .12s; }
.strip .swatch.dragging { cursor: grabbing; transform: scale(1.1); box-shadow: 0 6px 16px rgba(0,0,0,.3); z-index: 1; }
.dialog-actions { display: flex; gap: 8px; align-items: center; }

@media (max-width: 1000px) {
  .stage { grid-template-columns: 1fr; }
  .palette { position: static; max-width: 420px; }
}
@media (max-width: 720px) {
  #make { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .pictures { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ---------- phase 2: profiles and photos ---------- */
input[type="email"], input:not([type]), select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-width: 0; }
.account { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.numberform { display: grid; gap: 8px; }
.numberform .row { display: flex; gap: 6px; }
#number-input { width: 100%; font-size: 22px; letter-spacing: 3px; text-align: center; }
.check { font-size: 13px; display: flex; gap: 6px; align-items: center; }
.account details { margin-top: 10px; font-size: 14px; }
.account summary { cursor: pointer; color: var(--accent); }
.stack { display: grid; gap: 8px; margin-top: 8px; }
.stack small, .small { font-size: 12px; color: var(--muted); }
.who { font-size: 15px; }
#who-number { color: var(--muted); }
.msg { font-size: 13px; color: var(--accent); min-height: 1em; margin: 8px 0 0; }
.msg.error { color: #b3261e; }
.pictures h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 0 2px; }
.pictures small { display: block; color: var(--muted); font-size: 11px; }
.status-pick { display: flex; gap: 6px; align-items: center; color: var(--muted); }
label.button { display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.photo-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.photos { list-style: none; padding: 0; margin: 12px 0 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photos button { padding: 0; border: 1px solid var(--line); overflow: hidden; width: 100%; background: #fff; text-align: left; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.photos span { display: block; font-size: 12px; color: var(--muted); padding: 4px 6px; }
.camera video { width: 100%; max-height: 65vh; background: #000; border-radius: 8px; }
.camera-msg { min-height: 1.2em; }
.photo-view img { width: 100%; max-height: 75vh; object-fit: contain; }
.photo-view .when { color: var(--muted); font-size: 13px; }
