/* ============================================================
   PoseMM design system — one token set for all pages
   ============================================================ */
@font-face {
  font-family: 'Yati Sans';
  src: url('/static/fonts/Yati_Sans_Variation.ttf') format('truetype');
  font-display: swap;
}
:root {
  --sbw: 248px;                  /* dashboard sidebar width (0 on mobile) */
  --modal-border: #e7dcc4;       /* theme-aware modal border, never pure white */
  --on-accent: #ffffff;          /* text on solid accent fills */
  --success: #15803d;
  --bg: #f7f6fc;
  --card: #ffffff;
  --ink: #221d38;
  --muted: #6f6a8c;
  --accent: #d99a00;               /* key accents follow the accent theme */
  --accent-deep: #b57e00;
  --accent-ink: #8a5a00;
  --accent-soft: #fdf3d8;
  --accent-faint: #fffaf0;
  --line: #e8e3f6;
  --danger: #dc2626;
  --danger-deep: #b91c1c;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(62, 42, 130, .05), 0 2px 10px rgba(62, 42, 130, .06);
  --shadow-md: 0 6px 18px rgba(76, 29, 149, .10), 0 16px 40px rgba(76, 29, 149, .08);
  --shadow-lg: 0 24px 70px rgba(46, 16, 101, .28);
  --ring: 0 0 0 3px rgba(217, 154, 0, .22);
  --btn-main: #FFC531;            /* primary buttons (same both modes) */
  --btn-hi: #ffd34d;
  --btn-ink: #1a1a1a;
  --btn-border: transparent;
  --btn-glow: rgba(255, 197, 49, .45);
  --check: #1a1a1a;               /* checkbox check-mark color */
  --bg-grad: #e9e0ff;
  --selection: #ddd0fb;
  --placeholder: #a5a0c0;
  --pill-hover: #e4d6fd;
  --box-border: #c9bdf0;
  --box-bg: #ffffff;
  --input-bg: #ffffff;
  --tile-ph: #efeafb;
  --dash: #d5cbf3;
  --modalx-hover: #e2d4fd;
  --scroll-thumb: #d9cff6;
}
/* ---------- dark theme (neutral black/grey scale, no blue tint) ---------- */
[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-grad: #1b1b1b;
  --card: #141414;
  --ink: #f2f2f2;
  --muted: #a3a3a3;
  --line: rgba(255, 255, 255, .08);
  --modal-border: rgba(255, 255, 255, .10);
  --selection: #3a3a3a;
  --placeholder: #6b6b6b;
  --pill-hover: #262626;
  --box-border: #333333;
  --box-bg: #1c1c1c;
  --input-bg: #161616;
  --tile-ph: #161616;
  --dash: #333333;
  --modalx-hover: #262626;
  --scroll-thumb: #3d3d3d;
  --success: #7ee2a8;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35), 0 2px 10px rgba(0,0,0,.30);
  --shadow-md: 0 6px 18px rgba(0,0,0,.42), 0 16px 40px rgba(0,0,0,.36);
  --shadow-lg: 0 24px 70px rgba(0,0,0,.62);
}
[data-theme="dark"] .modal { background: rgba(0, 0, 0, .72); }
/* ---------- accent themes (independent of light/dark) ---------- */
[data-accent="blue"] {
  --accent: #2f6bff;
  --accent-deep: #1e4fd6;
  --accent-ink: #1e40af;
  --accent-soft: #e9efff;
  --accent-faint: #f5f8ff;
  --btn-main: #2f6bff;
  --btn-hi: #5b8cff;
  --btn-ink: #ffffff;
  --btn-border: transparent;
  --btn-glow: rgba(47, 107, 255, .45);
  --check: #ffffff;
  --ring: 0 0 0 3px rgba(47, 107, 255, .20);
  --modal-border: #d5ddf8;
}
[data-accent="white"] {
  --accent: #6b7280;
  --accent-deep: #4b5563;
  --accent-ink: #374151;
  --accent-soft: #f0f0f3;
  --accent-faint: #fafafb;
  --btn-main: #f4f4f7;
  --btn-hi: #ffffff;
  --btn-ink: #1a1a1a;
  --btn-border: #d9d9e0;
  --btn-glow: rgba(0, 0, 0, .16);
  --check: #1a1a1a;
  --ring: 0 0 0 3px rgba(107, 114, 128, .25);
  --modal-border: #e3e3e8;
}
/* dark-mode surfaces for each accent */
[data-theme="dark"][data-accent="yellow"] {
  --accent: #e8a90c;
  --accent-deep: #c78f06;
  --accent-ink: #ffd34d;
  --accent-soft: #33270e;
  --accent-faint: #28200f;
  --ring: 0 0 0 3px rgba(255, 197, 49, .25);
}
[data-theme="dark"][data-accent="blue"] {
  --accent: #6b94ff;
  --accent-deep: #4a76f5;
  --accent-ink: #b9ccff;
  --accent-soft: #232323;
  --accent-faint: #1b1b1b;
  --ring: 0 0 0 3px rgba(107, 148, 255, .28);
}
[data-theme="dark"][data-accent="white"] {
  --accent: #9aa0ae;
  --accent-deep: #7c8290;
  --accent-ink: #d4d7de;
  --accent-soft: #26262e;
  --accent-faint: #202027;
  --btn-main: #e9e9ee;
  --btn-border: transparent;
  --ring: 0 0 0 3px rgba(154, 160, 174, .30);
}
/* ---------- glass theme: dark glassmorphism (implies dark; sun/moon toggle ignored) ---------- */
[data-accent="glass"] {
  --bg: #0a0a0f;
  --bg-grad: #101018;
  --card: rgba(255, 255, 255, .06);
  --ink: #f4f4f6;
  --muted: #a9a9b4;
  --accent: #ffffff;
  --accent-deep: #cfd0da;
  --accent-ink: #ffffff;
  --accent-soft: rgba(255, 255, 255, .10);
  --accent-faint: rgba(255, 255, 255, .05);
  --line: rgba(255, 255, 255, .12);
  --selection: rgba(255, 255, 255, .28);
  --placeholder: #6d6d78;
  --pill-hover: rgba(255, 255, 255, .17);
  --box-border: rgba(255, 255, 255, .24);
  --box-bg: rgba(255, 255, 255, .07);
  --input-bg: rgba(255, 255, 255, .06);
  --tile-ph: rgba(255, 255, 255, .05);
  --dash: rgba(255, 255, 255, .28);
  --modalx-hover: rgba(255, 255, 255, .17);
  --scroll-thumb: rgba(255, 255, 255, .24);
  --btn-main: #1d1d24;
  --btn-hi: #2b2b34;
  --btn-ink: #ffffff;
  --btn-border: rgba(255, 255, 255, .14);
  --btn-glow: rgba(255, 255, 255, .10);
  --check: #0a0a0f;
  --ring: 0 0 0 3px rgba(255, 255, 255, .22);
  --modal-border: rgba(255, 255, 255, .12);
  --on-accent: #0a0a0f;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.55), 0 4px 14px rgba(0,0,0,.45);
  --shadow-md: 0 8px 24px rgba(0,0,0,.55), 0 18px 48px rgba(0,0,0,.50);
  --shadow-lg: 0 30px 80px rgba(0,0,0,.72);
}
/* frosted-glass surfaces */
[data-accent="glass"] .card,
[data-accent="glass"] .sidebar,
[data-accent="glass"] .dash-sidebar,
[data-accent="glass"] .tile,
[data-accent="glass"] .prompt-card,
[data-accent="glass"] .modal-box,
[data-accent="glass"] .accent-picker,
[data-accent="glass"] .theme-toggle,
[data-accent="glass"] .chip,
[data-accent="glass"] .empty,
[data-accent="glass"] #manual-groups .fgroup,
[data-accent="glass"] .search-row input[type="text"],
[data-accent="glass"] .dd-btn,
[data-accent="glass"] .dd-list,
[data-accent="glass"] input[type="text"],
[data-accent="glass"] .pm-scope .char-card,
[data-accent="glass"] .pm-scope .section,
[data-accent="glass"] .pm-scope .pair-wrap,
[data-accent="glass"] .pm-scope .preset-panel,
[data-accent="glass"] .pm-scope .output-wrap,
[data-accent="glass"] .pm-scope .tabbar,
[data-accent="glass"] .pm-scope .modal-box {
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .12);
}
/* near-black ambient background with subtle radial glows */
[data-accent="glass"] body {
  background:
    radial-gradient(900px 420px at 12% -90px, rgba(130, 130, 190, .13) 0%, transparent 60%),
    radial-gradient(760px 400px at 88% 6%, rgba(90, 90, 150, .11) 0%, transparent 60%),
    radial-gradient(720px 520px at 50% 115%, rgba(60, 60, 110, .10) 0%, transparent 60%),
    #0a0a0f;
}
[data-accent="glass"] .modal { background: rgba(4, 4, 9, .60); }
/* white pill primary buttons, like the reference Download button */
[data-accent="glass"] .create-box,
[data-accent="glass"] .btn { border-radius: 999px; }
/* sun/moon toggle is disabled while Glass is active */
.theme-toggle:disabled { opacity: .35; cursor: default; }
.theme-toggle:disabled:hover { transform: none; border-color: var(--line); }
/* white icon chips — reference card language */
.icon-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 15px; vertical-align: middle;
  background: #ffffff; color: #0a0a0f;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.icon-chip svg { width: 25px; height: 25px; }
.icon-chip.sm { width: 38px; height: 38px; border-radius: 12px; }
.icon-chip.sm svg { width: 20px; height: 20px; }
.modal-title .icon-chip { margin-right: 10px; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: 'Yati Sans', system-ui, -apple-system, "Segoe UI", "Noto Sans Myanmar", sans-serif;
  background:
    radial-gradient(1100px 380px at 50% -140px, var(--bg-grad) 0%, transparent 62%),
    var(--bg);
  min-height: 100vh;
}
::selection { background: var(--selection); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 22px 70px; }
/* consistent vertical rhythm: create-box -> first section heading */
.wrap > section > h2:first-of-type { margin-top: 2px; }
.theme-toggle {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 21px; cursor: pointer; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease, background .15s ease, border-color .15s ease;
}
.theme-toggle:hover { transform: translateY(-1px) rotate(14deg); border-color: var(--box-border); }
.theme-toggle .ic { width: 21px; height: 21px; }
.accent-picker {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 7px 11px; box-shadow: var(--shadow-sm);
}
.dot {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  background: var(--dot); border: 1.5px solid rgba(0,0,0,.18);
  padding: 0; transition: transform .15s ease, box-shadow .15s ease;
}
.dot:hover { transform: scale(1.15); }
.dot.active { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -.5px; margin: 10px 0 20px; }
h2 { font-size: 23px; font-weight: 750; letter-spacing: -.3px; margin: 30px 0 16px; }
.hidden { display: none !important; }
button { font-family: inherit; }
button:focus-visible, input:focus-visible, .dd-btn:focus-visible, a:focus-visible {
  outline: none; box-shadow: var(--ring);
}

/* ---------- library view ---------- */
/* ---------- create-box: gradient "create new" heading button ---------- */
.create-box {
  width: 100%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 13px;
  background: var(--card);
  border: 1.5px dashed var(--box-border);
  color: var(--ink);
  border-radius: 18px; padding: 20px;
  font-size: 17px; font-weight: 800; letter-spacing: .2px;
  margin: 0 0 32px;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s ease;
}
.create-box:hover {
  border-color: var(--accent);
}
.create-box:active { transform: scale(.995); }
.create-box:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.create-box .cb-icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-ink);
}
.create-box .cb-icon .ic { width: 19px; height: 19px; }

.finder-row { display: grid; grid-template-columns: 7fr 3fr; gap: 12px; margin: 0 0 12px; padding: 0; grid-auto-rows: 46px; align-items: stretch; }
.finder-row .finder-btn { margin: 0; width: 100%; height: 46px; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; box-shadow: none; }
.finder-row .finder-btn:hover { box-shadow: none; transform: none; }
.finder-row .dd-mount { min-width: 0; display: flex; margin: 0; height: 46px; }
.finder-row .dd-mount .dd { flex: 1; display: flex; min-width: 0; }
.finder-row .dd-mount .dd-btn { padding: 12px 18px; font-size: 15px; border-radius: 13px; flex: 1; height: 46px; box-sizing: border-box; }
.search-row { display: flex; gap: 12px; margin-bottom: 12px; }
.search-row input[type="text"] {
  border: 1.5px solid var(--line); background: var(--card); border-radius: 15px;
  padding: 14px 18px; font-size: 16px; color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-row input[type="text"] { flex: 1; }
.search-row input[type="text"]::placeholder { color: var(--placeholder); }
.search-row input[type="text"]:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.search-row .dd-mount { flex: 0 0 220px; max-width: 220px; }

/* ---------- custom dropdown (replaces native <select>) ---------- */
.dd { position: relative; }
.dd-btn {
  width: 100%; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 15px; padding: 14px 18px; font-size: 16px; font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.dd-btn:hover { border-color: var(--box-border); transform: translateY(-1px); }
.dd-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: var(--ring); }
.dd-btn .dd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn > .ic { color: var(--muted); transition: transform .18s ease; }
.dd-btn[aria-expanded="true"] > .ic { transform: rotate(180deg); color: var(--accent); }
.dd-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-md); padding: 6px; margin: 0; list-style: none;
  max-height: 264px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent;
  animation: ddIn .16s ease;
}
.dd-list::-webkit-scrollbar { width: 8px; }
.dd-list::-webkit-scrollbar-track { background: transparent; }
.dd-list::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
/* portal: list lives in <body>, positioned fixed — never clipped by modals */
.dd-list.portal { position: fixed; top: 0; left: 0; z-index: 100; animation: ddIn .16s ease; }
@keyframes ddIn { from { opacity: 0; transform: translateY(-6px) scale(.99); } to { opacity: 1; transform: none; } }
.dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 10px; cursor: pointer;
  font-size: 15px; font-weight: 500; color: var(--ink);
  transition: background .12s ease;
}
.dd-item:hover, .dd-item.focused { background: var(--accent-faint); }
.dd-item .ic { width: 16px; height: 16px; margin-left: auto; color: var(--accent); visibility: hidden; }
.dd-item.selected .ic { visibility: visible; }
.dd-item.selected { font-weight: 700; }

.filters-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.filters-head span { font-size: 17px; font-weight: 700; }
.pill {
  border: none; cursor: pointer;
  background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 999px; padding: 7px 17px; font-size: 13.5px; font-weight: 700;
  transition: background .15s ease, transform .15s ease;
}
.pill:hover { background: var(--pill-hover); transform: translateY(-1px); }
.pill.small { padding: 5px 13px; font-size: 12.5px; }

.lib-main { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.sidebar {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 22px; padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.fgroup { margin-bottom: 4px; }
.fgroup-head {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 11px 12px; border-radius: 12px; user-select: none;
  transition: background .15s ease;
}
.fgroup-head:hover { background: var(--accent-faint); }
.fgroup-name { font-size: 16.5px; font-weight: 700; flex: 1; }
.fgroup-chev { color: var(--muted); display: inline-flex; transition: transform .18s ease; }
.fgroup.closed .fgroup-chev { transform: rotate(-90deg); }
.fgroup-body { padding-bottom: 10px; }
.fgroup.closed .fgroup-body { display: none; }

.checkbox {
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  padding: 9px 12px; border-radius: 10px; user-select: none;
  transition: background .13s ease;
}
.checkbox:hover { background: var(--accent-faint); }
.checkbox input { display: none; }
.checkbox .box {
  flex: none; width: 24px; height: 24px; border-radius: 9px; margin-top: 1px;
  border: 2px solid var(--box-border); background: var(--box-bg);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.checkbox:hover .box { border-color: var(--accent); }
.checkbox input:checked + .box {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border-color: var(--accent-deep);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
}
.checkbox input:checked + .box::after { content: "✓"; color: var(--check); font-size: 15px; font-weight: 800; line-height: 1; }
.checkbox .en { display: block; font-size: 15.5px; font-weight: 600; }
.checkbox .mm { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.grid-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 14px; }
.grid-head h2 { margin: 0; }
.seg-tab { display: inline-flex; background: var(--input-bg); border: 1px solid var(--box-border); border-radius: 999px; padding: 3px; gap: 2px; }
.seg-tab .seg-btn {
  border: none; background: none; color: var(--muted); font: inherit;
  font-size: 13px; font-weight: 700; padding: 7px 16px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .15s ease, color .15s ease;
}
.seg-tab .seg-btn:hover { color: var(--ink); }
/* ---------- Pose Finder ---------- */
.btn.finder-btn { margin: 0 0 12px; position: relative; }
.dotted-sep { border-top: 2px dotted var(--box-border); margin: 0 0 18px; }
.finder-count {
  position: absolute; top: -8px; right: -8px;
  min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: 12px; background: var(--danger); color: #fff;
  font-size: 13px; font-weight: 800; line-height: 24px; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet.hidden { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.sheet-box {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 82vh; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-bottom: none;
  border-radius: 20px 20px 0 0; box-shadow: 0 -12px 40px rgba(0,0,0,.3);
  animation: sheetUp .28s cubic-bezier(.2,.9,.3,1.05);
}
@keyframes sheetUp { from { transform: translateY(60px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 2px; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 10px; flex: none; }
.sheet-head h3 { margin: 0; font-size: 18px; }
.sheet-mm { font-size: 13px; color: var(--muted); font-weight: 500; }
.sheet-scroll { overflow-y: auto; padding: 4px 18px 12px; min-height: 0; flex: 1 1 auto; scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
.sheet-scroll::-webkit-scrollbar { width: 10px; }
.sheet-scroll::-webkit-scrollbar-track { background: transparent; }
.sheet-scroll::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.finder-group { margin-bottom: 14px; }
.finder-group-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 8px; }
.finder-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.finder-opt {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--line); background: var(--input-bg); color: var(--ink);
  border-radius: 999px; padding: 8px 14px 8px 10px; font: inherit; font-size: 14px;
  cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.finder-opt:hover { border-color: var(--accent); transform: translateY(-1px); }
.finder-opt .cbox {
  width: 18px; height: 18px; border-radius: 6px; flex: none;
  border: 1.5px solid var(--muted); position: relative;
  transition: border-color .15s ease, background .15s ease;
}
.finder-opt:hover .cbox { border-color: var(--accent); }
.finder-opt.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--input-bg)); }
.finder-opt.on .cbox { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.finder-opt.on .cbox::after {
  content: ""; position: absolute; left: 5px; top: 1.5px;
  width: 5px; height: 9px;
  border: solid var(--accent); border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.finder-opt .opt-mm { font-size: 12.5px; color: var(--muted); }
.sheet-foot { display: flex; gap: 10px; padding: 12px 18px 18px; flex: none; border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; padding: 14px; font-size: 15px; }
.tile {
  position: relative;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.tile-x {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0, 0, 0, .55); color: #fff; padding: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.85);
  transition: opacity .15s ease, transform .15s ease, background .15s ease;
}
.tile:hover .tile-x { opacity: 1; transform: scale(1); }
.tile-x:hover { background: var(--danger); }
#analyze-btn { position: relative; overflow: visible; }
.spark {
  position: absolute; pointer-events: none; z-index: 5;
  background: #fff; box-shadow: 0 0 8px 2px rgba(255, 213, 79, .9);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: spark-fly .75s ease-out forwards;
}
@keyframes spark-fly {
  0% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0) rotate(160deg); opacity: 0; }
}
.tile img { width: 100%; height: 172px; object-fit: cover; object-position: top; display: block; background: var(--tile-ph); }
.char-pick { margin-top: 10px; }
.char-pick .dd-btn { width: 100%; }
.tile .meta { padding: 11px 14px 13px; font-size: 14px; font-weight: 700; }
.tile .meta .mm { color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 3px; line-height: 1.5; }
.empty {
  text-align: center; color: var(--muted); padding: 70px 20px; line-height: 1.8;
  background: var(--card); border: 1.5px dashed var(--dash); border-radius: var(--radius);
}

/* ---------- upload form (shared) ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.field-label { display: block; font-weight: 700; margin: 18px 0 9px; font-size: 15.5px; }
.field-label:first-child { margin-top: 0; }
.field-mm { font-weight: 400; color: var(--muted); font-size: 13px; }
input[type="text"] {
  width: 100%; padding: 13px 15px; font-size: 15px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 13px; background: var(--input-bg);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type="text"]:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.file-hidden { display: none; }
.dropzone {
  border: 2px dashed var(--box-border); border-radius: 14px;
  background: var(--accent-faint); cursor: pointer;
  padding: 26px 20px; text-align: center; color: var(--muted);
  transition: border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.dropzone:hover { border-color: var(--accent); background: var(--card); }
.dropzone:focus-visible { box-shadow: var(--ring); outline: none; }
.dropzone.dragover {
  border-color: var(--accent); border-style: solid;
  background: var(--accent-soft);
  box-shadow: var(--ring);
  transform: scale(1.01);
}
.dz-icon { font-size: 34px; margin-bottom: 8px; }
.dz-text { font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.6; }
.dz-sub { font-weight: 400; color: var(--muted); font-size: 13.5px; }
.dropzone .field-mm { display: block; margin-top: 6px; }
#preview-wrap { position: relative; display: inline-block; margin-top: 14px; max-width: 100%; }
.preview-x {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0, 0, 0, .55); color: #fff; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, transform .15s ease;
}
.preview-x:hover { background: var(--danger); transform: scale(1.08); }
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; }
.row .btn { margin-top: 0; white-space: nowrap; }
.btn {
  display: inline-block; vertical-align: middle; text-align: center;
  border: 1.5px solid var(--line); background: var(--card); border-radius: 13px;
  padding: 12px 22px; font-size: 15px; font-weight: 700; cursor: pointer;
  color: var(--ink); line-height: 1.2; font-family: inherit;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease, border-color .14s ease;
}
.btn.block { display: block; width: 100%; }
.btn.mt { margin-top: 14px; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: var(--box-border); }
.btn.primary {
  background: linear-gradient(135deg, var(--btn-hi), var(--btn-main));
  border: 1.5px solid var(--btn-border); color: var(--btn-ink);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .14), inset 0 1px 0 rgba(255,255,255,.45);
}
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(0,0,0,.20), 0 0 20px var(--btn-glow), inset 0 1px 0 rgba(255,255,255,.45); }
.btn.big { width: 100%; padding: 12px; font-size: 15px; }
.btn.sm { padding: 8px 16px; font-size: 13px; }
.btn.danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  background: linear-gradient(135deg, #ef4444, var(--danger-deep));
  border: none; color: #fff; box-shadow: 0 8px 18px rgba(220, 38, 38, .25);
}
.btn.danger:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }
.btn-mm { font-size: 12px; opacity: .85; font-weight: 400; }
.status { min-height: 22px; margin-top: 10px; color: var(--muted); font-size: 14px; }
#preview {
  max-width: 100%; max-height: 340px; border-radius: 14px;
  box-shadow: var(--shadow-md); border: 1px solid var(--line);
}

.chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 8px; }
.chip {
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 12px;
  padding: 8px 14px; cursor: pointer; text-align: center; line-height: 1.35;
  user-select: none; box-shadow: var(--shadow-sm);
  transition: transform .13s ease, border-color .13s ease, box-shadow .13s ease, opacity .13s ease;
}
.chip:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.chip .en { display: block; font-size: 14px; font-weight: 700; }
.chip .mm { display: block; font-size: 11px; color: var(--muted); }
.chip.on { border-color: var(--accent); background: var(--accent-faint); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.chip.on .en { color: var(--accent-ink); }
.chip.off { opacity: .38; }
.chip.off .en { text-decoration: line-through; }

#manual-groups .fgroup {
  border: 1px solid var(--line); border-radius: 15px;
  padding: 4px 14px; margin-bottom: 10px; background: var(--card);
  transition: border-color .15s ease, box-shadow .15s ease;
}
#manual-groups .fgroup:hover { border-color: var(--dash); }
#manual-groups .fgroup:not(.closed) { box-shadow: var(--shadow-sm); }

/* ---------- modals ---------- */
.modal {
  position: fixed; inset: 0; left: var(--sbw); /* overlay starts after the sidebar */
  z-index: 10;
  background: rgba(32, 20, 68, .55);
  -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: var(--card); border-radius: 26px;
  max-width: 580px; width: 100%; max-height: 90vh; overflow-y: auto;
  padding: 22px; position: relative;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--modal-border);
  animation: popIn .22s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-box::-webkit-scrollbar { width: 10px; }
.modal-box::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 2px solid var(--card); }
.modal-x {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  border: none; cursor: pointer; padding: 0;
  background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 50%; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, transform .15s ease;
}
.modal-x:hover { background: var(--modalx-hover); transform: rotate(90deg); }
#modal .modal-box { max-width: 800px; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
/* Inner scroll area: scrollbar can never poke outside the rounded corner. */
#modal .modal-scroll { overflow-y: auto; min-height: 0; flex: 1 1 auto; padding: 22px; scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
#modal .modal-scroll::-webkit-scrollbar { width: 10px; }
#modal .modal-scroll::-webkit-scrollbar-track { background: transparent; }
#modal .modal-scroll::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
/* ---------- prompt modal: inner scroll so the bar never pokes out ---------- */
#prompt-modal .modal-box { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
#prompt-modal .modal-box.prompt-modal-wide { max-width: 1200px; width: min(94vw, 1200px); height: min(90vh, 820px); }
#prompt-modal .modal-scroll { display: flex; flex-direction: column; }
.prompt-cols { display: grid; grid-template-columns: 35fr 65fr; gap: 24px; align-items: stretch; flex: 1 1 auto; min-height: 0; margin: 6px 0 16px; }
.prompt-col-left { display: flex; flex-direction: column; }
.prompt-col-left .dd-mount { margin-bottom: 4px; }
.prompt-col-right { display: flex; flex-direction: column; min-height: 0; }
.prompt-col-right .field-label { flex: none; }
.prompt-col-right textarea { flex: 1 1 auto; min-height: 200px; resize: vertical; }
#prompt-modal .modal-title, #prompt-save { flex: none; }
@media (max-width: 640px) {
  #prompt-modal .modal-box.prompt-modal-wide { height: auto; max-height: 92vh; }
  .prompt-cols { grid-template-columns: 1fr; flex: none; }
  .prompt-col-right textarea { min-height: 220px; flex: none; }
}
#prompt-modal .modal-scroll { overflow-y: auto; min-height: 0; flex: 1 1 auto; padding: 22px; scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
#prompt-modal .modal-scroll::-webkit-scrollbar { width: 10px; }
#prompt-modal .modal-scroll::-webkit-scrollbar-track { background: transparent; }
#prompt-modal .modal-scroll::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
/* ---------- view prompt modal ---------- */
#prompt-view-modal .modal-box { max-width: 640px; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
#prompt-view-modal .modal-scroll { overflow-y: auto; min-height: 0; flex: 1 1 auto; padding: 26px 22px 22px; scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
#prompt-view-modal .modal-scroll::-webkit-scrollbar { width: 10px; }
#prompt-view-modal .modal-scroll::-webkit-scrollbar-track { background: transparent; }
#prompt-view-modal .modal-scroll::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.pc-view-text { font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; margin-bottom: 18px; }
/* ---------- prompt textarea scrollbar ---------- */
#prompt-text { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
#prompt-text::-webkit-scrollbar { width: 10px; }
#prompt-text::-webkit-scrollbar-track { background: transparent; }
#prompt-text::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
#modal-img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 16px; box-shadow: var(--shadow-sm); background: var(--tile-ph); }
.detail-cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; }
@media (max-width: 640px) { .detail-cols { grid-template-columns: 1fr; } }
.modal-info { display: flex; flex-direction: column; gap: 9px; font-size: 15px; padding-top: 14px; min-height: 280px; }
.modal-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 18px; align-self: flex-end; }
.modal-actions .btn { margin-top: 0; padding: 10px 22px; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }

/* ---------- upload modal (full-screen) ---------- */
.upload-modal { z-index: 20; }
.upload-modal .modal-box {
  width: min(80vw, 1600px);
  max-width: calc(100vw - 32px);
  max-height: 94vh;
  padding: 0;                    /* padding lives on the inner scroll area */
  overflow: hidden;              /* clip everything to the rounded corners */
  display: flex;
  flex-direction: column;
}
/* Inner scroll area: the custom scrollbar lives here so it can never
   poke outside the modal's rounded corner. */
.upload-modal .modal-scroll {
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
  padding: 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}
.upload-modal .modal-scroll::-webkit-scrollbar { width: 10px; }
.upload-modal .modal-scroll::-webkit-scrollbar-track { background: transparent; }
.upload-modal .modal-scroll::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.upload-modal .modal-title { margin: 0 48px 20px 0; font-size: 27px; }
.upload-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start;
}
/* ---------- upload modal: fixed header/footer, scrollable middle ---------- */
.um-head {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 22px 12px; border-bottom: 1px solid var(--line);
}
.um-head .modal-title { margin: 0; }
.um-head .modal-x { position: static; flex: none; }
.um-scroll { flex: 1 1 auto; min-height: 0; }
.um-foot {
  flex: none; padding: 6px 22px 8px; border-top: 1px solid var(--line);
  background: var(--card);
}
.um-foot .btn { margin-top: 0; }
.um-foot .status { margin-top: 8px; }
/* manual tag checkboxes in 3 columns */
#manual-groups .fgroup-body {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 6px;
}
#manual-groups .fgroup.closed .fgroup-body { display: none; }
@media (max-width: 760px) {
  #manual-groups .fgroup-body { grid-template-columns: repeat(2, 1fr); }
}
.upload-cols .card { margin-bottom: 0; }
.upload-right .card { margin-bottom: 16px; }
.upload-right .card:last-child { margin-bottom: 0; }
.upload-modal #save-btn { margin-top: 20px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .upload-cols { grid-template-columns: 1fr; }
  .upload-modal .modal-scroll { padding: 20px; }
  .lib-main { grid-template-columns: 1fr; }   /* sidebar stacks above grid */
}
@media (max-width: 760px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .search-row { flex-wrap: wrap; }
  .search-row .dd-mount { max-width: none; flex: 1; }
  .wrap { padding: 20px 14px 60px; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
  h2 { font-size: 20px; }
  .upload-modal .modal-box { width: calc(100vw - 24px); }
  .upload-modal .modal-scroll { padding: 18px 14px; }
  .upload-modal .modal-title { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============================================================
   PoseMM dashboard — sidebar, prompt library, shared bits
   ============================================================ */

/* ---------- Lucide icon sizing ---------- */
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.ic.sm { width: 16px; height: 16px; }
.ic.xs { width: 14px; height: 14px; }
.ic.lg { width: 25px; height: 25px; }
.ic.xl { width: 38px; height: 38px; }
.dz-icon { margin-bottom: 8px; color: var(--accent); display: flex; justify-content: center; }

/* ---------- dashboard shell ---------- */
.dash { display: flex; min-height: 100vh; }
.dash-sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 50;
  width: var(--sbw);
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 24px 16px 18px;
  box-shadow: var(--shadow-sm);
}
.dash-main { margin-left: var(--sbw); flex: 1; min-width: 0; }

.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; padding: 2px 8px 20px;
}
.brand-tile {
  flex: none; width: 44px; height: 44px; border-radius: 13px;
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .18s ease;
}
.brand-tile img { width: 38px; height: 38px; display: block; }
.brand:hover .brand-tile { transform: scale(1.06) rotate(-4deg); }
.brand-name {
  font-size: 19px; font-weight: 800; letter-spacing: -.4px;
  color: var(--ink); white-space: nowrap;
}
.side-ver {
  text-align: center; font-size: 11px; font-weight: 600;
  color: var(--muted); opacity: .55; padding-top: 10px; letter-spacing: .4px;
}

.dash-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 14px;
  color: var(--ink); text-decoration: none;
  font-size: 15.5px; font-weight: 600;
  transition: background .15s ease, transform .15s ease, color .15s ease, box-shadow .15s ease;
}
.nav-item:hover { background: var(--accent-faint); transform: translateX(2px); }
.nav-item:focus-visible { outline: none; box-shadow: var(--ring); }
.nav-item.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--on-accent);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .16);
}
.nav-item.active:hover { transform: none; filter: brightness(1.05); }

.side-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.side-user {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; margin: 8px 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  font-size: 13px;
}
.side-user-name { font-weight: 800; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-role {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  color: var(--accent-ink); background: var(--accent-soft);
  padding: 3px 8px; border-radius: 999px;
}
.side-logout { color: var(--muted); display: inline-flex; padding: 4px; border-radius: 8px; }
.side-logout:hover { color: var(--ink); background: var(--accent-soft); }
/* auth pages */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--card);
  border: 1px solid var(--line); border-radius: 20px;
  padding: 32px 28px; box-shadow: var(--shadow-md);
}
.auth-card h1 { font-size: 22px; margin: 0 0 6px; }
.auth-card .auth-sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.auth-card label { display: block; font-size: 13px; font-weight: 700; margin: 0 0 6px; }
.auth-card input {
  width: 100%; border: 1.5px solid var(--line); background: var(--bg);
  border-radius: 12px; padding: 12px 14px; font-size: 15px; color: var(--ink);
  margin-bottom: 14px; font-family: inherit;
}
.auth-card input:focus { outline: none; border-color: var(--accent); }
.auth-error {
  background: rgba(220, 60, 60, .12); color: #e05c5c; border: 1px solid rgba(220,60,60,.3);
  border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 14px;
}
/* team management */
.team-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 16px; margin-bottom: 10px; min-height: 68px;
  box-sizing: border-box;
}
.team-row .t-name { font-weight: 800; }
.team-row .t-role {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  color: var(--accent-ink); background: var(--accent-soft);
  padding: 4px 10px; border-radius: 999px; margin-right: auto;
}
.team-row .t-date { color: var(--muted); font-size: 12.5px; }
/* team table */
.team-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.team-table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); font-weight: 700; padding: 14px 18px;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.team-table td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.team-table tbody tr:last-child td { border-bottom: none; }
.team-table tbody tr:hover td { background: var(--accent-soft); }
.team-table .tt-name { font-weight: 700; }
.team-table .t-role {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  color: var(--accent-ink); background: var(--accent-soft);
  padding: 4px 10px; border-radius: 999px; display: inline-block;
}
/* table action buttons — simple like the badge, no .btn baggage */
.tbl-btn {
  display: inline-block; vertical-align: middle;
  font-size: 13px; font-weight: 700; font-family: inherit;
  padding: 7px 16px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  margin: 0 0 0 8px; line-height: 1.2;
}
.tbl-btn:first-child { margin-left: 0; }
.tbl-btn:hover { border-color: var(--accent); }
.tbl-btn.danger {
  background: #ef4444; border-color: #ef4444; color: #fff;
}
.tbl-btn.danger:hover { background: #dc2626; border-color: #dc2626; }
/* attribution on cards */
.attr { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.side-foot .accent-picker { box-shadow: none; }
.side-foot .theme-toggle { width: 44px; height: 44px; }

/* ---------- prompt library ---------- */
.cat-chips { margin-bottom: 22px; }
.cat-chip { font-family: inherit; }
.cat-chip:focus-visible { outline: none; box-shadow: var(--ring); }

.prompt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.prompt-card {
  position: relative;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.prompt-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--dash); }
.pc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pc-title { font-size: 16.5px; font-weight: 750; letter-spacing: -.2px; }
.copy-btn {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  border: 1.5px solid var(--line); background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 11px; padding: 8px 14px; font-size: 13.5px; font-weight: 700; cursor: pointer;
  transition: transform .14s ease, background .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.copy-btn:hover { transform: translateY(-1px); border-color: var(--accent); box-shadow: var(--shadow-sm); }
.copy-btn:active { transform: translateY(0); }
.copy-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.copy-btn.copied { background: #16a34a; border-color: #16a34a; color: #fff; }
.pc-meta { margin-top: 8px; }
.pc-cat {
  display: inline-block; font-size: 12px; font-weight: 700;
  background: var(--accent-faint); color: var(--accent-ink);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px;
}
.pc-label { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 12px; }
.pc-text { font-size: 14px; line-height: 1.65; margin-top: 4px; white-space: pre-wrap; word-break: break-word; cursor: pointer; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-text.expanded { display: block; }
.pc-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pc-head-left .pc-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* prompt-card actions are always visible (never hover-only) */
.prompt-card .tile-x { opacity: 1; transform: none; }
.pc-check {
  flex: none; margin: 0;
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 6px;
  background: var(--input-bg);
  position: relative; transition: background .15s ease, border-color .15s ease;
}
.pc-check:hover { border-color: var(--danger); }
.pc-check:checked { background: var(--danger); border-color: var(--danger); }
.pc-check:checked::after {
  content: ""; position: absolute; left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.pc-actions { display: flex; gap: 8px; margin-top: 14px; }
.pc-btn {
  border: 1px solid var(--line); background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 9px; padding: 7px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: transform .14s ease, background .14s ease;
}
.pc-btn:hover { transform: translateY(-1px); }
.pc-btn.danger { background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .35); color: var(--danger); }
.pc-btn.danger:hover { background: var(--danger); color: #fff; }
.prompt-card.selected { border-color: var(--danger); box-shadow: var(--shadow-sm); }
.prompt-card.selected:hover { border-color: var(--danger); }
.pill.danger-pill { border-color: var(--danger); color: var(--danger); font-weight: 700; }
.pill.danger-pill:hover { background: var(--danger); color: #fff; }

textarea, select {
  width: 100%; padding: 13px 15px; font-size: 15px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 13px; background: var(--input-bg);
  font-family: inherit; resize: vertical;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea:focus, select:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
textarea::placeholder { color: var(--placeholder); }
select { cursor: pointer; }

/* ---------- prompt-maker page container ---------- */
.pm-scope { border-radius: 20px; }
.pm-scope .ic.sm { vertical-align: -2px; }
/* its internal preset modal is viewport-fixed: keep it out from under the sidebar */
.pm-scope #presetModal { left: var(--sbw); }

/* ---------- interaction-state audit: focus rings ---------- */
.chip:focus-visible, .tile:focus-visible {
  outline: none; box-shadow: var(--ring);
}
.dot:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.nav-item, .chip, .tile { -webkit-tap-highlight-color: transparent; }

/* ---------- responsive: sidebar becomes a slim top bar ---------- */
@media (max-width: 900px) {
  :root { --sbw: 0px; }
  .dash { flex-direction: column; }
  .dash-sidebar {
    position: sticky; top: 0;
    width: 100%; height: auto;
    flex-direction: row; align-items: center; gap: 8px;
    padding: 10px 14px;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0 8px 0 0; }
  .brand-tile { width: 38px; height: 38px; border-radius: 11px; }
  .brand-tile img { width: 32px; height: 32px; }
  .brand-name { font-size: 17px; }
  .dash-nav { flex-direction: row; flex: 1; gap: 4px; }
  .nav-item { padding: 9px 12px; font-size: 14px; gap: 8px; }
  .nav-item:hover { transform: none; }
  .side-foot { padding-top: 0; border-top: none; gap: 8px; }
  .side-foot .accent-picker { padding: 5px 8px; gap: 6px; }
  .side-foot .dot { width: 18px; height: 18px; }
  .side-foot .theme-toggle { width: 38px; height: 38px; }
  .dash-main { margin-left: 0; }
  .prompt-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .nav-item span { display: none; }   /* icon-only nav on small phones */
  .nav-item { padding: 9px 11px; }
  .brand-name { font-size: 16px; }
}
