:root{
  --bg:#f5f6f8; --card:#fff; --text:#1c2230; --muted:#667085; --line:#e2e5ea;
  --accent:#2563eb; --accent-text:#fff; --danger:#c2410c; 
}
@media (prefers-color-scheme:dark){
  :root{--bg:#0f1218;--card:#181c25;--text:#e8ebf1;--muted:#98a2b3;--line:#2a3040;--accent:#5b8def;--accent-text:#0b1020;--danger:#fb923c}
}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{background:var(--bg);color:var(--text);font:16px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}

/* Picture panels take exactly 15% on each side; the app uses the middle. */
.shell{
  display:grid; height:100vh; height:100dvh;
  grid-template-columns:15% minmax(0,1fr) 15%;
  grid-template-rows:15% minmax(0,1fr) 15%;
  grid-template-areas:"top top top" "left main right" "bottom bottom bottom";
}
.pic-top{grid-area:top}.pic-left{grid-area:left}.pic-right{grid-area:right}.pic-bottom{grid-area:bottom}
main{grid-area:main;overflow:auto;padding:20px clamp(12px,3vw,32px)}
.pic{position:relative;overflow:hidden;min-width:0;min-height:0;background:var(--line)}
.pic img{position:absolute;inset:0;width:100%;height:100%;max-width:none;object-fit:cover;display:block}

header h1{margin:0 0 4px;font-size:1.6rem}
.sub{margin:0 0 16px;color:var(--muted)}
.card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:16px;margin-bottom:16px}
.card h2{margin:0 0 10px;font-size:1.1rem}
.count{font-weight:400;color:var(--muted);font-size:.9rem;margin-left:6px}

.drop{display:flex;flex-direction:column;align-items:center;gap:4px;padding:26px 12px;border:2px dashed var(--line);
  border-radius:10px;cursor:pointer;text-align:center}
.drop:hover,.drop.over{border-color:var(--accent)}
.drop input{display:none}
.drop small{color:var(--muted)}
.chosen{margin:10px 0 0;font-size:.9rem;color:var(--muted);word-break:break-all}
#go{margin-top:12px;padding:10px 20px;border:0;border-radius:8px;background:var(--accent);color:var(--accent-text);font-weight:600;font-size:1rem;cursor:pointer}
#go:disabled{opacity:.45;cursor:not-allowed}
progress{display:block;width:100%;margin-top:10px;height:10px}
progress[hidden]{display:none}
#msg{margin:10px 0 0;min-height:1.4em}
#msg.err{color:var(--danger)}
.rules{margin:12px 0 0;color:var(--muted);font-size:.85rem}

.table-wrap{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:.95rem}
th,td{text-align:left;padding:8px 10px;border-bottom:1px solid var(--line);vertical-align:middle}
th{color:var(--muted);font-weight:600;font-size:.82rem;text-transform:uppercase;letter-spacing:.03em}
td.nm{max-width:34ch;word-break:break-all}
td.nm a{color:var(--text);text-decoration:none}
td.nm a:hover{text-decoration:underline}
td.act{white-space:nowrap}
.btn{display:inline-block;padding:5px 12px;border-radius:7px;background:var(--accent);color:var(--accent-text);text-decoration:none;font-size:.85rem;font-weight:600}
.link{background:none;border:0;color:var(--muted);cursor:pointer;font:inherit;font-size:.85rem;margin-left:8px;text-decoration:underline}
.link.del{color:var(--danger)}
.flag{color:var(--danger);font-size:.8rem}
.empty{color:var(--muted)}
footer{padding:8px 0 4px;text-align:center;font-size:.8rem;color:var(--muted)}
footer a{color:var(--muted)}

/* Very narrow screens: the side panels would leave no room for the app, so only the top and bottom panels stay. */
@media (max-width:700px){
  .shell{grid-template-columns:minmax(0,1fr);grid-template-areas:"top" "main" "bottom"}
  .pic-left,.pic-right{display:none}
}
