:root {
  --paw: #fe54a6; --paw-hover: #ffb8dc; --paw-deep: #c73d80; --paw-tint: rgba(254, 84, 166, .12);
  --on-paw: #14060b; --border-pink: rgba(254, 84, 166, .45);
  --bg: #0b0b0f; --e1: #131318; --e2: #1b1b22; --e3: #24242d; --inset: #07070a;
  --hair: rgba(255, 255, 255, .06); --soft: rgba(255, 255, 255, .10); --strong: rgba(255, 255, 255, .18);
  --fg1: #f5f5f7; --fg2: #9a9aa8; --fg3: #5b5b68; --bad: #ff6b6b;
  --r: 12px; --r-sm: 8px;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg1);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--paw-hover); outline-offset: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; }
header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
header h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.lead { color: var(--fg2); font-size: 14px; margin: -8px 0 16px; }
.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tabs a { color: var(--fg2); text-decoration: none; padding: 6px 12px; border-radius: var(--r-sm); font-size: 14px; }
.tabs a:hover { color: var(--fg1); background: var(--e2); }
.tabs a[aria-current] { color: var(--fg1); background: var(--e2); box-shadow: inset 0 -2px 0 var(--paw-deep); }
.view > .card + .card { margin-top: 16px; }
header .spacer { flex: 1; }

.btn { border: 1px solid var(--soft); background: var(--e2); border-radius: var(--r-sm);
  padding: 9px 16px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--e3); }
.btn:disabled { color: var(--fg3); cursor: not-allowed; background: var(--e1); }
.btn.primary { background: var(--paw); border-color: var(--paw); color: var(--on-paw); font-weight: 600; }
.btn.primary:hover { background: var(--paw-hover); }
.btn.primary:active { background: var(--paw-deep); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg2); }
.btn.ghost:hover { color: var(--fg1); background: var(--e2); }

.card { background: var(--e1); border: 1px solid var(--hair); border-radius: var(--r); padding: 20px; }
.card h2 { font-size: 15px; font-weight: 600; margin: 0; }
.card .hint { color: var(--fg2); font-size: 13px; margin: 4px 0 0; }
.head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.head .count { color: var(--fg2); font-size: 13px; font-variant-numeric: tabular-nums; }

.add { display: flex; gap: 12px; margin-bottom: 16px; }
.add input { flex: 1; min-width: 0; background: var(--inset); border: 1px solid var(--soft); border-radius: var(--r-sm);
  padding: 9px 12px; font-family: var(--mono); font-size: 14px; }
.add input::placeholder { color: var(--fg3); }
.add input:focus { outline: none; border-color: var(--border-pink); box-shadow: 0 0 0 3px var(--paw-tint); }

.zone { min-height: 64px; border-radius: var(--r-sm); border: 1px dashed transparent; transition: border-color .12s, background .12s; }
.zone.over { border-color: var(--border-pink); background: var(--paw-tint); }
.zone.deny { border-color: rgba(255, 107, 107, .5); background: rgba(255, 107, 107, .06); }
body.is-dragging.deny-cursor, body.is-dragging.deny-cursor * { cursor: not-allowed !important; }
.banned-card { margin-top: 16px; }
.banned-pool { margin-top: 12px; }
.chip.banned { background: transparent; border-style: dashed; padding-right: 12px; }
.chip.banned .host { color: var(--fg2); }
.chip.banned .host b { font-weight: 600; color: var(--fg1); }
.chip.was-a::before { content: "A"; font-size: 10px; font-weight: 600; color: var(--fg3); border: 1px solid var(--soft);
  border-radius: 4px; padding: 0 3px; margin-left: -4px; }
.pool { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px; }
.list { display: flex; flex-direction: column; gap: 6px; padding: 4px; margin-top: 12px; }
.empty { color: var(--fg3); font-size: 13px; padding: 18px 8px; text-align: center; width: 100%; }

.groups { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
@media (max-width: 760px) { .groups { grid-template-columns: minmax(0, 1fr); } .wrap { padding: 20px 16px 48px; } .row { gap: 8px; } .row .grip { display: none; } }
.tag { font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--fg2); border: 1px solid var(--soft);
  border-radius: 6px; padding: 1px 7px; }

.chip { display: inline-flex; align-items: center; gap: 8px; background: var(--e2); border: 1px solid var(--soft);
  border-radius: 999px; padding: 5px 6px 5px 12px; font-family: var(--mono); font-size: 13.5px;
  cursor: grab; user-select: none; touch-action: none; max-width: 100%; }
.chip:hover { border-color: var(--strong); }
.chip, .row { transition: border-color .2s, box-shadow .2s; }
.chip .host { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .x, .row .x { border: 0; background: transparent; color: var(--fg3); width: 22px; height: 22px; border-radius: 50%;
  cursor: pointer; line-height: 1; padding: 0; font-size: 16px; }
.chip .x:hover, .row .x:hover { color: var(--fg1); background: var(--e3); }
.row { display: flex; align-items: center; gap: 12px; background: var(--e2); border: 1px solid var(--soft);
  border-radius: var(--r-sm); padding: 8px 8px 8px 10px; cursor: grab; user-select: none; touch-action: none; }
.row:hover { border-color: var(--strong); }
.row .grip { color: var(--fg3); font-size: 14px; letter-spacing: -2px; }
.row .host { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prio { display: inline-flex; align-items: center; background: var(--inset); border: 1px solid var(--soft); border-radius: 6px; }
.prio button { border: 0; background: transparent; color: var(--fg2); width: 26px; height: 26px; cursor: pointer; padding: 0; }
.prio button:hover:not(:disabled) { color: var(--fg1); background: var(--e3); }
.prio button:disabled { color: var(--fg3); cursor: default; }
.prio span { min-width: 30px; text-align: center; font-variant-numeric: tabular-nums; font-size: 13px; }
.prio span::before { content: "#"; color: var(--fg3); }
.dragging { opacity: .35; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }
.chip.flash, .row.flash { border-color: var(--paw); box-shadow: 0 0 0 3px var(--paw-tint); }
.shake { animation: shake .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); } 40%, 60% { transform: translateX(5px); }
}
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } }
.drag-ghost { position: fixed; margin: 0; z-index: 10; pointer-events: none; opacity: .95; transform: rotate(-1.5deg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }

.bar { position: sticky; bottom: 0; margin-top: 20px; display: flex; align-items: center; gap: 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-top: 1px solid var(--hair); padding: 14px 0; }
.bar .status { color: var(--fg2); font-size: 13px; flex: 1; }
.toast { white-space: pre-line; position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--e3);
  border: 1px solid var(--strong); border-radius: var(--r-sm); padding: 10px 16px; font-size: 14px; display: none; max-width: calc(100% - 32px); }
.toast.show { display: block; }
.toast.bad { border-color: rgba(255, 107, 107, .5); }

.login { max-width: 360px; margin: 14vh auto 0; padding: 0 16px; }
.login h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.login p { color: var(--fg2); margin: 0 0 20px; font-size: 14px; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login input { background: var(--inset); border: 1px solid var(--soft); border-radius: var(--r-sm); padding: 10px 12px; }
.login input:focus { outline: none; border-color: var(--border-pink); box-shadow: 0 0 0 3px var(--paw-tint); }
.login .err { color: var(--bad); font-size: 13px; min-height: 18px; margin: 0; }

.bar .status #published { color: var(--fg3); }
.btn.small { padding: 5px 10px; font-size: 13px; }
code, pre { font-family: var(--mono); font-size: 13px; }
.form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; margin-top: 4px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--fg2); }
.form label.check { flex-direction: row; align-items: center; gap: 8px; grid-column: 1 / -1; color: var(--fg1); }
.form .wide { grid-column: 1 / -1; }
.form .hint { margin: 0; }
.form input:not([type=checkbox]), .form textarea { background: var(--inset); border: 1px solid var(--soft); border-radius: var(--r-sm);
  padding: 9px 12px; color: var(--fg1); font: inherit; font-family: var(--mono); font-size: 14px; resize: vertical; }
.form input::placeholder { color: var(--fg3); }
.form input:focus, .form textarea:focus { outline: none; border-color: var(--border-pink); box-shadow: 0 0 0 3px var(--paw-tint); }
.form input[type=checkbox] { accent-color: var(--paw); width: 16px; height: 16px; }
.actions { display: flex; justify-content: flex-end; }
.kv-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hair); }
.kv-row:first-child { border-top: 0; }
.kv-row .k { width: 170px; flex: none; color: var(--fg2); font-size: 13px; }
.kv-row .v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note { color: var(--fg3); font-size: 13px; }
#pictures, #keys, #defines, .covers { margin-top: 12px; }
.pic { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--e2); border: 1px solid var(--soft);
  border-radius: var(--r-sm); margin-top: 8px; }
.pic .thumb { width: 72px; height: 48px; flex: none; border-radius: 6px; object-fit: cover; background: var(--inset); }
.pic .thumb.empty { display: grid; place-items: center; font-size: 10px; color: var(--fg3); text-align: center; }
.pic-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pic-main .v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pic .x { border: 0; background: transparent; color: var(--fg3); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 16px; }
.pic .x:hover { color: var(--fg1); background: var(--e3); }
.covers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cover { margin: 0; background: var(--e2); border: 1px solid var(--soft); border-radius: var(--r-sm); overflow: hidden; }
.cover img, .cover-empty { display: block; width: 100%; height: 180px; object-fit: cover; }
.cover-empty { display: grid; place-items: center; color: var(--fg3); font-size: 13px; background: var(--inset); }
.cover figcaption { display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-size: 14px; }
.cover figcaption .note { flex: 1; }
.define + .define { margin-top: 14px; }
.define-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 6px; }
.define pre { margin: 0; background: var(--inset); border: 1px solid var(--hair); border-radius: var(--r-sm); padding: 12px;
  overflow-x: auto; white-space: pre; color: var(--fg2); line-height: 1.6; }
.check-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.check-quick:empty { display: none; }
#check-form { margin-bottom: 0; }
#check-result { margin-top: 16px; display: flex; flex-direction: column; gap: 16px; }
.result.bad { border-color: rgba(255, 107, 107, .4); }
.result.bad .count, .result.bad p:not(.hint) { color: var(--bad); }
.result table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.result th { text-align: left; color: var(--fg2); font-weight: 500; font-size: 13px; padding: 6px 0; }
.result td { padding: 8px 0; border-top: 1px solid var(--hair); }
.result .mono { font-family: var(--mono); font-size: 13.5px; }
.result .num { text-align: right; font-variant-numeric: tabular-nums; width: 90px; }
@media (max-width: 760px) {
  header { flex-wrap: wrap; }
  .tabs { order: 3; width: 100%; margin-left: 0; }
  .form, .covers { grid-template-columns: minmax(0, 1fr); }
  .pic { flex-wrap: wrap; }
  .pic-main { flex-basis: calc(100% - 84px); }
  .kv-row { flex-wrap: wrap; }
  .kv-row .k { width: 100%; }
}

/* storages */
.storage { border: 1px solid var(--hair); border-radius: var(--r); padding: 14px; }
.storage + .storage { margin-top: 12px; }
.storage-name { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.storage-access { margin-top: 12px; }
.storage-access summary { cursor: pointer; color: var(--fg2); font-size: 13px; }
.storage-access[open] summary { margin-bottom: 10px; }
.storage.new .form { margin-top: 10px; }
#storages { margin-top: 14px; }
#storages + .actions { margin-top: 12px; justify-content: flex-start; }
.pic-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pic-title .v { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pic-title .tag { flex: none; }
