:root {
  color-scheme:dark;
  --cyan:#00c8ee;
  --pink:#ff006d;
  --yellow:#ffe100;
  --panel:#070809;
  --line:#56585b;
  --content:1040px;
}

* { box-sizing:border-box; }
html,body { margin:0; min-height:100%; background:#000; }
body {
  overflow-x:hidden;
  color:#fff;
  font-family:"Noto Sans JP","Yu Gothic",Meiryo,Arial,sans-serif;
}
body.modal-open { overflow:hidden; }
button,input,select { font:inherit; }
button,a,select,input { -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; }
[hidden] { display:none!important; }
.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

.merch-app {
  width:min(100%,var(--content));
  margin:0 auto;
  padding:24px 24px 50px;
}
.page-header {
  display:grid;
  grid-template-columns:72px 1fr 72px;
  align-items:center;
  min-height:86px;
  padding-bottom:12px;
  border-bottom:3px solid var(--pink);
}
.page-header h1 {
  grid-column:2;
  margin:0;
  text-align:center;
  font-size:clamp(28px,4.2vw,43px);
  font-weight:1000;
  line-height:1.05;
  letter-spacing:.02em;
}
.header-button {
  display:grid;
  place-items:center;
  width:62px;
  height:62px;
  padding:0;
  border:2px solid var(--pink);
  border-radius:16px;
  background:#030303;
  color:#fff;
  text-decoration:none;
  font:300 48px/1 Arial,sans-serif;
  box-shadow:0 0 16px rgba(255,0,109,.3);
}
.header-button:active { transform:scale(.96); }

.merch-toolbar {
  display:grid;
  grid-template-columns:minmax(0,1fr) 180px 180px;
  gap:10px;
  margin:28px 0 12px;
}
.merch-toolbar input,.merch-toolbar select,.add-product {
  width:100%;
  height:54px;
  border-radius:9px;
  font-weight:900;
}
.merch-toolbar input,.merch-toolbar select {
  border:1px solid #666;
  background:#040505;
  color:#fff;
}
.merch-toolbar input { padding:0 17px; }
.merch-toolbar select { padding:0 13px; }
.add-product {
  border:1px solid var(--pink);
  background:var(--pink);
  color:#050505;
}
.product-count {
  margin:0 2px 10px;
  color:#aaa;
  font-size:14px;
  font-weight:800;
}

.product-list {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}
.product-card {
  position:relative;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  min-width:0;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:13px;
  background:linear-gradient(115deg,#0a0b0c,#030303);
  box-shadow:inset 0 1px rgba(255,255,255,.04);
}
.product-card.low { border-color:#8b7500; }
.product-card.sold-out { border-color:#6a1b3e; }
.product-image {
  position:relative;
  display:grid;
  place-items:center;
  height:320px;
  min-height:0;
  padding:8px;
  overflow:hidden;
  border-bottom:1px solid #292929;
  background:#050505;
}
.product-image img {
  display:block;
  width:100%;
  height:100%;
  min-height:0;
  object-fit:contain;
  object-position:center;
}
.product-image .no-image {
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  color:#666;
  font-weight:900;
}
.stock-label {
  position:absolute;
  left:9px;
  bottom:9px;
  padding:5px 9px;
  border-radius:999px;
  background:rgba(0,0,0,.86);
  color:#fff;
  font-size:12px;
  font-weight:1000;
}
.stock-label.low { color:var(--yellow); }
.stock-label.zero { color:var(--pink); }
.product-copy {
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:228px;
  padding:14px;
}
.product-topline {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.category-badge {
  padding:4px 8px;
  border:1px solid currentColor;
  border-radius:5px;
  color:var(--cyan);
  font-size:10px;
  font-weight:1000;
}
.category-badge.sticker { color:var(--yellow); }
.category-badge.badge,.category-badge.cd,.category-badge.other { color:var(--pink); }
.edit-product {
  border:0;
  background:none;
  color:#aaa;
  font-size:12px;
  font-weight:800;
}
.product-copy h3 {
  display:-webkit-box;
  margin:10px 0 4px;
  overflow:hidden;
  color:#fff;
  font-size:19px;
  font-weight:1000;
  line-height:1.25;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}
.product-details {
  min-height:18px;
  overflow:hidden;
  color:#999;
  font-size:12px;
  font-weight:700;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.product-price {
  margin:9px 0 12px;
  color:#fff;
  font-size:23px;
  font-weight:1000;
}
.stock-controls {
  display:grid;
  grid-template-columns:40px minmax(48px,1fr) 40px;
  gap:6px;
  margin-top:auto;
}
.stock-controls button {
  height:38px;
  border:1px solid #666;
  border-radius:7px;
  background:#090909;
  color:#fff;
  font-size:19px;
  font-weight:900;
}
.stock-controls strong {
  display:grid;
  place-items:center;
  border:1px solid #333;
  border-radius:7px;
  color:#fff;
  font-size:17px;
}
.sale-product-button {
  width:100%;
  height:41px;
  margin-top:7px;
  border:1px solid var(--pink);
  border-radius:7px;
  background:var(--pink);
  color:#050505;
  font-weight:1000;
}
.sale-product-button:disabled {
  border-color:#444;
  background:#222;
  color:#777;
  cursor:not-allowed;
}
.empty-state {
  grid-column:1/-1;
  display:grid;
  place-items:center;
  min-height:220px;
  padding:28px;
  border:1px dashed #666;
  border-radius:13px;
  color:#aaa;
  text-align:center;
}
.empty-state strong { display:block; margin-bottom:8px; color:#fff; font-size:21px; }

.sales-section {
  margin-top:34px;
  padding-top:22px;
  border-top:2px solid var(--pink);
}
.sales-heading {
  display:flex;
  align-items:end;
  justify-content:space-between;
  gap:18px;
  margin-bottom:12px;
}
.sales-heading p {
  margin:0 0 4px;
  color:var(--cyan);
  font-size:11px;
  font-weight:900;
  letter-spacing:.18em;
}
.sales-heading h2 { margin:0; font-size:27px; }
.sales-count { color:var(--pink); }
.sales-list { display:grid; gap:7px; }
.sale-entry {
  display:grid;
  grid-template-columns:150px minmax(0,1fr) auto auto;
  align-items:center;
  gap:14px;
  min-height:64px;
  padding:10px 13px;
  border:1px solid #444;
  border-radius:9px;
  background:#060707;
}
.sale-entry time { color:#aaa; font-size:12px; font-weight:700; }
.sale-entry strong {
  overflow:hidden;
  font-size:15px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.sale-entry span { color:var(--yellow); font-weight:1000; white-space:nowrap; }
.undo-sale {
  border:1px solid #555;
  border-radius:6px;
  background:#050505;
  color:#bbb;
  font-size:11px;
  font-weight:800;
}

.modal {
  position:fixed;
  inset:0;
  z-index:80;
  overflow:auto;
  padding:24px;
  background:rgba(0,0,0,.93);
  backdrop-filter:blur(5px);
}
.modal-panel {
  width:min(100%,650px);
  margin:0 auto;
  padding:24px;
  border:2px solid var(--yellow);
  border-radius:16px;
  background:#070707;
  box-shadow:0 0 28px rgba(255,225,0,.18);
}
.sale-panel {
  width:min(100%,540px);
  border-color:var(--pink);
  box-shadow:0 0 28px rgba(255,0,109,.25);
}
.modal-header {
  display:grid;
  grid-template-columns:1fr 50px;
  gap:18px;
  align-items:start;
  margin-bottom:20px;
  padding-bottom:15px;
  border-bottom:2px solid var(--pink);
}
.modal-header p {
  margin:0 0 5px;
  color:var(--cyan);
  font:900 11px/1 Arial,sans-serif;
  letter-spacing:.16em;
}
.modal-header h2 { margin:0; font-size:29px; }
.modal-close {
  display:grid;
  place-items:center;
  width:48px;
  height:48px;
  padding:0;
  border:2px solid var(--pink);
  border-radius:11px;
  background:#050505;
  color:#fff;
  font:400 33px/1 Arial,sans-serif;
}
.product-form,.sale-form { display:grid; gap:15px; }
.form-columns {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
.form-field {
  display:grid;
  gap:7px;
}
.form-field > span { font-size:14px; font-weight:900; }
.form-field input,.form-field select {
  width:100%;
  height:50px;
  padding:0 13px;
  border:1px solid #777;
  border-radius:8px;
  background:#020202;
  color:#fff;
}
.form-actions {
  display:grid;
  grid-template-columns:auto 1fr 1.2fr;
  gap:9px;
  margin-top:5px;
}
.form-actions button {
  min-height:52px;
  border-radius:8px;
  font-weight:1000;
}
.delete-product { padding:0 18px; border:1px solid var(--pink); background:#080808; color:var(--pink); }
.cancel-product,.cancel-sale { border:1px solid #777; background:#080808; color:#fff; }
.save-product,.save-sale { border:1px solid var(--pink); background:var(--pink); color:#050505; }
.sale-actions { grid-template-columns:1fr 1.35fr; }
.sale-product {
  display:grid;
  grid-template-columns:82px 1fr;
  align-items:center;
  gap:14px;
  padding:10px;
  border:1px solid #444;
  border-radius:10px;
}
.sale-product img {
  width:82px;
  height:66px;
  border-radius:7px;
  background:#111;
  object-fit:cover;
}
.sale-product strong { display:block; margin-bottom:4px; font-size:17px; }
.sale-product span { color:#aaa; font-size:13px; font-weight:800; }
.sale-total {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:15px;
  border:1px solid var(--yellow);
  border-radius:9px;
}
.sale-total span { font-weight:900; }
.sale-total strong { color:var(--yellow); font-size:26px; }
.toast {
  position:fixed;
  left:50%;
  bottom:24px;
  z-index:100;
  max-width:90vw;
  padding:11px 20px;
  transform:translate(-50%,20px);
  opacity:0;
  background:#fff;
  color:#080808;
  font-weight:900;
  white-space:nowrap;
  transition:.2s;
  pointer-events:none;
}
.toast.show { transform:translate(-50%,0); opacity:1; }

.header-button:focus-visible,.merch-toolbar input:focus-visible,.merch-toolbar select:focus-visible,
.add-product:focus-visible,.product-card button:focus-visible,.modal button:focus-visible,
.modal input:focus-visible,.modal select:focus-visible,.undo-sale:focus-visible {
  outline:3px solid #fff;
  outline-offset:3px;
}

@media (max-width:720px) {
  .merch-app { padding:12px 11px 32px; }
  .page-header {
    grid-template-columns:50px 1fr 50px;
    min-height:64px;
    padding-bottom:8px;
    border-bottom-width:2px;
  }
  .page-header h1 { font-size:22px; }
  .header-button {
    width:46px;
    height:46px;
    border-radius:12px;
    font-size:35px;
  }
  .merch-toolbar {
    grid-template-columns:1fr 125px;
    gap:7px;
    margin-top:20px;
  }
  .search-field { grid-column:1/-1; }
  .merch-toolbar input,.merch-toolbar select,.add-product { height:46px; font-size:13px; }
  .merch-toolbar input { padding:0 12px; }
  .product-list { grid-template-columns:1fr; gap:8px; }
  .product-card { grid-template-columns:minmax(0,1fr); border-radius:10px; }
  .product-image { height:280px; min-height:0; }
  .product-image img { min-height:0; }
  .product-copy { min-height:218px; }
  .product-copy { padding:11px; }
  .product-copy h3 { margin-top:7px; font-size:16px; }
  .product-details { font-size:10px; }
  .product-price { margin:7px 0 9px; font-size:20px; }
  .stock-controls { grid-template-columns:37px minmax(42px,1fr) 37px; }
  .stock-controls button,.stock-controls strong { height:35px; }
  .sale-product-button { height:38px; margin-top:6px; font-size:13px; }
  .sales-section { margin-top:25px; padding-top:17px; }
  .sales-heading h2 { font-size:22px; }
  .sale-entry {
    grid-template-columns:1fr auto;
    gap:5px 9px;
    min-height:69px;
    padding:9px 10px;
  }
  .sale-entry time { grid-column:1; }
  .sale-entry strong { grid-column:1; grid-row:2; }
  .sale-entry span { grid-column:2; grid-row:1; font-size:13px; }
  .undo-sale { grid-column:2; grid-row:2; }
  .modal { padding:10px; }
  .modal-panel { padding:17px 13px; border-radius:12px; }
  .modal-header { grid-template-columns:1fr 44px; margin-bottom:16px; padding-bottom:12px; }
  .modal-header h2 { font-size:24px; }
  .modal-close { width:42px; height:42px; border-radius:9px; font-size:29px; }
  .product-form,.sale-form { gap:12px; }
  .form-columns { gap:8px; }
  .form-field > span { font-size:12px; }
  .form-field input,.form-field select { height:46px; padding:0 10px; font-size:13px; }
  .form-actions { grid-template-columns:1fr 1.25fr; gap:7px; }
  .form-actions button { min-height:47px; font-size:13px; }
  .delete-product { grid-column:1/-1; }
  .sale-actions { grid-template-columns:1fr 1.35fr; }
  .toast { font-size:12px; }
}

@media (prefers-reduced-motion:reduce) {
  * { transition:none!important; }
}
