:root {
  color-scheme: dark;
  --bg: #13181c;
  --card: #1b2228;
  --paper: #232e34;
  --line: #38464c;
  --ink: #f5f3e9;
  --muted: #b4c0bf;
  --amber: #f4c36b;
  --mint: #9adebd;
  --muted-blue: #7eabb7;
  font: 16px/1.55 "Hiragino Sans", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
h1,h2,h3,p { margin: 0; }
h1 { font-size: clamp(2rem,4vw,3rem); line-height: 1.17; letter-spacing: .012em; }
h2 { font-size: 1.18rem; }
h3 { font-size: 1rem; }
a { color: var(--amber); }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
input, select, button { min-height: 42px; }
button:not(:disabled), select { cursor: pointer; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.max { max-width: 1280px; margin-inline: auto; padding-inline: clamp(14px, 4vw, 48px); }
.bar { background: #1b2227; border-bottom: 1px solid var(--line); }
.bar nav, .account { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.bar nav { min-height: 65px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; color: var(--ink); white-space: nowrap; }
.brand img { border-radius: 7px; }
.account { font-variant-numeric: tabular-nums; color: var(--amber); flex-wrap: wrap; }
.button {
  min-height: 40px; border-radius: 7px; border: 1px solid var(--line); padding: 8px 12px;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 700;
  color: var(--ink); background: var(--paper); white-space: nowrap; font-size: .9rem;
}
.button:hover { border-color: var(--muted-blue); text-decoration: none; }
.button.accent { background: var(--amber); color: #261b0b; border-color: var(--amber); }
.button:disabled { opacity: .5; }
.masthead { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px 20px; margin: 32px 0 22px; }
.masthead p { color: var(--muted); margin-top: 8px; }
.fresh,.muted { color: var(--muted); font-size: .89rem; }
.fresh { white-space: nowrap; }
.deals { margin-bottom: 18px; }
.deals h2 { margin-bottom: 8px; }
.deal-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.deal, .product-row {
  display: flex; align-items: center; gap: 10px; text-align: left; color: var(--ink);
  border: 0; background: none; width: 100%;
}
.deal {
  border: 1px solid #3a5249; border-radius: 10px;
  background: linear-gradient(120deg,#23352e,#242c2d); padding: 9px 11px;
}
.deal:hover, .product-row:hover { background: #2a3c3b; }
.deal img, .product-row img, .item-title img {
  flex: 0 0 auto; image-rendering: pixelated; object-fit: contain;
  border-radius: 5px; background: #354641; padding: 3px;
}
.deal strong,.product-row strong { display: block; min-width: 0; overflow-wrap: anywhere; }
.deal small,.product-row small { color: var(--muted); display: block; line-height: 1.35; font-size: .82rem; }
.deal .deal-value, .row-price { color: var(--mint); margin-left: auto; white-space: nowrap; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.book { display: grid; grid-template-columns: minmax(315px,.8fr) minmax(0,1.2fr); gap: 14px; align-items: start; }
.panel { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 15px; min-width: 0; }
form { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; }
form input, form select, dialog input { border: 1px solid #4b5b60; border-radius: 7px; background: #161e22; padding: 6px 9px; font-size: .94rem; max-width: 100%; }
.query { min-width: 125px; flex: 1 1 160px; }
.query input { display: block; width: 100%; }
.products, .offers { margin-top: 8px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.product-row { padding: 8px 9px; min-height: 53px; }
.product-row + .product-row, .offer-row + .offer-row { border-top: 1px solid var(--line); }
.product-row[aria-current] { background: #304137; box-shadow: inset 3px 0 0 var(--mint); }
.product-row .row-name { flex: 1; min-width: 0; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 11px; margin-top: 9px; }
.item-panel { position: sticky; top: 16px; }
.item-title { display: flex; align-items: center; gap: 11px; }
.item-title h2 { font-size: 1.37rem; overflow-wrap: anywhere; }
.quotes { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 14px 0 15px; }
.quotes div { border: 1px solid var(--line); border-radius: 8px; background: #242d31; padding: 9px; }
.quotes span { color: var(--muted); font-size: .85rem; display: block; }
.quotes strong { font-size: clamp(1rem,2vw,1.48rem); color: var(--amber); overflow-wrap: anywhere; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 7px; flex-wrap: wrap; }
.legend { display: flex; gap: 10px; color: var(--muted); font-size: .86rem; }
.legend span:before { display: inline-block; vertical-align: middle; content: ""; width: 10px; height: 3px; margin-right: 4px; background: var(--mint); }
.legend span + span:before { background: var(--amber); }
canvas { display: block; width: 100%; height: 180px; background: #151c20; border-radius: 7px; margin: 8px 0; }
.buy-panel { margin-top: 14px; }
.offer-row { padding: 6px 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #212a2e; }
.offer-row small { color: var(--muted); margin-left: 6px; }
.buy-panel > button { margin-top: 8px; }
footer { margin: 25px 0 0; border-top: 1px solid var(--line); padding: 17px 0 25px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 15px; font-size: .88rem; }
footer p { flex: 1 1 100%; color: var(--muted); }
dialog { width: min(420px,calc(100vw - 26px)); border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 12px; padding: 18px; }
dialog::backdrop { background: #0a0b0dbb; }
dialog p, dialog label, .dialog-actions { margin-top: 8px; }
dialog label { display: block; }
dialog input { width: 90px; margin-left: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 790px) {
  .masthead { align-items: flex-start; flex-direction: column; margin-top: 22px; }
  .book { grid-template-columns: 1fr; }
  .item-panel { position: static; }
  .deal-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 490px) {
  .deal-grid { grid-template-columns: 1fr; gap: 6px; }
  .book { gap: 10px; }
  .quotes { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; }
  .quotes div { padding: 6px; }
  .quotes span { font-size: .81rem; }
}
