:root{
  --bg:#0b0b10;
  --panel:#12121a;
  --panel2:#161623;
  --border:#2a2a3f;
  --text:#eaeaf0;
  --muted:rgba(234,234,240,.72);
}

*{ box-sizing:border-box; }
body{ margin:0; background:var(--bg); color:var(--text); font-family:system-ui, Arial; }
a{ color:inherit; text-decoration:none; }

.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; justify-content:space-between; align-items:center;
  padding:12px 18px;
  background:rgba(18,18,26,.92);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--border);
}
.brand{ font-weight:700; letter-spacing:.2px; }
.nav{ color:var(--muted); }

.wrap{ max-width:1600px; margin:0 auto; padding:14px 18px; }

.filters{
  display:grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.7fr 0.9fr 0.8fr 0.7fr 0.7fr 0.9fr 0.9fr auto;
  gap:8px;
  align-items:center;
  padding:10px;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
}

.filters input, .filters select{
  width:100%;
  padding:9px 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--text);
  outline:none;
}
.filters button{
  padding:9px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#1f1f2f;
  color:var(--text);
  cursor:pointer;
}
.filters button:hover{ filter:brightness(1.1); }

.totals{
  display:flex; flex-wrap:wrap; gap:10px;
  margin:10px 0 14px;
  color:var(--muted);
  font-size:13px;
}
.totals b{ color:var(--text); }

.grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap:12px;
  align-items:stretch;
}

.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-height: 360px;
}

.thumb{ position:relative; display:block; }
.thumbwrap{
  position:relative;
}

.extbtn{
  position:absolute;
  bottom:10px;
  right:10px;

  width:32px;
  height:32px;
  display:flex;
  align-items:center;
  justify-content:center;

  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(10,10,16,.45);
  backdrop-filter: blur(10px);

  color:rgba(234,234,240,.92);
  font-weight:800;
  z-index:5;
  box-shadow: 0 6px 22px rgba(0,0,0,.45);
}

.extbtn:hover{
  filter:brightness(1.15);
  transform: translateY(-1px);
}

.chips{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin: 6px 0 10px;
}
.chip{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(10,10,16,.35);
  color:rgba(234,234,240,.90);
  font-size:12px;
}
.chip:hover{ filter:brightness(1.12); }
.priceedit{ display:grid; gap:8px; }
.priceform{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}
.priceform input{
  width:120px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--text);
}
.priceform select{
  padding:8px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--text);
}
.priceform button{
  padding:8px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#1f1f2f;
  color:var(--text);
  cursor:pointer;
}
.priceform button:hover{ filter:brightness(1.1); }

/* Rating stars: left-to-right fill using row-reverse trick */
.ratingwrap{
  display:flex;
  flex-direction: row-reverse;   /* key: makes 10..1 DOM display as 1..10 */
  justify-content:flex-end;
  align-items:center;
  gap:2px;
  flex-wrap:wrap;               /* prevents overflow on mobile */
}

.starform{
  margin:0;
  padding:0;
}

.star{
  border:0;
  background:transparent;
  cursor:pointer;

  padding:0;
  width:auto;

  font-size:22px;
  line-height:1;
  color: rgba(234,234,240,.25); /* grey base */
  transition: transform .08s ease, filter .08s ease, color .08s ease;
}

/* ensure your generic button styling does not box these */
.controlrow button.star{
  width:auto;
  padding:0;
  border:0;
  background:transparent;
}

.star:hover{
  transform: translateY(-1px);
  filter: brightness(1.15);
}

/* Hover fill: highlight hovered star plus "previous" visually (siblings in DOM) */
.ratingwrap:hover .star{
  color: rgba(234,234,240,.25);
}
.ratingwrap:hover .star:hover,
.ratingwrap:hover .star:hover ~ .star{
  color: rgba(255,215,0,.95);
}

/* Persisted fill from server */
.star.filled{
  color: rgba(255,215,0,.92);
}

/* Hover should override persisted fill for preview */
.ratingwrap:hover .star.filled{
  color: rgba(234,234,240,.25);
}

.startext{
  margin-right:10px;
  color: var(--muted);
  font-size:12px;
  white-space:nowrap;
}



.card img{
  width:100%;
  height:280px;
  object-fit:cover;
  background:#0d0d14;
  display:block;
}

.badge-row{
  position:absolute;
  left:10px; right:10px; bottom:10px;
  display:flex; gap:8px; flex-wrap:wrap;
}
.badge{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(10,10,16,.65);
  backdrop-filter: blur(8px);
}

.meta{
  padding:10px 10px 12px;
  display:grid;
  gap:6px;
}
.title{
  font-size:13px;
  line-height:1.25;
  max-height: 3.75em;
  overflow:hidden;
}
.sub{
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.card form{ margin-top:4px; }
.card button{
  width:100%;
  padding:8px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#1f1f2f;
  color:var(--text);
  cursor:pointer;
}
.card button:hover{ filter:brightness(1.1); }
.productpage{
  display:grid;
  grid-template-columns: 1.05fr 1fr;
  gap:16px;
  align-items:start;
}

.pleft{
  position:sticky;
  top:72px;
  align-self:start;
}

.phero{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden;
}

.heroimg{
  width:100%;
  height:min(70vh, 680px);
  object-fit:contain;
  background:#0d0d14;
  display:block;
}

.pheroactions{
  display:flex;
  flex-wrap: wrap;
  gap:10px;
  padding:10px;
  border-top:1px solid var(--border);
  background:rgba(18,18,26,.8);
}

.pillrow{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:8px 0 12px;
  max-width:100%;
}

.pill{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(10,10,16,.35);
  font-size:12px;
  white-space:nowrap;
}

.pill-link{
  cursor:pointer;
}

.pill-link:hover{
  filter:brightness(1.15);
}

/* Long titles/strings should wrap instead of expanding the page width */
.ptitle{
  overflow-wrap:anywhere;
  word-break: break-word;
}

.pbtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:8px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#1f1f2f;
  color:var(--text);
}

.pbtn:hover{ filter:brightness(1.1); }

.thumbgrid{
  margin-top:10px;
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap:8px;
}

.thumbimg{
  width:100%;
  height:110px;
  object-fit:cover;
  background:#0d0d14;
  border-radius:12px;
  border:1px solid var(--border);
}

.pright{
  display:grid;
  gap:12px;
}

.ptitle{
  margin:2px 0 0;
  font-size:28px;
  line-height:1.15;
}

.panel{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  padding:12px;
}

.paneltitle{
  font-weight:700;
  margin-bottom:10px;
  color:rgba(234,234,240,.92);
}

.kv{
  display:grid;
  grid-template-columns: 140px 1fr;
  gap:8px 12px;
  color:var(--muted);
}

.kv .k{ color:var(--muted); }
.kv .v{ color:var(--text); font-weight:600; }

.controls{
  display:grid;
  gap:10px;
}

.controlrow{
  display:grid;
  grid-template-columns: 160px 1fr;
  gap:10px;
  align-items:center;
}

.controlrow label{
  color:var(--muted);
  font-size:13px;
}

.controlright{
  display:flex;
  gap:10px;
  align-items:center;
}

.controlrow input{
  padding:9px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--text);
  width:140px;
}

.controlrow button{
  padding:9px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#1f1f2f;
  color:var(--text);
  cursor:pointer;
}

.controlrow button:hover{ filter:brightness(1.1); }

.attrgrid{
  display:grid;
  gap:8px;
}

.attrrow{
  display:grid;
  grid-template-columns: 180px 1fr;
  gap:12px;
  padding:10px;
  border-radius:12px;
  background:var(--panel2);
  border:1px solid rgba(255,255,255,.06);
}

.attrk{
  color:var(--muted);
  font-size:13px;
  text-transform: none;
}

.attrv{
  color:var(--text);
  font-size:13px;
  overflow-wrap:anywhere;
}

@media (max-width: 1100px){
  .productpage{ grid-template-columns: 1fr; }
  .pleft{ position:relative; top:auto; }
  .heroimg{ height: min(60vh, 540px); }
}

.sentinel{ height:1px; }

@media (max-width: 1200px){
  .filters{ grid-template-columns: 1fr 1fr 1fr 0.8fr 1fr 1fr auto; }
}
@media (max-width: 800px){
  .filters{ grid-template-columns: 1fr 1fr; }
}
.thumbbtn{
  padding:0;
  border:0;
  background:transparent;
  cursor:pointer;
  border-radius:12px;
}

.thumbbtn:focus{
  outline:2px solid rgba(255,255,255,.18);
  outline-offset:2px;
}

.thumbbtn.active .thumbimg{
  border-color: rgba(255,255,255,.28);
  filter: brightness(1.05);
}

.psubline{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin-top:8px;
}
.plink{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(10,10,16,.30);
  color:rgba(234,234,240,.90);
  font-size:12px;
}
.plink:hover{ filter:brightness(1.12); }

html, body{
  max-width: 100%;
  overflow-x: hidden;
}

@media (max-width: 600px){
  .wrap{ padding: 12px 12px; }

  /* if any grid rows exist in your product panels, force stacking */
  .kv{
    grid-template-columns: 1fr;
  }
  .attrrow{
    grid-template-columns: 1fr;
  }

  /* if you still use these anywhere */
  .controlrow{
    grid-template-columns: 1fr;
  }
  .controlrow input{
    width: 100%;
  }

  /* thumbnails: slightly smaller so they fit comfortably */
  .thumbgrid{
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  }
  .thumbimg{
    height: 92px;
  }
}
/* --- MOBILE OVERFLOW FIXES (prevents horizontal scroll) --- */
html, body { overflow-x: hidden; }

.wrap, .productpage, .pleft, .pright, .phero, .panel { min-width: 0; }

.productpage{
  /* allow columns to shrink properly */
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}

.ptitle{ overflow-wrap:anywhere; }

@media (max-width: 1100px){
  .productpage{ grid-template-columns: 1fr; }
}

/* --- “chips” for series/character row --- */
.chiprow{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:6px 0 10px;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(18,18,26,.7);
  color: rgba(234,234,240,.92);
}

.chip:hover{ filter:brightness(1.12); }

/* --- clickable pills --- */
.pill-link{ cursor:pointer; }
.pill-link:hover{ filter:brightness(1.12); }

/* --- price edit row --- */
.priceedit{
  display:flex;
  gap:10px;
  margin-top:12px;
  flex-wrap:wrap;
}
.priceedit input{
  padding:9px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--text);
  width:140px;
}
.priceedit select{
  padding:9px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--text);
}
.priceedit button{
  padding:9px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#1f1f2f;
  color:var(--text);
  cursor:pointer;
}
.priceedit button:hover{ filter:brightness(1.1); }

/* --- STAR RATING: left-to-right fill + persisted selection --- */
.ratingwrap{
  display:flex;
  flex-direction: row-reverse; /* key trick */
  gap:6px;
  align-items:center;
}

.starform{ margin:0; }

.star{
  appearance:none;
  border:0;
  padding:0;
  background:transparent;
  cursor:pointer;
  font-size:20px;
  line-height:1;
  color: rgba(234,234,240,.38); /* grey default */
}

.star.filled{ color: rgba(255,215,0,.95); } /* gold persisted */

/* hover fill left->right (with row-reverse) */
.star:hover,
.star:hover ~ .star{
  color: rgba(255,215,0,.95);
}

.startext{
  color: var(--muted);
  font-size:13px;
  white-space:nowrap;
}

/* On small screens allow wrap so it never forces horizontal scroll */
@media (max-width: 520px){
  .controlright{ flex-wrap:wrap; }
  .startext{ white-space:normal; }
}

/* --- HERO IMAGE NAV ARROWS --- */
.phero{
  position: relative;
}

.imgnav{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  width:48px;
  height:64px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:0;
  border-radius:12px;
  background: linear-gradient(
    to right,
    rgba(10,10,16,.55),
    rgba(10,10,16,.15)
  );
  color: rgba(234,234,240,.9);
  font-size:34px;
  font-weight:300;
  cursor:pointer;
  z-index:5;
  opacity:.55;
  transition: opacity .15s ease, filter .15s ease;
  backdrop-filter: blur(6px);
}

.imgnav:hover{
  opacity:1;
  filter:brightness(1.15);
}

.imgnav.prev{
  left:10px;
}

.imgnav.next{
  right:10px;
  background: linear-gradient(
    to left,
    rgba(10,10,16,.55),
    rgba(10,10,16,.15)
  );
}

/* mobile friendly */
@media (max-width: 700px){
  .imgnav{
    width:42px;
    height:56px;
    font-size:30px;
  }
}