.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.field {
  width: 100%; height: 48px; padding: 0 18px;
  border-radius: 999px; border: 1px solid #fff;
  background: rgba(255, 255, 255, 0.7);
  font-size: 16px; color: var(--ink);
  box-shadow: inset 0 2px 6px rgba(40, 90, 180, 0.12);
  transition: box-shadow 160ms, background-color 160ms;
}
.field::placeholder { color: var(--ink-soft); opacity: 0.7; }
.field:focus { outline: none; background: #fff; box-shadow: inset 0 2px 6px rgba(40, 90, 180, 0.1), 0 0 0 4px rgba(255, 95, 168, 0.35); }
.field.sm { height: 38px; font-size: 14px; padding: 0 14px; }
@media (pointer: coarse) { .field.sm { font-size: 16px; } }

/* ---------- login ---------- */
.login { position: relative; z-index: 1; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(380px, 100%); padding: 36px 30px 26px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.login-card img { border-radius: 24px; box-shadow: 0 10px 30px rgba(255, 79, 163, 0.4), 0 0 0 3px #fff; }
.login-card h1 { font-size: 72px; margin: 4px 0 0; }
.login-card .label { color: var(--ink-soft); text-shadow: none; margin: 0 0 6px; }
.login-card .btn { width: 100%; }
.err { margin: 0; min-height: 1.2em; color: var(--pink-deep); font-weight: 600; font-size: 14px; }

/* ---------- layout ---------- */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 290px 1fr; gap: 20px; padding: 16px; min-height: 100dvh; }
.side {
  position: sticky; top: 16px; height: calc(100dvh - 32px);
  display: flex; flex-direction: column; gap: 18px; padding: 18px 14px; overflow: hidden;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; text-decoration: none; }
.side-brand img { border-radius: 12px; box-shadow: 0 0 0 2px #fff; }
.side-brand .jelly { font-size: 40px; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-group.grow { flex: 1; min-height: 0; }
.side-h { margin: 0 0 6px 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink-soft); }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 38px; padding: 6px 10px; border: 0; border-radius: 14px;
  background: transparent; text-align: left; font-weight: 500; font-size: 15px;
  transition: background-color 140ms, box-shadow 140ms, transform 140ms var(--ease-out);
}
@media (hover: hover) { .nav-item:hover { background: rgba(255, 255, 255, 0.5); } }
.nav-item.active { background: #fff; box-shadow: 0 6px 16px rgba(40, 90, 180, 0.14); font-weight: 600; }
.nav-item .ico { width: 22px; text-align: center; flex: none; }
.nav-item .dot { width: 12px; height: 12px; margin: 0 5px; border-radius: 50%; background: var(--dc); box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.15), inset 0 2px 2px rgba(255, 255, 255, 0.7); flex: none; }
.nav-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .n { font-size: 12px; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.new-col { margin: 0 0 8px; }
.col-list { overflow-y: auto; flex: 1; margin: 0 -6px; padding: 0 6px 8px; scrollbar-width: thin; }
.col-row { position: relative; }
.col-row .thumb { width: 26px; height: 26px; border-radius: 8px; object-fit: cover; background: var(--pink-soft); flex: none; box-shadow: 0 0 0 1.5px #fff; }
.col-row .row-actions { position: absolute; right: 8px; top: 50%; translate: 0 -50%; display: none; gap: 2px; }
@media (hover: hover) { .col-row:hover .row-actions { display: flex; } .col-row:hover .n { display: none; } }
.row-actions button { width: 26px; height: 26px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, 0.7); font-size: 12px; }
.row-actions button:hover { background: #fff; }
.col-row.drop-hover .nav-item { background: var(--pink); color: #fff; transform: scale(1.03); box-shadow: 0 8px 22px rgba(255, 95, 168, 0.45); }
.col-row.drop-hover .n { color: #fff; }
.col-row input.field { height: 34px; }

.side-foot { display: flex; gap: 8px; }
.side-foot .pill { height: 34px; font-size: 13px; padding: 0 14px; text-decoration: none; }

/* ---------- main ---------- */
.main { min-width: 0; display: flex; flex-direction: column; gap: 16px; padding-bottom: 60px; }
.main-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 10px 6px 0; flex-wrap: wrap; }
.main-head .label { margin: 0 0 4px; }
.view-title { font-size: clamp(44px, 6vw, 76px); margin: 0; }
.head-actions { display: flex; gap: 10px; align-items: center; }
.head-actions .pill { height: 38px; text-decoration: none; font-size: 13px; }
.search { width: 220px; }

/* dropzone */
.drop { padding: 18px 22px; border-style: dashed; border-width: 2px; transition: transform 200ms var(--ease-out), background-color 200ms; }
.drop.hot { background: rgba(255, 210, 234, 0.6); transform: scale(1.005); }
.drop-inner { display: flex; align-items: center; gap: 20px; }
.drop-jar {
  flex: none; width: 76px; height: 76px; display: grid; place-items: center;
  border-radius: 40px 40px 22px 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 210, 234, 0.7));
  box-shadow: inset 0 2px 0 #fff, inset 0 -8px 16px rgba(255, 95, 168, 0.25), 0 10px 24px rgba(255, 95, 168, 0.3);
}
.drop-jar .jelly { font-size: 44px; }
.drop-title { margin: 0; font-weight: 700; font-size: 22px; }
.drop-sub { margin: 2px 0 10px; color: var(--ink-soft); font-size: 14px; }
.drop-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.drop-btns .pill { height: 36px; font-size: 13px; cursor: pointer; }
.drop-opts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.7); }
.opt-label { font-size: 11px; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-soft); }
.opt-tags { display: flex; gap: 6px; }
.opt-tags .pill, .tb-group .pill, .toolbar > .pill { height: 34px; padding: 0 14px; font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; font-size: 14px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--pink); }

.progress { display: flex; align-items: center; gap: 14px; margin-top: 14px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { flex: 1; height: 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.6); overflow: hidden; box-shadow: inset 0 2px 4px rgba(40, 90, 180, 0.15); }
.bar span {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 60%), linear-gradient(90deg, var(--pink), var(--orange), var(--lemon), #7cc8ff);
  transition: width 300ms var(--ease-out);
}

/* toolbar */
.toolbar {
  position: sticky; top: 12px; z-index: 6;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: 26px;
}
.sel-count { font-weight: 700; font-size: 14px; min-width: 88px; font-variant-numeric: tabular-nums; }
.tb-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.toolbar.none .tb-group { opacity: 0.45; pointer-events: none; }
.pill.mixed { background: linear-gradient(90deg, var(--pc-on) 0 50%, rgba(255, 255, 255, 0.7) 50%); }
.pill.danger { color: var(--pink-deep); }
.kbd-hint { margin-left: auto; font-size: 12px; color: var(--ink-soft); }
@media (max-width: 1200px) { .kbd-hint { display: none; } }
.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 20;
  min-width: 240px; max-height: 340px; overflow-y: auto; padding: 6px;
  border-radius: var(--r-md); background: rgba(255, 255, 255, 0.92);
  transform-origin: top left; animation: menuIn 160ms var(--ease-out);
}
@keyframes menuIn { from { opacity: 0; transform: scale(0.96) translateY(-4px); } }
.menu button { display: flex; width: 100%; padding: 9px 12px; border: 0; border-radius: 12px; background: transparent; text-align: left; font-size: 14px; font-weight: 500; }
.menu button:hover, .menu button:focus-visible { background: var(--pink-soft); outline: none; }
.menu .menu-sep { height: 1px; margin: 4px 6px; background: rgba(42, 58, 122, 0.12); }

/* grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.card {
  position: relative; padding: 0; border: 0; border-radius: var(--r-md); overflow: hidden;
  aspect-ratio: 16 / 11; background: var(--ph, #fff);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.85), 0 10px 24px rgba(40, 90, 180, 0.18);
  transition: transform 180ms var(--ease-out), box-shadow 180ms;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.card img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 55%, rgba(20, 30, 80, 0.45)); pointer-events: none; }
@media (hover: hover) { .card:hover { transform: translateY(-2px); } }
.card.sel { box-shadow: 0 0 0 4px var(--pink), 0 0 0 7px #fff, 0 14px 30px rgba(255, 95, 168, 0.4); transform: scale(0.97); }
.card .check-bubble {
  position: absolute; top: 10px; left: 10px; z-index: 2; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; font-weight: 700; color: #fff;
  background: rgba(255, 255, 255, 0.35); border: 2px solid #fff;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 140ms, transform 200ms var(--ease-jelly);
}
@media (hover: hover) { .card:hover .check-bubble { opacity: 1; } }
.grid.selecting .check-bubble { opacity: 1; }
.card.sel .check-bubble { opacity: 1; background: var(--pink); transform: scale(1.1); }
.card .c-tags { position: absolute; left: 10px; bottom: 9px; z-index: 2; display: flex; gap: 5px; }
.card .c-tags .tag { height: 20px; font-size: 10px; padding: 0 8px; }
.card .c-meta { position: absolute; right: 10px; bottom: 10px; z-index: 2; font-size: 11px; font-weight: 600; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.card .cover-badge { position: absolute; top: 10px; right: 10px; z-index: 2; }
.card.uploading { animation: shimmer 1.2s ease-in-out infinite; }
@keyframes shimmer { 50% { opacity: 0.55; } }

.empty-note { text-align: center; padding: 50px 20px; color: #fff; font-weight: 600; font-size: 17px; text-shadow: 0 2px 10px rgba(40, 90, 180, 0.35); }

/* overlay / dialogs */
.drag-overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(255, 150, 200, 0.35); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 6px dashed rgba(255, 255, 255, 0.9); pointer-events: none;
}
.drag-overlay .jelly { font-size: clamp(80px, 14vw, 180px); animation: bob 1.6s ease-in-out infinite; }

.preview { width: min(1100px, 94vw); padding: 14px; border-radius: var(--r-lg); color: var(--ink); }
.preview::backdrop { background: rgba(70, 130, 220, 0.5); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.preview img { width: 100%; max-height: 72dvh; object-fit: contain; border-radius: var(--r-md); }
.pv-row { display: flex; gap: 10px; margin-top: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; translate: -50% 0;
  padding: 12px 20px; border-radius: 999px; color: #fff; font-weight: 600; font-size: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 55%), var(--ink);
  box-shadow: 0 12px 30px rgba(20, 40, 100, 0.35);
  opacity: 0; transform: translateY(12px); transition: opacity 200ms, transform 240ms var(--ease-out); pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: relative; top: 0; height: auto; max-height: none; }
  .col-list { max-height: 260px; }
  .drop-inner { align-items: flex-start; }
  .drop-jar { width: 56px; height: 56px; }
  .check { margin-left: 0; }
  .search { width: 100%; }
  .head-actions { width: 100%; }
}

.tpl-pick { display: inline-flex; align-items: center; gap: 8px; }
.tpl-pick select { width: auto; padding-right: 34px; cursor: pointer; }
.col-desc { margin-top: -4px; }
