/* Dio&Bite – liquid glass styling */

:root {
  color-scheme: light;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg: #eef1ff;
  --blob1: #bfcaff; --blob2: #ffd9c4; --blob3: #c9f1e4;
  --text: #151a33; --muted: #566083; --faint: #8b92b0;
  --accent: #3f58f5; --accent-2: #6d83ff; --on-accent: #fff; --accent-soft: rgba(63, 88, 245, .14);
  --danger: #dc3b45; --ok: #14a06f;
  --glass: rgba(255, 255, 255, .5);
  --glass-strong: rgba(255, 255, 255, .82);
  --glass-solid: rgba(250, 251, 255, .96);
  --glass-border: rgba(255, 255, 255, .72);
  --glass-hi: rgba(255, 255, 255, .85);
  --glass-lo: rgba(60, 80, 170, .06);
  --hover: rgba(63, 88, 245, .09);
  --shadow: 0 10px 36px -14px rgba(36, 50, 120, .34), 0 2px 8px -3px rgba(36, 50, 120, .12);
  --card: rgba(255, 255, 255, .62);
  --line: rgba(40, 55, 120, .12);
  --paper: #fffefa;
  --board-ink: #1a2250;
  --guide: rgba(63, 88, 245, .30);
  --guide-base: rgba(63, 88, 245, .62);
  --radius: 22px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0d1b;
  --blob1: #2a3bb5; --blob2: #6a2a7a; --blob3: #12706a;
  --text: #eceeff; --muted: #a3abd0; --faint: #747ca3;
  --accent: #7b8dff; --accent-2: #9aa8ff; --on-accent: #0a0d1b; --accent-soft: rgba(123, 141, 255, .18);
  --danger: #ff6b73; --ok: #43d6a0;
  --glass: rgba(34, 39, 66, .46);
  --glass-strong: rgba(70, 78, 120, .55);
  --glass-solid: rgba(24, 28, 50, .97);
  --glass-border: rgba(255, 255, 255, .13);
  --glass-hi: rgba(255, 255, 255, .16);
  --glass-lo: rgba(0, 0, 0, .25);
  --hover: rgba(255, 255, 255, .08);
  --shadow: 0 14px 40px -14px rgba(0, 0, 0, .65), 0 2px 8px -3px rgba(0, 0, 0, .4);
  --card: rgba(30, 35, 62, .55);
  --line: rgba(255, 255, 255, .1);
  --paper: #171a2b;
  --board-ink: #f1f3ff;
  --guide: rgba(140, 160, 255, .26);
  --guide-base: rgba(150, 168, 255, .6);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0d1b;
    --blob1: #2a3bb5; --blob2: #6a2a7a; --blob3: #12706a;
    --text: #eceeff; --muted: #a3abd0; --faint: #747ca3;
    --accent: #7b8dff; --accent-2: #9aa8ff; --on-accent: #0a0d1b; --accent-soft: rgba(123, 141, 255, .18);
    --danger: #ff6b73; --ok: #43d6a0;
    --glass: rgba(34, 39, 66, .46);
    --glass-strong: rgba(70, 78, 120, .55);
    --glass-solid: rgba(24, 28, 50, .97);
    --glass-border: rgba(255, 255, 255, .13);
    --glass-hi: rgba(255, 255, 255, .16);
    --glass-lo: rgba(0, 0, 0, .25);
    --hover: rgba(255, 255, 255, .08);
    --shadow: 0 14px 40px -14px rgba(0, 0, 0, .65), 0 2px 8px -3px rgba(0, 0, 0, .4);
    --card: rgba(30, 35, 62, .55);
    --line: rgba(255, 255, 255, .1);
    --paper: #171a2b;
    --board-ink: #f1f3ff;
    --guide: rgba(140, 160, 255, .26);
    --guide-base: rgba(150, 168, 255, .6);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--font); font-size: 15px; line-height: 1.45;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .42; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }

/* ---------- background ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg i { position: absolute; border-radius: 50%; opacity: .75; will-change: transform; }
.bg i:nth-child(1) { width: 62vmax; height: 62vmax; left: -18vmax; top: -22vmax; background: radial-gradient(circle at 50% 50%, var(--blob1), transparent 66%); animation: drift1 26s ease-in-out infinite alternate; }
.bg i:nth-child(2) { width: 56vmax; height: 56vmax; right: -20vmax; top: 8vmax; background: radial-gradient(circle at 50% 50%, var(--blob2), transparent 66%); animation: drift2 32s ease-in-out infinite alternate; }
.bg i:nth-child(3) { width: 60vmax; height: 60vmax; left: 10vmax; bottom: -34vmax; background: radial-gradient(circle at 50% 50%, var(--blob3), transparent 66%); animation: drift3 38s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(8vmax, 6vmax) scale(1.08); } }
@keyframes drift2 { to { transform: translate(-7vmax, 8vmax) scale(1.12); } }
@keyframes drift3 { to { transform: translate(6vmax, -7vmax) scale(1.06); } }

/* ---------- glass ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(185%);
  backdrop-filter: blur(24px) saturate(185%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi), inset 0 -1px 0 var(--glass-lo);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-solid); }
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 10px; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: min(1320px, calc(100% - 24px)); margin: 10px auto 0; padding: 8px 10px 8px 12px;
  border-radius: 999px;
}
/* The glass look lives on a pseudo-element: a filter on the bar itself would trap the fixed bottom tabs on phones inside it. */
.topbar.glass { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; border: 0; }
.topbar::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(185%); backdrop-filter: blur(24px) saturate(185%); border: 1px solid var(--glass-border); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi), inset 0 -1px 0 var(--glass-lo); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .topbar::before { background: var(--glass-solid); } }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand-mark { width: 34px; height: 34px; flex: none; border-radius: 10px; object-fit: cover; box-shadow: 0 4px 12px -4px rgba(40, 120, 200, .5); }
.brand-icon { width: 34px; height: 34px; flex: none; border-radius: 10px; object-fit: cover; box-shadow: 0 4px 12px -4px rgba(63, 88, 245, .45); }
.brand-name { font-weight: 750; font-size: 19px; letter-spacing: -.02em; }

.tabs { position: relative; display: flex; padding: 4px; border-radius: 999px; background: var(--hover); border: 1px solid var(--line); }
.tabs button { position: relative; z-index: 1; min-width: 86px; padding: 8px 20px; border-radius: 999px; font-weight: 600; color: var(--muted); transition: color .25s; }
.tabs button[aria-selected="true"] { color: var(--text); }
.tab-ind { position: absolute; top: 4px; bottom: 4px; left: 0; width: 0; transform: translateX(0); border-radius: 999px; background: var(--glass-strong); box-shadow: 0 2px 10px -2px rgba(30, 40, 110, .3), inset 0 1px 0 var(--glass-hi); transition: transform .38s var(--ease), width .38s var(--ease); }

.top-right { display: flex; align-items: center; gap: 6px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--text); transition: background .2s, transform .2s; }
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { transform: scale(.92); }

.progress { display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 14px 0 12px; border-radius: 999px; transition: background .2s; }
.progress:hover { background: var(--hover); }
.pg-track { position: relative; width: 78px; height: 8px; border-radius: 99px; background: var(--line); overflow: visible; }
.pg-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .5s var(--ease); }
.pg-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 2px; background: var(--faint); opacity: .7; }
.pg-text { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress.ready .pg-text { color: var(--ok); }

main { width: min(1320px, calc(100% - 24px)); margin: 0 auto; padding: 18px 0 48px; }
.view { animation: viewIn .4s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- shared buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 20px; border-radius: 999px; font-weight: 600; background: var(--glass-strong); border: 1px solid var(--glass-border); transition: transform .2s, background .2s, box-shadow .2s; }
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--on-accent); border-color: transparent; box-shadow: 0 8px 20px -8px var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.link-btn { color: var(--muted); font-size: 13px; font-weight: 600; padding: 6px 8px; border-radius: 8px; }
.link-btn:hover { color: var(--text); background: var(--hover); }

.pill { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--muted); background: var(--card); border: 1px solid var(--line); transition: all .2s; }
.pill:hover { color: var(--text); }
.pill[aria-checked="true"] { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
button.chip:hover { filter: brightness(1.1); }

/* ---------- edit layout ---------- */
.edit-grid {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: 98px minmax(0, 1fr) 96px 252px;
  grid-template-areas: "chars stage tools variants";
}
.char-pane { grid-area: chars; position: sticky; top: 84px; display: flex; flex-direction: column; gap: 10px; min-width: 0; max-height: calc(100vh - 104px); max-height: calc(100dvh - 104px); }
.stage { grid-area: stage; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.tools { grid-area: tools; position: sticky; top: 84px; display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 28px; }
.variants-pane { grid-area: variants; position: sticky; top: 84px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 104px); max-height: calc(100dvh - 104px); }

/* dropdown (glass) */
.dd { position: relative; min-width: 0; }
.dd-btn { width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 10px 0 14px; border-radius: 16px; font-weight: 600; font-size: 14px; background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); border: 1px solid var(--glass-border); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi); transition: background .2s; }
.dd-btn:hover { background: var(--glass-strong); }
.dd-btn .dd-text { text-align: left; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn .ic { color: var(--muted); transition: transform .25s var(--ease); }
.dd-btn[aria-expanded="true"] .ic { transform: rotate(180deg); }
.cat-dd .dd-btn { min-height: 54px; padding: 0 8px 0 10px; font-size: 12.5px; }
.cat-dd .dd-text { white-space: normal; }

/* character list */
.char-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; overscroll-behavior: contain; padding: 6px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); scrollbar-width: thin; }
.char-item { position: relative; flex: none; height: 48px; display: grid; place-items: center; border-radius: 14px; font-size: 22px; font-weight: 500; color: var(--text); transition: background .15s, transform .15s; }
.char-item:hover { background: var(--hover); }
.char-item:active { transform: scale(.95); }
.char-item[aria-selected="true"] { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--on-accent); box-shadow: 0 6px 16px -6px var(--accent); }
.char-item .ci-badge { position: absolute; top: 4px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center; color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.char-item[aria-selected="true"] .ci-badge { color: #fff; background: rgba(255, 255, 255, .28); }
.char-item .ci-req { position: absolute; top: 6px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); opacity: .55; }
.char-item[aria-selected="true"] .ci-req { background: #fff; opacity: .7; }

/* stage */
.stage-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-height: 58px; }
.stage-title h1 { font-size: clamp(20px, 2.6vw, 28px); font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.stage-title h1 b { display: inline-block; min-width: 1ch; padding: 0 .28em; margin: 0 .05em; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.stage-title .sym { font-weight: 500; color: var(--muted); font-size: .72em; }
.hint { margin-top: 4px; color: var(--muted); font-size: 13.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.tag { padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.tag.req { color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); }
.tag.opt { color: var(--muted); background: var(--hover); }
.tag.done { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }

.board-wrap { position: relative; width: 100%; aspect-ratio: 8 / 5; border-radius: 26px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; display: block; -webkit-tap-highlight-color: transparent; }
.board-wrap.erasing #board { cursor: none; }
.eraser-ring { position: absolute; left: 0; top: 0; pointer-events: none; border-radius: 50%; border: 1.5px solid var(--accent); background: var(--accent-soft); transform: translate(-100px, -100px); }
.board-opts { display: flex; flex-wrap: wrap; gap: 8px; }

/* tools */
.tool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 58px; padding: 6px 4px; border-radius: 20px; font-size: 11.5px; font-weight: 600; color: var(--muted); transition: background .18s, color .18s, transform .18s; }
.tool:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.tool:active:not(:disabled) { transform: scale(.94); }
.tool[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.tool.save { margin-top: 4px; min-height: 64px; color: var(--on-accent); background: linear-gradient(180deg, var(--accent-2), var(--accent)); box-shadow: 0 8px 18px -8px var(--accent); }
.tool.save:hover:not(:disabled) { color: var(--on-accent); filter: brightness(1.07); background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.tool.thick { padding: 8px 6px 6px; gap: 5px; cursor: default; }
.tool.thick label { font-size: 11.5px; }
.thick-dot { width: 100%; height: 30px; display: grid; place-items: center; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.thick-dot i { display: block; border-radius: 50%; background: var(--board-ink); transition: width .12s, height .12s; }
.tool.thick output { font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: var(--line); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 99px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: #fff; border: 1px solid rgba(0, 0, 0, .1); box-shadow: 0 2px 8px rgba(20, 30, 90, .35); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 1px solid rgba(0, 0, 0, .1); box-shadow: 0 2px 8px rgba(20, 30, 90, .35); }

/* saved drawings */
.vp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 4px; }
.vp-head h2 { font-size: 15px; font-weight: 700; }
.count { font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.variant-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; overscroll-behavior: contain; padding: 2px; scrollbar-width: thin; }
.variant { flex: none; display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 6px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); transition: border-color .2s, background .2s, transform .25s var(--ease); animation: popIn .35s var(--ease); }
@keyframes popIn { from { opacity: 0; transform: scale(.94); } }
.variant.editing { border-color: var(--accent); background: var(--accent-soft); }
.v-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; border-radius: 14px; }
.v-thumb { width: 96px; height: 58px; flex: none; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.v-label { display: flex; flex-direction: column; font-weight: 600; font-size: 13.5px; line-height: 1.25; }
.v-label small { font-weight: 500; font-size: 11.5px; color: var(--muted); }
.v-del { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--faint); transition: all .18s; }
.v-del:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.empty { padding: 18px 14px; border-radius: 20px; border: 1.5px dashed var(--line); color: var(--muted); font-size: 13.5px; text-align: center; }

/* ---------- menus, toasts, modal ---------- */
.menu { position: fixed; z-index: 100; min-width: 210px; max-width: min(360px, calc(100vw - 16px)); padding: 6px; border-radius: 22px; overflow: auto; opacity: 0; transform: translateY(-6px) scale(.97); transform-origin: top; transition: opacity .16s, transform .22s var(--ease); }
.menu.in { opacity: 1; transform: none; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 15px; text-align: left; font-weight: 550; font-size: 14.5px; transition: background .12s; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item.sel { color: var(--accent); }
.menu-item.danger { color: var(--danger); }
.menu-item .ic:last-child:not(:first-child) { margin-left: auto; }
.mi-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.mi-hint { font-size: 12px; font-weight: 450; color: var(--muted); }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--line); }
.menu-note { padding: 8px 12px 6px; font-size: 12px; color: var(--muted); max-width: 270px; }

.pop { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 14px; width: min(340px, calc(100vw - 32px)); }
.pop h3 { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.field { display: grid; gap: 0; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; font-size: 13.5px; font-weight: 600; }
.field-row output { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chipbtn { height: 34px; padding: 0 13px; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--card); border: 1px solid var(--line); transition: all .15s; }
.chipbtn:hover { color: var(--text); }
.chipbtn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85); box-shadow: 0 0 0 1px var(--line), 0 3px 8px -2px rgba(0, 0, 0, .3); transition: transform .15s; position: relative; }
.sw:hover { transform: scale(1.1); }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--accent), 0 3px 8px -2px rgba(0, 0, 0, .3); }
.sw.custom { overflow: hidden; background: conic-gradient(#ff5f5f, #ffd45f, #6fe08a, #5fd0ff, #7a6bff, #ff5fd2, #ff5f5f); cursor: pointer; }
.sw.custom input { position: absolute; inset: -10px; width: 60px; height: 60px; opacity: 0; cursor: pointer; }
.pop-note { font-size: 12.5px; color: var(--muted); }
.pop .btn { min-height: 38px; }

.pg-row { display: grid; gap: 6px; }
.pg-row .line { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 14px; }
.pg-row .line small { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 6px; }
.pg-row .bar { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.pg-row .bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.pg-row.done .bar span { background: var(--ok); }

.toasts { position: fixed; z-index: 120; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: min(460px, calc(100vw - 24px)); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 11px 12px 11px 18px; border-radius: 99px; font-weight: 550; font-size: 14px; opacity: 0; transform: translateY(12px) scale(.96); transition: opacity .2s, transform .3s var(--ease); max-width: 100%; }
.toast.in { opacity: 1; transform: none; }
.toast-btn { flex: none; padding: 6px 14px; border-radius: 99px; font-weight: 700; color: var(--accent); background: var(--accent-soft); }

.modal-backdrop { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 16px; background: rgba(10, 14, 40, .32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .2s; }
.modal-backdrop.in { opacity: 1; }
.modal { width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 24px; border-radius: 30px; transform: scale(.95); transition: transform .3s var(--ease); background: var(--glass-solid); }
.modal-backdrop.in .modal { transform: none; }
.modal h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 8px; }
.modal p { color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.keys { display: grid; gap: 4px; margin-top: 14px; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.key-row:last-child { border: 0; }
kbd { display: inline-block; min-width: 26px; padding: 2px 8px; margin-left: 3px; border-radius: 8px; font: 600 12px var(--font); text-align: center; color: var(--text); background: var(--card); border: 1px solid var(--line); border-bottom-width: 2px; }

/* ---------- type tab ---------- */
.type-bar { position: sticky; top: 76px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; border-radius: 28px; margin-bottom: 16px; }
.type-bar .spacer { flex: 1; }
.font-dd { width: 200px; }
.bar-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 99px; font-weight: 600; font-size: 14px; transition: background .18s, transform .18s; }
.bar-btn:hover { background: var(--hover); }
.bar-btn:active { transform: scale(.96); }
.bar-btn.accent { color: var(--on-accent); background: linear-gradient(180deg, var(--accent-2), var(--accent)); box-shadow: 0 8px 18px -8px var(--accent); }
.bar-btn.accent:hover { filter: brightness(1.07); }
.swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85); box-shadow: 0 0 0 1px var(--line); }
.bar-btn .swatch + span { margin-right: 2px; }

.type-main { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.writer { position: sticky; top: 148px; display: flex; flex-direction: column; border-radius: 26px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.writer textarea { display: block; width: 100%; min-height: min(420px, 55vh); resize: vertical; padding: 18px 18px 8px; border: 0; outline: 0; background: transparent; color: var(--text); font: 17px/1.6 var(--font); }
.writer textarea::placeholder { color: var(--faint); }
.writer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.writer-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 10px 10px 18px; min-height: 44px; }
.status { font-size: 12.5px; color: var(--muted); }
.status button { color: var(--accent); font-weight: 650; text-decoration: underline; text-underline-offset: 2px; }
.status b { font-weight: 700; color: var(--text); }

.preview { min-width: 0; }
.paper-stack { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.paper-fig { margin: 0; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.paper { display: block; width: 100%; height: auto; background: #fff; border-radius: 6px; box-shadow: 0 18px 50px -18px rgba(20, 30, 90, .45), 0 2px 6px rgba(20, 30, 90, .12); cursor: text; }
.paper-fig figcaption { font-size: 12.5px; font-weight: 600; color: var(--muted); }

.lock { display: grid; place-items: center; min-height: calc(100dvh - 190px); }
.lock-card { width: min(440px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 34px 28px; text-align: center; border-radius: 34px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.lock-ic { width: 60px; height: 60px; display: grid; place-items: center; border-radius: 20px; background: var(--accent-soft); color: var(--accent); }
.lock-ic .ic { width: 28px; height: 28px; }
.lock-card h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.lock-card p { color: var(--muted); }
.lock-bar { width: 100%; height: 9px; margin-top: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.lock-bar span { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .5s var(--ease); }
.lock-count { font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; }
.lock-card .btn { margin-top: 6px; }
.noscript { padding: 24px; text-align: center; }

/* ---------- type bar: font, ink, thickness, paper ---------- */
.bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.type-bar { column-gap: 14px; row-gap: 8px; }
.font-btn { width: 210px; min-height: 42px; border-radius: 99px; padding: 0 12px 0 18px; box-shadow: none; background: var(--hover); border: 1px solid var(--line); -webkit-backdrop-filter: none; backdrop-filter: none; }
.font-btn:hover { background: var(--glass-strong); }
.font-btn .dd-text { font-size: 15px; }
.font-btn[aria-expanded="true"] .ic { transform: rotate(180deg); }
.font-btn .ic { color: var(--muted); transition: transform .25s var(--ease); }
.size-dd { width: 112px; }
.size-dd .dd-btn { border-radius: 99px; min-height: 42px; padding: 0 12px 0 18px; box-shadow: none; background: var(--hover); border: 1px solid var(--line); -webkit-backdrop-filter: none; backdrop-filter: none; }
.size-dd .dd-btn:hover { background: var(--glass-strong); }
.bar-slider { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 16px 0 16px; border-radius: 99px; background: var(--hover); border: 1px solid var(--line); cursor: default; }
.bs-label { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.bar-slider input[type="range"] { width: 130px; }
.bar-slider output { min-width: 62px; text-align: right; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

.menu-head { padding: 8px 12px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.menu-row { display: flex; align-items: center; gap: 2px; }
.menu-row .menu-item:first-child { flex: 1; min-width: 0; }
.menu-item.menu-del { width: 38px; height: 38px; flex: none; padding: 0; justify-content: center; border-radius: 50%; color: var(--faint); }
.menu-item.menu-del:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.font-menu { min-width: 300px; max-width: min(380px, calc(100vw - 16px)); }
.font-menu .mi-hint { white-space: normal; }

/* ---------- responsive ---------- */
@media (max-width: 1160px) {
  .edit-grid {
    grid-template-columns: 98px minmax(0, 1fr) 96px;
    grid-template-areas: "chars stage tools" "variants variants variants";
  }
  .variants-pane { position: static; max-height: none; }
  .variant-list { flex-direction: row; overflow-x: auto; padding-bottom: 8px; }
  .variant { min-width: 210px; }
  .empty { text-align: left; }
}
@media (max-width: 900px) {
  .type-main { grid-template-columns: 1fr; }
  .writer { position: static; }
  .writer textarea { min-height: 150px; resize: vertical; }
  .type-bar { top: 70px; }
}
@media (max-width: 760px) {
  body { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .topbar { top: 6px; margin-top: 6px; width: calc(100% - 16px); padding: 6px 6px 6px 10px; }
  .brand-name { font-size: 17px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-icon { width: 30px; height: 30px; }
  main { width: calc(100% - 16px); padding-top: 12px; }
  .tabs { position: fixed; z-index: 45; bottom: calc(14px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); padding: 5px; background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(185%); backdrop-filter: blur(24px) saturate(185%); border: 1px solid var(--glass-border); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi); }
  .tabs button { min-width: 112px; padding: 11px 24px; font-size: 16px; }
  .tab-ind { top: 5px; bottom: 5px; }
  .pg-track { width: 52px; }
  .progress { padding: 0 10px; gap: 7px; }
  .toasts { bottom: calc(92px + env(safe-area-inset-bottom)); }

  .edit-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "chars" "stage" "tools" "variants";
    gap: 12px;
  }
  .char-pane { position: static; max-height: none; flex-direction: row; align-items: stretch; gap: 8px; }
  .cat-dd { flex: 0 0 128px; }
  .cat-dd .dd-btn { height: 100%; min-height: 56px; }
  .char-list { flex: 1; min-width: 0; flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 5px; scroll-snap-type: x proximity; }
  .char-item { width: 48px; height: 100%; min-height: 44px; scroll-snap-align: center; }
  .stage-head { min-height: 0; }
  .tools { position: static; flex-direction: row; flex-wrap: wrap; align-items: stretch; justify-content: center; border-radius: 26px; padding: 6px; gap: 4px; }
  .tool { flex: 1 1 56px; min-width: 56px; min-height: 54px; }
  .tool.thick { flex: 1 1 100%; flex-direction: row; align-items: center; gap: 10px; padding: 4px 12px; min-height: 48px; order: -1; }
  .tool.thick label { width: 68px; text-align: left; }
  .tool.thick .thick-dot { width: 38px; height: 34px; flex: none; }
  .tool.thick output { width: 22px; text-align: right; }
  .tool.save { flex: 1 1 100%; margin-top: 2px; flex-direction: row; min-height: 50px; gap: 8px; font-size: 15px; }
  .variant { min-width: 200px; }
  .type-bar { position: static; border-radius: 26px; }
  .bar-row { width: 100%; }
  .font-btn { flex: 1 1 100%; width: 100%; }
  .bar-slider { flex: 1 1 200px; min-width: 0; padding: 0 14px; }
  .bar-slider input[type="range"] { flex: 1; width: auto; min-width: 0; }
  #inkBtn { flex: 0 0 auto; }
  .bar-row:nth-child(2) > * { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .size-dd { width: auto; }
  .bar-btn { flex: 1 1 auto; justify-content: center; padding: 0 12px; }
  .bar-btn.accent { flex: 1 1 100%; }
  .type-bar .spacer { display: none; }
  .modal { padding: 20px; }
}
@media (hover: none) {
  .char-item:hover, .tool:hover:not(:disabled), .bar-btn:hover, .btn:hover { background: transparent; }
  .btn.primary:hover { background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
  .tool.save:hover:not(:disabled) { background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
  .char-item[aria-selected="true"]:hover { background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
  .tool[aria-pressed="true"]:hover { background: var(--accent-soft); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}

/* ---------- Dio & Bite, the guides ---------- */
.chr { display: block; width: 100%; height: auto; overflow: visible; }
.chr .chr-body { animation: chrBob 3.6s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.chr-bite .chr-body { animation-delay: -1.6s; }
.chr .eye { animation: chrBlink 5.2s infinite; transform-box: fill-box; transform-origin: 50% 55%; }
.chr-bite .eye { animation-delay: -2.2s; }
.chr .zzz { animation: chrZ 2.4s ease-in-out infinite; }
@keyframes chrBob { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-2.5px) scale(1.012, .99); } }
@keyframes chrBlink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes chrZ { 0%, 100% { opacity: .2; transform: translateY(2px); } 50% { opacity: .8; transform: translateY(-3px); } }

.buddies { position: fixed; z-index: 60; right: 16px; bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; transition: opacity .25s, transform .3s var(--ease); }
.buddies.away { opacity: 0; transform: translateY(10px); }
.buddy-row { display: flex; align-items: flex-end; gap: 2px; pointer-events: none; }
.buddy { pointer-events: auto; width: 56px; padding: 0; border-radius: 18px; transition: transform .25s var(--ease); filter: drop-shadow(0 6px 10px rgba(30, 40, 110, .25)); }
.buddy:hover { transform: translateY(-4px) rotate(-3deg); }
.buddy[data-who="bite"]:hover { transform: translateY(-4px) rotate(3deg); }
.buddy:active { transform: scale(.94); }
.buddy.hop { animation: chrHop .7s var(--ease); }
@keyframes chrHop { 0% { transform: translateY(0) scale(1, 1); } 25% { transform: translateY(2px) scale(1.08, .9); } 55% { transform: translateY(-18px) scale(.95, 1.08); } 80% { transform: translateY(0) scale(1.06, .94); } 100% { transform: none; } }

.bubble { pointer-events: auto; position: relative; width: min(300px, calc(100vw - 28px)); padding: 12px 36px 12px 16px; border-radius: 22px 22px 8px 22px; background: var(--glass-solid); opacity: 0; transform: translateY(8px) scale(.96); transform-origin: 100% 100%; transition: opacity .22s, transform .35s var(--ease); }
.bubble.in { opacity: 1; transform: none; }
.bubble .b-who { display: block; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 2px; }
.bubble.dio .b-who { color: var(--accent); }
.bubble.bite .b-who { color: #d4741c; }
html[data-theme="dark"] .bubble.bite .b-who { color: #ffb765; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .bubble.bite .b-who { color: #ffb765; } }
.bubble .b-text { font-size: 14.5px; line-height: 1.4; }
.bubble .b-x { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.bubble .b-x:hover { background: var(--hover); color: var(--text); }
.bubble .b-x .ic { width: 14px; height: 14px; }
.b-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.b-actions:empty { display: none; }
.b-act { padding: 6px 14px; border-radius: 99px; font-size: 13px; font-weight: 700; color: var(--on-accent); background: linear-gradient(180deg, var(--accent-2), var(--accent)); }

/* inline "character says something" rows */
.speech { display: flex; align-items: flex-end; gap: 10px; text-align: left; }
.speech.flip { flex-direction: row-reverse; }
.speech-chr { flex: none; width: 54px; filter: drop-shadow(0 5px 8px rgba(30, 40, 110, .22)); }
.speech-bub { position: relative; padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: var(--card); border: 1px solid var(--line); }
.speech.flip .speech-bub { border-radius: 18px 18px 6px 18px; }
.speech-bub b { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.speech.bite .speech-bub b { color: #d4741c; }
html[data-theme="dark"] .speech.bite .speech-bub b { color: #ffb765; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .speech.bite .speech-bub b { color: #ffb765; } }
.speech-bub p { font-size: 14px; color: var(--text); }
.empty .speech { justify-content: center; }

/* lock screen */
.lock-chars { display: flex; justify-content: center; align-items: flex-end; gap: 4px; margin-bottom: 4px; }
.lock-chars .chr { width: 84px; filter: drop-shadow(0 8px 12px rgba(30, 40, 110, .25)); }

/* welcome */
.modal.welcome { text-align: center; }
.w-stage { height: 150px; display: grid; place-items: center; margin-bottom: 6px; }
.w-chr { width: 118px; display: block; animation: wIn .5s var(--ease); filter: drop-shadow(0 10px 14px rgba(30, 40, 110, .28)); }
@keyframes wIn { from { opacity: 0; transform: translateY(14px) scale(.85) rotate(-6deg); } }
.w-title { font-size: 21px; font-weight: 750; letter-spacing: -.01em; margin-bottom: 6px; }
.w-text { color: var(--muted); min-height: 66px; }
.w-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.w-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: all .25s; }
.w-dots i.on { width: 20px; border-radius: 99px; background: var(--accent); }
.modal.welcome .modal-actions { justify-content: space-between; }

@media (max-width: 760px) {
  .buddies { bottom: calc(92px + env(safe-area-inset-bottom)); right: auto; left: 8px; align-items: flex-start; }
  .bubble { border-radius: 22px 22px 22px 8px; transform-origin: 0 100%; }
  .buddy { width: 46px; }
  .buddies:not(.has-bubble) .buddy-row { opacity: .96; }
}

/* ---------- accounts: header, sign up / log in ---------- */
.tabs.off { opacity: 0; pointer-events: none; visibility: hidden; }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn.wide { width: 100%; min-height: 48px; font-size: 16px; }
.btn.busy { opacity: .7; pointer-events: none; }
.btn.soft-danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: color-mix(in srgb, var(--danger) 28%, transparent); }
.btn:disabled { opacity: .5; pointer-events: none; }
.panel-btn { color: var(--accent); }
.panel-btn .ic { width: 16px; height: 16px; }
.account-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 6px; border-radius: 99px; font-weight: 650; font-size: 14px; background: var(--hover); border: 1px solid var(--line); max-width: 190px; }
.account-btn:hover { background: var(--accent-soft); }
.acc-av { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; background: linear-gradient(145deg, var(--accent-2), var(--accent)); }
.acc-av .ic { width: 16px; height: 16px; stroke: #fff; }
.acc-av.big { width: 40px; height: 40px; font-size: 17px; }
.acc-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-btn:not(.in) { padding-left: 6px; }
.acc-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.acc-who { display: grid; min-width: 0; }
.acc-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-who small { color: var(--muted); }
body[data-page] .progress { display: none; }

.auth-wrap { max-width: 460px; margin: 0 auto; padding: 8px 0 40px; display: grid; gap: 18px; }
.auth-say .speech { justify-content: center; }
.auth-card { padding: 24px; border-radius: 30px; background: var(--glass-solid); border: 1px solid var(--glass-border); box-shadow: var(--shadow); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 20px; border-radius: 99px; background: var(--hover); border: 1px solid var(--line); }
.auth-tabs button { padding: 10px; border-radius: 99px; font-weight: 650; color: var(--muted); transition: background .2s, color .2s; }
.auth-tabs button[aria-selected="true"] { background: var(--glass-strong); color: var(--text); box-shadow: 0 2px 10px -4px rgba(30, 40, 110, .35); }
.auth-h { font-size: 22px; font-weight: 750; letter-spacing: -.01em; margin-bottom: 14px; }
.auth-p { color: var(--muted); margin-bottom: 16px; }
.auth-mail { width: 62px; height: 62px; margin: 0 auto 10px; border-radius: 22px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.auth-mail .ic { width: 30px; height: 30px; }
.auth-card .auth-h, .auth-card .auth-p { text-align: center; }
.fld { margin-bottom: 12px; }
.fld label { display: block; font-size: 13.5px; font-weight: 650; margin-bottom: 6px; }
.fld-box { position: relative; }
.fld input { width: 100%; height: 48px; padding: 0 16px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 16px; outline: 0; transition: border-color .2s, box-shadow .2s; }
.fld input::placeholder { color: var(--faint); }
.fld input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.fld.bad input { border-color: var(--danger); }
.fld-box:has(.fld-eye) input { padding-right: 48px; }
.fld-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); }
.fld-eye:hover { background: var(--hover); color: var(--text); }
.fld-eye .ic { width: 20px; height: 20px; }
.fld-msg { min-height: 18px; margin-top: 4px; padding-left: 4px; font-size: 12.5px; color: var(--muted); }
.fld-msg.bad { color: var(--danger); }
.fld-msg.ok { color: var(--ok); }
.form-error { margin: 2px 0 12px; padding: 10px 14px; border-radius: 14px; font-size: 14px; font-weight: 550; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }
.forgot { display: flex; justify-content: flex-end; margin: -4px 0 12px; }
.link { color: var(--accent); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { filter: brightness(1.15); }
.auth-foot { display: flex; justify-content: center; margin-top: 16px; }
.auth-alt { text-align: center; margin-top: 16px; color: var(--muted); font-size: 14.5px; }
.auth-note { text-align: center; margin-top: 12px; font-size: 12.5px; color: var(--faint); }

.chk { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); cursor: pointer; user-select: none; }
.chk input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chk-box { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; border: 1.5px solid var(--line); background: var(--card); transition: background .15s, border-color .15s; }
.chk-box .ic { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; opacity: 0; transform: scale(.5); transition: opacity .15s, transform .2s var(--ease); }
.chk input:checked + .chk-box { background: var(--accent); border-color: var(--accent); }
.chk input:checked + .chk-box .ic { opacity: 1; transform: none; }
.chk input:focus-visible + .chk-box { box-shadow: 0 0 0 4px var(--accent-soft); }

.providers { display: grid; gap: 10px; }
.prov { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; border-radius: 16px; font-weight: 650; background: var(--card); border: 1.5px solid var(--line); transition: transform .15s, background .2s; }
.prov:hover { background: var(--hover); }
.prov:active { transform: scale(.98); }
.prov-ic { width: 22px; height: 22px; display: grid; place-items: center; }
.prov-ic svg { width: 20px; height: 20px; }
.prov.github .prov-ic { color: var(--text); }
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0 16px; color: var(--faint); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- control panel ---------- */
.panel-wrap { max-width: 1120px; margin: 0 auto; padding: 0 0 60px; }
.panel-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.panel-title { display: flex; align-items: center; gap: 10px; }
.panel-title h1 { font-size: 28px; font-weight: 780; letter-spacing: -.02em; }
.panel-say { margin: 6px 0 14px; }
.panel-tabs { display: flex; gap: 6px; padding: 5px; border-radius: 99px; background: var(--hover); border: 1px solid var(--line); width: max-content; max-width: 100%; overflow-x: auto; margin-bottom: 18px; }
.panel-tabs button { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 99px; font-weight: 650; color: var(--muted); white-space: nowrap; }
.panel-tabs button .ic { width: 18px; height: 18px; }
.panel-tabs button[aria-selected="true"] { background: var(--glass-strong); color: var(--text); box-shadow: 0 2px 10px -4px rgba(30, 40, 110, .35); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 750; letter-spacing: .02em; background: var(--hover); color: var(--muted); }
.badge.owner { background: color-mix(in srgb, #f5a524 20%, transparent); color: #b66a00; }
.badge.admin { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge.banned { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
html[data-theme="dark"] .badge.owner { color: #ffc766; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .badge.owner { color: #ffc766; } }
.panel-card { padding: 22px; border-radius: 26px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 16px; }
.panel-card.center { text-align: center; display: grid; gap: 12px; justify-items: center; }
.panel-card h2 { font-size: 18px; font-weight: 720; margin-bottom: 6px; }
.muted { color: var(--muted); }
.note { margin-top: 10px; font-size: 13.5px; }
.panel-load { padding: 18px; text-align: center; color: var(--muted); }
.panel-form { display: grid; gap: 4px; margin-top: 14px; max-width: 460px; }
.panel-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.panel-btns .btn, .panel-form > .btn { }
.modal-fld { margin-top: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { padding: 16px 18px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); }
.stat b { display: block; font-size: 28px; font-weight: 780; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 13.5px; }
.ptools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.psearch { flex: 1 1 240px; height: 42px; padding: 0 16px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); font: inherit; outline: 0; }
.psearch:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 8px 14px; border-radius: 99px; font-size: 13.5px; font-weight: 650; color: var(--muted); background: var(--hover); border: 1px solid transparent; }
.chip.on { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

.utable { border-radius: 26px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.urow { display: grid; grid-template-columns: minmax(170px, 1.5fr) minmax(170px, 1.5fr) .8fr .7fr .8fr 1.1fr .7fr minmax(150px, 1fr); gap: 12px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 14px; }
.urow.uhead { border-top: 0; font-size: 12px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--hover); }
.urow.banned { background: color-mix(in srgb, var(--danger) 5%, transparent); }
.ucell { min-width: 0; overflow-wrap: anywhere; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-t { display: grid; min-width: 0; }
.who-t b, .who-t small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-t small { color: var(--muted); }
.ucell .why { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.uacts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.locked { color: var(--faint); font-size: 13px; font-weight: 650; }
.alist { display: grid; gap: 10px; margin-top: 10px; }
.arow { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border-radius: 18px; background: var(--hover); }
.a-t { display: grid; gap: 2px; min-width: 0; }
.a-t small { color: var(--muted); }
.a-sample { font-size: 22px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.icon-prev { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin: 14px 0; border-radius: 18px; background: var(--hover); width: max-content; max-width: 100%; }
.icon-prev img { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: var(--card); }
.icon-name { font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 8px 0; cursor: pointer; }
.sw-text { display: grid; gap: 3px; }
.sw-text small { color: var(--muted); font-size: 13.5px; }
.switch { position: relative; flex: none; width: 52px; height: 32px; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(20, 30, 90, .35); transition: transform .25s var(--ease); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + i { opacity: .55; }

@media (max-width: 980px) {
  .urow.uhead { display: none; }
  .urow { grid-template-columns: 1fr 1fr; gap: 8px 14px; padding: 16px; }
  .urow .ucell:first-child { grid-column: 1 / -1; }
  .urow .ucell[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); margin-bottom: 1px; }
  .urow .ucell:first-child::before { display: none !important; }
  .urow .ucell:last-child { grid-column: 1 / -1; }
  .uacts { justify-content: flex-start; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .acc-text { display: none; }
  .account-btn { padding: 0 6px; }
  .account-btn:not(.in) .acc-text { display: inline; padding-right: 8px; }
  .panel-btn span { display: none; }
  .panel-btn { padding: 0 10px; }
  .auth-card { padding: 20px; }
  .panel-title h1 { font-size: 24px; }
  .arow { flex-direction: column; align-items: flex-start; }
}
body[data-page] .buddies { display: none; }

/* ---------- footer, info dialog, about page ---------- */
.site-foot { width: min(1320px, calc(100% - 24px)); margin: 0 auto; padding: 10px 4px 26px; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 8px 18px; padding-right: 160px; font-size: 13px; color: var(--muted); }
.site-foot b { color: var(--text); font-weight: 650; }
.sf-info { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px 8px 11px; border-radius: 99px; font-weight: 650; color: var(--accent); background: var(--accent-soft); text-decoration: none; transition: background .2s, transform .2s var(--ease); }
.sf-info:hover { background: var(--hover); transform: translateY(-1px); }
.sf-info .ic { width: 17px; height: 17px; }
body[data-page] .site-foot { display: none; }
@media (max-width: 760px) { .site-foot { width: calc(100% - 16px); justify-content: center; text-align: center; padding: 10px 4px 96px; } }

.modal.wide { width: min(640px, 100%); }
.modal.wide .about { padding: 0; }
.modal.wide .about h1 { display: none; }

.about { color: var(--text); line-height: 1.6; }
.about h1 { font-size: clamp(30px, 5vw, 42px); letter-spacing: -.03em; line-height: 1.1; margin-bottom: 12px; }
.about h2 { font-size: 18px; letter-spacing: -.01em; margin: 26px 0 8px; color: var(--text); }
.modal .about h2 { color: var(--text); margin-bottom: 6px; }
.about p, .modal .about p { color: var(--muted); margin: 0 0 10px; }
.about p b, .about li b { color: var(--text); font-weight: 650; }
.about .lead, .modal .about .lead { font-size: 17px; color: var(--text); }
.about .steps, .about .bullets { margin: 6px 0 4px; padding-left: 22px; color: var(--muted); display: grid; gap: 8px; }
.about .steps { list-style: decimal; }
.about .bullets { list-style: disc; }
.about .fine { margin-top: 26px; font-size: 13px; color: var(--faint); }
.about-page .about-top { width: min(760px, calc(100% - 24px)); margin: 14px auto 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.about-page .about { width: min(760px, calc(100% - 24px)); margin: 18px auto 10px; padding: clamp(20px, 4vw, 40px); border-radius: 30px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.about-page .site-foot { width: min(760px, calc(100% - 24px)); }
.about-page .btn { text-decoration: none; }

.about a { color: var(--accent); font-weight: 600; }
.about-page .about-top a.btn { color: var(--on-accent); }
.modal.wide .about { width: auto; margin: 0; padding: 0; }
