/* ===== PonSHOP — shared pixel/indie theme ===== */
:root {
  --bg:        #2b1d12;
  --bg-2:      #3a2817;
  --panel:     #4a3320;
  --panel-2:   #5c4026;
  --border:    #6b4a2b;
  --border-lt: #8a6239;
  --ink:       #f3e2c7;
  --ink-dim:   #c9a97e;
  --gold:      #e8b455;
  --gold-dk:   #b07d2a;
  --green:     #7fae55;
  --red:       #c0533a;
  --shadow:    #1a1009;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background-color: var(--bg);
  background-image:
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><defs><g id='m' fill='%237a5740'><ellipse rx='4' ry='13'/><ellipse rx='4' ry='13' transform='rotate(45)'/><ellipse rx='4' ry='13' transform='rotate(90)'/><ellipse rx='4' ry='13' transform='rotate(135)'/><circle r='3'/><circle cx='22' r='1.7'/><circle cx='15.6' cy='15.6' r='1.7'/><circle cy='22' r='1.7'/><circle cx='-15.6' cy='15.6' r='1.7'/><circle cx='-22' r='1.7'/><circle cx='-15.6' cy='-15.6' r='1.7'/><circle cy='-22' r='1.7'/><circle cx='15.6' cy='-15.6' r='1.7'/></g></defs><g opacity='0.5'><use href='%23m' x='60' y='60'/><use href='%23m'/><use href='%23m' x='120'/><use href='%23m' y='120'/><use href='%23m' x='120' y='120'/><use href='%23m' transform='translate(60,0) scale(0.5)'/><use href='%23m' transform='translate(60,120) scale(0.5)'/><use href='%23m' transform='translate(0,60) scale(0.5)'/><use href='%23m' transform='translate(120,60) scale(0.5)'/></g></svg>"),
    radial-gradient(circle at 20% 0%, #3a2817 0%, transparent 55%),
    radial-gradient(circle at 90% 10%, #402c19 0%, transparent 45%);
  background-repeat: repeat, no-repeat, no-repeat;
  background-size: 150px 150px, auto, auto;
  color: var(--ink);
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 20px;
  min-height: 100vh;
  image-rendering: pixelated;
}
a { color: var(--gold); }

/* ---------- buttons ---------- */
.btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--bg);
  background: var(--gold);
  border: none;
  padding: 12px 16px;
  cursor: pointer;
  box-shadow: inset -3px -3px 0 var(--gold-dk), 0 3px 0 var(--shadow);
  transition: transform .05s ease;
  text-transform: uppercase;
  line-height: 1.6;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: inset -3px -3px 0 var(--gold-dk); }
.btn.secondary {
  color: var(--ink);
  background: var(--panel-2);
  box-shadow: inset -3px -3px 0 #3a2817, 0 3px 0 var(--shadow);
}
.btn.secondary:active { box-shadow: inset -3px -3px 0 #3a2817; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- header ---------- */
header {
  border-bottom: 4px solid var(--border);
  background: linear-gradient(180deg, #3a2817, #2b1d12);
  box-shadow: 0 4px 0 var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.logo div.mark {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: var(--gold);
  color: var(--bg);
  font-family: 'Press Start 2P', monospace;
  font-size: 20px;
  box-shadow: inset -4px -4px 0 var(--gold-dk), 0 3px 0 var(--shadow);
}
.logo img.mark {
  width: 52px; height: 52px;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
}
.logo h1 { font-family: 'Press Start 2P', monospace; font-size: 22px; margin: 0; letter-spacing: 1px; }
.logo h1 .shop { color: var(--gold); }
.logo .tag { color: var(--ink-dim); font-size: 18px; margin-top: 2px; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- banner ---------- */
.banner { max-width: 1100px; margin: 24px auto 8px; padding: 0 20px; }
.banner-inner {
  border: 4px solid var(--border);
  background: repeating-linear-gradient(45deg, #4a3320 0 12px, #45301d 12px 24px);
  box-shadow: 0 4px 0 var(--shadow);
  padding: 22px 24px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap;
}
.banner h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px; margin: 0 0 10px; color: var(--gold); line-height: 1.5;
}
.banner p { margin: 0; color: var(--ink-dim); max-width: 560px; }

/* ---------- layout ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 20px; }
main.narrow { max-width: 780px; }
.section-head {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px; color: var(--ink-dim);
  margin: 6px 0 16px; letter-spacing: 1px;
}

/* ---------- product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .grid { grid-template-columns: 1fr; } }

.card {
  border: 4px solid var(--border);
  background: var(--panel);
  box-shadow: 0 4px 0 var(--shadow);
  display: flex; flex-direction: column;
  overflow: hidden; position: relative;
  transition: transform .08s ease, box-shadow .08s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--shadow); border-color: var(--border-lt); }
.card.mine { border-color: var(--gold-dk); }
.thumb {
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  font-size: 64px;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.08) 0 2px, transparent 2px 6px),
    var(--thumb, #5c4026);
  border-bottom: 4px solid var(--border);
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.3));
  user-select: none;
}
.thumb-img {
  width: 100%; height: 100%;
  object-fit: cover;
  image-rendering: auto;
  display: block;
}
.card-body { padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.rarity { font-family: 'Press Start 2P', monospace; font-size: 8px; letter-spacing: 1px; text-transform: uppercase; }
.card .name { font-size: 22px; line-height: 1.05; word-break: break-word; }
.card .desc { color: var(--ink-dim); font-size: 16px; flex: 1; word-break: break-word; }
.price-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.price {
  font-family: 'Press Start 2P', monospace; font-size: 12px; color: var(--gold);
  display: flex; align-items: center; gap: 6px;
}
.price .eth { width: 12px; height: 19px; flex: none; }
.buy-btn { font-size: 9px; padding: 9px 11px; }

.mine-tag {
  position: absolute; top: 8px; left: 8px;
  font-family: 'Press Start 2P', monospace; font-size: 7px;
  background: var(--gold); color: var(--bg);
  padding: 5px 7px; letter-spacing: 1px; box-shadow: 0 2px 0 var(--shadow);
}
.del-btn {
  position: absolute; top: 8px; right: 8px;
  font-family: 'Press Start 2P', monospace; font-size: 8px;
  background: var(--red); color: #fff; border: none;
  width: 24px; height: 24px; cursor: pointer; box-shadow: 0 2px 0 var(--shadow);
}

.r-common   { color: #b7c0a8; }
.r-uncommon { color: #7fae55; }
.r-rare     { color: #5aa9d6; }
.r-epic     { color: #b587d6; }
.r-legend   { color: var(--gold); }

footer {
  max-width: 1100px; margin: 24px auto 40px; padding: 18px 20px;
  color: var(--ink-dim);
  font-family: 'Press Start 2P', monospace; font-size: 10px;
  border-top: 4px solid var(--border);
  text-align: center; letter-spacing: 1px;
}

/* ---------- panels & forms ---------- */
.panel {
  border: 4px solid var(--border);
  background: var(--bg-2);
  box-shadow: 0 4px 0 var(--shadow);
  padding: 22px;
}
.panel-head {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px; color: var(--gold);
  margin: 0 0 6px; letter-spacing: 1px;
}
.panel-sub { color: var(--ink-dim); margin: 0 0 20px; }

label {
  font-family: 'Press Start 2P', monospace; font-size: 9px;
  text-transform: uppercase; color: var(--ink-dim);
  display: block; margin-bottom: 6px; letter-spacing: .5px;
}
.field { margin-bottom: 14px; }
input, textarea, select {
  width: 100%;
  font-family: 'VT323', monospace; font-size: 19px;
  color: var(--ink); background: #1f150c;
  border: 3px solid var(--border); padding: 9px 11px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); }
input.bad, textarea.bad { border-color: var(--red); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row2, .row3 { grid-template-columns: 1fr; } }
.hint { font-size: 15px; color: var(--ink-dim); margin-top: 6px; }
.err { color: #e08a6f; font-size: 17px; margin-bottom: 12px; }

/* ---------- progress steps ---------- */
.progress {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.pstep {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Press Start 2P', monospace; font-size: 8px;
  color: var(--ink-dim); letter-spacing: 1px;
}
.pstep .dot {
  width: 26px; height: 26px; display: grid; place-items: center;
  background: var(--panel); color: var(--ink-dim);
  border: 3px solid var(--border); font-size: 8px;
}
.pstep.on .dot { background: var(--gold); color: var(--bg); border-color: var(--gold-dk); }
.pstep.on { color: var(--gold); }
.pstep.done .dot { background: var(--green); color: var(--bg); border-color: #5d8a3a; }
.pbar { flex: 1; height: 4px; background: var(--border); min-width: 12px; }
@media (max-width: 700px) { .pstep .plabel { display: none; } }

/* ---------- order summary ---------- */
.order-box {
  border: 4px solid var(--border); background: var(--panel);
  box-shadow: 0 4px 0 var(--shadow); padding: 16px;
}
.order-item { display: flex; gap: 14px; align-items: center; }
.order-item .oi-thumb {
  width: 72px; height: 72px; flex: none;
  display: grid; place-items: center; font-size: 40px;
  background: var(--thumb, #5c4026); border: 3px solid var(--border);
}
.order-item .oi-name { font-size: 22px; line-height: 1.1; }
.line {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 2px solid var(--border);
  color: var(--ink-dim); font-size: 18px;
}
.line:last-child { border-bottom: none; }
.line .v { color: var(--ink); }
.line.total {
  font-family: 'Press Start 2P', monospace; font-size: 13px;
  color: var(--ink); padding-top: 14px; border-top: 3px solid var(--border-lt); border-bottom: none;
}
.line.total .v { color: var(--gold); }

/* ---------- delivery options ---------- */
.opt {
  display: flex; align-items: center; gap: 14px;
  border: 3px solid var(--border); background: var(--panel);
  padding: 14px; margin-bottom: 12px; cursor: pointer;
}
.opt:hover { border-color: var(--border-lt); }
.opt.sel { border-color: var(--gold); background: var(--panel-2); }
.opt input { width: auto; flex: none; accent-color: var(--gold); }
.opt .o-ico { font-size: 30px; width: 40px; text-align: center; flex: none; }
.opt .o-name { font-size: 20px; }
.opt .o-desc { color: var(--ink-dim); font-size: 16px; }
.opt .o-fee {
  margin-left: auto; font-family: 'Press Start 2P', monospace;
  font-size: 10px; color: var(--gold); flex: none;
}

/* ---------- recap ---------- */
.recap {
  border: 3px solid var(--border); background: var(--panel);
  padding: 12px 14px; font-size: 18px; color: var(--ink-dim);
}
.recap .rl {
  font-family: 'Press Start 2P', monospace; font-size: 8px;
  color: var(--gold); letter-spacing: 1px; margin-bottom: 8px;
  display: flex; justify-content: space-between;
}
.recap .rl a { font-size: 8px; }

/* ---------- payment ---------- */
.pay-box { border: 3px dashed var(--border-lt); padding: 16px; background: var(--panel); }
.addr-line {
  font-size: 16px; color: var(--ink-dim); word-break: break-all;
  background: #1f150c; padding: 10px; border: 2px solid var(--border); margin-bottom: 14px;
}
.addr-line b { color: var(--gold); }
.pay-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.pay-actions .btn { flex: 1; min-width: 150px; }

.note { font-size: 16px; color: var(--ink-dim); border-left: 3px solid var(--gold-dk); padding-left: 12px; }
.nav-row { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.nav-row .btn { flex: 1; min-width: 150px; }

.status-ok { color: var(--green); }
.status-err { color: #e08a6f; }
.hidden { display: none !important; }

/* ---------- modal (sell) ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(15, 9, 4, .82);
  display: none; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
}
.overlay.open { display: flex; }
.modal {
  width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
  border: 4px solid var(--border-lt); background: var(--bg-2);
  box-shadow: 0 6px 0 var(--shadow);
}
.modal-head {
  padding: 16px 18px; border-bottom: 4px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel); position: sticky; top: 0; z-index: 2;
}
.modal-head h3 { font-family: 'Press Start 2P', monospace; font-size: 13px; margin: 0; color: var(--gold); }
.x-btn { font-family: 'Press Start 2P', monospace; background: none; border: none; color: var(--ink); cursor: pointer; font-size: 14px; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 3px solid var(--gold);
  color: var(--ink); padding: 12px 18px; font-size: 18px;
  box-shadow: 0 4px 0 var(--shadow); z-index: 80; display: none;
}
.toast.show { display: block; animation: pop .2s ease; }
@keyframes pop {
  from { transform: translateX(-50%) translateY(8px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ---------- success ---------- */
.success-mark {
  font-size: 64px; text-align: center; margin-bottom: 10px;
}
.success h2 {
  font-family: 'Press Start 2P', monospace; font-size: 18px;
  color: var(--green); text-align: center; margin: 0 0 14px; line-height: 1.6;
}
.tx-line {
  font-size: 16px; word-break: break-all; background: #1f150c;
  border: 2px solid var(--border); padding: 10px; color: var(--ink-dim);
}
