:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1d2329;
  --muted: #66707a;
  --line: #dde2e7;
  --accent: #1f5f8b;
  --accent-soft: #e5eff6;
  --danger: #b3261e;
  --ok: #1e7b45;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181c;
    --surface: #1d2328;
    --text: #e6eaee;
    --muted: #9aa4ad;
    --line: #313a42;
    --accent: #6fb2e0;
    --accent-soft: #1d3446;
    --danger: #f2877f;
    --ok: #6fcf97;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.35rem; margin: .2em 0 .6em; }
h2 { font-size: 1.1rem; margin: 1.4em 0 .5em; }
.muted, small { color: var(--muted); }
small { display: block; font-size: .8rem; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; color: var(--text); }
.topnav { display: none; gap: 16px; align-items: center; }
.container { max-width: 880px; margin: 0 auto; padding: 16px; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; padding: 6px 0; color: var(--muted); font-size: 1.1rem; }
.tabbar a span { font-size: .7rem; }
.tabbar a.active { color: var(--accent); }
@media (min-width: 760px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  body { padding-bottom: 0; }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card.narrow { max-width: 420px; margin: 40px auto; }

.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list li + li { border-top: 1px solid var(--line); }
.list a.row { display: flex; gap: 12px; align-items: center; padding: 12px 14px; color: var(--text); }
.list a.row:active { background: var(--accent-soft); }
.row .thumb { width: 72px; height: 44px; object-fit: cover; border-radius: 4px; flex: none; background: var(--line); }
.row .main { min-width: 0; flex: 1; }
.row .title { font-weight: 600; }
.row .sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .count { color: var(--muted); font-size: .8rem; white-space: nowrap; }

.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tag { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 0 8px; font-size: .75rem; }
.tag.off { background: var(--line); color: var(--muted); }

.searchbar { display: flex; gap: 8px; margin-bottom: 8px; }
.searchbar input[type=search] { flex: 1; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; font-size: .9rem; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

input, select, textarea, button, .button {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
}
input, select, textarea { width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
select[multiple] { min-height: 10em; }
button, .button { cursor: pointer; display: inline-block; text-align: center; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger, .button.danger { color: var(--danger); border-color: var(--danger); }
button.link { border: 0; padding: 0; background: none; color: var(--accent); }
button.wide { width: 100%; margin-top: 8px; }
form.inline { display: inline; }
label { display: block; margin-bottom: 10px; }

.form .field { margin-bottom: 14px; }
.form .field > label { font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.form .field ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.form .field ul label { font-weight: normal; margin: 0; }
.form .has-error input, .form .has-error select { border-color: var(--danger); }
.errorlist { color: var(--danger); font-size: .85rem; padding: 0; list-style: none; margin: 4px 0 0; }
.req { color: var(--danger); }
.actions { display: flex; gap: 8px; margin-top: 16px; }

dl.props { display: grid; grid-template-columns: 7.5em 1fr; gap: 6px 12px; margin: 0; }
dl.props dt { color: var(--muted); font-size: .85rem; }
dl.props dd { margin: 0; word-break: break-all; }

.images { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .images { grid-template-columns: 1fr 1fr; } }
.images figure { margin: 0; }
.images img { width: 100%; border-radius: 6px; border: 1px solid var(--line); display: block; }
.images figcaption { text-align: right; font-size: .8rem; }

.flash { padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); }
.flash.error { color: var(--danger); }
.flash.success { color: var(--ok); }

.pager { display: flex; justify-content: space-between; margin: 12px 0; }
.stats { display: flex; gap: 16px; color: var(--muted); font-size: .85rem; }
.stats b { color: var(--text); font-size: 1rem; }
