:root {
  --bg: #f6f7f2;
  --card: #ffffff;
  --ink: #14213d;
  --muted: #4f5d75;
  --accent: #f4a261;
  --line: #d9e1ec;
  --panel: #ffffff;
  --overlay: rgba(20, 33, 61, 0.3);
  --shadow-soft: rgba(20, 33, 61, 0.05);
  --shadow-card: rgba(20, 33, 61, 0.04);
  --shadow-card-hover: rgba(20, 33, 61, 0.09);
  --shadow-menu: rgba(20, 33, 61, 0.16);
  --thumb-bg: #eef2f8;
  --skeleton: #e8eef5;
  --shimmer: rgba(255,255,255,.52);
  --mobile-pager: rgba(246, 247, 242, 0.95);
  --fav-bg: rgba(255, 255, 255, 0.92);
}
body[data-theme="dark"] {
  --bg: #101418;
  --card: #182028;
  --ink: #f3f5f7;
  --muted: #b6c1cd;
  --accent: #f4a261;
  --line: #2f3a46;
  --panel: #141b22;
  --overlay: rgba(0, 0, 0, 0.52);
  --shadow-soft: rgba(0, 0, 0, 0.24);
  --shadow-card: rgba(0, 0, 0, 0.22);
  --shadow-card-hover: rgba(0, 0, 0, 0.3);
  --shadow-menu: rgba(0, 0, 0, 0.34);
  --thumb-bg: #222c36;
  --skeleton: #24303b;
  --shimmer: rgba(255,255,255,.09);
  --mobile-pager: rgba(16, 20, 24, 0.95);
  --fav-bg: rgba(20, 27, 34, 0.92);
}
* { box-sizing: border-box; }
@font-face {
  font-family: "ChikuhoMincho";
  src:
    url("/fonts/TsukuhouMincho-Regular.ttf") format("truetype"),
    local("築豊明朝"),
    local("Chikuho Mincho"),
    local("ChikuhoMincho");
  font-display: swap;
}
body {
  margin: 0;
  font-family: "BIZ UDPGothic", "Yu Gothic", "Meiryo", sans-serif;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 20% -10%, #ffe8c2 0%, transparent 60%),
    radial-gradient(1000px 350px at 90% -20%, #dff3ff 0%, transparent 60%),
    var(--bg);
  transition: background-color .2s ease, color .2s ease;
}
body[data-theme="dark"] {
  background:
    radial-gradient(1200px 420px at 20% -10%, rgba(244, 162, 97, 0.16) 0%, transparent 60%),
    radial-gradient(1000px 360px at 90% -20%, rgba(82, 160, 255, 0.14) 0%, transparent 60%),
    var(--bg);
}
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}
.menu-btn {
  position: fixed;
  right: 14px;
  top: 14px;
  z-index: 30;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.menu-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 19;
}
.side-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: min(360px, 92vw);
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 36px var(--shadow-menu);
  transform: translateX(100%);
  transition: transform .18s ease;
  z-index: 20;
  padding: 14px;
  overflow: auto;
}
.side-menu.open { transform: translateX(0); }
.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.menu-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
.menu-nav { display: grid; gap: 12px; }
.menu-note {
  margin: -4px 2px 0;
  color: var(--muted);
  font-size: 12px;
}
.menu-item {
  display: block;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 10px 12px;
  font-weight: 700;
}
.menu-item[hidden] {
  display: none !important;
}
button.menu-item {
  width: 100%;
  text-align: left;
  cursor: pointer;
}
h1 { margin: 0 0 12px; padding-right: 56px; font-size: 24px; }
.home-title {
  font-family: "MS Gothic", "MS PGothic", "BIZ UDPGothic", "Yu Gothic", "Meiryo", sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: inherit;
  text-decoration: none;
}
.home-title:hover {
  text-decoration: underline;
}
.search {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 20px var(--shadow-soft);
  position: sticky;
  top: 8px;
  z-index: 2;
}
.search > * {
  min-width: 0;
}
.search input, .search select, .search button {
  display: block;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  line-height: 1.2;
}
.search .date-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  background: var(--panel);
}
.search .date-field input {
  position: relative;
  z-index: 1;
  min-height: 40px;
  border: 0;
  padding: 8px 0;
  background: transparent;
}
.date-placeholder {
  position: absolute;
  left: 12px;
  right: 12px;
  color: var(--muted);
  opacity: 0.58;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.date-field.is-filled .date-placeholder,
.date-field.is-active .date-placeholder {
  opacity: 0;
}
.search select,
.search button {
  appearance: none;
  -webkit-appearance: none;
}
.date-field:not(.is-filled):not(.is-active) input[type="date"] {
  color: transparent;
  caret-color: transparent;
}
.date-field:not(.is-filled):not(.is-active) input[type="date"]::-webkit-datetime-edit,
.date-field:not(.is-filled):not(.is-active) input[type="date"]::-webkit-datetime-edit-text,
.date-field:not(.is-filled):not(.is-active) input[type="date"]::-webkit-datetime-edit-month-field,
.date-field:not(.is-filled):not(.is-active) input[type="date"]::-webkit-datetime-edit-day-field,
.date-field:not(.is-filled):not(.is-active) input[type="date"]::-webkit-datetime-edit-year-field {
  color: transparent;
}
.date-field.is-active input[type="date"],
.date-field.is-filled input[type="date"] {
  color: var(--ink);
  caret-color: var(--ink);
}
.search button:disabled {
  opacity: 0.75;
  cursor: progress;
}
.search button {
  background: var(--accent);
  color: #1a1a1a;
  border: 0;
  cursor: pointer;
  font-weight: 700;
}
.meta { margin: 12px 2px; color: var(--muted); font-size: 14px; }
.pager {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 2px 12px;
}
.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
}
.sort-control select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}
.pager-bottom {
  justify-content: flex-end;
  margin: 14px 2px 0;
}
.pager-bottom button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: inherit;
}
.pager button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 6px 10px;
  cursor: pointer;
}
.pager button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#pageInfo,
#pageInfoBottom {
  color: var(--muted);
  font-size: 13px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.card {
  position: relative;
  min-height: 220px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 20px var(--shadow-card);
  transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 14px 26px var(--shadow-card-hover); }
.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.status-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(108, 117, 125, 0.94);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(20, 33, 61, 0.12);
}
.fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--fav-bg);
  color: #7d8796;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.fav-btn.active {
  color: #f5b700;
  border-color: #f5b700;
}
.thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--thumb-bg); }
.body { padding: 10px; }
.title { font-size: 14px; line-height: 1.35; margin: 0 0 6px; }
.sub { font-size: 12px; color: var(--muted); margin: 2px 0; }
.card.skeleton {
  overflow: hidden;
}
.card.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--shimmer), transparent);
  animation: shimmer 1.15s linear infinite;
}
.skeleton-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--skeleton);
}
.skeleton-line {
  height: 12px;
  border-radius: 6px;
  margin: 8px 10px;
  background: var(--skeleton);
}
.skeleton-line.wide { width: calc(100% - 20px); }
.skeleton-line.mid { width: 76%; }
.skeleton-line.short { width: 52%; }
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
@media (max-width: 980px) {
  .search {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}
@media (max-width: 720px) {
  .menu-btn {
    right: 10px;
    top: 10px;
  }
  .wrap { padding: calc(14px + env(safe-area-inset-top)) 12px calc(88px + env(safe-area-inset-bottom)); }
  h1 { font-size: 22px; }
  .search {
    grid-template-columns: 1fr;
    position: static;
    gap: 8px;
  }
  .search input, .search select, .search button {
    min-height: 46px;
    font-size: 16px;
  }
  .search .date-field {
    min-height: 46px;
  }
  .search .date-field input {
    min-height: 44px;
  }
  .grid { grid-template-columns: 1fr; }
  .pager {
    justify-content: space-between;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--mobile-pager);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
    z-index: 8;
  }
  .sort-control {
    width: 100%;
    justify-content: space-between;
    margin-right: 0;
    font-size: 14px;
  }
  .sort-control select {
    min-height: 42px;
    min-width: 148px;
  }
  .pager-bottom {
    display: none;
  }
  .pager button {
    min-height: 42px;
    min-width: 88px;
  }
  #pageInfo,
  #pageInfoBottom {
    font-size: 14px;
    font-weight: 700;
  }
  .fav-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  .status-badge {
    min-height: 36px;
    padding: 0 12px;
    font-size: 12px;
  }
}
