:root {
  --bg: #08080a;
  --fg: #f4f4f5;
  --muted: #8d8d97;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --glass: rgba(18, 18, 22, 0.72);
  --chip: rgba(255, 255, 255, 0.06);
  --accent: #e8c36a;
  --accent-ink: #141005;
  --radius: 14px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --bar-h: 58px;
  --panel-w: clamp(300px, 30vw, 400px);
  --handle-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); transition: background-color .4s; }
body {
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden; overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- layout ---------- */
.app {
  position: fixed; inset: 0;
  display: grid; grid-template-rows: calc(var(--bar-h) + var(--sat)) 1fr;
}
.bar {
  display: flex; align-items: center; gap: 12px;
  padding: var(--sat) calc(14px + var(--sar)) 0 calc(14px + var(--sal));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  z-index: 5; min-width: 0;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--fg); text-decoration: none; flex: none; }
.brand img { border-radius: 8px; display: block; }
.brand span { font: 600 16px/1 Unbounded, Inter, sans-serif; letter-spacing: -0.01em; }
.title-wrap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.title {
  min-width: 0; width: 100%; max-width: 420px;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  padding: 7px 10px; font-weight: 500; color: var(--fg);
  text-overflow: ellipsis;
}
.title:hover { border-color: var(--line); }
.title:focus { outline: none; border-color: var(--line-2); background: rgba(255,255,255,0.04); }
.title[readonly] { pointer-events: none; }
.save-state { font-size: 12px; color: var(--muted); white-space: nowrap; }
.actions { display: flex; align-items: center; gap: 4px; flex: none; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #cfcfd6;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.07); color: #fff; }
.icon-btn .snd-off { display: none; }
.icon-btn[aria-pressed="false"] .snd-on { display: none; }
.icon-btn[aria-pressed="false"] .snd-off { display: block; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px 0 12px; margin-left: 6px;
  border-radius: 999px; background: var(--fg); color: #0b0b0d; font-weight: 600; font-size: 14px;
}
.pill-btn svg { width: 17px; height: 17px; }
.pill-btn:hover { background: #fff; }

.main {
  min-height: 0; display: grid;
  grid-template-columns: 1fr var(--panel-w);
}
.stage { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.canvas-wrap { position: relative; flex: 1; min-height: 0; }
.canvas-wrap canvas { position: absolute; inset: 0; display: block; cursor: grab; }
.canvas-wrap canvas:active { cursor: grabbing; }
.spin-row {
  flex: none; display: flex; justify-content: center;
  padding: 6px 16px calc(22px + var(--sab));
  position: relative; z-index: 2;
}
.spin-btn {
  position: relative; min-width: 200px; height: 60px; padding: 0 40px; border-radius: 999px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 100%, #fff 18%), var(--accent));
  color: var(--accent-ink);
  font: 800 17px/1 Unbounded, Inter, sans-serif; letter-spacing: 0.22em; text-transform: uppercase;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25) inset, 0 10px 40px -8px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform .15s ease, filter .2s, opacity .2s;
  overflow: hidden;
}
.spin-btn span { position: relative; z-index: 1; padding-left: 0.22em; }
.spin-btn::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.55) 50%, transparent 70%);
  transform: translateX(-120%); animation: shine 3.4s ease-in-out infinite;
}
.spin-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.spin-btn:active { transform: scale(0.97); }
.spin-btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.spin-btn:disabled::after { animation: none; }
@keyframes shine { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }

.viewer-note {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 2;
  display: flex; gap: 10px; align-items: center; white-space: nowrap;
  font-size: 13px; color: #d8d8de; padding: 7px 8px 7px 14px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px);
}
.link-btn { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.viewer-note .link-btn { text-decoration: none; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,0.08); }

/* ---------- panel ---------- */
.panel {
  min-height: 0; display: flex; flex-direction: column;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, #000 18%);
  padding-right: var(--sar);
}
.sheet-handle { display: none; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 18px calc(18px + var(--sab)); display: flex; flex-direction: column; gap: 12px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.count { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--chip); padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.tools { display: flex; gap: 2px; }
.tool { font-size: 13px; color: #c4c4cc; padding: 6px 9px; border-radius: 8px; }
.tool:hover { background: rgba(255,255,255,0.07); color: #fff; }
.input-wrap { position: relative; }
textarea {
  width: 100%; resize: vertical; min-height: 96px; max-height: 40vh;
  padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,0.04);
  border: 1px solid var(--line); line-height: 1.6; font-size: 15px;
}
textarea:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: rgba(255,255,255,0.06); }
textarea[readonly] { opacity: 0.6; }
.hint { margin: -4px 2px 0; font-size: 12px; color: var(--muted); }
kbd { font: 600 11px Inter, sans-serif; padding: 1px 5px; border-radius: 5px; border: 1px solid var(--line-2); color: #d0d0d6; }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 5px 5px 5px 11px; border-radius: 999px; background: var(--chip); border: 1px solid var(--line);
  font-size: 13.5px; animation: pop .18s ease;
}
.chips li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips li i { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-right: 2px; }
.chips li button { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex: none; font-size: 15px; line-height: 1; }
.chips li button:hover { background: rgba(255,255,255,0.1); color: #fff; }
.chips:empty { display: none; }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
.removed { border-top: 1px solid var(--line); padding-top: 12px; }
.removed summary { cursor: pointer; font-size: 14px; color: #c9c9d0; list-style: none; display: flex; align-items: center; gap: 8px; }
.removed summary::-webkit-details-marker { display: none; }
.removed summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 16px; color: var(--muted); }
.removed[open] summary::before { transform: rotate(90deg); }
.removed-list { margin: 10px 0; }
.removed-list li { opacity: 0.75; text-decoration: line-through; text-decoration-color: rgba(255,255,255,0.3); }
.removed-list li button { text-decoration: none; }
.removed-list li:hover { opacity: 1; }

/* ---------- portrait / narrow: bottom sheet ---------- */
@media (orientation: portrait), (max-width: 699px) {
  .main { grid-template-columns: 1fr; }
  .stage { padding-bottom: calc(var(--handle-h) + var(--sab)); }
  .spin-row { padding-bottom: 14px; }
  .panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    height: min(78dvh, 720px);
    border-left: 0; border-top: 1px solid var(--line-2);
    border-radius: 22px 22px 0 0;
    background: color-mix(in srgb, var(--bg) 88%, #15151a 12%);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    transform: translateY(calc(100% - var(--handle-h) - var(--sab)));
    transition: transform .35s cubic-bezier(.2,.8,.2,1);
    box-shadow: 0 -20px 60px rgba(0,0,0,0.45);
    padding: 0 var(--sar) 0 var(--sal);
  }
  .panel.open { transform: translateY(0); }
  .sheet-handle {
    display: flex; align-items: center; gap: 10px; flex: none; position: relative;
    height: var(--handle-h); padding: 10px 20px 0; width: 100%; text-align: left;
  }
  .grip { position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: rgba(255,255,255,0.22); }
  .sheet-summary { flex: 1; color: #d6d6dc; }
  .sheet-summary b { color: var(--fg); font-variant-numeric: tabular-nums; }
  .sheet-cta { font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px; background: rgba(255,255,255,0.08); }
  .panel-body { padding-top: 4px; }
  .panel-head h2 { display: none; }
  .panel-head { justify-content: flex-end; }
}
@media (max-width: 560px) {
  .brand span { display: none; }
  #btnFull { display: none; }
  .pill-btn { padding: 0 11px; }
  .pill-btn span { display: none; }
  .actions { gap: 0; }
  .icon-btn { width: 36px; }
  .spin-btn { min-width: 180px; height: 56px; }
  .save-state { display: none; }
}
/* phone landscape: compact */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --bar-h: 48px; --panel-w: clamp(260px, 34vw, 340px); }
  .main { grid-template-columns: 1fr var(--panel-w); }
  .panel { position: static; transform: none; height: auto; border-radius: 0; border-top: 0; border-left: 1px solid var(--line); box-shadow: none; }
  .sheet-handle { display: none; }
  .stage { padding-bottom: 0; }
  .spin-row { padding: 4px 0 calc(8px + var(--sab)); }
  .spin-btn { height: 44px; min-width: 150px; font-size: 14px; }
  .panel-head h2 { display: flex; }
  .panel-head { justify-content: space-between; }
  .brand span { display: none; }
}

/* ---------- winner ---------- */
.winner {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 50% 50%, rgba(0,0,0,0.25), rgba(0,0,0,0.72));
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: fade .35s ease;
}
.winner.closing { animation: fadeout .25s ease forwards; }
.winner-rays {
  position: absolute; left: 50%; top: 50%; width: 170vmax; height: 170vmax; margin: -85vmax 0 0 -85vmax;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--accent) 22%, transparent) 0deg 6deg, transparent 6deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0%, transparent 55%); mask: radial-gradient(circle, #000 0%, transparent 55%);
  animation: rays 24s linear infinite; pointer-events: none;
}
.winner-card {
  position: relative; width: min(92vw, 620px); text-align: center;
  padding: clamp(26px, 5vw, 44px) clamp(20px, 5vw, 44px) clamp(22px, 4vw, 32px);
  border-radius: 26px;
  background:
    linear-gradient(rgba(14,14,18,0.92), rgba(14,14,18,0.92)) padding-box,
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 100%, #fff 30%), transparent 40%, transparent 60%, var(--accent)) border-box;
  border: 1.5px solid transparent;
  box-shadow: 0 0 120px -20px color-mix(in srgb, var(--accent) 60%, transparent), 0 40px 80px -30px rgba(0,0,0,0.8);
  animation: cardIn .7s cubic-bezier(.2,1.4,.3,1);
}
.eyebrow { margin: 0 0 10px; font-size: 12px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); }
.winner-name {
  margin: 0; font: 800 clamp(30px, 8.5vw, 84px)/1.05 Unbounded, Inter, sans-serif; letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  background: linear-gradient(100deg, color-mix(in srgb, var(--accent) 80%, #fff 20%) 0%, #fff 22%, var(--accent) 45%, color-mix(in srgb, var(--accent) 60%, #fff 40%) 70%, #fff 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: glint 3s ease-in-out infinite, nameIn .9s cubic-bezier(.2,1.2,.3,1) both .15s;
  filter: drop-shadow(0 4px 30px color-mix(in srgb, var(--accent) 45%, transparent));
}
.winner-actions { display: flex; gap: 10px; justify-content: center; margin-top: clamp(22px, 4vw, 34px); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeout { to { opacity: 0; } }
@keyframes rays { to { transform: rotate(360deg); } }
@keyframes cardIn { from { transform: scale(0.6) translateY(30px); opacity: 0; } }
@keyframes nameIn { from { transform: scale(1.4); opacity: 0; letter-spacing: 0.2em; } }
@keyframes glint { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
.money { position: fixed; inset: 0; z-index: 21; pointer-events: none; display: none; }
.money.on { display: block; }

/* ---------- buttons ---------- */
.btn {
  height: 46px; padding: 0 20px; border-radius: 12px; font-weight: 600; font-size: 15px;
  background: rgba(255,255,255,0.08); border: 1px solid var(--line-2);
  transition: background .15s, transform .1s;
}
.btn:hover { background: rgba(255,255,255,0.13); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.danger { color: #ff8b8b; }

/* ---------- dialogs ---------- */
.dlg {
  width: min(94vw, 460px); max-height: min(88dvh, 720px); overflow: auto;
  padding: 22px; border-radius: 20px; border: 1px solid var(--line-2);
  background: #121216; color: var(--fg);
  box-shadow: 0 40px 100px -20px rgba(0,0,0,0.8);
}
.dlg::backdrop { background: rgba(0,0,0,0.55); backdrop-filter: blur(4px); }
.dlg[open] { animation: dlgIn .25s cubic-bezier(.2,1.2,.3,1); }
@keyframes dlgIn { from { transform: translateY(12px) scale(0.98); opacity: 0; } }
.dlg h3 { margin: 0 0 16px; font-size: 18px; font-weight: 600; }
.dlg-x { position: absolute; top: 12px; right: 12px; margin: 0; }
.dlg-x button { width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1; color: var(--muted); }
.dlg-x button:hover { background: rgba(255,255,255,0.08); color: #fff; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.seg button { text-align: left; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 3px; }
.seg button small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.seg button[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.seg button:disabled { opacity: 0.5; cursor: default; }
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255,255,255,0.04); font-size: 14px; }
.share-extra { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.qr { margin-left: auto; }
.qr img, .qr svg { display: block; width: 132px; height: 132px; border-radius: 10px; background: #fff; padding: 8px; }
.fine { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; }

.wheel-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wheel-list li { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; border-radius: 12px; border: 1px solid var(--line); }
.wheel-list li.current { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.wheel-list .w-open { flex: 1; min-width: 0; text-align: left; display: flex; flex-direction: column; }
.wheel-list .w-open b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wheel-list .w-open small { color: var(--muted); font-size: 12px; }
.wheel-list .w-del { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.wheel-list .w-del:hover { background: rgba(255,90,90,0.12); color: #ff8b8b; }
.wheel-list .empty { border-style: dashed; color: var(--muted); justify-content: center; padding: 18px; font-size: 14px; }

.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-opt { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px 10px; border-radius: 14px; border: 1px solid var(--line); font-size: 13px; }
.theme-opt[aria-checked="true"] { border-color: var(--accent); background: rgba(255,255,255,0.04); }
.theme-opt .sw { width: 64px; height: 64px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255,255,255,0.12), 0 8px 24px -6px rgba(0,0,0,0.6); position: relative; }
.theme-opt .sw::after { content: ""; position: absolute; inset: 40%; border-radius: 50%; background: inherit; box-shadow: 0 0 0 3px rgba(255,255,255,0.35); filter: brightness(1.2); }

/* ---------- toast / boot ---------- */
.toast {
  position: fixed; left: 50%; top: calc(var(--bar-h) + var(--sat) + 12px); z-index: 40;
  transform: translate(-50%, -8px); opacity: 0; pointer-events: none;
  padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 500;
  background: #f4f4f5; color: #0c0c0e; transition: opacity .2s, transform .2s; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.boot { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--bg); transition: opacity .5s; }
.boot img { animation: bootspin 1.4s cubic-bezier(.5,0,.5,1) infinite; border-radius: 14px; }
.boot.gone { opacity: 0; pointer-events: none; }
@keyframes bootspin { to { transform: rotate(360deg); } }
.fallback { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; text-align: center; color: #d6d6dc; padding: 24px; background: var(--bg); }
.fallback p { margin: 0 0 16px; font-size: 16px; }

@media (prefers-reduced-motion: reduce) {
  .winner-rays, .spin-btn::after, .winner-name { animation: none; }
}

/* ---------- present mode ---------- */
.present-exit {
  display: none; position: fixed; z-index: 9; top: calc(14px + var(--sat)); right: calc(14px + var(--sar));
  width: 42px; height: 42px; border-radius: 50%; place-items: center; color: #fff;
  background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.15); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .3s;
}
body.present .present-exit { display: grid; }
body.present.show-ui .present-exit, .present-exit:focus-visible { opacity: 1; }
body.present .bar, body.present .panel, body.present .viewer-note { display: none !important; }
body.present .app { grid-template-rows: 1fr; }
body.present .main { grid-template-columns: 1fr; }
body.present .stage { padding-bottom: 0; }
body.present .spin-row { padding-bottom: calc(28px + var(--sab)); }
body.present .spin-btn { height: 66px; min-width: 230px; font-size: 19px; }
body.present .canvas-wrap canvas { cursor: pointer; }

/* ---------- design panel ---------- */
.dlg.side::backdrop { background: transparent; backdrop-filter: none; }
.dlg.side { position: fixed; z-index: 30; width: min(94vw, 420px); margin: 0; }
@media (min-width: 900px) {
  .dlg.side { inset: calc(12px + var(--sat)) calc(12px + var(--sar)) 12px auto; height: auto; max-height: none; }
}
@media (max-width: 899px) {
  .dlg.side { inset: auto 0 0 0; width: 100%; max-width: 100%; max-height: 50dvh; border-radius: 22px 22px 0 0; padding-bottom: calc(22px + var(--sab)); border-bottom: 0; }
}
.themes { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.theme-opt { padding: 10px 4px 8px; gap: 6px; font-size: 12px; }
.theme-opt .sw { width: 46px; height: 46px; }
.sec { margin: 22px 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }
.opt { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.opt-label { font-size: 13px; color: #c9c9d0; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-btn { font-size: 13px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line-2); color: #d6d6dc; }
.chip-btn:hover { background: rgba(255,255,255,0.06); }
.chip-btn[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); color: #fff; }
.chip-btn .rim-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.3); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.color-dot { position: relative; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px rgba(255,255,255,0.18); cursor: pointer; flex: none; }
.color-dot input { position: absolute; inset: -8px; width: 48px; height: 48px; border: 0; padding: 0; cursor: pointer; background: none; }
.swatch-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px dashed var(--line-2); color: var(--muted); font-size: 18px; line-height: 1; display: grid; place-items: center; }
.swatch-btn:hover { color: #fff; border-color: #fff; }
.logo-box { display: flex; gap: 14px; align-items: flex-start; }
.logo-prev { flex: none; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,0.04); border: 1px dashed var(--line-2); overflow: hidden; font-size: 11px; color: var(--muted); text-align: center; }
.logo-prev img { width: 100%; height: 100%; object-fit: cover; }
.logo-ctl { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.logo-ctl > .btn, .logo-ctl > .chip-btn { align-self: flex-start; }
.btn.small { height: 36px; padding: 0 14px; font-size: 14px; display: inline-flex; align-items: center; cursor: pointer; }
.reset { margin-top: 18px; height: 40px; font-size: 14px; color: var(--muted); }

/* ---------- live viewer ---------- */
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 0 rgba(61,220,132,0.6); animation: livePulse 2s infinite; flex: none; }
.live-dot.off { background: #8d8d97; animation: none; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(61,220,132,0.55); } 70% { box-shadow: 0 0 0 8px rgba(61,220,132,0); } 100% { box-shadow: 0 0 0 0 rgba(61,220,132,0); } }
.viewer-note .icon-btn.small { width: 28px; height: 28px; border-radius: 50%; }
.viewer-note .icon-btn.small svg { width: 16px; height: 16px; }
.viewer-note .icon-btn.small.spin svg { animation: bootspin .8s linear infinite; }
@media (max-width: 560px) { .viewer-note { font-size: 12px; gap: 6px; } }
body:has(#viewerNote:not([hidden])) .toast { top: calc(var(--bar-h) + var(--sat) + 64px); }

/* ---------- ads ---------- */
.ad { display: none; }
.ad-label { display: flex; justify-content: space-between; align-items: center; width: var(--ad-w); max-width: 100%; height: 16px; font-size: 10.5px; letter-spacing: 0.06em; color: var(--muted); padding: 0 2px; }
.ad-remove { font-size: 11px; font-weight: 600; letter-spacing: 0; color: var(--accent); }
.ad-remove:hover { text-decoration: underline; text-underline-offset: 2px; }
.ad-box { width: var(--ad-w); height: var(--ad-h); max-width: 100%; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,0.03); }
.ad-box ins { display: block; width: var(--ad-w); height: var(--ad-h); }
body.ad-preview .ad-box { border: 1px dashed var(--line-2); display: grid; place-items: center; }
body.ad-preview .ad-box::after { content: "Ad space · " attr(data-size); font-size: 12px; color: var(--muted); }
body.ad-preview .ad-box ins { display: none; }
.ad-top { --ad-w: 320px; --ad-h: 50px; flex-direction: column; align-items: center; flex: none; padding: 8px 12px 0; position: relative; z-index: 2; }
.ad-panel { --ad-w: 300px; --ad-h: 250px; flex-direction: column; align-items: center; flex: none; padding: 10px 0 calc(10px + var(--sab)); border-top: 1px solid var(--line); }
/* wide screens: box under the names */
body.ads-on .ad-panel { display: flex; }
@media (min-height: 521px) { body.ads-on { --panel-w: clamp(306px, 30vw, 400px); } }
@media (max-height: 639px) { body.ads-on .ad-panel { display: none; } }
@media (orientation: portrait), (max-width: 699px) {
  body.ads-on .ad-panel { display: none; }
  body.ads-on .ad-top { display: flex; }
  body.ads-on { --ad-top-space: 74px; }
}
@media (orientation: portrait) and (min-width: 760px) {
  .ad-top { --ad-w: 728px; --ad-h: 90px; }
  body.ads-on { --ad-top-space: 114px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  body.ads-on .ad-top, body.ads-on .ad-panel { display: none; }
  body.ads-on { --ad-top-space: 0px; }
}
.ad.ad-off, body.present .ad { display: none !important; }
body.ads-on .viewer-note { top: calc(14px + var(--ad-top-space, 0px)); }
body.present .viewer-note { top: 14px; }
.legal-link { margin: auto 0 0; padding-top: 6px; font-size: 12px; }
.legal-link a, .acc-legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- account / ad-free ---------- */
.acc-btn { position: relative; }
body.is-adfree .acc-btn::after { content: ""; position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
@media (max-width: 560px) { .acc-btn { display: none; } }
.acc-entry { margin-top: 8px; }
.dlg.acc { width: min(94vw, 420px); }
.acc-hero { display: flex; align-items: center; gap: 14px; margin: 0 36px 18px 0; }
.acc-hero img { border-radius: 12px; flex: none; }
.acc-hero h3 { margin: 0; }
.acc-hero p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.acc-perks { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 14.5px; }
.acc-perks li { display: flex; gap: 10px; align-items: flex-start; }
.acc-perks li::before { content: "✓"; flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--accent-ink); background: var(--accent); margin-top: 1px; }
.acc-user { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 14px; border-radius: 14px; border: 1px solid var(--line); }
.acc-user img, .acc-initial { width: 36px; height: 36px; border-radius: 50%; flex: none; object-fit: cover; }
.acc-initial { display: grid; place-items: center; background: rgba(255,255,255,0.1); font-weight: 600; }
.acc-user > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acc-user b, .acc-user small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-user b { font-weight: 600; font-size: 14px; }
.acc-user small { color: var(--muted); font-size: 12px; }
.acc-user .link-btn { font-size: 13px; color: var(--muted); flex: none; }
.btn.google { background: #fff; color: #1f1f1f; border-color: transparent; display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn.google:hover { background: #f1f1f1; }
.btn.google .g-logo { width: 20px; height: 20px; }
.btn:disabled { opacity: 0.6; cursor: default; }
.acc-done { display: flex; gap: 12px; align-items: flex-start; padding: 14px; margin-bottom: 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.acc-done > div { display: flex; flex-direction: column; gap: 3px; }
.acc-done small { color: #cfcfd6; font-size: 13px; }
.acc-check { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--accent-ink); background: var(--accent); }
.fine.center { text-align: center; }
