:root {
  --bg: #0b0f14;
  --panel: rgba(255, 255, 255, 0.04);
  --panel2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.62);
  --shadow: 0 10px 30px rgba(0,0,0,0.45);
  --radius: 14px;

  --common: #ffffff;
  --uncommon: #4ade80;
  --rare: #60a5fa;
  --epic: #a78bfa;

  /* Icon scaling (sprite tiles are 32px) */
  --tile: 32px;
  --icon-scale: 1;      /* default (Small) */
  --frame-size: 40px;   /* default frame size */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(255,255,255,0.08), transparent 60%),
              radial-gradient(900px 500px at 80% 0%, rgba(255,255,255,0.06), transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(11,15,20,0.92), rgba(11,15,20,0.70));
  border-bottom: 1px solid var(--border);
}

.topbar{
  max-width: 1100px;          /* SAMA kuin rarity & items */
  margin: 0 auto;
  padding: 14px;

  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.title .h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.title .sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.controls{
  display: flex;
  gap: 10px;
  justify-self: end;   /* TÄRKEÄ */
  align-items: center;
}


/* Icon size modes */
body.scale-sm { --icon-scale: 1;    --frame-size: 40px; }
body.scale-md { --icon-scale: 1.25; --frame-size: 48px; }
body.scale-lg { --icon-scale: 1.5;  --frame-size: 56px; }

/* Scale buttons */
.scaleGroup {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}

.scaleBtn {
  height: 30px;
  width: 34px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.scaleBtn.active {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.20);
}

input, select, button:not(.scaleBtn):not(.r) {
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  outline: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

input[type="text"],
input[type="search"]{
  padding: 0 12px;
  min-width: 220px;
}

select {
  padding: 0 10px;
}

button:not(.scaleBtn):not(.r) {
  padding: 0 12px;
  cursor: pointer;
  background: rgba(255,255,255,0.06);
}

button:not(.scaleBtn):not(.r):hover {
  background: rgba(255,255,255,0.09);
}

/* Rarity info block */
.rarityInfo {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 14px 0;
}

.rarityInfoInner {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

.rarityNote {
  margin: 0;
  color: rgba(255,255,255,0.88);
  line-height: 1.35;
  font-size: 13px;
}

/* ULTRA / SUPER label pills inside the note */
.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  vertical-align: middle;
  border: 1px solid transparent;
}

.pill.ultra {
  color: #facc15;
  background: rgba(250, 204, 21, 0.12);
  border-color: rgba(250, 204, 21, 0.35);
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.25);
}

.pill.super {
  color: #fb7185;
  background: rgba(251, 113, 133, 0.12);
  border-color: rgba(251, 113, 133, 0.35);
  box-shadow: 0 0 8px rgba(251, 113, 133, 0.25);
}

/* Rarity pills (these are also the filters) */
.rarity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.rarity-legend .r {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.rarity-legend .r:hover {
  background: rgba(255,255,255,0.07);
  transform: translateY(-1px);
}

.rarity-legend .r.is-active {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.20);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.06) inset;
}

.rarity-legend .r.common { color: var(--common); }
.rarity-legend .r.uncommon { color: var(--uncommon); }
.rarity-legend .r.rare { color: var(--rare); }
.rarity-legend .r.epic { color: var(--epic); }
.rarity-legend .r.super { color: #fb7185; }
.rarity-legend .r.ultra { color: #facc15; }


.rarity-legend .r.unobtainable { color: rgba(255,255,255,0.72); }
.rarity-legend .r.unobtainable.is-active{
  border-color: rgba(255,255,255,0.28);
  box-shadow: 0 0 10px rgba(255,255,255,0.08);
}

/* List */
#items {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 14px 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.item.is-selected{
  border-color: rgba(255,255,255,0.28);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.10), var(--shadow);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
}


.iconWrap {
  width: var(--frame-size);
  height: var(--frame-size);
  background-size: var(--frame-size) var(--frame-size);
  background-repeat: no-repeat;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  image-rendering: pixelated;
}

.icon {
  width: var(--tile);
  height: var(--tile);
  transform: scale(var(--icon-scale));
  transform-origin: center;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 860px) {
  #items {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1180px) {
  #items {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logoimg {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.logoimg img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.topBtn {
  height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.topBtn:hover {
  background: rgba(255,255,255,0.09);
}

.topBtn.primary {
  background: linear-gradient(135deg, #ffd45a, #ff8a2a);
  color: #1a1208;
  border-color: transparent;
}

/* Filters card under rarity info */
.filterCard{
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 14px 0;
}

.filterCardInner{
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

.filterRow{
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start; /* tai flex-end jos haluat oikealle */
}

/* tekee searchista vähän "tärkeämmän" */
.filterRow input#search{
  min-width: 260px;
  flex: 1 1 260px;
}

/* Disable text selection on item cards */
.item,
.item * {
  -webkit-user-select: none; /* Safari / iOS */
  -moz-user-select: none;    /* Firefox */
  -ms-user-select: none;     /* IE/Edge */
  user-select: none;         /* Standard */
}
.seoIntro{
  max-width:1100px;
  margin:0 auto;
  padding:10px 14px 0;
}

.seoIntro h2{
  margin:0 0 8px;
  font-size:13px;
  letter-spacing:.3px;
  text-transform:uppercase;
  color:rgba(255,255,255,0.86);
}

.seoIntro p{
  margin:0;
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:12px 14px;
  color: rgba(255,255,255,0.85);
  line-height:1.45;
  font-size:13px;
}

.items-footer{
  margin: 28px auto 40px;
  max-width: 1100px;
  padding: 0 16px;
}

.items-footer-card{
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 18px;
  padding: 16px 18px;
  backdrop-filter: blur(10px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 12px 30px rgba(0,0,0,.35);
}

.items-footer-card p{
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: rgba(255,255,255,.82);
}

.items-footer-card strong{
  color: rgba(255,255,255,.95);
}

.items-footer-links{
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12.5px;
  color: rgba(255,255,255,.6);
}

.items-footer-links a{
  color: rgba(255,255,255,.75);
  text-decoration: none;
}

.items-footer-links a:hover{
  text-decoration: underline;
}

/* Slot filter dropdown – theme fix */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.6) 50%),
    linear-gradient(135deg, rgba(255,255,255,0.6) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 16px,
    calc(100% - 12px) 16px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;

  padding-right: 34px;
}

/* Dropdown options */
select option {
  background: #0b0f14;        /* sama kuin --bg */
  color: rgba(255,255,255,.9);
}

/* Hover / selected (desktop browsers) */
select option:hover,
select option:checked {
  background: rgba(255,255,255,0.12);
}

/* ---- Type multi-select (checkbox dropdown) ---- */
.typeMulti{
  position: relative;
  display: inline-flex;
}

.typeBtn{
  height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.typeBtn:hover{
  background: rgba(255,255,255,0.08);
}

.typeBtn .chev{
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(255,255,255,0.70);
  margin-left: 2px;
}

.typePanel{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(20,24,30,0.98), rgba(14,18,24,0.96));
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  display: none;
  z-index: 50;
}

.typePanel.is-open{ display: block; }

.typeRow{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
}
.typeRow span{
  flex: 1 1 auto;
  text-align: left;
}
.typeRow input{
  flex: 0 0 auto;
}

.typeRow:hover{
  background: rgba(255,255,255,0.06);
}

.typeRow input{
  width: 16px;
  height: 16px;
  accent-color: #ffd45a; /* sopii sun themeen */
  /* checkbox must NOT inherit input styles */
  input[type="checkbox"]{
  min-width: 0 !important;
  height: 16px !important;
  width: 16px !important;
  padding: 0 !important;

  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

}

.typeSep{
  height: 1px;
  background: rgba(255,255,255,0.10);
  margin: 8px 2px;
}

/* --- Types dropdown panel layout fix --- */

#typePanel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 240px;
  z-index: 50;
}

#typePanel .row,
#typePanel label {
  display: flex;
  align-items: center;
  justify-content: space-between; /* text left, checkbox right */
  gap: 14px;
  padding: 10px 14px;
  width: 100%;
}

#typePanel input[type="checkbox"] {
  margin: 0;
  flex: 0 0 auto;
}

#typePanel .row span,
#typePanel label span,
#typePanel .row .label,
#typePanel label .label {
  flex: 1 1 auto;
  text-align: left;
  white-space: nowrap;
}
