:root {
  color-scheme: dark;
  --bg: #0a0a0f;
  --stage: #050508;
  --panel: #13131a;
  --panel-2: #1b1b24;
  --line: #262632;
  --text: #f2f2f6;
  --muted: #8e8ea3;
  --accent: #ff7a1a;
  --accent-soft: rgba(255, 122, 26, 0.16);
  --yellow: #ffd635;
  --good: #22d38a;
  --bad: #ff4d6a;
  --radius: 14px;
  --pixel: "Silkscreen", ui-monospace, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; overscroll-behavior: none; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  --top: 96px; /* header height, kept in sync by app.js */
}

h2 { font-size: 18px; margin: 0 0 6px; }
h3 {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 700;
}
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 14px; }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: #3a3a48; background: #23232d; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0d00; }
.btn.primary:hover { background: #ff8c3a; }
.btn.ghost { background: transparent; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; }
.btn.share svg { width: 15px; height: 15px; fill: currentColor; }
.linkish {
  background: none; border: 0; padding: 0; color: var(--text); font: inherit; font-weight: 700;
  cursor: pointer; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.linkish:hover { text-decoration: underline; }

.icon-btn {
  width: 36px; height: 36px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--panel-2); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.small { width: 26px; height: 26px; }
.icon-btn.small svg { width: 15px; height: 15px; }
.icon-btn.active { background: var(--accent); color: #1a0d00; }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }

/* ---------- the canvas fills the window; everything else floats on it */
.stage {
  position: fixed; inset: 0; overflow: hidden;
  background-color: var(--stage);
  /* Paint splashes in the logo's colors around the canvas (static: drawn once, costs nothing per frame) */
  background-image:
    url(splash.svg),
    radial-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
    radial-gradient(ellipse 38% 30% at 6% 22%, rgba(255, 90, 31, .42), transparent 70%),
    radial-gradient(ellipse 22% 18% at 20% 8%, rgba(255, 214, 53, .30), transparent 70%),
    radial-gradient(ellipse 34% 30% at 96% 16%, rgba(54, 144, 234, .42), transparent 70%),
    radial-gradient(ellipse 26% 22% at 80% 34%, rgba(81, 233, 244, .16), transparent 70%),
    radial-gradient(ellipse 40% 34% at 92% 92%, rgba(180, 74, 192, .46), transparent 70%),
    radial-gradient(ellipse 24% 20% at 70% 104%, rgba(255, 56, 129, .32), transparent 70%),
    radial-gradient(ellipse 36% 30% at 4% 94%, rgba(0, 204, 120, .36), transparent 70%),
    radial-gradient(ellipse 18% 16% at 28% 70%, rgba(255, 214, 53, .14), transparent 70%),
    linear-gradient(115deg, transparent 38%, rgba(255, 168, 0, .06) 45%, rgba(255, 56, 129, .07) 52%, rgba(106, 92, 255, .06) 59%, transparent 66%);
  background-size: cover, 22px 22px, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
  background-position: center;
}
/* Tall screens (phones): the same splash, arranged above and below the canvas. */
@media (max-aspect-ratio: 4/5) {
  .stage {
    background-image:
      url(splash-tall.svg),
      radial-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
      radial-gradient(ellipse 60% 22% at 10% 14%, rgba(255, 90, 31, .38), transparent 70%),
      radial-gradient(ellipse 50% 20% at 95% 12%, rgba(54, 144, 234, .38), transparent 70%),
      radial-gradient(ellipse 60% 22% at 92% 90%, rgba(180, 74, 192, .42), transparent 70%),
      radial-gradient(ellipse 55% 20% at 5% 88%, rgba(0, 204, 120, .34), transparent 70%);
    background-size: cover, 22px 22px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
  }
}
#view {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
#view.paint { cursor: crosshair; }
#view.grabbing { cursor: grabbing; }
.loader {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--pixel); color: var(--muted); pointer-events: none;
}

.top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 8;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "brand desc actions" "progress progress progress";
  align-items: center;
  gap: 8px 24px;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: linear-gradient(to bottom, rgba(5, 5, 8, .94), rgba(5, 5, 8, .78));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand { grid-area: brand; display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.logo { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 2px 8px rgba(255, 160, 40, .25)); }
.brand-name { font-family: var(--pixel); font-size: 22px; letter-spacing: 0.02em; white-space: nowrap; }
.ticker {
  font-family: var(--pixel); font-size: 12px; padding: 2px 7px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
}
.desc { grid-area: desc; cursor: default; margin: 0; color: #b9b9c9; max-width: 640px; justify-self: center; text-align: center; font-size: 14px; }
.desc b { color: var(--text); }
.announce {
  grid-column: 1 / -1; margin: 0; padding: 7px 12px; border-radius: 10px; font-size: 13px; font-weight: 600;
  background: rgba(255, 214, 53, .12); border: 1px solid rgba(255, 214, 53, .35); color: #ffe68a;
}
body.admin-page { height: auto; overflow: auto; }
.head-actions { grid-area: actions; display: flex; gap: 8px; justify-self: end; }

.progress { grid-area: progress; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 0; }
.progress-bar { flex: 0 0 120px; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.progress-fill { height: 100%; width: 0; min-width: 2px; background: linear-gradient(90deg, var(--accent), var(--yellow)); transition: width .6s ease; }
.progress-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.progress-pct { font-family: var(--pixel); color: var(--text); margin-left: auto; }

/* ---------- account drawer: only while adding art */
.panel {
  position: fixed; top: var(--top); right: 0; bottom: 0; z-index: 9; width: 360px;
  overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
  background: rgba(10, 10, 15, .97); border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px rgba(0, 0, 0, .5);
  transform: translateX(105%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s;
}
body.panel-open .panel { transform: none; visibility: visible; transition: transform .25s ease, visibility 0s; }
.panel-close { align-self: flex-end; margin: -6px -6px -6px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card a { color: var(--accent); text-decoration: none; display: inline-block; margin-top: 10px; }
.card a:hover { text-decoration: underline; }

/* ---------- overlay UI on the stage */
.tip {
  position: absolute; z-index: 5; pointer-events: none;
  padding: 6px 9px; border-radius: 8px;
  background: rgba(14, 14, 20, .95); border: 1px solid var(--line);
  font-size: 12px; white-space: nowrap; box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
}
.tip .coords { color: var(--muted); font-family: ui-monospace, Menlo, monospace; margin-right: 6px; }

.overlays {
  position: absolute; top: calc(var(--top) + 12px); left: 12px; z-index: 6;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  max-width: min(400px, calc(100% - 80px));
}
.commitbar {
  background: rgba(19, 19, 26, .96); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.commitbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 6px 6px 14px; border-color: var(--accent);
}
.commitbar #draftText { font-size: 13px; }

.danger-text { color: var(--bad); margin-right: auto; }
.claimbar { padding: 4px 4px 10px; border-bottom: 1px solid var(--line); min-width: 0; }
.dock.claiming { width: min(460px, calc(100% - 24px)); }
.dock.claiming .palette, .dock.claiming .sizes, .dock.claiming #undoBtn { display: none; }
.claim-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.claim-size { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.claim-size label { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.claim-size input {
  width: 72px; height: 36px; padding: 0 8px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 16px;
}
.claim-size input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.times { color: var(--muted); }
.chips { display: flex; gap: 4px; width: 100%; margin-top: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 26px; padding: 0 9px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; font-size: 12px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip:disabled { opacity: .35; cursor: default; border-color: var(--line); }
.claim-info { margin: 8px 0 2px; font-size: 13px; }
.claim-info b { font-family: var(--pixel); font-weight: 400; color: var(--accent); }
.claim-status { margin: 0 0 10px; font-size: 12px; min-height: 1.45em; }
.claim-status.ok { color: var(--good); }
.claim-status.bad { color: var(--bad); }
.claim-actions { display: flex; gap: 8px; justify-content: flex-end; }

.zoom {
  position: absolute; top: calc(var(--top) + 12px); right: 12px; z-index: 4;
  display: flex; flex-direction: column; gap: 4px; padding: 4px;
  background: rgba(19, 19, 26, .9); border: 1px solid var(--line); border-radius: 12px;
}

.toasts {
  position: fixed; inset: auto; left: 50%; top: calc(var(--top) + 14px); transform: translateX(-50%); z-index: 30;
  margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; color: inherit;
  display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none;
  width: max-content; max-width: calc(100% - 32px);
}
.toast {
  padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  background: rgba(19, 19, 26, .97); border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  animation: toast-in .18s ease-out; transition: opacity .3s, transform .3s;
}
.toast.good { border-color: var(--good); }
.toast.error { border-color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(-6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

body:not(.editing) .dock { display: none; }
.dock {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 4;
  display: flex; flex-direction: column; gap: 8px; padding: 8px;
  background: rgba(19, 19, 26, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .55);
}
.dock-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.seg { display: flex; gap: 2px; padding: 2px; background: var(--bg); border-radius: 12px; }
.sizes button {
  width: 34px; height: 36px; border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  display: grid; place-items: center;
}
.sizes button i { display: block; background: var(--text); border-radius: 2px; }
.sizes button.active { background: var(--panel-2); box-shadow: inset 0 0 0 1px #3a3a48; }
.palette { display: grid; grid-template-columns: repeat(16, 22px); gap: 4px; }
.swatch {
  width: 22px; height: 22px; padding: 0; border-radius: 6px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .16);
}
.swatch.active { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- account card */
.who { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.who-text { flex: 1; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; }
.avatar i { display: block; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.stats3 > div { background: var(--panel-2); border-radius: 10px; padding: 9px 10px; min-width: 0; }
.label { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.val { display: block; font-family: var(--pixel); font-size: 15px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.val.accent { color: var(--accent); }
.banned { color: var(--bad); font-weight: 600; }
.recover { display: block; margin-top: 10px; font-weight: 400; }
.demo { border-color: rgba(255, 214, 53, .4); }
.demo h3 { color: var(--yellow); }

.how { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--muted); }
.how b { color: var(--text); }
.top-list { margin: 0; padding: 0; list-style: none; counter-reset: rank; display: grid; gap: 6px; }
.top-list li { display: flex; align-items: center; gap: 10px; counter-increment: rank; }
.top-list li:not(.muted)::before { content: counter(rank); width: 18px; color: var(--muted); font-family: var(--pixel); font-size: 12px; }
.top-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-list .px { font-family: var(--pixel); font-size: 12px; color: var(--muted); }
.feed { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 13px; }
.feed li { display: flex; gap: 8px; align-items: baseline; }
.feed .dot { width: 8px; height: 8px; border-radius: 2px; flex: none; transform: translateY(-1px); background: var(--good); }
.feed .dot.claimed { background: var(--accent); }
.feed .dot.moderated { background: var(--muted); }
.feed .text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.feed time { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* ---------- dialogs */
dialog {
  width: min(420px, calc(100vw - 32px));
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 18px; padding: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
dialog::backdrop { background: rgba(0, 0, 0, .65); backdrop-filter: blur(3px); }
dialog input:not([type]), dialog input[type="text"] {
  width: 100%; height: 42px; padding: 0 12px; margin-top: 8px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 16px;
}
dialog input:focus, dialog select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.error { color: var(--bad); min-height: 1.4em; margin: 8px 0 0; font-size: 13px; }
.file { display: flex; align-items: center; gap: 10px; margin: 12px 0; cursor: pointer; }
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-weight: 600; }
.select select {
  flex: 1; height: 34px; padding: 0 8px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit;
}
.image-preview {
  display: grid; place-items: center; height: 220px; border-radius: 12px; overflow: hidden;
  background: repeating-conic-gradient(#1d1d25 0 25%, #16161c 0 50%) 0 0 / 16px 16px;
}
.image-preview canvas { image-rendering: pixelated; }
.image-preview canvas.smooth { image-rendering: auto; }
.range { display: flex; align-items: center; gap: 10px; margin: 12px 0 6px; font-weight: 600; }
.range input { flex: 1; accent-color: var(--accent); }
.range span { width: 56px; text-align: right; font-family: ui-monospace, Menlo, monospace; font-weight: 400; color: var(--muted); }
#imageInfo.over { color: var(--bad); }
.wallet-list { display: grid; gap: 8px; margin-top: 12px; }
.wallet-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-align: left;
}
.wallet-opt:hover { border-color: var(--accent); }
.wallet-opt img { width: 28px; height: 28px; border-radius: 7px; }

/* ---------- plot card */
.pd-head { display: flex; align-items: flex-start; gap: 10px; }
.pd-head-text { flex: 1; min-width: 0; }
.pd-head h2 { overflow-wrap: anywhere; }
.pd-link { display: inline-block; max-width: 100%; margin: 2px 0 10px; color: var(--accent); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-link:hover { text-decoration: underline; }
.pd-sale {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 8px 0; padding: 12px; border-radius: 12px; background: rgba(34, 211, 138, .08); border: 1px solid rgba(34, 211, 138, .35);
}
.pd-price { display: block; font-family: var(--pixel); font-weight: 400; font-size: 18px; color: var(--good); }
.pd-section { margin: 18px 0 8px; }
.field { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.field input {
  display: block; width: 100%; height: 38px; margin-top: 4px; padding: 0 10px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 16px; font-weight: 400;
}
#plotDialog .row.end { margin-top: 8px; }
.sale-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.sale-list button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border-radius: 8px;
  border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.sale-list button:hover { background: var(--panel-2); }
.sale-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sale-list .px { color: var(--muted); font-size: 12px; }
.sale-list .price { font-family: var(--pixel); font-size: 12px; color: var(--good); }
.feed .dot.bought, .feed .dot.listed { background: var(--yellow); }

/* ---------- powered by NutLab */
.powered {
  position: absolute; left: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 5;
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px; border-radius: 99px;
  background: rgba(19, 19, 26, .92); border: 1px solid var(--line); color: var(--muted);
  font-size: 12px; text-decoration: none; transition: border-color .15s, color .15s;
}
.powered:hover { color: var(--text); border-color: #c8913c; }
.powered b { color: var(--text); font-weight: 700; }
.powered img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
@media (max-width: 860px) { body.editing .powered { display: none; } }

/* ---------- "what is Picatso?" window */
.brand { cursor: pointer; }
.brand:hover .logo { transform: rotate(-8deg) scale(1.06); }
.logo { transition: transform .2s ease; }
dialog.about { width: min(520px, calc(100vw - 32px)); padding: 26px 24px 22px; }
.about-close { position: absolute; top: 12px; right: 12px; }
.about-hero { text-align: center; margin-bottom: 14px; }
.about-logo { width: 128px; height: 128px; filter: drop-shadow(0 8px 24px rgba(255, 160, 40, .35)); }
dialog.about[open] .about-logo { animation: cat-hello 1s ease-out both; }
@keyframes cat-hello {
  0% { transform: scale(.4) rotate(-25deg); opacity: 0; }
  55% { transform: scale(1.08) rotate(8deg); opacity: 1; }
  75% { transform: scale(.97) rotate(-4deg); }
  100% { transform: scale(1) rotate(0); }
}
.pixel-strip { display: flex; justify-content: center; gap: 3px; margin: 10px 0 12px; }
.pixel-strip i { width: 10px; height: 10px; border-radius: 2px; }
dialog.about[open] .pixel-strip i { animation: pixel-pop .35s ease-out both; }
@keyframes pixel-pop { from { transform: scale(0); } }
.about h2 { font-size: 24px; margin: 0; }
.about .pix { font-family: var(--pixel); color: var(--accent); }
.about-tag { color: #c9c9d8; margin: 6px 0 0; }
.about-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.about-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.about-steps .emoji { font-size: 26px; line-height: 1; flex: none; width: 34px; text-align: center; }
.about-steps b { display: block; margin-bottom: 2px; }
.about-steps p { margin: 0; color: #c2c2d2; font-size: 13.5px; }
.about-goal { margin: 14px 0 10px; padding: 12px; border-radius: 14px; background: linear-gradient(135deg, rgba(255, 122, 26, .12), rgba(180, 74, 192, .12)); border: 1px solid rgba(255, 122, 26, .3); }
.about-goal-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.about-goal-head span { font-family: var(--pixel); color: var(--accent); }
.about-bar { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.about-bar div { height: 100%; min-width: 3px; width: 0; border-radius: 99px; background: linear-gradient(90deg, #ff4500, #ffa800, #ffd635, #00cc78, #3690ea, #b44ac0); transition: width .8s ease; }
.about-goal p { margin: 8px 0 0; }
.about-risk { font-size: 12px; color: #a99aa0; margin: 0 0 4px; }

/* ---------- final confirmation */
.cf-lines { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 6px; }
.cf-lines li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.cf-lines li span:first-child { color: var(--muted); }
.cf-lines li b, .cf-lines li span:last-child { text-align: right; overflow-wrap: anywhere; }
.cf-lines li b { color: var(--accent); }
.cf-risk { margin: 12px 0; padding: 12px; border-radius: 12px; background: rgba(255, 77, 106, .08); border: 1px solid rgba(255, 77, 106, .4); font-size: 13px; }
.cf-risk b { color: #ff8095; }
.cf-risk p { margin: 6px 0 0; color: #d8c4c8; }
.cf-agree { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; font-weight: 600; cursor: pointer; }
.cf-agree input { margin-top: 2px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }

/* ---------- small screens */
@media (max-width: 1100px) {
  .top { grid-template-columns: auto 1fr; grid-template-areas: "brand actions" "desc desc" "progress progress"; }
  .desc { justify-self: start; text-align: left; font-size: 13px; }
}

@media (max-width: 860px) {
  .panel { left: 0; width: auto; border-left: 0; }
  .commitbar { justify-content: space-between; }
  .overlays { right: 60px; max-width: none; }
}

@media (max-width: 430px) {
  .brand-name { display: none; }
}

@media (max-width: 520px) {
  .top { padding: 10px 12px 8px; gap: 6px 10px; }
  .logo { width: 32px; height: 32px; }
  .brand-name { font-size: 17px; }
  .ticker, #shareBtn span { display: none; }
  .head-actions { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .dock-row { flex-wrap: wrap; justify-content: center; }
  #shareBtn { padding: 0 10px; }
  .head-actions .btn { height: 34px; padding: 0 11px; }
  .progress-bar { flex-basis: 60px; }
  .zoom { right: 8px; }
  .zoom .icon-btn { width: 32px; height: 32px; }
  .dock { left: 8px; right: 8px; bottom: 8px; transform: none; padding: 6px; gap: 6px; }
  .dock-row { gap: 4px; }
  .seg .icon-btn, .dock .icon-btn { width: 32px; height: 34px; }
  .sizes button { width: 26px; height: 34px; }
  .palette { grid-template-columns: repeat(16, 1fr); gap: 3px; }
  .swatch { width: 100%; height: auto; aspect-ratio: 1; border-radius: 4px; }
  .swatch.active { outline-offset: 1px; }
  .dock.claiming { width: auto; }
}

/* ---------- touch screens: smooth and thumb-friendly */
@media (pointer: coarse) {
  /* Frosted-glass blur is re-computed on every frame while the canvas moves under it: skip it. */
  .top, .dock, .commitbar, dialog::backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .top { background: rgba(5, 5, 8, .97); }
  .dock { background: rgba(19, 19, 26, .98); }
  .icon-btn { width: 40px; height: 40px; }
  .zoom .icon-btn { width: 40px; height: 40px; }
  .btn.small { height: 36px; padding: 0 12px; }
  .chip { height: 32px; padding: 0 12px; font-size: 13px; }
}

@media (max-width: 520px) {
  /* Short header: two lines of description (tap to read it all), none while editing. */
  .desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .desc.open { display: block; }
  body.editing .desc { display: none; }
  .progress-text { font-size: 11px; }

  .dock { bottom: calc(8px + env(safe-area-inset-bottom)); }
  .seg .icon-btn, .dock .icon-btn { width: 40px; height: 40px; }
  .sizes button { width: 32px; height: 40px; }
  /* Colors in one swipeable row of big swatches instead of 32 tiny ones. */
  .palette { display: flex; grid-template-columns: none; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px 4px; scrollbar-width: none; }
  .palette::-webkit-scrollbar { display: none; }
  .swatch { flex: none; width: 36px; height: 36px; aspect-ratio: auto; border-radius: 9px; scroll-snap-align: start; }
  .swatch.active { outline-offset: 2px; }

  /* Pop-ups slide up from the bottom, where thumbs are. */
  dialog {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 20px 20px 0 0; border-bottom: 0;
    max-height: 88dvh; overflow-y: auto; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    animation: sheet-up .22s ease-out;
  }
  .panel { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  dialog.about { width: 100%; padding: 22px 16px calc(20px + env(safe-area-inset-bottom)); }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }
