/* The Guiding of Isaac — basement floor, torn paper and ink. */
:root {
  --bg: #130c0a;
  --bg-2: #1d1310;
  --paper: #dccaa6;
  --paper-2: #cbb58d;
  --paper-shade: #b89d74;
  --ink: #2b1c13;
  --ink-soft: #5b4531;
  --blood: #9e1b12;
  --blood-bright: #d23a26;
  --on-dark: #eee1cb;
  --on-dark-muted: #a8937a;
  --gold: #e8c252;
  --up: #3f8f2c;
  --down: #b32416;
  --focus: #f3d36b;

  --dlc-rebirth: #8a6a48;
  --dlc-afterbirth: #b0472b;
  --dlc-afterbirthplus: #6c4aa0;
  --dlc-repentance: #1f6f7a;

  --font-display: "Permanent Marker", "Comic Sans MS", cursive;
  --font-body: "Patrick Hand", "Comic Sans MS", cursive;
  --slot: 72px;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  font: 19px/1.35 var(--font-body);
  color: var(--on-dark);
  /* Basement 1: stone wall along the top, wooden floor below, room shadow around the edges.
     Textures are mirrored from the game's 01_basement.png and drawn at 2x like in-game. */
  background-color: #734136;
  background-image:
    radial-gradient(ellipse 75% 70% at 50% 45%, transparent 55%, rgba(12, 6, 4, 0.5) 100%),
    linear-gradient(rgba(20, 10, 8, 0.6), transparent 40px),
    url(../img/ui/wall-top.png),
    linear-gradient(rgba(20, 11, 9, 0.18), rgba(20, 11, 9, 0.18)),
    url(../img/ui/floor.png);
  background-size: auto, auto, 696px 120px, auto, 712px 400px;
  background-repeat: no-repeat, no-repeat, repeat-x, no-repeat, repeat;
  background-position: 0 0, 0 120px, 50% 0, 0 0, 50% 120px;
  background-attachment: fixed, scroll, scroll, fixed, scroll;
  image-rendering: pixelated;
  overflow-x: hidden;
}
body.drawer-open { overflow: hidden; }
img { image-rendering: pixelated; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.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; }

/* ---------- paper panels: a rough-edged background layer behind the content */
.paper { position: relative; isolation: isolate; color: var(--ink); }
.paper::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 4px;
  background:
    radial-gradient(ellipse at 15% 20%, rgba(255, 250, 235, 0.45), transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(120, 85, 45, 0.28), transparent 60%),
    radial-gradient(circle at 70% 30%, rgba(140, 100, 60, 0.12) 0 6%, transparent 7%),
    linear-gradient(170deg, var(--paper), var(--paper-2));
  box-shadow: 0 0 0 2px var(--ink) inset, 0 6px 0 rgba(0, 0, 0, 0.35);
  filter: url(#rough);
}

/* ---------- header */
.site-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  max-width: 1280px;
  min-height: 120px;
  margin: 0 auto 14px;
  padding: 18px 20px 8px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.85);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-icon { width: 64px; height: 64px; animation: bob 2.4s ease-in-out infinite; filter: drop-shadow(0 10px 3px rgba(0, 0, 0, 0.6)); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-sub { font-size: 15px; color: var(--on-dark); letter-spacing: 0.02em; }
.brand-title {
  font: 44px/1 var(--font-display);
  color: var(--on-dark);
  text-shadow: 3px 3px 0 var(--blood), 0 0 18px rgba(0, 0, 0, 0.8);
  transform: rotate(-2deg);
  margin-top: 4px;
}

.tabs { display: flex; flex-wrap: wrap; gap: 4px 2px; width: 100%; }
.tab.is-soon { opacity: 0.8; font-size: 16px; padding-inline: 6px; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px 5px;
  text-decoration: none;
  font: 18px var(--font-display);
  color: var(--on-dark);
  border: 2px solid transparent;
  border-radius: 4px;
  transition: color 0.15s, transform 0.15s;
}
.tab:hover { color: var(--on-dark); transform: rotate(-1.5deg); }
.tab.is-active { color: var(--ink); text-shadow: none; }
.tab.is-active::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--paper); box-shadow: 0 0 0 2px var(--ink) inset; filter: url(#rough-sm); border-radius: 3px;
}
.tab { isolation: isolate; }
.tab-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; }
.tab-icon img { width: 28px; height: 28px; }
.tab.is-soon .tab-icon { filter: grayscale(1) brightness(0.55); }
.tab-soon {
  font: 12px var(--font-body);
  padding: 0 4px;
  border-radius: 3px;
  background: var(--blood);
  color: var(--on-dark);
  transform: rotate(4deg);
}

main { max-width: 1280px; margin: 0 auto; padding: 8px 20px 40px; }

/* ---------- toolbar */
.toolbar {
  position: sticky;
  top: 8px;
  z-index: 5;
  padding: 14px 18px 10px;
  margin-bottom: 22px;
}
.search { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 12px; display: grid; place-items: center; pointer-events: none; }
.search input {
  width: 100%;
  padding: 8px 44px 8px 44px;
  font-size: 22px;
  color: var(--ink);
  background: rgba(255, 252, 240, 0.55);
  border: 2px solid var(--ink);
  border-radius: 3px;
  outline: none;
}
.search input::placeholder { color: var(--ink-soft); opacity: 0.8; }
.search input:focus { background: rgba(255, 252, 240, 0.85); box-shadow: 0 0 0 3px var(--gold); }
.search-kbd {
  position: absolute; right: 12px;
  font: 15px var(--font-body);
  padding: 0 7px; border: 1.5px solid var(--ink-soft); border-radius: 4px; color: var(--ink-soft);
}

.filters { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 10px; }
.fgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.flabel { font: 16px var(--font-display); margin-right: 3px; color: var(--ink-soft); }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 32px;
  padding: 2px 10px;
  font-size: 17px;
  color: var(--ink);
  background: transparent;
  border: 2px dashed rgba(43, 28, 19, 0.45);
  border-radius: 999px 900px 999px 950px;
  cursor: pointer;
  transition: transform 0.1s, background 0.1s;
}
.chip:hover { border-style: solid; transform: rotate(-2deg); }
.chip[aria-pressed="true"] {
  border: 2.5px solid var(--blood);
  background: rgba(158, 27, 18, 0.12);
  color: var(--blood);
  font-weight: bold;
  transform: rotate(-1.5deg);
}
.chip-q { padding: 2px 8px; }
.select {
  padding: 3px 8px;
  font-size: 17px;
  color: var(--ink);
  background: rgba(255, 252, 240, 0.55);
  border: 2px solid var(--ink);
  border-radius: 3px;
}
.select option, .select optgroup { color: #111; background: #fff; }
.toolbar-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin-top: 8px; font-size: 17px; }
.count { margin: 0; margin-right: auto; }
.count b { font-family: var(--font-display); font-weight: normal; color: var(--blood); }
.toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.toggle input { accent-color: var(--blood); width: 18px; height: 18px; }
.filters-toggle { display: none; }
.linkish { background: none; border: 0; padding: 0; text-decoration: underline wavy; text-underline-offset: 4px; cursor: pointer; color: var(--blood); }

/* ---------- the floor grid */
.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--slot), 1fr));
  gap: 4px;
}
.cell { display: grid; place-items: center; }
.cell[hidden] { display: none; }
.slot {
  position: relative;
  width: var(--slot);
  height: var(--slot);
  padding: 0;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.slot img { width: 64px; height: 64px; position: relative; z-index: 1; transition: transform 0.15s; }
/* the little shadow items cast on the floor */
.slot::before {
  content: "";
  position: absolute;
  left: 50%; bottom: 6px;
  width: 38px; height: 9px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(20, 8, 5, 0.45);
  transition: transform 0.15s, opacity 0.15s;
}
.slot:hover img, .slot:focus-visible img, .slot.is-current img { animation: bob 0.9s ease-in-out infinite; }
.slot:hover::before, .slot:focus-visible::before { transform: translateX(-50%) scale(0.75); opacity: 0.7; }
.slot:focus-visible { outline: 3px dashed var(--focus); outline-offset: -2px; }
.slot.is-current { background: radial-gradient(circle, rgba(232, 194, 82, 0.28), transparent 70%); }
.slot-id {
  position: absolute;
  top: 1px; left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font: 13px/1 var(--font-body);
  padding: 1px 4px 0;
  color: var(--on-dark);
  background: rgba(10, 6, 5, 0.75);
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s;
}
.slot:hover .slot-id, .slot:focus-visible .slot-id, .show-ids .slot-id { opacity: 1; }
.show-ids .slot-id { top: auto; bottom: -2px; background: transparent; color: var(--on-dark); text-shadow: 0 1px 0 #000, 0 0 3px #000; }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.empty { text-align: center; font-size: 22px; color: var(--on-dark); text-shadow: 0 2px 0 #000; padding: 40px 0; }

/* ---------- ink streak, like the in-game pickup banner */
.streak {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 30px 12px;
  color: #fff;
  text-align: center;
  background: url(../img/ui/streak.png) center / 100% 100% no-repeat;
  image-rendering: pixelated;
  line-height: 1.05;
}
.streak-name { font: 23px/1.05 var(--font-display); margin: 0; text-shadow: 2px 2px 0 #000; }
.quote { margin: 0; font-size: 18px; color: var(--ink-soft); text-align: center; font-style: italic; }
.streak.big { padding: 18px 40px 20px; min-width: min(100%, 360px); }
.streak.big .streak-name { font-size: 30px; }
.hero .quote { font-size: 21px; }

/* ---------- item text pieces */
.desc { list-style: none; margin: 6px 0 0; padding: 0; }
.desc li { position: relative; padding-left: 16px; margin: 3px 0; }
.desc li::before { content: "•"; position: absolute; left: 2px; color: var(--ink-soft); }
.up { color: var(--up); }
.down { color: var(--down); }
.c-yellow { color: #9a6a00; }
.c-red { color: var(--down); }
.c-blue { color: #1f55a8; }
.c-orange { color: #b25a0c; }
.c-green { color: var(--up); }
.c-silver, .c-gray { color: #6d6258; }
.ei { display: inline-block; vertical-align: middle; margin: -6px 0 -4px; image-rendering: pixelated; background-repeat: no-repeat; }
.ico-item { display: inline-block; vertical-align: middle; }
.ico-item img, img.ico-item { width: 32px; height: 32px; margin: -8px -2px; vertical-align: middle; }
a.ico-item:hover img { filter: drop-shadow(0 0 3px var(--gold)); }
.dot { margin: 0 6px; color: var(--ink-soft); }
.dlc-tag { padding: 0 6px; border-radius: 3px; color: #fff; font-size: 15px; white-space: nowrap; }
.dlc-rebirth { --dlc: var(--dlc-rebirth); }
.dlc-afterbirth { --dlc: var(--dlc-afterbirth); }
.dlc-afterbirthplus { --dlc: var(--dlc-afterbirthplus); }
.dlc-repentance { --dlc: var(--dlc-repentance); }
.dlc-tag { background: var(--dlc); }
.chip-dlc[aria-pressed="true"] { border-color: var(--dlc); color: var(--dlc); background: color-mix(in srgb, var(--dlc) 14%, transparent); }
.meta-q { white-space: nowrap; }

/* ---------- tooltip */
.tooltip {
  position: fixed;
  top: 0; left: 0;
  z-index: 30;
  width: 360px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.55));
}
.tooltip[hidden] { display: none; }
.tooltip .streak { margin: 0 -6px -8px; position: relative; z-index: 1; }
.tip-body { padding: 16px 16px 10px; font-size: 17px; }
.tip-meta { display: flex; flex-wrap: wrap; align-items: center; font-size: 16px; color: var(--ink-soft); }
.tip-id { font-family: var(--font-display); color: var(--blood); margin-right: 8px; }
.tip-unlock {
  display: flex; gap: 8px;
  margin-top: 10px; padding-top: 8px;
  border-top: 2px dashed rgba(43, 28, 19, 0.35);
  color: var(--blood);
}
.tip-unlock.is-free { color: var(--up); }
.tip-unlock .lock { flex: none; }
.tip-hint { margin-top: 6px; font-size: 14px; color: var(--ink-soft); text-align: right; }

/* ---------- drawer */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(8, 4, 3, 0.6);
}
.drawer-backdrop[hidden], .drawer[hidden] { display: none; }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 50;
  width: min(520px, 100vw);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 16px 24px;
  transform: translateX(105%);
  transition: transform 0.22s ease-out;
}
.drawer.is-open { transform: none; }
.drawer-inner { padding: 14px 22px 22px; min-height: 100%; }
.drawer-nav { display: flex; align-items: center; gap: 8px; }
.drawer-id { font: 18px var(--font-display); color: var(--blood); margin: 0 auto; }
.navbtn, .close {
  display: inline-flex; align-items: center; gap: 2px;
  min-height: 40px; min-width: 40px;
  padding: 0 6px;
  font-size: 26px;
  color: var(--ink);
  background: transparent;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}
.navbtn img { width: 32px; height: 32px; }
.navbtn:hover:not([disabled]), .close:hover { border-color: var(--ink); transform: rotate(-3deg); }
.navbtn[disabled] { opacity: 0.3; cursor: default; }
.close { font-size: 22px; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0 8px; }
.pedestal { position: relative; width: 150px; height: 150px; display: grid; place-items: center; }
.pedestal::after {
  content: ""; position: absolute; bottom: 10px; left: 50%;
  width: 80px; height: 16px; transform: translateX(-50%);
  border-radius: 50%; background: rgba(43, 28, 19, 0.35);
}
.pedestal img { width: 128px; height: 128px; animation: bob 1.6s ease-in-out infinite; position: relative; z-index: 1; }
.drawer-meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; margin: 4px 0 6px; font-size: 17px; }
.drawer h3 {
  font: 21px var(--font-display);
  margin: 18px 0 4px;
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
  display: inline-block;
  transform: rotate(-1deg);
}
.drawer .desc { font-size: 19px; }
.per-char { margin-top: 10px; }
.per-char summary { cursor: pointer; font: 18px var(--font-display); color: var(--blood); }
.per-char dl { margin: 6px 0 0; }
.per-char dt { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-family: var(--font-display); font-size: 17px; }
.per-char dd { margin: 0 0 0 4px; font-size: 17px; }
.note { font-size: 17px; margin: 8px 0 0; color: var(--ink-soft); }
.muted { color: var(--ink-soft); margin: 4px 0; }

.unlock-h { color: var(--blood) !important; border-color: var(--blood) !important; }
.unlock-card {
  margin-top: 6px;
  padding: 12px 14px;
  border: 2.5px solid var(--blood);
  border-radius: 8px 12px 7px 14px;
  background: rgba(158, 27, 18, 0.07);
}
.unlock-card.is-free { border-color: var(--up); background: rgba(63, 143, 44, 0.08); }
.ach-paper { display: block; width: 100%; max-width: 250px; margin: 10px auto 0; mix-blend-mode: multiply; image-rendering: auto; }
.unlock-how { margin: 0; font-size: 21px; }
.unlock-how a { color: var(--blood); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.unlock-card.is-free .unlock-how { color: var(--up); font-family: var(--font-display); }
.unlock-ach { margin: 4px 0 0; font-size: 16px; color: var(--ink-soft); }
.pools { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.pools li { display: inline-flex; align-items: center; gap: 6px; font-size: 18px; }
.greed { font-size: 13px; padding: 0 4px; border-radius: 3px; background: var(--ink); color: var(--gold); vertical-align: 2px; }

/* ---------- characters page */
.roster-intro { padding: 14px 22px 12px; margin-bottom: 18px; text-align: center; }
.roster-intro p { margin: 4px 0 0; font-size: 19px; }
.roster-title { font: 34px/1 var(--font-display); margin: 0; transform: rotate(-1.5deg); }
.roster-h {
  font: 26px var(--font-display);
  margin: 10px 0 12px;
  color: var(--on-dark);
  text-shadow: 3px 3px 0 var(--blood), 0 2px 6px #000;
}
.roster-h small { font: 18px var(--font-body); color: var(--on-dark); opacity: 0.8; margin-left: 6px; }
.roster-h.is-tainted { margin-top: 30px; text-shadow: 3px 3px 0 #3b0b08, 0 0 10px var(--blood); }
.char-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px 14px;
}
.char-card {
  position: relative;
  isolation: isolate;
  width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 8px 10px;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.15s;
}
.char-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(170deg, #e6dbd6, #cfc2bc);
  box-shadow: 0 0 0 2px var(--ink) inset, 0 5px 0 rgba(0, 0, 0, 0.35);
  filter: url(#rough-sm);
  border-radius: 3px;
}
.is-tainted .char-card::before { background: linear-gradient(170deg, #d9cbc6, #b9a7a0); }
.char-card:hover, .char-card:focus-visible, .char-card.is-current { transform: rotate(0deg) translateY(-4px) scale(1.04); }
.char-card:focus-visible { outline: 3px dashed var(--focus); outline-offset: 3px; }
.char-card.is-current::before { box-shadow: 0 0 0 3px var(--blood) inset, 0 5px 0 rgba(0, 0, 0, 0.35); }
.char-portrait { width: 96px; height: 96px; }
.char-card:hover .char-portrait { animation: bob 0.9s ease-in-out infinite; }
.char-name { font: 18px/1.1 var(--font-display); text-align: center; }
.char-hearts { display: flex; flex-wrap: wrap; justify-content: center; gap: 1px; min-height: 22px; align-items: center; font-size: 15px; }
.char-state { position: absolute; top: 6px; right: 8px; font-size: 15px; }
.char-state.is-free { color: var(--up); font-weight: bold; }
.tip-count { margin-top: 6px; font-size: 16px; }
.tip-count b { font-family: var(--font-display); font-weight: normal; color: var(--blood); }

.hero-portrait { width: 144px; height: 144px; animation: bob 1.8s ease-in-out infinite; }
.intro { font-size: 18px; color: var(--ink-soft); margin: 4px 0 0; }
.form + .form { margin-top: 12px; padding-top: 10px; border-top: 2px dashed rgba(43, 28, 19, 0.3); }
.form h4 { font: 18px var(--font-display); margin: 0 0 4px; }
.hearts-row { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; min-height: 24px; }
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px 12px;
  margin: 8px 0 0;
}
.stats div { display: flex; flex-direction: column; }
.stats dt { font-size: 15px; color: var(--ink-soft); white-space: nowrap; }
.stats dd { margin: 0; font: 18px var(--font-display); }
.starts-h { margin: 10px 0 2px; font: 16px var(--font-display); color: var(--ink-soft); }
.things { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.thing { display: inline-flex; align-items: center; gap: 4px; font-size: 18px; text-decoration: none; color: var(--ink); }
.thing img { width: 32px; height: 32px; }
.thing .thing-portrait { width: 36px; height: 36px; }
a.thing span { text-decoration: underline; text-decoration-color: rgba(43, 28, 19, 0.35); text-underline-offset: 3px; }
a.thing:hover span { color: var(--blood); text-decoration-color: currentColor; }
.thing.is-text span { font-style: italic; }
.thing-lock { font-size: 13px; margin-left: -2px; }
.birthright { display: flex; gap: 8px; align-items: flex-start; }
.birthright .ico-item img { width: 40px; height: 40px; margin: 0; }
.h-count { font: 16px var(--font-body); padding: 0 6px; margin-left: 4px; background: var(--ink); color: var(--paper); border-radius: 3px; vertical-align: 3px; }
.marks { list-style: none; margin: 8px 0 0; padding: 0; }
.mark { display: flex; gap: 10px; padding: 8px 0; border-bottom: 2px dashed rgba(43, 28, 19, 0.2); }
.mark:last-child { border-bottom: 0; }
.mark-icons { flex: none; width: 40px; display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; padding-top: 2px; }
.mark-icons img { width: 32px; height: 32px; }
.mark-icons img:not(:only-child) { width: 18px; height: 18px; }
.mark-dot { font-size: 22px; color: var(--ink-soft); }
.mark-body { min-width: 0; }
.mark-title { margin: 0 0 2px; font: 17px var(--font-display); }
.mark-cond { margin: 2px 0 0; font-size: 15px; color: var(--ink-soft); }
.wiki-link { margin: 18px 0 0; text-align: right; }
.wiki-link a { color: var(--blood); }
.char-link { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); }
.char-link img { width: 32px; height: 32px; }

/* ---------- trinkets: golden mode */
.c-gold { color: #a87800; font-weight: bold; }
.is-golden .slot img, .pedestal.is-golden img {
  filter: sepia(1) saturate(4.5) hue-rotate(-8deg) brightness(1.12) contrast(1.05) drop-shadow(0 0 4px rgba(255, 214, 90, 0.55));
}
.chip-gold { border-color: rgba(168, 120, 0, 0.55); }
.chip-gold[aria-pressed="true"] { border-color: #b88600; background: rgba(232, 194, 82, 0.28); color: #7a5600; }
.streak.is-gold .streak-name { color: var(--gold); }
.variant-label { margin: 6px 0 0; font: 15px var(--font-display); color: #a87800; }
.variant-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.variant-pane[hidden] { display: none; }

/* ---------- challenges page: pinned notes, like the in-game challenge list */
.chal-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px 16px;
}
.chal-grid li[hidden] { display: none; }
.chal-card {
  position: relative;
  isolation: isolate;
  width: 100%; height: 100%;
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 14px 12px;
  text-align: left;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.15s;
}
.chal-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(170deg, var(--paper), var(--paper-2));
  box-shadow: 0 0 0 2px var(--ink) inset, 0 5px 0 rgba(0, 0, 0, 0.35);
  filter: url(#rough-sm);
  border-radius: 3px;
}
/* the pin */
.chal-card::after {
  content: ""; position: absolute; top: -5px; left: 50%;
  width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d9534a, var(--blood) 60%, #4a0d08);
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.5);
}
.chal-card:hover, .chal-card:focus-visible, .chal-card.is-current { transform: rotate(0deg) translateY(-3px); }
.chal-card:focus-visible { outline: 3px dashed var(--focus); outline-offset: 3px; }
.chal-card.is-current::before { box-shadow: 0 0 0 3px var(--blood) inset, 0 5px 0 rgba(0, 0, 0, 0.35); }
.chal-state { position: absolute; top: 8px; right: 10px; font-size: 15px; }
.chal-state.is-free { color: var(--up); font-weight: bold; }
.chal-title { font: 20px/1.1 var(--font-display); padding-right: 22px; }
.chal-num { font: 16px var(--font-body); color: var(--blood); }
.chal-row { display: flex; align-items: center; gap: 6px; min-height: 48px; }
.chal-char { width: 48px; height: 48px; flex: none; }
.chal-loadout { display: flex; flex-wrap: wrap; gap: 0; }
.chal-loadout img { width: 32px; height: 32px; }
.chal-goal { display: flex; align-items: center; gap: 4px; font-size: 16px; }
.chal-goal img { width: 24px; height: 24px; }
.chal-goal.big { font-size: 20px; margin: 4px 0 0; }
.chal-goal.big img { width: 32px; height: 32px; }
.chal-goal b { font-family: var(--font-display); font-weight: normal; }
.chal-reward { display: flex; align-items: center; gap: 2px; font-size: 15px; color: var(--ink-soft); margin-top: auto; }
.chal-reward img { width: 28px; height: 28px; }
.chal-reward .ei { transform: scale(1.5); margin: 0 6px; }
.rules { list-style: none; margin: 6px 0 0; padding: 0; }
.rules li { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 18px; }
.rule-dot { width: 24px; text-align: center; color: var(--ink-soft); }
.reward-card { margin-top: 6px; padding: 10px 14px; border: 2.5px solid var(--gold); border-radius: 12px 7px 14px 8px; background: rgba(232, 194, 82, 0.12); }
.reward-card + .reward-card { margin-top: 10px; }
.reward-text { margin: 0 0 6px; font: 19px var(--font-display); }

/* ---------- secrets page */
.fmap { padding: 16px 20px 18px; margin-bottom: 26px; }
.fmap-title { font: 28px var(--font-display); margin: 0; transform: rotate(-1deg); }
.fmap-legend { margin: 2px 0 12px; font-size: 16px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.fmap-key::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px; border: 2px solid var(--ink); border-radius: 3px; background: rgba(255, 252, 240, 0.6); }
.fmap-key.is-alt::before { border-color: var(--blood); background: rgba(158, 27, 18, 0.1); }
.fmap-key.is-optional::before { border-style: dashed; }
.fmap-grid { display: flex; flex-direction: column; gap: 10px; position: relative; }
.fmap-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: stretch; position: relative; }
/* the descent: a dotted line down the middle of the main column */
.fmap-row:not(:last-child) .fmap-cell:not(.is-alt):not(.is-empty)::after {
  content: ""; position: absolute; left: 50%; bottom: -12px; height: 12px; border-left: 2px dotted var(--ink-soft);
}
.fmap-chapter { font: 15px var(--font-display); color: var(--ink-soft); align-self: center; }
.fmap-cell {
  position: relative;
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 7px 11px 6px 12px;
  background: rgba(255, 252, 240, 0.55);
  color: var(--ink);
  text-decoration: none;
}
.fmap-cell.is-alt { border-color: var(--blood); background: rgba(158, 27, 18, 0.08); }
.fmap-cell.is-empty { border: 0; background: none; }
.fmap-row.is-optional .fmap-cell:not(.is-empty) { border-style: dashed; }
a.fmap-cell:hover { transform: rotate(-0.8deg); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); }
a.fmap-cell:focus-visible { outline: 3px dashed var(--focus); outline-offset: 2px; }
.fmap-floors { font: 17px/1.15 var(--font-display); }
.fmap-boss { display: flex; align-items: center; gap: 4px; font-size: 16px; }
.fmap-boss img { width: 24px; height: 24px; }
.fmap-how { font-size: 14px; color: var(--ink-soft); line-height: 1.2; }
.fmap-cell.is-alt .fmap-how { color: var(--blood); }

.secret-grid {
  list-style: none; margin: 0 0 12px; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
}
.secret-card {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto 1fr; gap: 2px 10px;
  height: 100%; padding: 12px 14px;
  color: var(--ink); text-decoration: none;
  transform: rotate(var(--tilt, 0deg)); transition: transform 0.15s;
}
.secret-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(170deg, var(--paper), var(--paper-2));
  box-shadow: 0 0 0 2px var(--ink) inset, 0 5px 0 rgba(0, 0, 0, 0.35);
  filter: url(#rough-sm); border-radius: 3px;
}
.secret-card:hover, .secret-card:focus-visible, .secret-card.is-current { transform: rotate(0) translateY(-3px); }
.secret-card:focus-visible { outline: 3px dashed var(--focus); outline-offset: 3px; }
.secret-card.is-current::before { box-shadow: 0 0 0 3px var(--blood) inset, 0 5px 0 rgba(0, 0, 0, 0.35); }
.secret-icon { grid-row: 1 / 3; display: grid; place-items: center; width: 48px; height: 48px; }
.secret-icon img { width: 48px; height: 48px; }
.secret-icon .ei { transform: scale(1.5); }
.secret-title { font: 19px/1.1 var(--font-display); align-self: end; }
.secret-summary { font-size: 16px; color: var(--ink-soft); line-height: 1.25; }
.secret-hero { display: grid; place-items: center; width: 110px; height: 110px; }
.secret-hero img { width: 96px; height: 96px; }
.secret-hero .ei { transform: scale(3); }
.secret-lead { color: var(--ink); font-size: 19px; }
.secret-text { margin: 6px 0 0; font-size: 18px; }
.secret-list li { margin: 5px 0; }
.nav-icon { width: 28px; height: 28px; }
i.nav-icon { transform: scale(1.2); width: auto; }
.ref { white-space: nowrap; color: var(--ink); text-decoration: none; font-weight: bold; }
a.ref { text-decoration: underline; text-decoration-color: rgba(43, 28, 19, 0.35); text-underline-offset: 3px; }
a.ref:hover { color: var(--blood); }
.ref img { width: 28px; height: 28px; vertical-align: middle; margin: -6px 2px -4px 0; }
.ref .ei { margin-right: 3px; }
.ref-steam, .thing-steam { border-radius: 3px; image-rendering: auto; }
.ref .ref-steam { width: 22px; height: 22px; }
.thing .thing-steam { width: 30px; height: 30px; }
.ref-boss img { width: 22px; height: 22px; }
@media (max-width: 720px) {
  .fmap { padding: 12px; }
  .fmap-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fmap-chapter { grid-column: 1 / -1; }
  .fmap-row:not(:last-child) .fmap-cell:not(.is-alt):not(.is-empty)::after { display: none; }
}

/* ---------- cards & runes page */
.card-img { image-rendering: pixelated; }
.card-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.card-slot { height: 92px; border-radius: 10px; }
.card-slot img { filter: drop-shadow(0 4px 2px rgba(0, 0, 0, 0.45)); }
.card-slot::before { bottom: 2px; width: 34px; }
.slot.card-slot:hover img, .slot.card-slot:focus-visible img { animation: bob 0.9s ease-in-out infinite; }
/* Tarot Cloth mode: cards it improves glow purple */
.is-cloth .card-slot.has-cloth { background: radial-gradient(circle, rgba(170, 90, 230, 0.35), transparent 70%); }
.is-cloth .card-slot:not(.has-cloth) img { opacity: 0.55; }
.toggle-cloth img { width: 28px; height: 28px; margin: -6px 0; }
.c-purple { color: #7b2fb0; font-weight: bold; }
.variant-label.is-cloth { color: #7b2fb0; }
.chip-cloth[aria-pressed="true"] { border-color: #8e44c4; background: rgba(142, 68, 196, 0.16); color: #6b2598; }
.card-hero { display: flex; align-items: flex-end; justify-content: center; gap: 22px; min-height: 110px; }
.card-hero figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.card-hero figcaption { font-size: 14px; color: var(--ink-soft); }
.card-hero .card-img { filter: drop-shadow(0 6px 3px rgba(43, 28, 19, 0.35)); animation: bob 2s ease-in-out infinite; }
.nav-card { height: 30px; width: auto; }
.thing .thing-card, .ref .ref-card { height: 30px; width: auto; }
.ref .ref-card { height: 24px; }
.give-card { height: 30px; width: auto; }
.chal-reward .give-card, .ach-gives .give-card { height: 28px; }

/* ---------- achievements page */
.ach-hint { margin: -8px 0 14px; font-size: 17px; text-align: center; text-shadow: 0 1px 0 #000, 0 0 4px #000; }
.ach-hint a { color: var(--gold); }
.ach-sheet { padding: 8px 14px; }
.ach-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ach-cell { border-bottom: 2px dashed rgba(43, 28, 19, 0.2); }
.ach-cell[hidden] { display: none; }
.ach-row {
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 92px;
  align-items: center;
  gap: 12px;
  padding: 8px 6px;
  text-align: left;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.ach-row:hover { background: rgba(255, 250, 235, 0.35); }
.ach-row:focus-visible { outline: 3px dashed var(--blood); outline-offset: -2px; }
.ach-row.is-current { background: rgba(158, 27, 18, 0.1); }
.ach-icon { width: 48px; height: 48px; border: 2px solid var(--ink); border-radius: 3px; image-rendering: auto; background: var(--ink); }
.ach-main { display: flex; flex-direction: column; min-width: 0; }
.ach-title { font: 18px/1.15 var(--font-display); }
.ach-id { font: 15px var(--font-body); color: var(--blood); margin-right: 2px; }
.ach-text { font-size: 16px; color: var(--ink-soft); line-height: 1.25; }
.ach-gives { display: flex; gap: 2px; }
.ach-gives img { width: 32px; height: 32px; }
.ach-pct { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font: 16px var(--font-display); }
.ach-bar { position: relative; width: 80px; height: 7px; border: 1.5px solid var(--ink); border-radius: 4px; overflow: hidden; }
.ach-bar::after { content: ""; position: absolute; inset: 0; width: var(--p); background: var(--rar, var(--ink-soft)); }
.very-rare { --rar: var(--blood-bright); color: var(--blood); }
.rare { --rar: #c7731c; }
.uncommon { --rar: #b39a2c; }
.common { --rar: var(--up); }
.ach-empty { color: var(--ink-soft); text-shadow: none; }
.hero-steam { width: 96px; height: 96px; border: 3px solid var(--ink); border-radius: 4px; image-rendering: auto; transform: rotate(-3deg); }
.ach-paper.big { max-width: 320px; margin-top: 14px; }
.nav-steam { width: 32px; height: 32px; image-rendering: auto; border-radius: 2px; }
.rarity-bar { display: block; height: 14px; margin-top: 6px; border: 2px solid var(--ink); border-radius: 7px; overflow: hidden; }
.rarity-bar span { display: block; height: 100%; background: var(--rar, var(--ink-soft)); }
.rarity p { margin: 6px 0 0; font-size: 19px; color: var(--ink); }
.rarity b { font-family: var(--font-display); font-weight: normal; }
.unlock-ach a { color: inherit; }
.mark-cond a { color: var(--ink-soft); }
@media (max-width: 720px) {
  .ach-row { grid-template-columns: 40px minmax(0, 1fr) 64px; gap: 8px; }
  .ach-icon { width: 40px; height: 40px; }
  .ach-gives { display: none; }
  .ach-bar { width: 56px; }
}

/* ---------- coming soon */
.soon { display: grid; place-items: center; padding: 40px 0 60px; }
.soon-note { width: min(520px, 100%); padding: 36px 32px 32px; text-align: center; transform: rotate(-1.5deg); }
.soon-lock { position: relative; display: inline-grid; place-items: center; width: 110px; height: 110px; }
.soon-lock img, .soon-lock .ei { filter: brightness(0) opacity(0.85); }
.soon-lock img { width: 96px; height: 96px; }
.soon-lock .ei.big { transform: scale(2.4); }
.soon-q { position: absolute; font: 56px var(--font-display); color: var(--paper); text-shadow: 0 0 0 var(--ink); }
.soon-title { font: 40px var(--font-display); margin: 6px 0 0; }
.soon-sub { display: inline-block; margin: 6px 0 12px; padding: 2px 14px; font: 22px var(--font-display); color: var(--on-dark); background: var(--blood); transform: rotate(2deg); }
.soon-blurb { font-size: 21px; margin: 0 0 12px; }
.soon-hint { font-size: 18px; color: var(--ink-soft); margin: 0; }
.soon-hint a { color: var(--blood); }

/* ---------- footer */
.site-footer { max-width: 1280px; margin: 0 auto; padding: 10px 20px 30px; font-size: 15px; color: var(--on-dark); text-align: center; text-shadow: 0 1px 0 #000, 0 0 4px #000; }
.site-footer a { color: var(--on-dark); }
.site-footer .version { margin-top: 4px; font-size: 14px; opacity: 0.85; }

/* ---------- small screens */
@media (max-width: 720px) {
  :root { --slot: 56px; }
  body { font-size: 18px; }
  .site-header { padding: 14px 16px 6px; gap: 10px; }
  .brand-icon { width: 48px; height: 48px; }
  .brand-title { font-size: 28px; }
  .tabs { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; font-size: 16px; }
  main { padding: 6px 16px 30px; }
  .toolbar { position: relative; top: 0; padding: 12px 12px 8px; }
  .filters { gap: 8px 14px; display: none; }
  .toolbar.filters-open .filters { display: flex; }
  .filters-toggle { display: inline-flex; }
  .slot img { width: 48px; height: 48px; }
  .slot::before { width: 30px; bottom: 4px; }
  .drawer {
    top: auto; left: 0; width: 100vw; max-height: 88vh;
    padding: 0 8px 8px;
    transform: translateY(105%);
  }
  .drawer-inner { padding: 10px 14px 18px; }
  .streak.big .streak-name { font-size: 25px; }
  .tooltip { display: none !important; }
}

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