/* Independent Fog Atlas presentation. Load after the base stylesheet. */
[hidden] { display: none !important; }
.usage-details { margin-top: 1rem; }
.usage-details > summary { cursor: pointer; padding: .75rem 0; color: var(--muted); }
.character-story { margin-top: 1.5rem; padding: .1rem 1.2rem 1rem; border-left: 2px solid var(--accent); background: #24131766; }
.character-story p { line-height: 1.9; }
.record-description { margin: 1.5rem 0; }
.description-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.9; }
.description-tiers { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; }
.description-tier { min-height: 44px; padding: .5rem 1rem; }
.description-tier[aria-pressed="true"] { background: #711621; border-color: var(--accent); color: #fff; }
.description-warning { color: #e5a4ac; }
.tags button.tag { min-height: 32px; cursor: pointer; }
.tags button.tag:hover { color: #ffe7e9; border-color: var(--red); }
.perk-tag-panel { margin: 1.5rem 0; padding: 0 1rem 1rem; border: 1px solid var(--line); background: #11161b; }
.perk-tag-editor > summary { cursor: pointer; color: #df9199; padding: .5rem 0; min-height: 44px; }
.tag-choices { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .3rem .6rem; padding: .75rem; border: 1px solid var(--line); }
.tag-choices legend { color: var(--muted); font-size: .8rem; }
.tag-choices label { display: flex; align-items: center; gap: .5rem; min-width: 0; min-height: 44px; font-size: .8rem; overflow-wrap: anywhere; cursor: pointer; }
.tag-choices input[type=checkbox] { width: 18px; height: 18px; flex: 0 0 18px; margin: 0; accent-color: var(--red); }
#perk-tag-form > label { display: block; margin-top: .8rem; color: var(--muted); font-size: .8rem; }
#perk-tag-form > input { width: 100%; margin: .4rem 0 .8rem; }
@media(max-width:600px) { .tag-choices { grid-template-columns: repeat(2,minmax(0,1fr)); padding: .5rem; } .perk-tag-panel { padding: 0 .7rem .7rem; } }
:root {
  --bg: #08090a;
  --panel: #111315;
  --elevated: #191c1f;
  --line: #303438;
  --text: #f1f0ed;
  --muted: #a1a5aa;
  --red: #ee454c;
  --accent: #831820;
  --amber: #dfb576;
}

body {
  background: radial-gradient(ellipse at 90% 0%, #38101555, transparent 40rem),
    radial-gradient(ellipse at 0% 45%, #20242955, transparent 36rem), var(--bg);
  background-attachment: fixed;
}
html { scrollbar-gutter: stable; }
html:has(dialog[open]), body:has(dialog[open]) { overflow: hidden; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
#detail-title:focus { outline: 3px solid var(--red); outline-offset: 4px; }
.card:focus-within { border-color: #b53e49; }

.masthead { height: 88px; background: #08090ad9; border-bottom-color: #3c2226; }
.brand { letter-spacing: .16em; }
.sigil { color: var(--red); text-shadow: 0 0 28px #c4223340; }
main { max-width: 1400px; padding-top: 2rem; }
.workspace { padding-top: .5rem; }
.title-row { margin: .75rem 0 1rem; }
h1 { font-size: clamp(1.8rem, 3.6vw, 3rem); font-weight: 700; letter-spacing: .015em; }
.section-label { letter-spacing: .2em; }
.intro { max-width: 48rem; color: var(--muted); margin: 0 0 1.5rem; }
.archive-number { color: #929ba5; font-size: .8rem; letter-spacing: .07em; }
.search-wrap { background: #111417; border-color: #363b40; border-left-color: var(--red); }
.search-wrap:focus-within { border-color: #a23039; box-shadow: 0 0 0 1px #85232b33; }
.search-symbol { color: #c8c9c8; }

button, select, textarea { border-radius: 0; }
button:hover:enabled { background: #271316; border-color: var(--red); }
.roles button { background: #0d1012; border-color: #373b3f; }
.roles button[aria-pressed="true"] { background: #7f1721; border-color: #c53641; }
.views { gap: .35rem; }
.views button { padding: .6rem .8rem; border: 1px solid transparent; }
.views button[aria-pressed="true"] { background: #361216; border: 1px solid #a92b36; color: #fff1ef; }
.control-row { gap: 1.15rem; }
.filter-row { gap: 1rem; }
.field label { font-size: .8rem; letter-spacing: .025em; }
select { background: #111416; border-color: #353a3e; }

.atlas-nav { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.atlas-nav > button { background: #0c0f11; }
.atlas-nav > button[aria-pressed="true"] { background: #351216; border-color: #a8323d; color: #fff4f2; }
.snapshot-picker { display: flex; align-items: center; gap: .6rem; margin-left: auto; min-width: 0; }
.snapshot-picker label { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.snapshot-picker select { width: auto; min-width: 10rem; max-width: 18rem; }
.snapshot-note { font-size: .8rem; }

.archive-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; margin-top: .6rem; border-bottom: 1px solid #2b2e32; }
.archive-toolbar p { margin: 0; color: #a1a8b0; font-size: .8rem; line-height: 1.8; }
.archive-toolbar .text-button { font-size: .8rem; }
.results-header { margin: 1.8rem 0 1.15rem; flex-wrap: wrap; }
.results-header h2 { font-size: 1.15rem; letter-spacing: .06em; }
.results-header > span { font: .8rem monospace; }

.grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.card { min-width: 0; background: linear-gradient(145deg, #16191c, #0c0e10 75%); border: 1px solid #33383d; border-top: 2px solid #3c4249; padding: 1.25rem; box-shadow: 0 12px 30px #0003; transition: border-color .18s, transform .18s, box-shadow .18s; }
.card:hover { transform: translateY(-3px); border-color: #99313a; border-top-color: #ef454e; box-shadow: 0 14px 32px #0006, 0 0 24px #a92a3110; }
.card-top { color: #a1a8b0; font-size: .8rem; letter-spacing: .08em; }
.card-index { color: #929ba5; }
.record-heading { gap: 1.2rem; margin: 1.1rem 0 .8rem; min-height: 90px; }
.record-names { min-width: 0; flex: 1; }
.record-heading h3 { margin: 0 0 .35rem; font-size: 1.1rem; line-height: 1.45; font-weight: 650; }
.secondary-name { margin: .3rem 0 0; color: #a1a8b0; font-size: .8rem; line-height: 1.45; }

.icon-frame, .chip-icon-frame { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: #171b20; border: 1px solid #4b5260; box-shadow: inset 0 0 22px #0007; }
.icon-frame { width: 72px; height: 72px; margin: .4rem; }
.record-icon { width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 2px 6px #000b); }
.chip-icon-frame { width: 32px; height: 32px; margin: .2rem; }
.chip-icon { width: 29px; height: 29px; object-fit: contain; }
.perk-icon-frame { transform: rotate(45deg); background: radial-gradient(ellipse at center, #49304f, #211625 85%); border-color: #75617b; }
.perk-icon-frame > img { transform: rotate(-45deg); }
.card:hover .perk-icon-frame { border-color: #d95862; box-shadow: inset 0 0 22px #0007, 0 0 18px #8b18272e; }
.icon-frame[hidden], .chip-icon-frame[hidden] { display: none; }

.card-summary { color: #c2c5c8; font-size: .89rem; line-height: 1.75; margin: .3rem 0 .9rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.tags { gap: .35rem; }
.tag { color: #b8bfc7; border-color: #394047; font-size: .8rem; padding: .13rem .45rem; }
.resource-warning { color: #e5b57a; border-color: #815d35; background: #36281b55; }
.rarity-tag { border-color: #59616c; color: #c4cbd3; background: #252a3155; }
.rarity-common { color: #cabd9c; border-color: #74684d; background: #5f503f30; }
.rarity-uncommon { color: #e0ca74; border-color: #92813c; background: #76612430; }
.rarity-rare { color: #a1cf79; border-color: #617d42; background: #3c5d2930; }
.rarity-veryrare { color: #c8a4de; border-color: #8c61a5; background: #60397730; }
.rarity-ultrarare { color: #eda09f; border-color: #a9565b; background: #8c323530; }
.rarity-event { color: #eab870; border-color: #a87532; background: #99652930; }
.rarity-visceral, .rarity-special { color: #dfb4c6; border-color: #9a6178; background: #6c3a5130; }
.card-action { margin-top: auto; padding-top: 1rem; }
.card-action button { width: 100%; border-color: #3e454d; background: #15191d; color: #e8e6e2; letter-spacing: .025em; }
.card-action button:hover { background: #43171d; border-color: #c23845; }
.perk-chip { background: #11161a; border-color: #353d44; gap: .75rem; line-height: 1.5; }
.perk-chip:hover { background: #28151a; border-color: #9c2e3b; }
.perk-chip span:last-child { color: #e0e2e3; }
.perk-list { gap: .7rem; }
.empty, .load-state { background: #11141677; border-color: #373c43; }
.pagination button { min-width: 6rem; background: #101316; }
footer { margin-top: 1rem; color: #a1a8b0; border-top-color: #2d3338; font-size: .8rem; }
.community-stats, .ranking-mode, .ranking-perks, .ranking-score,
.ranking-card .fineprint, .ranking-source, .post-reference,
.reference-editor-chip, .reference-editor-chip button, .eyebrow { font-size: .8rem; }
.post-footer { flex-wrap: wrap; }

dialog { width: min(760px, calc(100vw - 2rem)); border-color: #444c55; background: linear-gradient(155deg, #171b1f, #0b0e11 70%); box-shadow: 0 28px 90px #000b; }
dialog::backdrop { background: #030507db; backdrop-filter: blur(6px); }
.dialog-top { padding-bottom: .7rem; border-bottom: 1px solid #343b43; }
#detail-content > .record-heading { margin: 1.5rem 0 1.1rem; }
#detail-content > .record-heading h3 { font-size: clamp(1.3rem, 3vw, 1.85rem); }
#detail-content > p { font-size: 1rem; line-height: 1.95; color: #d2d3d2; }
#detail-content h4 { font-size: .9rem; color: #b3bcc6; letter-spacing: .045em; margin: 1.5rem 0 .7rem; }
.archive-details { margin-top: 1.8rem; border-top: 1px solid #343c44; }
.archive-details > summary { cursor: pointer; padding: 1rem .2rem; color: #939da8; font-size: .82rem; letter-spacing: .04em; }
.archive-details > summary:hover { color: #e19da5; }
.archive-details[open] > summary { color: #d4b2b7; }
.archive-details > .record-status { margin: .7rem 0 1rem; }
.archive-details .fineprint { color: #a1a8b0; font-size: .8rem; }
.archive-details .fact-table { font-size: .8rem; margin: 1rem 0; table-layout: fixed; }
.archive-details .fact-table th { width: 34%; color: #98a4b0; }
.archive-details .fact-table td { color: #c1c9d0; }
.archive-details .fact-table th, .archive-details .fact-table td { overflow-wrap: anywhere; padding: .75rem .6rem; border-bottom-color: #2b333b; }
.archive-details .fact-table tr:nth-child(even) { background: #131a2055; }
.archive-details a { color: #d37f89; font-size: .8rem; }
.record-status { gap: .4rem; }
.source-status, .mechanics-status { font-size: .8rem; padding: .18rem .5rem; }

@media (max-width: 1200px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .control-row { align-items: flex-start; }
  .views { justify-content: flex-start; }
}

@media (max-width: 820px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .snapshot-picker { width: 100%; margin-left: 0; }
  .snapshot-picker select { flex: 1; max-width: none; }
  .archive-number { display: none; }
}

@media (max-width: 600px) {
  body { background-attachment: scroll; }
  button, .tags button.tag { min-height: 44px; }
  input, select, textarea, form input, form textarea, .snapshot-picker select { font-size: 1rem; }
  .ranking-source, footer a { display: inline-flex; align-items: center; min-height: 44px; }
  .masthead { height: auto; min-height: 76px; padding: .75rem 1rem; flex-wrap: wrap; }
  .header-right { margin-left: auto; }
  main { padding: 1.4rem 1rem 2.5rem; }
  .atlas-nav { gap: .4rem; padding-bottom: 1rem; }
  .atlas-nav > button { padding: .55rem .6rem; font-size: .8rem; flex: 1; white-space: nowrap; }
  .snapshot-picker { gap: .65rem; }
  .snapshot-picker select { min-width: 0; }
  .snapshot-note { line-height: 1.65; margin: .7rem 0 1.2rem; }
  .section-label { font-size: .8rem; letter-spacing: .14em; }
  h1 { font-size: 1.9rem; line-height: 1.35; }
  .intro { font-size: .88rem; line-height: 1.8; }
  .search-wrap { height: 56px; }
  .control-row { margin: 1.1rem 0; gap: .8rem; }
  .roles { width: 100%; gap: .45rem; }
  .roles button { min-width: 0; overflow-wrap: anywhere; }
  .views { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; }
  .views button { min-height: 44px; padding: .5rem .3rem; font-size: .82rem; overflow-wrap: anywhere; }
  .filter-row { gap: .7rem; }
  .filter-row .field, .filter-row .field:last-of-type { flex-basis: calc(50% - .35rem); min-width: 0; }
  .archive-toolbar { align-items: flex-start; padding: .9rem 0; gap: .7rem; }
  .archive-toolbar p { font-size: .8rem; }
  .archive-toolbar .text-button { font-size: .8rem; padding-top: 0; }
  .archive-toolbar p { min-width: 0; overflow-wrap: anywhere; }
  .results-header { margin-top: 1.4rem; }
  .results-header h2 { font-size: 1.05rem; }
  .grid { grid-template-columns: 1fr; gap: .85rem; }
  .card { padding: 1.15rem; }
  .record-heading { gap: 1.3rem; margin: 1.1rem 0 .85rem; }
  .record-heading h3 { font-size: 1.2rem; }
  .card-summary { font-size: .93rem; }
  .card-action button { min-height: 44px; }
  .pagination { flex-wrap: wrap; gap: .6rem; }
  .pagination button { min-width: 5rem; }
  footer { flex-wrap: wrap; }
  .reference-editor-chip { flex-wrap: wrap; }
  .reference-editor-chip button { white-space: normal; overflow-wrap: anywhere; }
  dialog { padding: 1rem; }
  #detail-content > .record-heading { gap: 1.1rem; }
  .archive-details .fact-table { font-size: .8rem; }
  .archive-details .fact-table th { width: 35%; }
  .archive-details .fact-table th, .archive-details .fact-table td { padding: .65rem .4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .card:hover { transform: none; transition: none; }
  dialog::backdrop { backdrop-filter: none; }
}
