/* Terraria wiki: compact layout (terraria-wiki.mjs), based on the A Link to the Past / Wild World layout. Uses the site palette variables. */
.trw{--trw-line:color-mix(in srgb,var(--line,#393732) 85%,#fff 15%);--trw-soft:color-mix(in srgb,var(--surface,#1c1c1c) 80%,#000 20%);font-size:15px;line-height:1.5;min-width:0}
.trw h1{font-size:clamp(1.45rem,1.1rem + 1.4vw,2rem);line-height:1.15;margin:.2rem 0 .5rem}
.trw-h1-sub{display:block;font-size:.55em;font-weight:600;color:var(--muted,#aaa69d);letter-spacing:.02em;margin-top:.2rem}
.trw h2{font-size:1.15rem;margin:1.6rem 0 .6rem;padding-bottom:.3rem;border-bottom:1px solid var(--trw-line)}
.trw h3{font-size:1rem;margin:0 0 .2rem}
.trw p{margin:.4rem 0}
.trw a{color:var(--accent,var(--gold))}
.trw small{display:block;color:var(--muted,#aaa69d);font-size:.8rem}
.trw-px{image-rendering:pixelated;image-rendering:crisp-edges}
.trw img{max-width:100%;height:auto}
.trw-muted{color:var(--muted,#aaa69d);font-size:.86rem}
.trw-lead{font-size:1.02rem;color:var(--text);max-width:70ch}
.trw-crumbs{font-size:.8rem;color:var(--muted);margin-bottom:.4rem}
.trw-crumbs a{color:var(--muted)}
.trw-scope{font-size:.82rem;color:var(--muted)}
.trw-facts{display:flex;flex-wrap:wrap;gap:6px;margin:.7rem 0;padding:0}
.trw-facts>div{background:var(--trw-soft);border:1px solid var(--trw-line);border-radius:6px;padding:4px 10px;min-width:0}
.trw-facts dt{font-size:.68rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}
.trw-facts dd{margin:0;font-weight:600;font-size:.9rem}
.trw-fig{margin:0}
.trw-fig figcaption{font-size:.8rem;color:var(--muted);margin-top:4px}
.trw-fig img{display:block;border-radius:4px;background:#000;width:100%}
/* inline item links with a tiny sprite */
.trw-item{display:inline-flex;align-items:center;gap:4px;white-space:nowrap;margin:1px 6px 1px 0}
.trw-mini{width:18px;height:18px;object-fit:contain;flex:none}
.trw-chip{display:inline-block;font-size:.74rem;padding:1px 8px;border:1px solid var(--trw-line);border-radius:999px;text-decoration:none;margin-left:4px;white-space:nowrap}
/* dungeon page top */
.trw-top{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:14px;align-items:start;margin:.8rem 0}
.trw-panel{background:var(--trw-soft);border:1px solid var(--trw-line);border-radius:6px;padding:10px 12px}
.trw-panel h2{margin:0 0 .4rem;border:0;font-size:1rem}
.trw-kv{margin:0}
.trw-kv>div{padding:5px 0;border-top:1px solid var(--trw-line);font-size:.88rem}
.trw-kv>div:first-child{border-top:0}
.trw-kv dt{font-weight:700;font-size:.78rem;color:var(--secondary,var(--gold))}
.trw-kv dd{margin:0}
.trw-foe-row{display:flex;flex-wrap:wrap;gap:6px}
.trw-foe-row a{display:flex;align-items:center;gap:6px;text-decoration:none;color:var(--text);border:1px solid var(--trw-line);border-radius:6px;padding:4px 8px 4px 4px;font-size:.82rem;background:var(--trw-soft)}
.trw-foe-row a>span{width:34px;height:34px;display:grid;place-items:center;background:#000;border-radius:4px;flex:none}
.trw-foe-row img{max-width:30px;max-height:30px;width:auto;height:auto}
/* dungeons hub */
.trw-dgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px;margin:.6rem 0}
.trw-dcard{display:flex;flex-direction:column;border:1px solid var(--trw-line);border-radius:7px;overflow:hidden;text-decoration:none;background:var(--trw-soft);scroll-margin-top:80px}
.trw .trw-dcard{color:var(--text)}
.trw-dcard:hover,.trw-dcard:focus-visible{border-color:var(--accent,var(--gold))}
.trw-dshot{display:block;background:#000;aspect-ratio:8/7;overflow:hidden}
.trw-dshot img{display:block;width:100%;height:100%;object-fit:cover}
.trw-dbody{padding:8px 10px;display:grid;gap:1px;font-size:.84rem}
.trw-dbody strong{font-size:1.02rem}
.trw-table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
.trw-table{width:100%;border-collapse:collapse;font-size:.86rem}
.trw-table th,.trw-table td{padding:6px 8px;border-bottom:1px solid var(--trw-line);text-align:left;vertical-align:top}
.trw-table thead th{font-size:.72rem;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}
.trw-table tr{scroll-margin-top:80px}
.trw-table tr:target{background:var(--trw-soft);outline:2px solid var(--accent,var(--gold));outline-offset:-2px}
.trw-item-table th[scope=row]{display:flex;align-items:center;gap:8px;white-space:nowrap}
.trw-sprite{width:32px;height:32px;object-fit:contain;flex:none}
.trw-sprite-lg{width:64px;height:auto}
.trw-h2-pic{width:26px;height:26px;object-fit:contain;vertical-align:-6px;margin-right:8px}
.trw-tips ul,.trw-list,.trw-route{padding-left:1.3rem;margin:.3rem 0}
.trw-tips li,.trw-list li{margin:.25rem 0}
.trw-route li{margin:.35rem 0;padding-left:.2rem}
.trw-route strong{color:var(--secondary,var(--gold));margin-right:4px}
/* FAQ + sources */
.trw-faq details{border:1px solid var(--trw-line);border-radius:6px;padding:6px 10px;margin:6px 0;background:var(--trw-soft)}
.trw-faq summary{cursor:pointer;font-weight:600}
.trw-sources{margin-top:1.4rem;font-size:.82rem;color:var(--muted)}
.trw-sources summary{cursor:pointer}
.trw-sources ul{columns:2;column-gap:20px;padding-left:1.1rem}
.trw-sources li{overflow-wrap:anywhere}
/* home */
.trw-hero{display:grid;grid-template-columns:220px minmax(0,1fr);gap:16px;align-items:start}
.trw-hero>a img{width:220px;border-radius:5px;display:block}
.trw-cta a{font-weight:700}
.trw-topic-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:8px}
.trw-topic-grid a,.trw-related a{display:flex;gap:10px;align-items:center;text-decoration:none;color:var(--text);border:1px solid var(--trw-line);border-radius:7px;padding:8px;background:var(--trw-soft);font-size:.82rem}
.trw-topic-grid a:hover,.trw-related a:hover{border-color:var(--accent,var(--gold))}
.trw-topic-grid img,.trw-related img{width:56px;height:56px;object-fit:contain;flex:none;background:#000;border-radius:4px}
.trw-topic-grid strong{display:block;color:var(--accent,var(--gold));font-size:.95rem}
.trw-strip{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:8px}
.trw-strip a{display:grid;gap:4px;text-decoration:none;font-size:.78rem;color:var(--text)}
.trw-strip img{width:100%;aspect-ratio:8/7;object-fit:cover;background:#000;border-radius:4px}
.trw-trivia{padding-left:1.2rem;font-size:.9rem}
.trw-related{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:8px;margin-top:1.4rem}
/* characters + enemies */
.trw-char-grid,.trw-enemy-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:8px}
.trw-char,.trw-enemy{display:flex;gap:10px;align-items:flex-start;border:1px solid var(--trw-line);border-radius:7px;padding:8px;background:var(--trw-soft);scroll-margin-top:80px}
.trw-char:target,.trw-enemy:target{border-color:var(--accent,var(--gold))}
.trw-char>a{flex:none;width:80px;height:100px;display:grid;place-items:center;background:#000;border-radius:5px;overflow:hidden}
.trw-char>a img{max-width:80px;max-height:100px;width:auto;height:auto;object-fit:contain}
.trw-char>a img.trw-px{min-width:40px}
.trw-char p,.trw-enemy p{font-size:.84rem;margin:.2rem 0}
.trw-role{color:var(--muted)}
.trw-enemy-pic{flex:none;width:64px;height:64px;display:grid;place-items:center;background:#000;border-radius:5px}
.trw-enemy-pic img{max-width:58px;max-height:58px;width:auto;height:auto}
.trw-enemy-pic img[width="16"],.trw-enemy-pic img[width="14"]{width:40px}
.trw-filter{display:flex;flex-wrap:wrap;gap:10px;align-items:end;margin:.6rem 0}
.trw-filter input{display:block;margin-top:3px;padding:6px 9px;border-radius:5px;border:1px solid var(--trw-line);background:var(--bg);color:var(--text);min-width:240px}
.trw-filter p{margin:0;color:var(--muted);font-size:.84rem}
.trw-jump{display:flex;flex-wrap:wrap;gap:5px;margin:.6rem 0}
.trw-jump a{font-size:.78rem;padding:3px 9px;border:1px solid var(--trw-line);border-radius:999px;text-decoration:none}
/* figures side by side */
.trw-side{display:grid;grid-template-columns:minmax(0,260px) minmax(0,1fr);gap:14px;align-items:start}
.trw-side>.trw-fig img{width:100%}
.trw-fig-row{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}
.trw-maps{grid-template-columns:repeat(2,minmax(0,1fr));margin:.8rem 0}
/* bosses */
/* pager */
.trw-pager{display:flex;justify-content:space-between;gap:10px;margin-top:1.2rem;flex-wrap:wrap}
.trw-pager a{border:1px solid var(--trw-line);border-radius:6px;padding:7px 12px;text-decoration:none;font-weight:600;font-size:.88rem}
/* gallery */
.trw-gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:8px}
.trw-gallery figure{margin:0;font-size:.74rem;text-align:center}
.trw-gallery figure>a{display:grid;place-items:center;aspect-ratio:1;background:#000;border-radius:5px;overflow:hidden}
.trw-gallery img{max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain}
.trw-gallery img.trw-px[width="16"],.trw-gallery img.trw-px[width="14"],.trw-gallery img.trw-px[width="24"],.trw-gallery img.trw-px[width="26"],.trw-gallery img.trw-px[width="28"],.trw-gallery img.trw-px[width="32"]{width:56px}
.trw-gallery figcaption{margin-top:3px;overflow-wrap:anywhere}
/* rail */
.trw-rail .infobox>a>img{display:block;width:100%;height:auto;max-height:220px;object-fit:contain}
.trw-rail-nav{border:1px solid var(--line);border-radius:6px;padding:10px;background:var(--surface);margin-top:12px}
.trw-rail-nav h2{font-size:.95rem;margin:0 0 .4rem}
.trw-rail-nav a{display:flex;gap:8px;align-items:center;padding:4px 0;text-decoration:none;font-size:.85rem;border-top:1px solid var(--line)}
.trw-rail-nav small{display:block;font-size:.7rem;color:var(--muted)}
.trw-rail-shot{width:48px;height:42px;object-fit:cover;background:#000;border-radius:3px;flex:none}
@media (max-width:900px){
 .trw-top{grid-template-columns:1fr}
 .trw-top .trw-fig{max-width:520px}
}
@media (max-width:640px){
 .trw-hero{grid-template-columns:110px minmax(0,1fr);gap:10px}
 .trw-hero>a img{width:110px}
 .trw-side{grid-template-columns:1fr}
 .trw-side>.trw-fig{max-width:340px}
 .trw-maps{grid-template-columns:1fr}
 .trw-sources ul{columns:1}
 .trw-dgrid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .trw-filter input{min-width:0;width:100%}
 .trw-filter label{flex:1}
 .trw-facts>div{padding:3px 8px}
}



/* Terraria additions */
.trw-px{image-rendering:pixelated;image-rendering:crisp-edges}
.trw-num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.trw-name{display:flex;align-items:center;gap:8px;min-width:140px}
.trw-ico{width:auto;height:auto;max-width:32px;max-height:32px;flex:none;vertical-align:middle;display:inline-block}
span.trw-ico{width:24px;height:24px}
.trw-inline{display:inline!important}
.trw-h3{font-size:1rem;margin:1rem 0 .4rem}
.trw-top{grid-template-columns:minmax(0,260px) minmax(0,1fr)}
.trw-boss-pic{margin:0;background:#0d1117;border-radius:6px;display:grid;place-items:center;min-height:200px;padding:10px}
.trw-boss-pic img{max-width:100%;max-height:300px;width:auto;height:auto}
.trw-boss-pic figcaption{font-size:.8rem;color:var(--muted)}
.trw-banner{margin:.4rem 0 .8rem}
.trw-banner img{width:100%;height:auto;border-radius:6px;display:block}
.trw-top-biome{grid-template-columns:auto minmax(0,1fr)}
.trw-biome-ico img{width:48px;height:auto}
.trw-stats{max-width:560px}
.trw-stats caption{text-align:left;font-weight:700;font-size:.86rem;padding:6px 0}
.trw-gear{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:8px}
.trw-gear p{font-size:.88rem;margin:0}
.trw-drops td{width:90px;vertical-align:middle}
.trw-chips{display:flex;flex-wrap:wrap;gap:6px}
.trw-chips .trw-chip{display:inline-flex;align-items:center;gap:5px;margin:0;font-size:.82rem;padding:3px 10px}
.trw-hm{border-color:color-mix(in srgb,var(--accent,var(--gold)) 60%,transparent)}
.trw-tip{border-left:3px solid var(--accent,var(--gold));padding-left:10px;font-size:.9rem}
/* cards */
.trw-dgrid{grid-template-columns:repeat(auto-fill,minmax(170px,1fr))}
.trw-dshot{aspect-ratio:4/3;display:grid!important;place-items:center;background:#0d1117}
.trw-dshot img{width:auto!important;height:auto!important;max-width:86%;max-height:86%;object-fit:contain}
.trw-dbody small{font-size:.78rem;display:flex!important;align-items:center;gap:4px}
.trw-bgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:8px}
.trw-bgrid-sm{grid-template-columns:repeat(auto-fill,minmax(180px,1fr))}
.trw-bcard{display:block;border:1px solid var(--trw-line);border-radius:7px;overflow:hidden;text-decoration:none;background:var(--trw-soft)}
.trw .trw-bcard{color:var(--text)}
.trw-bcard:hover{border-color:var(--accent,var(--gold))}
.trw-bcard img{display:block;width:100%;height:auto}
.trw-bcard span{display:block;padding:6px 10px;font-size:.88rem}
.trw-boss-row{display:flex;flex-wrap:wrap;gap:6px}
.trw-boss-row a{display:flex;align-items:center;gap:6px;text-decoration:none;color:var(--text);border:1px solid var(--trw-line);border-radius:6px;padding:4px 8px 4px 4px;background:var(--trw-soft);font-size:.82rem}
.trw .trw-boss-row a{color:var(--text)}
.trw-boss-mini{width:40px;height:40px;object-fit:contain;background:#0d1117;border-radius:4px}
/* NPCs and events */
.trw-npc-grid,.trw-event-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:8px}
.trw-npc,.trw-event{display:grid;grid-template-columns:64px minmax(0,1fr);gap:10px;border:1px solid var(--trw-line);border-radius:7px;padding:8px;background:var(--trw-soft);scroll-margin-top:80px}
.trw-event{grid-template-columns:1fr}
.trw-npc:target,.trw-event:target{border-color:var(--accent,var(--gold))}
.trw-npc h3,.trw-event h3{font-size:1rem;margin:0 0 .2rem}
.trw-npc p,.trw-event p{font-size:.84rem;margin:.2rem 0}
.trw-npc-pic{display:grid;place-items:center;background:#0d1117;border-radius:5px;height:72px}
.trw-npc-pic img{width:auto;height:auto;max-height:64px;transform:scale(1.4)}
.trw-event-pic img{width:100%;height:auto;aspect-ratio:4/1;object-fit:cover;border-radius:5px;display:block}
.trw-prefs{margin:.3rem 0 0;display:grid;gap:2px;font-size:.8rem}
.trw-prefs div{display:grid;grid-template-columns:62px minmax(0,1fr);gap:6px}
.trw-prefs dt{font-weight:700}
.trw-pref.love dt{color:#ff7aa8}.trw-pref.like dt{color:#7bd88f}.trw-pref.dislike dt{color:#f0b35a}.trw-pref.hate dt{color:#ff6b6b}
.trw-prefs dd{margin:0}
.trw-npc-row{display:flex;flex-wrap:wrap;gap:6px}
.trw-npc-row a{display:flex;align-items:center;gap:6px;text-decoration:none;color:var(--text);border:1px solid var(--trw-line);border-radius:6px;padding:4px 8px;background:var(--trw-soft);font-size:.82rem}
.trw .trw-npc-row a{color:var(--text)}
.trw-npc-row small{display:block}
.trw-npc-mini{height:40px;width:auto}
.trw-ores td small{display:block}
/* progression */
.trw-stage{scroll-margin-top:80px}
.trw-stage-no{display:inline-grid;place-items:center;width:26px;height:26px;border-radius:50%;background:var(--accent,var(--gold));color:#111;font-size:.85rem;margin-right:6px;vertical-align:middle}
/* home, rail, gallery */
.trw-hero{grid-template-columns:260px minmax(0,1fr)}
.trw-logo{width:100%;height:auto}
.trw-topic-grid img,.trw-related img{background:#0d1117;object-fit:contain}
.trw-rail .infobox>a>img{max-height:120px}
.trw-rail-ico{width:28px;height:28px;object-fit:contain;flex:none}
.trw-gallery figure>a{background:#0d1117}
.trw-gallery img{min-width:24px}
@media (max-width:640px){
 .trw-top,.trw-hero{grid-template-columns:1fr}
 .trw-boss-pic{min-height:140px}
 .trw-dgrid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .trw-dbody{padding:6px 8px;font-size:.78rem}
 .trw-bgrid{grid-template-columns:1fr 1fr}
 .trw-npc-grid,.trw-event-grid{grid-template-columns:1fr}
 .trw-ores thead{display:none}
 .trw-ores tr{display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid var(--trw-line);padding:4px 0}
 .trw-ores th,.trw-ores td{border:0;padding:2px 4px}
 .trw-ores td:nth-child(3)::before{content:'Alt: ';color:var(--muted)}
 .trw-ores td:nth-child(4){text-align:left}
 .trw-ores td:nth-child(4)::before{content:'Pickaxe: ';color:var(--muted)}
 .trw-ores td:nth-child(5){grid-column:1/-1}
}
.trw-group td{font-size:.76rem;font-weight:700;color:var(--secondary,var(--gold));padding-top:10px;border-bottom:0}
.trw-in-group th[scope=row]{padding-left:18px}
.trw-drops small{display:block;font-weight:400}
.trw-table-wrap+.trw-h3,.trw-drops+.trw-h3,div+h3.trw-h3{margin-top:18px}
