/* Dood Pixel Map — Mayor Pinto's Casino Night Room palette (shared with Doodle or Nothing).
   One memorable object: the world as a gilded pixel atlas; everything else stays quiet so the art is the show. */
@font-face { font-family: "Bagel Fat One"; src: url("fonts/bagel-fat-one-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Outfit"; src: url("fonts/outfit-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Outfit"; src: url("fonts/outfit-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Outfit"; src: url("fonts/outfit-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
:root {
  --ink: #0b0614; --night: #120a22; --plum: #1c1033; --plum-2: #26164a; --line: #3a2766;
  --gold: #e2b955; --gold-2: #f6d98b; --gold-ink: #2a1a05; --brass: #a8822f;
  --neon: #c58bff; --ok: #5ee39b; --warn: #f2c45a; --bad: #ff7a7a;
  --ivory: #f6eedf; --muted: #bcaed6; --dim: #9384b0;
  --display: "Bagel Fat One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --sans: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 18px; --r-sm: 12px; --pad: clamp(10px, 2.4vw, 24px);
  --dock-h: 76px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { min-height: 100dvh; background: var(--ink); color: var(--ivory); font: 400 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; display: flex; flex-direction: column; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(900px 520px at 50% -8%, #3b1a6b88, transparent 62%), radial-gradient(600px 380px at 100% 90%, #4a2a0a40, transparent 60%), var(--ink); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 60; background: var(--gold); color: var(--gold-ink); padding: 10px 16px; border-radius: 8px; font-weight: 600; }
.skip:focus { left: 12px; }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; border-radius: 10px; }
.preview-flag { margin: 0; padding: 5px 12px; text-align: center; font-size: 12.5px; color: #1b1203; background: repeating-linear-gradient(135deg, #f2c45a, #f2c45a 14px, #e9b43e 14px, #e9b43e 28px); font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .12s, box-shadow .15s, background-color .15s; }
.btn:active { transform: translateY(1px); }
.btn.gold { background: linear-gradient(180deg, var(--gold-2), var(--gold) 55%, var(--brass)); color: var(--gold-ink); box-shadow: 0 1px 0 #fff6 inset, 0 8px 22px -10px #e2b955aa; }
.btn.ghost { background: #ffffff0a; border-color: #ffffff26; color: var(--ivory); }
.btn.ghost:hover { border-color: #e2b95566; background: #ffffff14; }
.btn.big { min-height: 52px; padding: 0 26px; font-size: 17px; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--gold-2); font-weight: 600; font-size: 14px; cursor: pointer; padding: 6px 4px; min-height: 36px; }
.link-btn:hover { text-decoration: underline; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #ffffff1f; background: #120a22d9; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--ivory); border-color: #e2b95566; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn[aria-pressed="false"] .wave { opacity: 0; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 6px var(--pad); background: #0b0614eb; backdrop-filter: blur(10px); border-bottom: 1px solid #ffffff12; min-height: 56px; }
.back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; color: var(--muted); text-decoration: none; font-weight: 600; }
.back svg { width: 20px; height: 20px; }
.back:hover { color: var(--ivory); }
.brand { display: flex; flex-direction: column; line-height: 1.05; margin-right: auto; min-width: 0; }
.brand b { font: 400 21px/1 var(--display); color: var(--gold-2); letter-spacing: .5px; white-space: nowrap; }
.brand small { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding: 4px 10px; border-radius: 999px; background: #ffffff08; border: 1px solid #ffffff14; white-space: nowrap; }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.conn[data-state="live"] i { background: var(--ok); box-shadow: 0 0 0 3px #5ee39b33; }
.conn[data-state="connecting"] i, .conn[data-state="reconnecting"] i { background: var(--warn); animation: blink 1s infinite; }
.conn[data-state="offline"] i { background: var(--bad); }
@keyframes blink { 50% { opacity: .3; } }
.me-chip { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.me-badge { padding: 2px 8px; border-radius: 999px; background: #5ee39b22; color: var(--ok); font-weight: 700; font-size: 12px; white-space: nowrap; }
.me-badge[data-state="off"] { background: #ff7a7a22; color: var(--bad); }
.me-name { color: var(--ivory); font-weight: 600; max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* gate */
.gate { flex: 1; display: grid; place-items: center; padding: 24px var(--pad) 40px; }
.gate-card { width: min(560px, 100%); background: linear-gradient(180deg, #1c1033f2, #120a22f2); border: 1px solid var(--line); border-radius: 24px; padding: clamp(20px, 4vw, 36px); box-shadow: 0 30px 80px -40px #000, 0 0 0 1px #e2b9551a inset; text-align: center; }
.gate-art canvas { width: 192px; height: 96px; image-rendering: pixelated; border-radius: 10px; border: 2px solid var(--brass); box-shadow: 0 0 0 4px #e2b95522, 0 14px 40px -16px #e2b955aa; }
.gate h1 { font: 400 clamp(26px, 5vw, 36px)/1.1 var(--display); color: var(--gold-2); margin: 18px 0 10px; }
.lede { color: var(--muted); margin: 0 0 14px; }
.gate-rules { text-align: left; margin: 0 auto 18px; padding: 0; list-style: none; display: grid; gap: 6px; max-width: 420px; }
.gate-rules li { padding-left: 26px; position: relative; color: var(--ivory); }
.gate-rules li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 10px; height: 10px; background: var(--gold); box-shadow: 3px 3px 0 var(--brass); }
.gate-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.gate-flow { margin-top: 18px; padding: 16px; border-radius: var(--r); background: #0b0614aa; border: 1px dashed #e2b95555; }
.gate-flow img { margin: 0 auto 10px; border-radius: 12px; background: #fff; padding: 8px; }
.flow-msg { margin: 0 0 12px; font-weight: 600; }
.flow-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.gate-tickets { margin-top: 16px; display: grid; gap: 8px; text-align: left; }
.gate-tickets select { min-height: 44px; border-radius: 12px; background: var(--night); color: var(--ivory); border: 1px solid var(--line); padding: 0 10px; font: inherit; }
.gate-note { min-height: 1.5em; margin: 14px 0 0; color: var(--warn); font-weight: 600; }
.gate-note[data-tone="bad"] { color: var(--bad); }
.gate-small { color: var(--dim); font-size: 13px; margin: 8px 0 0; }

/* app */
.app { flex: 1; display: grid; grid-template-columns: 1fr 320px; grid-template-rows: 1fr auto; min-height: 0; height: calc(100dvh - 56px); }
body.has-flag .app { height: calc(100dvh - 56px - 28px); }
.stage { position: relative; grid-column: 1; grid-row: 1; overflow: hidden; background: #070310; touch-action: none; cursor: grab; outline: none; }
.stage[data-mode="paint"], .stage[data-mode="erase"] { cursor: crosshair; }
.stage[data-mode="claim"] { cursor: cell; }
.stage.panning { cursor: grabbing; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hover-tip { position: absolute; pointer-events: none; z-index: 5; background: #0b0614ee; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 13px; max-width: 240px; box-shadow: 0 8px 20px -8px #000; }
.hover-tip b { color: var(--gold-2); display: block; }
.hover-tip .no { color: var(--bad); font-weight: 600; }
.hover-tip .yes { color: var(--ok); font-weight: 600; }
.zoom { position: absolute; right: 12px; top: 12px; display: grid; gap: 8px; z-index: 4; }
.banner { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 10px; background: #2a1446f2; border: 1px solid var(--warn); color: var(--ivory); padding: 8px 10px 8px 14px; border-radius: 14px; max-width: calc(100% - 90px); font-size: 14px; }

.dock { grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center; gap: 12px; padding: 8px var(--pad); background: #0b0614f2; border-top: 1px solid #ffffff14; min-height: var(--dock-h); overflow-x: auto; }
.tools { display: flex; gap: 6px; flex: none; }
.tool-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 60px; height: 56px; border-radius: 14px; border: 1px solid #ffffff1a; background: #ffffff08; cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600; }
.tool-btn svg { width: 22px; height: 22px; }
.tool-btn[aria-checked="true"] { background: linear-gradient(180deg, #e2b95533, #e2b95514); color: var(--gold-2); border-color: var(--gold); }
.palette { display: grid; grid-template-columns: repeat(12, 26px); grid-auto-rows: 26px; gap: 4px; flex: none; }
.swatch { width: 26px; height: 26px; border-radius: 6px; border: 1px solid #ffffff33; cursor: pointer; padding: 0; }
.swatch[aria-checked="true"] { outline: 2px solid var(--gold-2); outline-offset: 2px; transform: scale(1.08); }
.pot { display: grid; gap: 3px; min-width: 150px; font-size: 13px; color: var(--muted); flex: none; }
.pot-bar { height: 8px; border-radius: 999px; background: #ffffff14; overflow: hidden; }
.pot-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--brass), var(--gold-2)); transition: width .25s; }
.pot[data-empty="true"] .pot-bar i { background: var(--bad); }
.save { font-weight: 600; min-height: 1.3em; }
.save[data-state="saved"] { color: var(--ok); }
.save[data-state="saving"] { color: var(--warn); }
.save[data-state="error"] { color: var(--bad); }
.panel-toggle { display: none; margin-left: auto; }
.panel-toggle .short { display: none; }

.panel { grid-column: 2; grid-row: 1; background: linear-gradient(180deg, #1c1033, #120a22); border-left: 1px solid #ffffff14; overflow-y: auto; padding: 12px 14px 20px; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tabs button { flex: 1; min-height: 40px; border-radius: 10px; border: 1px solid #ffffff14; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 14px; }
.tabs button[aria-selected="true"] { background: #e2b9551f; color: var(--gold-2); border-color: #e2b95566; }
.you-head b { display: block; font-size: 18px; }
.you-head small { color: var(--dim); }
.holder-line { font-size: 14px; color: var(--ok); margin: 6px 0 10px; }
.holder-line[data-state="off"] { color: var(--bad); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.stats div { background: #ffffff08; border: 1px solid #ffffff12; border-radius: 12px; padding: 8px 10px; }
.stats dt { font-size: 12px; color: var(--dim); }
.stats dd { margin: 0; font: 400 22px/1.1 var(--display); color: var(--gold-2); }
.panel h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 16px 0 6px; }
.my-plots, .milestones, .leaders { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.my-plots li { display: flex; align-items: center; gap: 8px; background: #ffffff08; border-radius: 10px; padding: 6px 8px; }
.my-plots li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-plots small { color: var(--dim); }
.milestones li { font-size: 14px; color: var(--dim); }
.milestones li[data-done="true"] { color: var(--ok); }
.ms-note { margin: -4px 0 8px; font-size: 13px; color: var(--muted); }
.milestones li::before { content: "○ "; }
.milestones li[data-done="true"]::before { content: "● "; }
.hint { color: var(--muted); font-size: 14px; }
.seg { display: flex; gap: 4px; margin-bottom: 10px; }
.seg-btn { flex: 1; min-height: 36px; border-radius: 999px; border: 1px solid #ffffff1a; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600; }
.seg-btn[aria-pressed="true"] { background: #e2b9551f; color: var(--gold-2); border-color: #e2b95566; }
.leaders { counter-reset: r; }
.leaders li { display: grid; grid-template-columns: 26px 1fr auto; gap: 6px; align-items: center; padding: 6px 8px; border-radius: 10px; background: #ffffff06; font-size: 14px; }
.leaders li::before { counter-increment: r; content: counter(r); color: var(--gold); font-weight: 700; text-align: center; }
.leaders li[data-me="true"] { background: #e2b9551f; }
.leaders .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaders .who small { color: var(--dim); margin-left: 4px; }
.leaders .n { font-weight: 700; color: var(--gold-2); }
.how ol { padding-left: 20px; display: grid; gap: 8px; color: var(--muted); }
.how b { color: var(--ivory); }

.toast-wrap { position: fixed; left: 50%; bottom: calc(var(--dock-h) + 16px); transform: translateX(-50%); display: grid; gap: 8px; z-index: 40; width: min(440px, calc(100% - 24px)); pointer-events: none; }
.toast { background: #1c1033f5; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 12px; padding: 10px 14px; font-size: 14px; box-shadow: 0 12px 30px -12px #000; animation: tin .18s ease-out; }
.toast[data-tone="bad"] { border-left-color: var(--bad); }
.toast[data-tone="ok"] { border-left-color: var(--ok); }
@keyframes tin { from { transform: translateY(6px); opacity: 0; } }

.dlg { border: 1px solid var(--line); border-radius: 20px; background: var(--plum); color: var(--ivory); padding: 22px; width: min(400px, calc(100% - 24px)); }
.dlg::backdrop { background: #0b0614b3; }
.dlg h2 { font: 400 24px/1.1 var(--display); color: var(--gold-2); margin: 0 0 8px; }
.dlg label { display: block; font-weight: 600; margin: 12px 0 4px; }
.dlg label small { color: var(--dim); font-weight: 400; }
.dlg input { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--night); color: var(--ivory); padding: 0 12px; font: inherit; }
.dlg-err { color: var(--bad); min-height: 1.3em; margin: 8px 0 0; font-size: 14px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* ───────── creator experience (rc4) ───────── */
.icon-btn.small { width: 36px; height: 36px; }
.icon-btn.small svg { width: 18px; height: 18px; }
.icon-btn[disabled] { opacity: .4; cursor: not-allowed; }
.gate-share { color: var(--gold-2); font-weight: 600; }
.guide { position: absolute; left: 12px; top: 12px; z-index: 5; width: min(330px, calc(100% - 24px)); background: #120a22f0; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 40px -20px #000; backdrop-filter: blur(6px); }
.guide-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 4px 14px; }
.guide-head h2 { margin: 0; flex: 1; font: 400 19px/1.15 var(--display); color: var(--gold-2); }
.guide-body { padding: 0 14px 12px; }
.guide.folded .guide-body { display: none; }
.guide.folded #guideFold svg { transform: rotate(180deg); }
.guide-text { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.guide-text b { color: var(--ivory); }
.guide-status { margin: 6px 0; min-height: 1.4em; font-size: 13.5px; font-weight: 600; }
.guide-status[data-tone="ok"] { color: var(--ok); }
.guide-status[data-tone="bad"] { color: var(--bad); }
.guide-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.guide-fine { margin: 8px 0 0; font-size: 12px; color: var(--dim); }
.sizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.size-btn { min-height: 52px; border-radius: 12px; border: 1px solid #ffffff1f; background: #ffffff08; color: var(--muted); cursor: pointer; display: grid; place-items: center; gap: 2px; padding: 4px 2px; font-size: 12px; font-weight: 600; }
.size-btn i { display: block; background: var(--gold); opacity: .8; }
.size-btn[aria-checked="true"] { border-color: var(--gold); color: var(--gold-2); background: #e2b9551f; }
.canvases { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.canvases li { display: flex; align-items: center; gap: 8px; background: #ffffff08; border: 1px solid #ffffff10; border-radius: 12px; padding: 6px 8px; }
.canvases li[data-selected="true"] { border-color: var(--gold); background: #e2b9551a; }
.canvases canvas { width: 32px; height: 32px; image-rendering: pixelated; border-radius: 6px; background: #0b0614; flex: none; border: 1px solid #ffffff22; }
.canvases .c-name { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.canvases .c-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.canvases .c-name small { color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canvases .c-draft { color: var(--warn); }
.mapbar { position: absolute; top: 12px; right: 66px; z-index: 4; display: flex; gap: 8px; align-items: flex-start; width: min(480px, calc(100% - 430px)); min-width: 280px; }
.search { position: relative; flex: 1; min-width: 0; }
.search input { width: 100%; min-height: 40px; border-radius: 999px; border: 1px solid #ffffff26; background: #120a22e6; color: var(--ivory); padding: 0 14px; font: inherit; font-size: 14px; }
.search input:focus { border-color: var(--gold); outline: none; }
.search-results { position: absolute; left: 0; right: 0; top: 46px; margin: 0; padding: 4px; list-style: none; background: #120a22f7; border: 1px solid var(--line); border-radius: 14px; max-height: 320px; overflow-y: auto; box-shadow: 0 18px 40px -20px #000; }
.search-results li { padding: 8px 10px; border-radius: 10px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.search-results li[aria-selected="true"], .search-results li:hover { background: #e2b9551f; }
.search-results small { color: var(--dim); }
.views { display: flex; background: #120a22e6; border: 1px solid #ffffff26; border-radius: 999px; padding: 2px; flex: none; }
.view-btn { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; }
.view-btn[aria-checked="true"] { background: #e2b95533; color: var(--gold-2); }
.key-btn { min-height: 38px; background: #120a22e6; }
.legend { position: absolute; z-index: 5; top: 60px; right: 66px; margin: 0; padding: 10px 12px; list-style: none; background: #120a22f5; border: 1px solid var(--line); border-radius: 14px; display: grid; gap: 4px; font-size: 13px; }
.legend i { display: inline-block; width: 16px; height: 12px; margin-right: 8px; vertical-align: -1px; border-radius: 3px; }
.legend i[data-k="free"] { background: #5ee39b55; border: 1px solid #5ee39b; }
.legend i[data-k="mine"] { background: #f6d98b55; border: 1px solid #f6d98b; }
.legend i[data-k="taken"] { background: #c58bff44; border: 1px solid #c58bff; }
.legend i[data-k="legacy"] { background: repeating-linear-gradient(135deg, #ff9f1c88 0 3px, transparent 3px 6px); border: 1px dashed #ff9f1c; }
.legend i[data-k="disputed"] { background: repeating-linear-gradient(45deg, #ff7a7a99 0 3px, transparent 3px 6px); border: 1px dashed #ff7a7a; }
.legend i[data-k="oldart"] { background: #ff7fa8; }
.legend i[data-k="draft"] { background: transparent; border: 2px dashed #f2c45a; }
.where { position: absolute; left: 12px; bottom: 120px; z-index: 4; font-size: 12px; color: var(--muted); background: #0b0614c0; border-radius: 8px; padding: 3px 8px; pointer-events: none; font-variant-numeric: tabular-nums; }
.where:empty { display: none; }
.overview { position: absolute; left: 12px; bottom: 12px; z-index: 4; width: 200px; height: 100px; border-radius: 10px; border: 1px solid #ffffff33; background: #0b0614; image-rendering: pixelated; cursor: pointer; box-shadow: 0 10px 30px -12px #000; }
.art-card { position: absolute; z-index: 7; right: 66px; top: 62px; width: min(320px, calc(100% - 90px)); max-height: calc(100% - 24px); overflow-y: auto; background: #120a22f7; border: 1px solid var(--line); border-radius: 18px; padding: 14px; box-shadow: 0 22px 50px -20px #000; }
.art-close { position: absolute; right: 8px; top: 8px; }
.art-thumb { width: 96px; height: 96px; image-rendering: pixelated; border-radius: 10px; border: 2px solid var(--brass); background: #0b0614; }
.art-card h2 { font: 400 22px/1.15 var(--display); color: var(--gold-2); margin: 8px 30px 2px 0; overflow-wrap: anywhere; }
.art-sub { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.art-facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0 0 10px; font-size: 13px; }
.art-facts dt { color: var(--dim); }
.art-facts dd { margin: 0; }
.art-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.creator { display: flex; align-items: center; gap: 8px; flex: none; }
.modes { display: flex; background: #ffffff08; border: 1px solid #ffffff1a; border-radius: 999px; padding: 2px; }
.mode-btn { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; }
.mode-btn[aria-checked="true"] { background: #e2b95533; color: var(--gold-2); }
.publish { display: grid; gap: 2px; justify-items: start; }
.draft-state { font-size: 12.5px; font-weight: 600; color: var(--muted); min-height: 1.2em; white-space: nowrap; }
.draft-state[data-state="unsaved"] { color: var(--warn); }
.draft-state[data-state="busy"] { color: var(--warn); }
.draft-state[data-state="ok"] { color: var(--ok); }
.draft-state[data-state="bad"] { color: var(--bad); }
body[data-mode="draft"] .pot { display: none; }
.app[data-has-canvas="false"] .creator, .app[data-has-canvas="false"] .palette { opacity: .45; }
.theme-card { display: grid; gap: 2px; background: linear-gradient(135deg, #e2b9552b, #c58bff1f); border: 1px solid #e2b95555; border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; }
.theme-card small { color: var(--dim); }
.theme-card b { font: 400 18px/1.2 var(--display); color: var(--gold-2); }
.theme-card p { margin: 0; font-size: 14px; color: var(--muted); }
.sample-note { color: var(--warn) !important; }
.btn.wide { width: 100%; }
.toast .toast-act { pointer-events: auto; margin-left: 10px; background: none; border: 1px solid var(--gold); color: var(--gold-2); border-radius: 999px; padding: 2px 10px; font-weight: 600; cursor: pointer; font-size: 13px; }
.toast-wrap .toast { pointer-events: auto; }
.dlg.wide { width: min(560px, calc(100% - 24px)); }
.dlg fieldset { border: 1px solid #ffffff1a; border-radius: 12px; margin: 12px 0 0; padding: 6px 12px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.dlg legend { padding: 0 4px; font-weight: 600; font-size: 14px; }
.dlg fieldset label, .dlg .check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 4px 0; font-size: 14px; }
.dlg input[type="radio"], .dlg input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--gold); }
.dlg input[type="file"] { padding: 8px; }
.crop { display: flex; gap: 12px; margin-top: 8px; }
.crop label { display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; }
.crop input { width: 90px; min-height: 36px; }
.import-preview { display: grid; grid-template-columns: auto auto 1fr; gap: 12px; align-items: start; margin-top: 12px; }
.import-preview figure { margin: 0; text-align: center; font-size: 12px; color: var(--dim); }
.import-preview canvas { width: 112px; height: 112px; image-rendering: pixelated; border-radius: 8px; border: 1px solid #ffffff33; background: #0b0614; display: block; }
.imp-report p { margin: 0 0 6px; font-size: 13px; }
.colour-map { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; max-height: 130px; overflow-y: auto; font-size: 12px; }
.colour-map li { display: flex; align-items: center; gap: 6px; }
.colour-map i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid #ffffff44; display: inline-block; }
.colour-map .same { color: var(--dim); }
.colour-map .chg { color: var(--warn); }

@media (max-width: 900px) {
  :root { --dock-h: 142px; }
  .app { grid-template-columns: 1fr; }
  .panel { position: fixed; left: 0; right: 0; bottom: var(--dock-h); max-height: 62dvh; z-index: 20; border-left: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; transform: translateY(calc(100% + var(--dock-h) + 24px)); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; box-shadow: 0 -20px 50px -20px #000; }
  .panel.open { transform: none; visibility: visible; transition: transform .22s ease; }
  .dock { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "tools pot toggle" "palette palette palette"; gap: 8px 10px; overflow: hidden; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .tools { grid-area: tools; }
  .pot { grid-area: pot; min-width: 0; align-self: center; }
  .palette { grid-area: palette; grid-template-columns: repeat(12, minmax(0, 28px)); grid-auto-rows: 26px; gap: 4px; justify-content: space-between; padding: 2px; min-width: 0; }
  .swatch { width: 100%; height: 26px; }
  .panel-toggle { grid-area: toggle; display: inline-flex; margin: 0; align-self: center; }
  .brand small { display: none; }
  .conn span { display: none; }
  .me-name { display: none; }
  .me-chip .link-btn { white-space: nowrap; font-size: 13px; }
}
@media (max-width: 480px) {
  .tool-btn { width: 50px; height: 50px; font-size: 11px; }
  .topbar { gap: 6px; }
  .back span { display: none; }
  .panel-toggle { padding: 0 12px; }
  .panel-toggle .long { display: none; }
  .panel-toggle .short { display: inline; }
  .brand b { font-size: 18px; }
  #soundBtn { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media (max-width: 900px) {
  :root { --dock-h: 186px; }
  .dock { grid-template-columns: 1fr auto; grid-template-areas: "tools toggle" "creator creator" "palette palette"; }
  body[data-mode="live"] .dock { grid-template-areas: "tools toggle" "creator pot" "palette palette"; }
  .creator { grid-area: creator; flex-wrap: nowrap; overflow-x: auto; min-width: 0; }
  .pot { display: none; }
  body[data-mode="live"] .pot { display: grid; grid-area: pot; align-self: center; min-width: 120px; }
  body[data-mode="live"] .publish { display: none; }
  .guide { width: calc(100% - 70px); }
  .mapbar { top: auto; bottom: 12px; left: 12px; right: 12px; width: auto; min-width: 0; }
  .search-results { top: auto; bottom: 46px; }
  .legend { top: auto; bottom: 60px; left: 12px; right: 12px; }
  .overview, .where { display: none; }
  .art-card { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 70%; }
  .import-preview { grid-template-columns: auto auto; }
  .imp-report { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .guide-head { padding: 6px 6px 2px 12px; }
  .guide-head h2 { font-size: 17px; }
  .guide-body { padding: 0 12px 8px; }
  .guide-text { font-size: 13px; margin-bottom: 6px; }
  #guidePlaceText { display: none; }
  .guide-fine { display: none; }
  .size-btn { min-height: 38px; }
  .size-btn i { display: none; }
  .guide-actions { margin-top: 4px; gap: 6px; }
  .guide-status { margin: 4px 0; font-size: 12.5px; }
  .canvases li { padding: 4px 6px; }
  .views .view-btn { padding: 0 8px; }
  .key-btn { padding: 0 10px; }
  .mode-btn { padding: 0 9px; }
  .creator .btn.small { padding: 0 10px; }
  .dlg fieldset { grid-template-columns: 1fr; }
}

/* link to the fine-canvas prototype (rc5 proposal); hidden on narrow screens to keep the top bar clear */
.geo-link { display: none; }
@media (min-width: 980px) { .geo-link { display: inline-flex; min-height: 36px; padding: 0 12px; font-size: 13.5px; } }
.imp-lines { margin: 0 0 8px; padding-left: 18px; font-size: 13.5px; } .imp-lines li { margin: 2px 0; } .imp-lines .warn { color: var(--warn); }
