:root {
  --bg: #f4f5f7; --surface: #ffffff; --text: #16181d; --muted: #6b7280; --line: #e3e5e9;
  --accent: #c2410c; --accent-soft: #fff1e8; --par: #7c3aed; --par-soft: #f3edff; --up: #b91c1c;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a; --surface: #1d2026; --text: #eceef2; --muted: #9aa1ad; --line: #2c3038;
    --accent: #fb923c; --accent-soft: #33241a; --par: #b794f6; --par-soft: #2a2138; --up: #f87171;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif; }
button, input { font: inherit; color: inherit; }
.top { position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 10px) 12px 10px; border-bottom: 1px solid var(--line); }
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); font-size: 17px; }
.search button, .boxform button, .fixlist button, dialog button {
  padding: 0 16px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 600; }
main { padding: 12px 12px calc(env(safe-area-inset-bottom) + 84px); max-width: 720px; margin: 0 auto; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs button { padding: 14px 2px; white-space: nowrap; border: 0; background: none; font-size: 13px; color: var(--muted); }
.tabs button.on { color: var(--accent); font-weight: 700; }
.card { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px; margin-bottom: 10px; }
.card img { width: 76px; aspect-ratio: 63 / 88; object-fit: cover; border-radius: 6px; flex: none; background: var(--line); }
.card .body { min-width: 0; flex: 1; }
.title { font-weight: 600; overflow-wrap: anywhere; }
.code { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 8px; }
.price { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); }
.tag.par { background: var(--par-soft); color: var(--par); }
.tag.up { color: var(--up); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: flex; flex-direction: column; align-items: flex-start; padding: 6px 10px; min-height: 44px;
  border-radius: 10px; border: 1px solid transparent; background: var(--accent-soft); color: var(--text); }
.chip b { font-size: 13px; color: var(--accent); }
.chip span { font-size: 15px; font-weight: 700; }
.chip.par { background: var(--par-soft); }
.chip.par b { color: var(--par); }
.chip em { font-style: normal; font-size: 11px; color: var(--par); }
.section { font-size: 17px; margin: 18px 0 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.section small { font-weight: 400; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; padding: 24px 0; }
.error { color: var(--up); background: var(--surface); padding: 12px; border-radius: 12px; }
.hint { background: var(--surface); border-radius: 14px; padding: 16px; border: 1px solid var(--line); }
.hint h2 { margin: 0 0 6px; font-size: 18px; }
.hint p { margin: 6px 0; color: var(--muted); }
.boxform { display: flex; gap: 8px; align-items: end; }
.boxform label { flex: 1; display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.boxform input, .fixlist input[placeholder] { padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.boxform button { height: 48px; }
.boxlist { list-style: none; padding: 0; margin: 0; background: var(--surface); border-radius: 14px; border: 1px solid var(--line); }
.boxlist li { display: grid; grid-template-columns: 40px 88px 1fr auto; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--line); font-size: 14px; align-items: center; }
.boxlist li:last-child { border-bottom: 0; }
.boxlist li.out { opacity: .4; text-decoration: line-through; }
.boxlist .pos { color: var(--muted); font-variant-numeric: tabular-nums; }
.boxlist .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.boxlist em { font-style: normal; color: var(--par); font-size: 12px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; }
.stats b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 13px; color: var(--muted); }
.fixlist { list-style: none; padding: 0; }
.fixlist li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.fixlist input[placeholder] { flex: 1; min-width: 120px; text-transform: uppercase; }
.fixlist button { height: 44px; }
.link { color: var(--accent); text-decoration: underline; cursor: pointer; }
.ghost { margin-top: 20px; background: none; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; color: var(--muted); }
.toast { position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 70px); z-index: 10;
  background: var(--text); color: var(--bg); border-radius: 12px; padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 696px; margin: 0 auto; }
.toast button { background: none; border: 0; color: var(--accent); font-weight: 700; }
dialog { border: 0; border-radius: 16px; padding: 20px; width: min(92vw, 360px); background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog form { display: grid; gap: 10px; }
dialog h2 { margin: 0; }
dialog p { margin: 0; color: var(--muted); }
dialog input { padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
dialog button { height: 48px; }
.variants { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.variants li { display: flex; gap: 8px; align-items: center; padding: 3px 0; border-top: 1px dashed var(--line, #ddd); }
.variants li span:first-child { flex: 1; color: var(--par); }
.variants .price { font-weight: 700; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: 13px; }
.pick select { font-size: 16px; min-height: 36px; max-width: 100%; }
.boxlist .price small { font-size: 12px; font-weight: 400; }
