:root {
  --bg: #0f0f12;
  --panel: #17171c;
  --line: #26262e;
  --text: #ececf1;
  --muted: #8b8b98;
  --accent: #4f8cff;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }

/* header */
/* header: same 1200px column as the grid below, quiet surface, same radii/heights as the chips */
.top {
  position: sticky; top: 0; z-index: 10;
  padding-top: env(safe-area-inset-top);
  background: rgba(15,15,18,.86); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.top-inner { max-width: 1228px; margin: 0 auto; height: 58px; padding: 0 14px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: .2px; flex: 0 0 auto; padding: 4px 6px 4px 0; border-radius: 10px; }
.brand .logo { width: 26px; height: 26px; }
.search {
  flex: 1 1 auto; min-width: 0; max-width: 520px; margin: 0 auto; height: 38px;
  display: flex; align-items: center; gap: 8px; padding: 0 10px 0 12px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  transition: border-color .15s, background .15s; cursor: text;
}
.search:focus-within { border-color: #3a3a46; color: var(--text); }
.search svg { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font-size: 14px; padding: 0; }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search #searchClear { border: 0; background: rgba(255,255,255,.1); color: var(--text); width: 20px; height: 20px; border-radius: 50%; font-size: 10px; line-height: 20px; padding: 0; cursor: pointer; }
.search #searchClear:hover { background: rgba(255,255,255,.2); }
.btn.new { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px 0 12px; border-radius: 12px; flex: 0 0 auto; box-shadow: none; }
.btn.new:hover { filter: brightness(1.08); }
.btn.new svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; }
@media (max-width: 600px) {
  .top-inner { gap: 10px; padding: 0 12px; height: 54px; }
  .brand span { display: none; }
  .btn.new { width: 38px; padding: 0; justify-content: center; }
  .btn.new span { display: none; }
}
.btn {
  padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; white-space: nowrap;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.danger { color: #ff6b6b; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 20px; padding: 8px; color: #fff; }

/* filter bar (home): a segmented control, then (when a type is chosen) that type's groups. Aligned with the grid. */
.tagbar { display: grid; gap: 12px; max-width: 1228px; margin: 4px auto 8px; padding: 0 14px; justify-items: start; }
.tagbar:empty { display: none; }
/* pixiv-style tabs: bold text, active one gets an underline (type colour for Anime/Game/Other) */
.seg {
  display: flex; gap: 0; width: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; width: calc(100% + 28px);
  border-bottom: 1px solid var(--line);
}
.seg::-webkit-scrollbar { display: none; }
.seg .chip {
  position: relative; height: 44px; padding: 0 14px; border-radius: 0; border: 0; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 700; letter-spacing: .1px; gap: 6px;
}
.seg .chip:hover { background: transparent; color: var(--text); }
.seg .chip::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: transparent; transition: background .15s; }
.seg .chip.active { color: var(--text); background: transparent; }
.seg .chip.all-chip.active { background: transparent; color: var(--text); }
.seg .chip.all-chip.active::after { background: var(--accent); }
.seg .chip.fav-chip.active { background: transparent; color: #ff7a94; }
.seg .chip.fav-chip.active::after { background: #ff5c8a; }
.seg .chip small { background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; padding: 0; }
.seg .chip.active small { color: var(--muted); }
.seg .chip.type svg { width: 15px; height: 15px; }
/* group tags under the tabs: pixiv-style flat rounded tags, one quiet tint, no label */
.groups-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: 100%; }
.groups {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%;
  max-height: 84px; overflow: hidden;                                    /* two lines of tags */
}
.groups.expanded { max-height: none; }
.gtag {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 0; cursor: pointer;
  background: rgba(255,255,255,.07); color: #d6d6e0; font-size: 13.5px; font-weight: 700; white-space: nowrap; transition: background .15s, color .15s;
}
.gtag small { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.gtag:hover { background: rgba(255,255,255,.12); color: #fff; }
.gtag.active { background: var(--accent); color: #fff; }
.gtag.active small { color: rgba(255,255,255,.8); }
.gtag.tagfilter.active::after { content: '✕'; font-size: 11px; opacity: .85; }
.groups-wrap .chip.more { height: 36px; border-radius: 8px; font-size: 13px; }
.chip.more { color: var(--accent); background: none; border-style: dashed; }
.chip.more::before { content: none; }
.chiprow { display: none; }
/* group colours: Anime rose, Game blue, Other amber */
:root { --anime: #ff7aa2; --anime-bg: rgba(255,92,138,.16); --game: #8fa8ff; --game-bg: rgba(109,140,255,.18); --other: #f7c26b; --other-bg: rgba(245,179,74,.16); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.anime .dot, .anime > .dot { background: var(--anime); } .game .dot, .game > .dot { background: var(--game); } .other .dot, .other > .dot { background: var(--other); }
.chip.type::before, .chip.gname::before { content: none; }
.chip.type svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.chip.type.anime.active { background: var(--anime-bg); border-color: transparent; color: var(--anime); }
.seg .chip.type.anime.active { background: transparent; } .seg .chip.type.anime.active::after { background: var(--anime); }
.chip.type.game.active { background: var(--game-bg); border-color: transparent; color: var(--game); }
.seg .chip.type.game.active { background: transparent; } .seg .chip.type.game.active::after { background: var(--game); }
.chip.type.other.active { background: var(--other-bg); border-color: transparent; color: var(--other); }
.seg .chip.type.other.active { background: transparent; } .seg .chip.type.other.active::after { background: var(--other); }
.chip.type.active small { background: rgba(255,255,255,.14); color: inherit; }
.seg .chip.type.active small { background: transparent; color: var(--muted); }
.chip.gname.anime.active { background: var(--anime-bg); border-color: transparent; color: var(--anime); }
.chip.gname.game.active { background: var(--game-bg); border-color: transparent; color: var(--game); }
.chip.gname.other.active { background: var(--other-bg); border-color: transparent; color: var(--other); }
.chip.gname.active small { background: rgba(255,255,255,.12); color: inherit; }
.chip.gname.active .dot { background: currentColor; }
.gpill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px 0 9px; border-radius: 999px; border: 0; cursor: pointer;
  font-size: 13px; font-weight: 600; letter-spacing: .1px; transition: filter .15s, transform .1s;
}
.gpill svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.gpill.anime { background: var(--anime-bg); color: var(--anime); }
.gpill.game { background: var(--game-bg); color: var(--game); }
.gpill.other { background: var(--other-bg); color: var(--other); }
.gpill:hover { filter: brightness(1.15); }
.gpill:active { transform: scale(.97); }
.card .sub { display: flex; align-items: center; gap: 6px; }
.ibtn {
  width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s;
}
.ibtn:hover { background: rgba(255,255,255,.07); color: var(--text); }
.ibtn.danger:hover { background: rgba(255,74,110,.12); color: #ff6b6b; }
.ibtn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chip.tagfilter.active::after { content: '✕'; font-size: 10px; margin-left: 2px; opacity: .8; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 10px;
  border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); color: #c9c9d4;
  transition: background .15s, border-color .15s, color .15s;
}
.chip::before { content: '#'; color: var(--muted); font-weight: 600; }
.chip:hover { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.14); color: var(--text); }
.chip small { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--muted); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.active::before, .chip.active small { color: rgba(255,255,255,.85); }
.chip.active small { background: rgba(255,255,255,.2); }
.chip.fav-chip::before, .chip.all-chip::before { content: none; }
.chip.all-chip { padding: 0 14px; }
.chip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.chip.fav-chip.active svg { fill: #fff; }

/* album grid (home) */
main { padding: 4px 14px 60px; }
/* Home grid: as many ~200px+ tiles as fit, capped at 5 per row (1200px) and centred on wide screens. */
.section-title, .albums { max-width: 1200px; margin-left: auto; margin-right: auto; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; margin-top: 10px; margin-bottom: 16px; }
.section-title .count { font-size: 11px; font-weight: 700; background: #2a2a33; color: var(--muted); padding: 2px 7px; border-radius: 6px; }
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 24px 18px; }
@media (max-width: 700px) { .albums { grid-template-columns: repeat(3, 1fr); gap: 18px 12px; } }
/* phones: pixiv-style edge-to-edge 2-column mosaic, no captions */
@media (max-width: 480px) {
  .albums { grid-template-columns: repeat(2, 1fr); gap: 2px; margin: 0 -14px; }
  .albums .card .cover, .albums .card .cover-link { border-radius: 0; border: 0; }
  .albums .card .title, .albums .card .sub { display: none; }
  .card .fav { bottom: 8px; right: 8px; width: 34px; height: 34px; }
  /* heading + sort share one line: sort becomes a quiet borderless control */
  .section-row { flex-wrap: nowrap; gap: 8px; }
  .section-row .section-title { margin: 8px 0 12px; font-size: 17px; min-width: 0; }
  .section-row .section-title .count { flex: 0 0 auto; }
  .sort { border: 0; background: none; padding: 0; height: auto; flex: 0 0 auto; }
  .sort select { font-size: 12.5px; color: var(--muted); padding: 4px 0 4px 2px; max-width: 130px; }
  .albums:last-of-type { margin-bottom: 12px; }
}
/* image-count badge (pixiv shows this for multi-page works) */
.card .cover-link { position: relative; }
.card .cnt { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 700; pointer-events: none; }
.card .cnt svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
/* pager */
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; max-width: 1200px; margin: 28px auto 8px; }
.pg { min-width: 38px; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pg:hover { border-color: #3a3a46; }
.pg.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pg:disabled { opacity: .35; cursor: default; }
.pg svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pg.next svg { transform: rotate(180deg); }
.pager .gap { color: var(--muted); padding: 0 2px; }
.card { position: relative; }
.card .cover-link { display: block; overflow: hidden; border-radius: var(--radius); }
.card .cover {
  aspect-ratio: 1; width: 100%; object-fit: cover; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); transition: filter .15s;
}
.card:hover .cover { filter: brightness(1.08); }
.card .cover.empty { display: grid; place-items: center; color: var(--muted); }
.card .title {
  display: block; margin-top: 8px; font-weight: 700; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .sub { margin-top: 3px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .sub .dot { flex: 0 0 auto; }
.card .fav {
  position: absolute; right: 8px; bottom: 34px; width: 32px; height: 32px; border: 0; padding: 0; cursor: pointer;
  border-radius: 50%; background: rgba(0,0,0,.45); display: grid; place-items: center; transition: transform .12s;
}
.card .fav svg { fill: none; stroke: #fff; stroke-width: 2; }
.card .fav.on svg { fill: #ff4a6e; stroke: #ff4a6e; }
.card .fav:active { transform: scale(.85); }
.empty-state { color: var(--muted); text-align: center; padding: 60px 20px; }
/* home: heading row with sort, footer links */
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1200px; margin: 0 auto; }
.section-row .section-title { margin: 10px 0 16px; }
.sort { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; padding: 0 4px 0 10px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); }
.sort svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sort select { border: 0; background: transparent; color: var(--text); font-size: 13px; padding: 4px 6px; outline: none; cursor: pointer; }
.sort select option { background: var(--panel); }
.foot-links { max-width: 1200px; margin: 44px auto 0; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.foot-link { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 8px 12px 8px 10px; border-radius: 10px; border: 0; background: none; cursor: pointer; font: inherit; }
.foot-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.foot-link:hover { color: var(--text); background: rgba(255,255,255,.06); }
.foot-slot:empty { display: none; }
/* header menu */
.menu-wrap { position: relative; flex: 0 0 auto; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(0,0,0,.5); z-index: 20; display: grid; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; width: 100%; }
.menu-item svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.menu-item:hover { background: rgba(255,255,255,.07); }
.menu-item small { margin-left: auto; font-size: 11px; font-weight: 700; background: #2a2a33; color: var(--muted); padding: 2px 7px; border-radius: 6px; }
.menu-item small:empty { display: none; }
#logoutBtn { border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; padding-top: 12px; }
.foot-links { display: none; }
/* cover section (edit page, left column) */
.coverpick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.coverpick-img { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.coverpick-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.coverpick-actions { display: grid; grid-template-rows: 1fr 1fr; gap: 10px; }
.cbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s; }
.cbtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.cbtn:hover { border-color: #3a3a46; background: rgba(255,255,255,.04); }
/* cover picker dialog (big) */
.pickgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: min(76vh, 900px); overflow-y: auto; padding: 2px; }
@media (max-width: 600px) { .pickgrid { grid-template-columns: repeat(3, 1fr); gap: 6px; } }
.pick { padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: var(--bg); cursor: pointer; aspect-ratio: 1; }
.pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick:hover { border-color: #3a3a46; }
.pick.on { border-color: var(--accent); }
/* undo toast */
.toast.undo { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 12px; }
.toast.undo svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toast.undo button { border: 0; background: rgba(79,140,255,.18); color: var(--accent); font-weight: 700; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.toast.undo button:hover { background: rgba(79,140,255,.28); }
/* cover framing dialog */
.frame { width: min(88vw, 66vh, 640px); aspect-ratio: 1; margin: 0 auto; border-radius: 12px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.frame:active { cursor: grabbing; }
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; -webkit-user-drag: none; }
.frame-zoom { display: flex; align-items: center; gap: 8px; margin: 14px auto 0; max-width: 360px; }
.frame-zoom input[type=range] { flex: 1; accent-color: var(--accent); margin: 0; padding: 0; width: auto; }
.frame-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.info-note { margin: 10px 0 0; color: #c9c9d4; font-size: 14px; line-height: 1.55; white-space: pre-wrap; max-width: 640px; }
/* edit page extras */
.edit-form textarea { display: block; width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 14px; line-height: 1.5; resize: vertical; min-height: 84px; }
.edit-form textarea:focus, .edit-form input[type=url]:focus { outline: none; border-color: #3a3a46; }
.edit-form input[type=url] { display: block; width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 14px; }
.esec-tools { display: flex; gap: 6px; margin-left: auto; }
.tbtn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 12.5px; cursor: pointer; }
.tbtn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tbtn:hover { border-color: #3a3a46; }
.tbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tbtn.danger { color: #ff6b6b; }
.tbtn:disabled { opacity: .5; cursor: default; }
@media (max-width: 480px) { .tbtn span { display: none; } }
.selbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; }
.selbar #selCount { font-weight: 600; margin-right: auto; }
.selmove { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); }
.selmove svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.selmove select { border: 0; background: transparent; color: var(--text); font-size: 13px; outline: none; max-width: 180px; }
.etile .check { display: none; position: absolute; inset: 0; place-items: center; font-size: 34px; font-weight: 800; color: #fff; background: rgba(79,140,255,.45); border-radius: var(--radius); }
.egrid.selecting .etile { cursor: pointer; }
.egrid.selecting .erm, .egrid.selecting .grip { display: none; }
.egrid.selecting .etile.sel { outline: 3px solid var(--accent); outline-offset: -3px; }
.egrid.selecting .etile.sel .check { display: grid; }
/* manage page */
.manage { max-width: 1100px; margin: 4px auto 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px 48px; align-items: start; }
@media (max-width: 800px) { .manage { grid-template-columns: 1fr; } }
.mlist { list-style: none; margin: 0; padding: 0; }
.mlist li { display: flex; align-items: center; gap: 10px; padding: 8px 4px 8px 10px; border-bottom: 1px solid var(--line); }
.mlist li:hover { background: rgba(255,255,255,.03); }
.mname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.mtype { font-size: 12px; color: var(--muted); }
.mcount { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mempty { color: var(--muted); font-size: 13px; }
.ibtn.sm { width: 32px; height: 32px; }
.ibtn.sm svg { width: 17px; height: 17px; }
.ask-title { font-weight: 700; margin-bottom: 12px; }
.ask-input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.ask-input:focus { outline: none; border-color: #3a3a46; }
.ask-types { margin-bottom: 10px; }
.ask-types .gtype { height: 34px; }
.progress b { color: var(--text); font-weight: 600; margin-left: 4px; }

/* trash */
.trash-link-wrap { max-width: 1200px; margin: 36px auto 0; }
.trash-link { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 8px 12px 8px 10px; border-radius: 10px; }
.trash-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.trash-link:hover { color: var(--text); background: rgba(255,255,255,.06); }
.trash-grid .cover { filter: saturate(.4) brightness(.8); }
.tsec { max-width: 1200px; margin: 22px auto 12px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tsec .count { font-size: 11px; font-weight: 700; background: #2a2a33; color: var(--muted); padding: 2px 7px; border-radius: 6px; }
.trash-grid { margin-bottom: 8px; }
@media (max-width: 480px) { .albums.trash-grid { gap: 14px 10px; margin: 0; } .albums.trash-grid .card .title, .albums.trash-grid .card .sub { display: block; } .albums.trash-grid .card .cover { border-radius: var(--radius); } }
.trash-grid .title { margin-top: 8px; font-weight: 700; font-size: 13px; }
.trash-actions { display: flex; gap: 2px; margin-top: 4px; margin-left: -8px; }
.trash-actions .ibtn { width: 36px; height: 36px; }
.trash-actions .ibtn svg { width: 19px; height: 19px; }
#emptyTrash { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 12px; border-radius: 10px; }
#emptyTrash svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.empty-hero { display: grid; justify-items: center; gap: 10px; padding: 80px 20px; text-align: center; color: var(--muted); }
.empty-hero .art { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(79,140,255,.18), rgba(123,92,255,.18)); border: 1px solid rgba(79,140,255,.25); margin-bottom: 6px; }
.empty-hero .art svg { width: 34px; height: 34px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.empty-hero h3 { margin: 0; color: var(--text); font-size: 18px; }
.empty-hero p { margin: 0; font-size: 13px; max-width: 320px; line-height: 1.5; }
.empty-hero .btn { margin-top: 10px; }

/* album page top bar: ‹ title › (arrows step through albums in the home order); details live under the strip */
.album-nav { max-width: 860px; margin: 6px auto 12px; display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 6px; }
.anav { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--text); transition: background .15s; }
.anav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.anav.next svg { transform: rotate(180deg); }
.anav:hover { background: rgba(255,255,255,.07); }
.anav.off { opacity: .25; pointer-events: none; }
.anav-title { text-align: center; font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 8px 4px; border-radius: 10px; }
.anav-title:hover { background: rgba(255,255,255,.05); }
@media (max-width: 480px) { .album-nav { margin: 2px -4px 8px; } .anav-title { font-size: 15px; } }
.info-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.info-count { color: var(--muted); font-size: 13px; }
.info-actions .actions { display: flex; gap: 4px; margin-left: auto; }

/* album page header (edit / trash / manage pages): same 860px column as the strip */
.album-head { max-width: 860px; margin: 8px auto 16px; }
.album-head .back {
  display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 14px 0 8px; margin: 0 0 16px -8px;
  border-radius: 999px; color: var(--muted); font-size: 13px; font-weight: 600; transition: background .15s, color .15s;
}
.album-head .back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.album-head .back:hover { color: var(--text); background: rgba(255,255,255,.07); }
@media (max-width: 600px) { .album-head .back { height: 40px; margin-left: -6px; } }
.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.head-text { flex: 1 1 280px; min-width: 0; }
.album-head h1 { font-size: 24px; line-height: 1.2; margin: 0 0 6px; font-weight: 800; letter-spacing: .2px; word-break: break-word; }
.head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); font-size: 13px; }
.album-head .actions { display: flex; gap: 4px; flex: 0 0 auto; margin-top: -4px; }
@media (max-width: 600px) {
  .album-head { margin-top: 2px; }
  .album-head h1 { font-size: 21px; }
  .head-row { flex-wrap: nowrap; }
  .head-row:has(.actions .btn) { flex-wrap: wrap; }              /* edit page: Save button drops to its own row */
  .album-head .actions:has(.btn) { flex: 1 1 100%; padding-top: 4px; }
  .album-head .actions .btn { flex: 1; text-align: center; padding: 9px 6px; }
}
.strip-empty { max-width: 860px; margin: 30px auto; padding: 48px 20px; text-align: center; border: 1.5px dashed #3a3a46; border-radius: 14px; color: var(--muted); }
.strip-empty p { margin: 0 0 14px; font-size: 15px; color: var(--text); }
.strip-empty small { display: block; margin-top: 10px; font-size: 12px; }
/* vertical strip: one image per row, full width, like a manga/pixiv reader */
.strip { display: flex; flex-direction: column; gap: 10px; max-width: 860px; margin: 0 auto; }
@media (max-width: 480px) { .strip { gap: 6px; margin: 0 -14px; } }
.tile { position: relative; background: var(--panel); cursor: zoom-in; overflow: hidden; border-radius: var(--radius); }
@media (max-width: 480px) { .tile { border-radius: 0; } }
.tile img { width: 100%; height: auto; }
/* album info block under the strip */
.info { max-width: 860px; margin: 18px auto 0; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.like {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 12px; border-radius: 999px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: 14px;
  transition: background .15s, border-color .15s, transform .1s;
}
.like svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .15s; }
.like:hover { border-color: #3a3a46; }
.like:active { transform: scale(.96); }
.like.on { color: #ff4a6e; border-color: rgba(255,74,110,.35); background: rgba(255,74,110,.08); }
.like.on svg { fill: #ff4a6e; transform: scale(1.1); }
.info-title { margin: 12px 0 14px; font-size: 20px; font-weight: 400; letter-spacing: .1px; line-height: 1.35; word-break: break-word; color: var(--text); }
.info-tags { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 10px; }
.info-tags:last-child { margin-bottom: 0; }
.tag { border: 0; background: none; padding: 0; cursor: pointer; color: var(--accent); font-size: 16px; font-weight: 600; }
.tag:hover { text-decoration: underline; }
.info-meta { color: var(--muted); font-size: 13px; }
@media (max-width: 480px) { .info { margin-top: 14px; } .info-title { font-size: 21px; } }

/* more albums row at the bottom of an album */
.more { max-width: 860px; margin: 28px auto 0; }
.more h2 { font-size: 14px; color: var(--muted); font-weight: 600; margin: 0 0 10px; }
.more-row {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px;
  scroll-snap-type: x proximity; scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.more-card { flex: 0 0 132px; scroll-snap-align: start; }
@media (max-width: 480px) { .more-card { flex-basis: 112px; } .more-row { margin: 0 -14px; padding: 0 14px 6px; } }
.more-card { transition: transform .15s; }
.more-card .more-img { display: block; margin: 0; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.more-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.more-card:hover { transform: translateY(-2px); }
.more-card:hover .more-img { border-color: #3a3a46; }
.more-card span { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.strip-counter {
  position: fixed; right: 14px; top: calc(68px + env(safe-area-inset-top)); z-index: 5;
  background: rgba(0,0,0,.55); backdrop-filter: blur(6px); color: #fff;
  font-size: 12px; padding: 4px 10px; border-radius: 999px; pointer-events: none;
}
/* iOS Safari zooms the page when focusing an input smaller than 16px */
@media (pointer: coarse) { input, .search input { font-size: 16px; } }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: #000; touch-action: none; user-select: none; -webkit-user-select: none; }
.lb-stage { position: absolute; inset: 0; overflow: hidden; display: grid; place-items: center; }
.lb-stage img.anim { transition: transform .32s cubic-bezier(.22, .9, .3, 1); }   /* double-tap / double-click zoom */
.lb-stage img {
  max-width: 100vw; max-height: 100vh; max-height: 100dvh; transform-origin: 0 0; will-change: transform;
  -webkit-user-drag: none; pointer-events: none;
}
.lb-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top));
  background: linear-gradient(rgba(0,0,0,.6), transparent); color: #fff; transition: opacity .2s;
}
.lb-counter { font-size: 13px; opacity: .8; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  background: rgba(0,0,0,.35); border: 0; color: #fff; font-size: 34px; line-height: 1;
  width: 48px; height: 72px; cursor: pointer; border-radius: 8px;
}
.lb-nav.prev { left: 8px; } .lb-nav.next { right: 8px; }
.lightbox.zoomed .lb-nav { opacity: 0; pointer-events: none; }
/* full-size image still downloading (the strip thumbnail is on screen meanwhile) */
.lb-spin { display: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); border-top-color: #fff; animation: spin .8s linear infinite; margin-left: -8px; }
.lightbox.loading .lb-spin { display: inline-block; }
.lightbox.loading .lb-stage img { image-rendering: high-quality; }   /* upscaled preview: smoother resampling while the original loads */
.lb-top { gap: 14px; justify-content: flex-start; }
.lb-top .icon-btn { margin-left: auto; }
@keyframes spin { to { transform: rotate(360deg); } }
/* thumbnail strip along the bottom */
.lb-strip {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; gap: 6px; padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom)); overflow-x: auto; scrollbar-width: none;
  background: linear-gradient(transparent, rgba(0,0,0,.7)); transition: opacity .2s;
}
.lb-strip::-webkit-scrollbar { display: none; }
.lb-strip img { flex: 0 0 auto; width: 52px; height: 52px; object-fit: cover; border-radius: 6px; opacity: .55; border: 2px solid transparent; cursor: pointer; transition: opacity .15s; }
.lb-strip img.active { opacity: 1; border-color: #fff; }
.lb-strip img:hover { opacity: .9; }
.lightbox.zoomed .lb-strip, .lightbox.pulling .lb-strip, .lightbox.pulling .lb-top { opacity: 0; pointer-events: none; }
/* bottom toolbar (pixiv-style): fit width · fit height · zoom % · − · +  — always visible, fades while pulling to close */
.lb-tools {
  position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 999px;
  background: rgba(20,20,26,.72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: opacity .2s;
}
.lb-tool { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: #fff; display: grid; place-items: center; cursor: pointer; font-size: 13px; font-weight: 700; padding: 0; }
.lb-tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.lb-tool:hover { background: rgba(255,255,255,.2); }
.lb-tool.pct { width: auto; min-width: 74px; padding: 0 14px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.lightbox.pulling .lb-tools { opacity: 0; pointer-events: none; }
/* desktop keeps the thumbnail strip; lift the toolbar above it while the strip is visible */
.lb-strip:not(:empty) ~ .lb-tools { bottom: 84px; }
.lightbox.zoomed .lb-strip:not(:empty) ~ .lb-tools { bottom: max(14px, env(safe-area-inset-bottom)); }
/* top-bar prev/next (phones; desktop has the side arrows) */
.lb-tnav { display: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; place-items: center; cursor: pointer; padding: 0; }
.lb-tnav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.lb-tnav.next svg { transform: rotate(180deg); }
.lb-tnav:disabled { opacity: .3; }
@media (pointer: coarse) {
  .lb-strip { display: none; }
  .lb-tnav { display: grid; }
  .lb-top { padding-top: max(10px, env(safe-area-inset-top)); }
}
.lb-stage img { transition: none; }
@media (pointer: coarse) { .lb-nav { display: none; } }

/* dialog */
.dlg { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); padding: 20px; width: min(92vw, 420px); }
.dlg::backdrop { background: rgba(0,0,0,.6); }
.dlg h2 { margin: 0 0 14px; font-size: 18px; }
.dlg label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.dlg input { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.dlg input:focus { outline: none; border-color: #3a3a46; }   /* focus = slightly lighter border, no blue ring anywhere */
.field-label { color: var(--muted); font-size: 13px; margin-bottom: 4px; }

/* new-album dialog: roomier than the default dialog */
#albumDlg { width: min(94vw, 600px); padding: 28px 30px; border-radius: 18px; max-height: min(92vh, 900px); overflow-y: auto; }
#albumDlg h2 { font-size: 22px; margin-bottom: 22px; }
#albumDlg label, #albumDlg .field-label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px; }
#albumDlg label { margin-bottom: 22px; }
#albumDlg label input { margin-top: 8px; padding: 12px 14px; font-size: 15px; border-radius: 10px; text-transform: none; letter-spacing: 0; font-weight: 400; }
#albumDlg .groupbox, #albumDlg .tagbox { margin-bottom: 22px; }
#albumDlg .gtype { height: 42px; font-size: 14px; }
#albumDlg .tagbox-row { min-height: 48px; padding: 8px 10px; }
#albumDlg .drop { padding: 18px; }
#albumDlg .drop-hint { padding: 22px 0; gap: 6px; }
#albumDlg .drop-hint svg { width: 34px; height: 34px; }
#albumDlg .drop-hint b, #albumDlg .drop-hint span { font-size: 15px; }
#albumDlg .previews { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
#albumDlg .dlg-actions { margin-top: 20px; gap: 10px; }
#albumDlg .dlg-actions .btn { padding: 11px 20px; font-size: 14px; }
@media (max-width: 600px) {
  #albumDlg { width: 100vw; max-width: none; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; border: 0; padding: 22px 18px; padding-top: max(22px, env(safe-area-inset-top)); }
  #albumDlg .dlg-actions { position: sticky; bottom: 0; padding: 14px 0 max(0px, env(safe-area-inset-bottom)); margin: 8px -18px -22px; padding-left: 18px; padding-right: 18px; background: var(--panel); border-top: 1px solid var(--line); }
}

/* confirm dialog */
.dlg.confirm { width: min(92vw, 360px); }
.dlg.confirm.big { width: min(96vw, 1100px); }
.dlg.confirm.framing { width: fit-content; max-width: 96vw; }
.dlg.confirm.framing #confirmMsg, .dlg.confirm.big #confirmMsg { margin-bottom: 14px; }
.dlg.confirm p { margin: 4px 0 18px; font-size: 15px; line-height: 1.5; }
.btn.danger-solid { background: #e5484d; border-color: #e5484d; color: #fff; font-weight: 600; }

/* edit page: each section is a card; details on the left, images on the right (stacked on narrow screens) */
.album-head:has(+ .edit-form) { max-width: 1100px; }
.edit-form { max-width: 1100px; margin: 4px auto 24px; display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px 48px; align-items: start; }
.edit-side, .edit-main { display: grid; gap: 30px; min-width: 0; align-content: start; }
.esec { padding: 0; }                                   /* boxless: spacing + type do the separating */
.esec.muted .esec-head h3 { color: var(--muted); }
.esec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 14px; }
.esec-head h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: 8px; }
.esec-head h3 .count { font-size: 11px; font-weight: 700; background: #2a2a33; color: var(--muted); padding: 2px 7px; border-radius: 6px; }
.esec-head p { margin: 0; font-size: 12.5px; color: var(--muted); flex-basis: 100%; }
.esec-head button { margin-left: auto; border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 0; }
.esec-head .ibtn { margin-left: 0; color: var(--muted); }
.esec-head .ibtn:hover { color: var(--text); }
.esec-head .menu-item { margin-left: 0; color: var(--text); font-size: 13.5px; padding: 10px 12px; }
.esec-head .menu { top: calc(100% + 6px); }
.edit-form input[type=text] { display: block; width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 15px; }
.edit-form input[type=text]:focus { outline: none; border-color: #3a3a46; }
.edit-form .groupbox, .edit-form .tagbox { margin-bottom: 0; }
.edit-form .gtype { background: var(--bg); }
.egrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; user-select: none; -webkit-user-select: none; }
@media (max-width: 900px) { .edit-form { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .edit-side, .edit-main { gap: 24px; } .edit-form { gap: 24px; } }
@media (max-width: 480px) { .egrid { grid-template-columns: repeat(3, 1fr); gap: 8px; } }
.etile { background: var(--bg); }
.etile { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--panel); border: 1px solid var(--line); cursor: grab; }
.etile img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.etile .num { position: absolute; left: 6px; top: 6px; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; }
.etile .erm { position: absolute; right: 6px; top: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 12px; cursor: pointer; }
.etile .erm:hover { background: #e5484d; }
.etile .grip {
  position: absolute; right: 6px; bottom: 6px; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(0,0,0,.55); color: #fff; touch-action: none; cursor: grab;
}
.etile .grip svg { width: 16px; height: 16px; fill: currentColor; }
.etile.dragging { opacity: .25; }
.etile.over { outline: 2px solid var(--accent); outline-offset: -2px; }
.drag-ghost { position: fixed; z-index: 300; pointer-events: none; border-radius: var(--radius); overflow: hidden; box-shadow: 0 12px 32px rgba(0,0,0,.6); transform: scale(1.05); opacity: .95; }
.drag-ghost img { width: 100%; height: 100%; object-fit: cover; display: block; }
body.is-dragging { cursor: grabbing; }
body.is-dragging * { cursor: grabbing !important; }

/* group picker: Anime / Game / Other, then a name with existing names to pick from */
/* type chips stand alone; the name box below is its own bordered field */
.groupbox { margin-bottom: 12px; }
.gtypes { display: flex; gap: 8px; }
.gtype {
  flex: 1; height: 38px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted); transition: background .15s, color .15s, border-color .15s;
}
.gtype:hover { color: var(--text); border-color: #3a3a46; }
.gtype.active[data-type=anime] { background: var(--anime-bg); border-color: var(--anime); color: var(--anime); }
.gtype.active[data-type=game] { background: var(--game-bg); border-color: var(--game); color: var(--game); }
.gtype.active[data-type=other] { background: var(--other-bg); border-color: var(--other); color: var(--other); }
.gname { margin-top: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.gname:focus-within { border-color: #3a3a46; }
.gname .tag-suggest { border-top: 1px solid var(--line); }
.gname-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; }
.gname-row input { flex: 1; min-width: 0; border: 0 !important; background: none !important; padding: 6px 2px !important; margin: 0 !important; width: auto !important; outline: none; color: var(--text); }
.gclear { border: 0; background: rgba(255,255,255,.08); color: var(--muted); width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 11px; }
.gclear:hover { color: var(--text); background: rgba(255,255,255,.15); }
.gname .tag-suggest:empty { display: none; }
.gname .tag-suggest .sug::before { content: none; }
.gname .tag-suggest .sug.new::before { content: '+'; }
.gname .hint { padding: 0 10px 8px; font-size: 12px; color: var(--muted); }

/* tag chip input: chosen tags + text field on top, existing tags to pick from underneath */
.tagbox { margin-bottom: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.tagbox:focus-within { border-color: #3a3a46; }
.tagbox-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 42px; padding: 6px 8px; cursor: text; }
.tagbox-chips { display: contents; }
.tchip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px 3px 10px; border-radius: 999px;
  background: var(--accent); border: 1px solid var(--accent); color: #fff; font-size: 13px; font-weight: 500;
}
.tchip button { border: 0; background: none; color: rgba(255,255,255,.75); cursor: pointer; padding: 0 3px; font-size: 12px; line-height: 1; }
.tchip button:hover { color: #fff; }
.tagbox input { flex: 1; min-width: 120px; border: 0 !important; background: none !important; padding: 4px 2px !important; margin: 0 !important; width: auto !important; outline: none; }
.tag-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.tag-suggest:empty { display: none; }
.tag-suggest .lbl { width: 100%; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.sug {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 999px; cursor: pointer; font-size: 13px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); color: #c9c9d4;
}
.sug::before { content: '#'; color: var(--muted); }
.sug small { font-size: 11px; color: var(--muted); }
.sug:hover { background: rgba(255,255,255,.1); color: var(--text); }
.sug.sel { border-color: var(--accent); background: rgba(79,140,255,.18); color: var(--text); }
.sug.new { border-style: dashed; color: var(--accent); }
.sug.new::before { content: '+'; color: var(--accent); font-weight: 700; }
.sug.new.sel { background: rgba(79,140,255,.22); }
.tag-suggest .none { font-size: 12px; color: var(--muted); }

/* login */
/* login: boxless, centred, a soft glow behind the mark */
.login {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(60% 45% at 50% 32%, rgba(79,140,255,.14), transparent 70%), var(--bg);
}
.login-card { display: grid; justify-items: center; gap: 10px; width: min(100%, 340px); padding: 0; }
.login-card .logo { width: 64px; height: 64px; margin-bottom: 6px; filter: drop-shadow(0 6px 24px rgba(110,110,255,.45)); }
.login-card h2 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: .3px; }
.login-sub { margin: -4px 0 22px; color: var(--muted); font-size: 14px; }
.login-card .pw { position: relative; width: 100%; display: block; }
.login-card .pw input {
  width: 100%; height: 50px; padding: 0 48px 0 16px; border-radius: 12px; font-size: 16px; letter-spacing: .5px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); text-align: left;
}
.login-card .pw input::placeholder { letter-spacing: 0; color: var(--muted); }
.login-card .pw input:focus { outline: none; border-color: #3a3a46; }
.login-card .pw button {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 9px;
  border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer;
}
.login-card .pw button:hover { color: var(--text); background: rgba(255,255,255,.06); }
.login-card .pw svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.login-card .pw .eye-off { display: none; }
.login-card .pw button[aria-pressed="true"] .eye { display: none; }
.login-card .pw button[aria-pressed="true"] .eye-off { display: block; }
.login-card #loginBtn {
  width: 100%; height: 50px; margin-top: 4px; border-radius: 12px; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: filter .15s;
}
.login-card #loginBtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.login-card #loginBtn:hover svg { transform: translateX(3px); }
.login-card #loginBtn.busy { filter: brightness(.8); }
.login-card #loginBtn.busy svg { animation: spin .8s linear infinite; }
.login-err { min-height: 1.4em; margin-top: 2px; font-size: 13px; color: #ff6b6b; text-align: center; }
.login-card.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* drop zone */
.drop {
  border: 1.5px dashed #3a3a46; border-radius: 12px; background: var(--bg);
  padding: 14px; cursor: pointer; outline: none; transition: border-color .15s, background .15s;
}
.drop:hover, .drop:focus-visible { border-color: #55556a; }
.drop.over { border-color: var(--accent); background: rgba(79,140,255,.08); }
.drop-hint { display: grid; justify-items: center; gap: 4px; padding: 12px 0; color: var(--muted); text-align: center; }
.drop-hint b { color: var(--text); font-weight: 600; }
.drop-hint small { font-size: 11px; opacity: .7; }
.drop-hint .touch-only { display: none; }
@media (pointer: coarse) { .drop-hint .mouse-only { display: none; } .drop-hint .touch-only { display: block; } }
.drop.has-files .drop-hint { padding: 6px 0 10px; }
.drop.has-files .drop-hint svg, .drop.has-files .drop-hint small { display: none; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.previews:empty { display: none; }
.pv { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--panel); }
.pv img { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s; }
.pv .rm {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.65); color: #fff; font-size: 12px; line-height: 20px; padding: 0; cursor: pointer;
}
.pv.done img { opacity: .35; }
.pv.done::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; }
.pv.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .4 } to { opacity: 1 } }
.file-summary { margin-top: 6px; font-size: 12px; color: var(--muted); min-height: 1em; }
.uploading .rm { display: none; }

/* drop onto album page */
.page-drop {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; pointer-events: none;
  background: rgba(15,15,18,.85); backdrop-filter: blur(4px);
}
.page-drop > div { border: 2px dashed var(--accent); border-radius: 16px; padding: 28px 40px; font-size: 18px; color: var(--text); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.progress { margin: 8px 0; font-size: 13px; color: var(--muted); }
.progress .bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* floating upload progress when adding to existing album */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-size: 13px;
}
