[hidden]{ display:none !important; }
img{ max-width:100%; }

:root{
  --bg:#F6F4FB;
  --surface:#FFFFFF;
  --surface-alt:#EFEBF7;
  --surface-sunk:#E9E4F5;
  --text:#2B2438;
  --text-muted:#6E6580;
  --border:#E3DEF0;
  --accent:#FF6F5E;
  --accent-strong:#E25142;
  --accent-tint:#FFE6E1;
  --mint:#1F9E8B;
  --mint-tint:#DCF4EF;
  --shadow: 0 1px 2px rgba(43,36,56,0.06), 0 8px 20px -8px rgba(43,36,56,0.12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#1B1726;
    --surface:#241F33;
    --surface-alt:#2F2842;
    --surface-sunk:#191420;
    --text:#F1EEF7;
    --text-muted:#AEA6C4;
    --border:#3A3250;
    --accent:#FF8A76;
    --accent-strong:#FFA694;
    --accent-tint:#3A2530;
    --mint:#4FD9BE;
    --mint-tint:#1B332E;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px -8px rgba(0,0,0,0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"]{
  --bg:#1B1726;
  --surface:#241F33;
  --surface-alt:#2F2842;
  --surface-sunk:#191420;
  --text:#F1EEF7;
  --text-muted:#AEA6C4;
  --border:#3A3250;
  --accent:#FF8A76;
  --accent-strong:#FFA694;
  --accent-tint:#3A2530;
  --mint:#4FD9BE;
  --mint-tint:#1B332E;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px -8px rgba(0,0,0,0.5);
  color-scheme: dark;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:'Karla', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,.display{
  font-family:'Fredoka', ui-rounded, system-ui, sans-serif;
  text-wrap:balance;
}
.tabular{ font-variant-numeric: tabular-nums; }

.wrap{
  max-width: 1180px;
  margin: 0 auto;
  padding-inline: 20px;
}

header.top{
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding-block: 14px;
}
.brand-row{
  display:flex;
  align-items:baseline;
  gap:10px;
  margin-bottom:12px;
}
.brand-row h1{
  font-size: 1.7rem;
  font-weight:700;
  margin:0;
  color:var(--accent-strong);
  letter-spacing:-0.01em;
}
.brand-row .tag{
  font-size:0.72rem;
  text-transform:uppercase;
  letter-spacing:0.08em;
  color:var(--text-muted);
  border:1px solid var(--border);
  border-radius:999px;
  padding:3px 9px;
  white-space:nowrap;
}

.search-row{
  display:flex;
  gap:10px;
  margin-bottom:12px;
}
.search-box{
  position:relative;
  flex:1;
}
.search-box svg{
  position:absolute;
  left:14px;
  top:50%;
  transform:translateY(-50%);
  width:18px;
  height:18px;
  color:var(--text-muted);
  pointer-events:none;
}
input#search{
  width:100%;
  font-family:inherit;
  font-size:1rem;
  padding:12px 14px 12px 40px;
  border-radius:14px;
  border:1.5px solid var(--border);
  background:var(--surface);
  color:var(--text);
  outline:none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input#search:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accent-tint);
}
input#search::placeholder{ color:var(--text-muted); }

.clear-btn{
  position:absolute;
  right:8px;
  top:50%;
  transform:translateY(-50%);
  border:none;
  background:transparent;
  color:var(--text-muted);
  cursor:pointer;
  padding:6px;
  border-radius:8px;
  display:none;
  line-height:0;
}
.clear-btn:hover{ background:var(--surface-alt); }

.filter-row{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}
.pill-group{
  display:flex;
  gap:6px;
  overflow-x:auto;
  scrollbar-width:none;
  padding-bottom:2px;
}
.pill-group::-webkit-scrollbar{ display:none; }
.pill{
  flex:none;
  font-family:inherit;
  font-size:0.85rem;
  font-weight:600;
  padding:7px 14px;
  border-radius:999px;
  border:1.5px solid var(--border);
  background:var(--surface);
  color:var(--text-muted);
  cursor:pointer;
  white-space:nowrap;
  transition: all .15s ease;
}
.pill:hover{ border-color:var(--accent); color:var(--text); }
.pill.active{
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
}

select#seriesSelect,
select#regionSelect{
  font-family:inherit;
  font-size:0.85rem;
  font-weight:600;
  padding:7px 30px 7px 12px;
  border-radius:999px;
  border:1.5px solid var(--border);
  background:var(--surface);
  color:var(--text);
  cursor:pointer;
  max-width:220px;
  appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236E6580' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 8px center;
}

main{ padding-block: 18px 60px; }

.status-row{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  margin-bottom:14px;
  color:var(--text-muted);
  font-size:0.85rem;
}
.status-row b{ color:var(--text); }
.weight-hint{
  font-size:0.78rem;
  color:var(--text-muted);
}

.grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap:14px;
}

.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden;
  cursor:pointer;
  text-align:left;
  padding:0;
  display:flex;
  flex-direction:column;
  box-shadow:var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
  font-family:inherit;
  color:inherit;
}
.card:hover{ transform: translateY(-2px); }
.card:focus-visible{ outline:3px solid var(--accent); outline-offset:2px; }

.card .photo{
  aspect-ratio:1/1;
  background:var(--surface-alt);
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
}
.card .photo img{
  width:100%;
  height:100%;
  object-fit:contain;
  padding:10px;
}
.card .photo .ph-fallback{
  color:var(--text-muted);
  font-size:0.7rem;
  text-align:center;
  padding:8px;
}
.delta-badge{
  position:absolute;
  top:6px;
  right:6px;
  background:var(--mint);
  color:#08211c;
  font-size:0.65rem;
  font-weight:700;
  padding:2px 7px;
  border-radius:999px;
}

.card .info{
  padding:9px 10px 11px;
  display:flex;
  flex-direction:column;
  gap:4px;
  flex:1;
}
.card .eyebrow{
  font-size:0.62rem;
  text-transform:uppercase;
  letter-spacing:0.06em;
  color:var(--text-muted);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.card .name{
  font-weight:700;
  font-size:0.92rem;
  line-height:1.2;
}
.card .weight-row{
  margin-top:auto;
  padding-top:6px;
}
.weight-tag{
  display:inline-flex;
  align-items:baseline;
  gap:4px;
  background:var(--accent-tint);
  color:var(--accent-strong);
  border-radius:8px;
  padding:3px 8px;
  font-weight:700;
  font-size:0.85rem;
}
.weight-tag .unit{ font-size:0.65rem; font-weight:600; }
.weight-tag.none{
  background:var(--surface-sunk);
  color:var(--text-muted);
  font-weight:600;
  font-size:0.7rem;
}
.weight-tag .label{
  font-size:0.55rem;
  text-transform:uppercase;
  letter-spacing:0.05em;
  font-weight:700;
  opacity:0.75;
  margin-left:2px;
}
.value-tag{
  display:inline-flex;
  align-items:baseline;
  gap:4px;
  background:var(--mint-tint);
  color:var(--mint);
  border-radius:8px;
  padding:3px 8px;
  font-weight:700;
  font-size:0.85rem;
}
.value-tag .label{
  font-size:0.55rem;
  text-transform:uppercase;
  letter-spacing:0.05em;
  font-weight:700;
  opacity:0.75;
  margin-left:2px;
}
.secret-badge{
  position:absolute;
  top:6px;
  left:6px;
  background:#B8860B;
  color:#fff;
  font-size:0.6rem;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.04em;
  padding:2px 7px;
  border-radius:999px;
}

.empty{
  text-align:center;
  padding:60px 20px;
  color:var(--text-muted);
}
.empty .big{ font-size:2.4rem; margin-bottom:8px; }

/* detail overlay */
.overlay{
  position:fixed;
  inset:0;
  background:rgba(20,16,28,0.55);
  display:flex;
  align-items:flex-end;
  justify-content:center;
  z-index:100;
  padding:0;
}
.overlay[hidden]{ display:none; }
@media (min-width:640px){
  .overlay{ align-items:center; padding:20px; }
}
.detail{
  background:var(--surface);
  width:100%;
  max-width:520px;
  max-height:90vh;
  border-radius:20px 20px 0 0;
  overflow-y:auto;
  padding: 18px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  position:relative;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.2);
}
@media (min-width:640px){
  .detail{ border-radius:20px; max-height:85vh; }
}
.detail-close{
  position:absolute;
  top:14px;
  right:14px;
  width:32px;
  height:32px;
  border-radius:50%;
  border:none;
  background:var(--surface-alt);
  color:var(--text);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.detail-close:hover{ background:var(--surface-sunk); }
.detail-top{
  display:flex;
  gap:16px;
  align-items:center;
  margin-bottom:16px;
}
.detail-photo{
  width:120px;
  height:120px;
  flex:none;
  background:var(--surface-alt);
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.detail-photo img{ width:100%; height:100%; object-fit:contain; padding:8px; }
.detail-heading .eyebrow{
  font-size:0.68rem;
  text-transform:uppercase;
  letter-spacing:0.07em;
  color:var(--text-muted);
  margin-bottom:4px;
}
.detail-heading h2{
  font-size:1.3rem;
  margin:0 0 4px;
  line-height:1.15;
}
.detail-heading .cat{
  font-size:0.78rem;
  color:var(--mint);
  font-weight:700;
}

.detail-section{ margin-top:16px; }
.detail-section h3{
  font-size:0.72rem;
  text-transform:uppercase;
  letter-spacing:0.07em;
  color:var(--text-muted);
  margin:0 0 8px;
  font-family:'Karla', sans-serif;
  font-weight:700;
}
.box-weight-hero{
  display:flex;
  align-items:baseline;
  gap:8px;
  background:var(--accent-tint);
  color:var(--accent-strong);
  border-radius:14px;
  padding:14px 16px;
}
.box-weight-hero .num{ font-size:2rem; font-weight:700; }
.box-weight-hero .g{ font-size:1rem; font-weight:700; }
.box-weight-hero .desc{
  margin-left:auto;
  font-size:0.72rem;
  color:var(--accent-strong);
  opacity:0.8;
  text-align:right;
  max-width:120px;
}
.no-weight-note{
  color:var(--text-muted);
  font-size:0.85rem;
  background:var(--surface-alt);
  border-radius:12px;
  padding:12px 14px;
}
.chip-row{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.chip{
  background:var(--surface-alt);
  color:var(--text);
  border-radius:999px;
  padding:4px 10px;
  font-size:0.8rem;
  font-weight:600;
}
.notes-box{
  font-size:0.88rem;
  line-height:1.5;
  color:var(--text);
  background:var(--surface-alt);
  border-radius:12px;
  padding:12px 14px;
  white-space:pre-wrap;
}
.raw-note{
  font-size:0.72rem;
  color:var(--text-muted);
  margin-top:6px;
}
.value-hero{
  display:flex;
  align-items:baseline;
  gap:8px;
  background:var(--mint-tint);
  color:var(--mint);
  border-radius:14px;
  padding:14px 16px;
}
.value-hero .num{ font-size:1.7rem; font-weight:700; }
.value-hero .tier-badge{
  margin-left:auto;
  background:#B8860B;
  color:#fff;
  font-size:0.62rem;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.04em;
  padding:3px 9px;
  border-radius:999px;
  white-space:nowrap;
}
.value-conf{
  font-size:0.72rem;
  color:var(--text-muted);
  margin-top:6px;
  line-height:1.4;
}
.value-conf .conf{
  font-weight:700;
  text-transform:capitalize;
}

footer{
  text-align:center;
  color:var(--text-muted);
  font-size:0.75rem;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0px));
}

/* Community weight submission (detail view) */
.submit-weight{
  display:flex;
  gap:8px;
  align-items:stretch;
  flex-wrap:wrap;
}
.submit-input{
  flex:1 1 140px;
  display:flex;
  align-items:center;
  gap:4px;
  background:var(--surface);
  border:1.5px solid var(--border);
  border-radius:12px;
  padding:0 12px;
}
.submit-input:focus-within{ border-color:var(--accent); }
.submit-input input{
  flex:1;
  min-width:0;
  border:0;
  outline:0;
  background:transparent;
  color:var(--text);
  font:inherit;
  font-size:1rem;
  padding:10px 0;
}
.submit-input .unit{ color:var(--text-muted); font-weight:600; }
.submit-btn{
  flex:none;
  font-family:inherit;
  font-size:0.9rem;
  font-weight:600;
  padding:10px 16px;
  border-radius:12px;
  border:0;
  background:var(--accent);
  color:#fff;
  cursor:pointer;
}
.submit-btn:hover{ background:var(--accent-strong); }
.submit-btn:disabled{ opacity:0.6; cursor:default; }
.submit-weight .hp{ position:absolute; left:-9999px; width:1px; height:1px; opacity:0; }
.submit-msg{ font-size:0.85rem; margin-top:8px; }
.submit-msg:empty{ display:none; }
.submit-msg.ok{ color:var(--mint); }
.submit-msg.error{ color:var(--accent-strong); }
