:root {
  --bg: #f5f5f7; --card: #fff; --text: #222; --muted: #777; --line: #e3e3e8;
  --accent: #be2d64; --accent-2: #8b53fe; --ok: #1a8f4c; --warn: #b85c00;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif; }
header { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; padding: 12px 24px; min-height: 56px;
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
header h1 { margin: 0; font-size: 22px; }
header small { font-size: 14px; font-weight: normal; opacity: .9; margin-left: 8px; }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border-radius: 12px; padding: 20px 24px; margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card h2 { margin: 0 0 16px; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 15px; }
.row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); min-width: 220px; }
label.grow { flex: 1; }
input { font: inherit; font-size: 15px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); }
input:focus { outline: 2px solid var(--accent-2); border-color: transparent; }
button, .button { font: inherit; font-size: 14px; padding: 9px 18px; border-radius: 8px; border: none;
  background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
button:disabled { opacity: .4; cursor: default; }
button.ghost { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
button.small { padding: 6px 12px; }
.primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); font-size: 16px; padding: 12px 28px; }
.drop { border: 2px dashed #c9c9d1; border-radius: 12px; padding: 40px; text-align: center; color: var(--muted);
  cursor: pointer; transition: .15s; }
.drop.over { border-color: var(--accent-2); background: #f6f1ff; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
figure { margin: 0; }
figcaption { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.checker { position: relative; aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); display: grid; place-items: center;
  background: conic-gradient(#eee 25%, #fff 0 50%, #eee 0 75%, #fff 0) 0 0 / 20px 20px; margin-bottom: 10px; overflow: hidden; }
.checker img { max-width: 92%; max-height: 92%; }
.checker img:not([src]), .checker img[src=""] { display: none; }
.checker span { color: var(--muted); font-size: 13px; }
.checker img[src]:not([src=""]) + span { display: none; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ok { color: var(--ok); font-weight: bold; margin: 12px 0 0; }
.notice { background: #fff4e5; color: var(--warn); border-radius: 8px; padding: 10px 14px; }
.muted { color: var(--muted); font-size: 13px; }
.sets { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
#set-list { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; user-select: none; font-size: 14px; }
.chip.on { background: #f6eaf0; border-color: var(--accent); color: var(--accent); font-weight: bold; }
#set-add { width: 80px; }
#results { display: flex; flex-direction: column; gap: 20px; margin-top: 18px; }
.result-row h3 { margin: 0 0 8px; font-size: 15px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pair a { display: block; text-decoration: none; color: var(--muted); font-size: 12px; }
.pair img { width: 100%; border: 1px solid var(--line); border-radius: 6px; display: block; margin-bottom: 4px; }
#busy { position: fixed; inset: 0; background: rgba(255,255,255,.75); display: grid; place-content: center; text-align: center; z-index: 10; }
#busy[hidden] { display: none; }
.spinner { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%; border: 4px solid #ddd; border-top-color: var(--accent);
  animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 700px) { .compare, .pair { grid-template-columns: 1fr; } }
.modes { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
label.radio { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; min-width: 0; cursor: pointer; }

/* ---- ヘッダー ---- */
header .brand { color: #fff; text-decoration: none; font-size: 21px; font-weight: bold; white-space: nowrap; }
header .brand small { font-size: 13px; font-weight: normal; opacity: .9; margin-left: 6px; }
header nav { display: flex; gap: 4px; flex: 1; }
header nav a, header .me a { color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 6px; font-size: 14px; opacity: .88; }
header nav a:hover, header .me a:hover { background: rgba(255,255,255,.15); opacity: 1; }
header nav a.active, header .me a.active { background: rgba(255,255,255,.22); opacity: 1; font-weight: bold; }
header .me { display: flex; align-items: center; gap: 8px; font-size: 14px; }
button.light { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #f6eaf0; color: var(--accent); font-weight: bold; vertical-align: middle; }
header .tag { background: rgba(255,255,255,.25); color: #fff; }

/* ---- 共通 ---- */
main.wide { max-width: 1280px; }
.card.narrow { max-width: 460px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { min-width: 0; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.banner { background: #eef4ff; color: #2c4a8a; border-radius: 8px; padding: 10px 14px; }
.error { color: #c0392b; margin: 0; font-size: 14px; }
.small { font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
button.danger { background: #fff; color: #c0392b; border: 1px solid #e3a49c; }
button.danger:hover { background: #fdf0ee; }
a.ghost-link { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
a.button.small, button.small { font-size: 13px; padding: 5px 11px; }
select { font: inherit; font-size: 15px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); }

/* ---- ログイン ---- */
body.login-page { min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #fbe9f0, #efe6ff); }
.login-card { width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 14px; padding: 32px; }
.login-card h1 { margin: 0; font-size: 28px; color: var(--accent); }
.login-card .muted { margin: -8px 0 6px; }
.login-card label { min-width: 0; }

/* ---- 一覧 ---- */
.filters { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.filters label { min-width: 160px; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.summary { margin: 0; font-weight: bold; font-size: 16px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-weight: normal; color: var(--muted); font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); }
table.list td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:hover td { background: #faf8fc; }
table.list tr.inactive td { color: var(--muted); }
table.list .check { width: 32px; }
table.list .thumb img { width: 72px; height: 72px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; display: block; }
table.list .code { font-weight: bold; color: var(--accent); text-decoration: none; }
table.list .name { color: var(--text); margin-top: 2px; }
table.list .actions { text-align: right; }
table.list .actions > * { margin-left: 4px; }
.mini-chip { display: inline-block; font-size: 12px; padding: 1px 8px; margin: 1px 3px 1px 0; border-radius: 999px; background: #f2f2f5; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 16px; font-size: 14px; }
@media (max-width: 800px) {
  table.list thead { display: none; }
  table.list tr { display: grid; grid-template-columns: 32px 80px 1fr; gap: 4px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.list td { border: none; padding: 2px 0; }
  table.list td:nth-child(n+4) { grid-column: 3; }
  table.list .actions { text-align: left; }
}
