:root {
  --bg: #0f1117;
  --panel: #171a23;
  --panel-2: #1f2430;
  --line: #2b3140;
  --text: #e9ecf3;
  --muted: #9aa3b5;
  --accent: #7dd3fc;
  --accent-2: #38bdf8;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 700px at 15% -10%, #18243a 0%, var(--bg) 55%);
  color: var(--text);
  font: 14px/1.55 "Segoe UI", "Microsoft YaHei", "Noto Sans JP", sans-serif;
}
.app { display: flex; min-height: 100vh; }
.rail {
  width: 190px;
  flex: 0 0 190px;
  background: rgba(15, 17, 23, .92);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; gap: 9px; align-items: baseline;
  padding: 4px 8px 18px;
}
.brand strong { font-size: 24px; letter-spacing: .06em; color: var(--accent); }
.brand span { color: var(--muted); font-size: 12px; }
.rail-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 7px;
  align-items: center;
  margin: 6px 0;
  padding: 11px 9px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.rail-btn:hover { background: var(--panel); color: var(--text); }
.rail-btn.active {
  background: var(--panel-2);
  border-color: #3b4a63;
  color: var(--text);
}
.rail-icon {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: #263247;
  color: var(--accent);
  font-size: 12px;
}
.rail-btn.active .rail-icon { background: var(--accent-2); color: #0b1220; }
.rail-btn small { color: var(--muted); font-size: 11px; }
.rail-note {
  position: absolute; bottom: 16px; left: 20px; right: 20px;
  color: #6f7a90; font-size: 11px; line-height: 1.6;
}
.main { flex: 1; min-width: 0; padding: 24px 28px 60px; }
.topbar {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 20px;
  padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 20px;
}
h1 { margin: 0; font-size: 26px; letter-spacing: .04em; }
#subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.tools { display: flex; gap: 10px; align-items: center; }
#search {
  width: min(330px, 40vw);
  padding: 10px 12px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
}
#search:focus { border-color: var(--accent-2); }
.count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}
.card:hover { border-color: #465875; }
.thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  background: linear-gradient(145deg, #202838, #141923);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.placeholder {
  width: 100%; height: 100%;
  display: grid; place-items: center; text-align: center;
  color: #6b768b; font-size: 12px; padding: 12px;
}
.caption { padding: 10px 11px 12px; min-height: 88px; }
.name { font-weight: 600; font-size: 14px; line-height: 1.35; word-break: break-word; }
.meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.sub { color: #b9c4d6; font-size: 12px; margin-top: 4px; }
.id { color: #71809a; font-size: 11px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }
@media (max-width: 760px) {
  .app { display: block; }
  .rail {
    width: auto; height: auto; position: static;
    display: flex; gap: 8px; align-items: center;
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: 10px 12px; overflow-x: auto;
  }
  .brand { padding: 0 8px 0 0; flex: 0 0 auto; }
  .brand span, .rail-note { display: none; }
  .rail-btn { width: auto; min-width: 120px; margin: 0; }
  .main { padding: 18px 14px 40px; }
  .topbar { display: block; }
  .tools { margin-top: 12px; }
  #search { width: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 10px; }
}
