.topbar { max-width: none; margin-bottom: 20px; }
.guild-banner { position: relative; isolation: isolate; overflow: hidden; border-radius: 18px; background: #271d46; border: 1px solid #e6bd8855; }
.guild-scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 60% 45%; z-index: -2; }
.guild-banner::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg,#17102fee 0%,#17102fd9 31%,#17102f00 68%); }
.guild-welcome { display: flex; gap: 22px; align-items: center; min-height: 380px; padding: 36px; max-width: 565px; }
.guild-world { color: #f4cb9a; font-size: 13px; margin-bottom: 8px; }
.guild-welcome h1 { font-size: clamp(32px,4vw,54px); line-height: 1.04; margin-bottom: 12px; }
.guild-welcome p:not(.guild-world) { color: #f4e7fc; max-width: 29ch; }
.guild-start { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 6px; text-decoration: none; background: #f4cb9a; color: #28152d; font-weight: 600; }
.guild-start:hover { background: #ffe0bc; }
.guild-stats { padding: 18px 0 24px; }
.guild-stats strong { color: #f4cb9a; }
.selection-panel::before { background-image: url('assets/guild-journal.webp'); filter: none; opacity: .13; background-position: 74% top; }
.counter-card::before { background-image: url('assets/guild-journal.webp'); filter: none; opacity: .065; }
#defenseTitle { scroll-margin-top: 24px; }
@media(max-width:760px) {
  .topbar { margin-bottom: 12px; }
  .guild-welcome { min-height: 0; max-width: none; padding: 18px; gap: 14px; }
  .guild-scene { position: static; height: clamp(110px,32vw,215px); object-position: 78% 43%; }
  .guild-banner::before { display: none; }
  .guild-welcome h1 { font-size: 29px; }
  .guild-welcome p:not(.guild-world) { font-size: 13px; }
  .guild-stats { gap: 10px; }
}

.archive-chibis { display: block; width: 100%; height: clamp(105px,15vw,180px); object-fit: cover; object-position: 70% 41%; border-radius: 14px; margin-bottom: 14px; }



/* Huge anime fortress, veiled in purple to keep archive content foremost. */
body {
  background-color: #211638;
  background-image: linear-gradient(#211638b8, #211638b8), url('assets/fortified-castle.webp');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
body::before { opacity: .35; }


.member-engraving {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  overflow: hidden; padding-inline: 12px; text-align: justify;
  font: 17px/42px Georgia, serif; letter-spacing: 1.2px;
  color: #dac0ef24; text-shadow: 0 -1px #0c061880;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
}
.member-engraving span { white-space: nowrap; }
.member-engraving .member-highlight { color: #ffd77d; text-shadow: 0 0 8px #ffb94b99, 0 1px 2px #251237; }

/* Gilded portrait mounts echo the pennant's corner ornaments. */
:is(.hero-card, .selected-slot, .counter-hero, .defense-portraits) img {
  border: 4px solid #6635a6;
  border-radius: 0;
  border-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Crect x='1' y='1' width='34' height='34' fill='none' stroke='%236635a6' stroke-width='2'/%3E%3Crect x='4' y='4' width='28' height='28' fill='none' stroke='%23a371e3'/%3E%3Cpath d='M1 12V1h11M24 1h11v11M35 24v11H24M12 35H1V24' fill='none' stroke='%23f8d9a0' stroke-width='2'/%3E%3Cpath d='m5 2 3 3-3 3-3-3zm26 0 3 3-3 3-3-3zM5 28l3 3-3 3-3-3zm26 0 3 3-3 3-3-3z' fill='%23f2ca94'/%3E%3C/svg%3E") 12 stretch;
}
.hero-card img { border-width: 3px; }
.defense-portraits img { border-width: 2px; }
.selected-slot.filled img,
.hero-card[aria-pressed="true"] img {
  box-shadow: 0 0 9px #f4cb9a65;
}
:is(.pet-pill, #selectedPetImage) img {
  border: 2px solid transparent;
  border-radius: 50%;
  background: linear-gradient(#1d1331, #1d1331) padding-box,
    conic-gradient(from 38deg, #e9bd78 0deg 12deg, #7541ba 12deg 90deg, #e9bd78 90deg 102deg, #7541ba 102deg 180deg, #e9bd78 180deg 192deg, #7541ba 192deg 270deg, #e9bd78 270deg 282deg, #7541ba 282deg) border-box;
  box-shadow: 0 0 0 1px #3d275a;
}




.defense-rankings { margin: 1rem 0; padding: 1rem 1.25rem; border: 1px solid #8d68c663; border-radius: 12px; background: #171026; }
.defense-rankings summary { cursor: pointer; color: #f7dfa5; font-weight: 700; }
.ranking-tier { margin-top: 1.5rem; }
.ranking-tier h3 { margin: 0 0 .5rem; color: #f7dfa5; }
.ranking-tier small { font-weight: 400; color: #c5b6d7; }
.ranking-table { overflow-x: auto; }
.ranking-table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ranking-table :is(th,td) { padding: .55rem .65rem; text-align: left; border-bottom: 1px solid #8d68c642; }
.ranking-table td { white-space: nowrap; }
.ranking-caption { text-align: left; color: #c5b6d7; font-size: .85rem; padding-bottom: .35rem; }
.ranking-trio { text-align: left; }

.ranking-trio { display: inline-grid; grid-template-columns: repeat(3,minmax(58px,72px)); gap: .4rem; align-items: start; }
.ranking-hero { display: grid; justify-items: center; gap: .3rem; text-align: center; font-size: .72rem; line-height: 1.15; }
.ranking-hero :is(img,.avatar-fallback) { width: 44px; height: 44px; object-fit: cover; border: 1px solid #a986d8; border-radius: 7px; }

.battle-modes { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin:18px 0; }
.battle-mode { display:flex; align-items:center; gap:16px; padding:12px 20px; min-height:150px; border:1px solid #75549c; border-radius:16px; background:#171026; color:#d9cbe9; text-align:left; cursor:pointer; }
.battle-mode[aria-pressed="true"] { border-color:#edca78; background:#33204c; box-shadow:inset 0 0 0 1px #edca7855,0 0 20px #8c50d229; }
.battle-mode:hover { border-color:#dfb5ff; }
.battle-mode:focus-visible { outline:3px solid #edd698; outline-offset:4px; }
.battle-mode strong { display:block; font-size:1.3rem; color:#f7dfa5; }
.battle-mode small { display:block; margin-top:6px; line-height:1.5; }
.mode-art { flex:0 0 125px; height:125px; background-image:url('assets/chibi-battle-modes.webp'); background-size:200% 100%; background-repeat:no-repeat; }
.mode-defense { background-position:left center; }
.mode-attack { background-position:right center; }
@media(max-width:600px) { .battle-modes { gap:8px; } .battle-mode { flex-direction:column; gap:4px; padding:10px; text-align:center; } .mode-art { flex-basis:100px; height:100px; width:100px; } .battle-mode strong { font-size:1.1rem; } .battle-mode small { font-size:.75rem; } }
.defense-rankings:has(>.ranking-toggle) { padding: 0; }
.ranking-toggle { display:flex; align-items:center; gap:18px; padding:12px 22px; min-height:150px; list-style:none; border-radius:12px; }
.ranking-toggle::-webkit-details-marker { display:none; }
.ranking-toggle:hover { background:#35204c88; }
.ranking-toggle:focus-visible { outline:3px solid #edd698; outline-offset:3px; }
.ranking-toggle strong { display:block; font-size:1.2rem; }
.ranking-toggle small { display:block; font-weight:400; color:#cbbadf; margin-top:7px; }
.ranking-mascot { display:block; flex:0 0 125px; height:125px; background-image:url('assets/chibi-ranking-modes.webp'); background-size:200% 100%; background-repeat:no-repeat; }
.ranking-defensive { background-position:left center; }
.ranking-offensive { background-position:right center; }
.ranking-toggle-arrow { margin-left:auto; font-size:1.6rem; }
.defense-rankings[open]>.ranking-toggle { background:#33204c; box-shadow:inset 0 0 0 1px #edca78; }
.defense-rankings[open]>.ranking-toggle .ranking-toggle-arrow { transform:rotate(180deg); }
.defense-rankings:has(>.ranking-toggle)>:not(summary) { margin-left:20px; margin-right:20px; }
.defense-rankings:has(>.ranking-toggle)>div { padding-bottom:20px; }
@media(max-width:600px) { .ranking-toggle { gap:10px; padding:10px; min-height:116px; } .ranking-mascot { flex-basis:90px; height:90px; } .ranking-toggle strong { font-size:1rem; } .ranking-toggle small { font-size:.75rem; } }

/* Community branding and archive totals. Three equal columns share the full canvas. */
.topbar .brand { min-width:0; line-height:1.35; }
.topbar .quiet-button { margin-left:auto; flex:none; }
.guild-welcome { max-width:530px; padding:40px; }
.guild-world { margin-bottom:12px; font-weight:500; }
.guild-welcome h1 { font-size:clamp(36px,4.2vw,58px); line-height:1.08; letter-spacing:-.025em; }
.guild-welcome p:not(.guild-world) { max-width:31ch; margin-bottom:22px; }
.guild-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:0; align-items:stretch; margin:20px 0 24px; padding:24px 0; border:1px solid #9471b36b; border-radius:16px; background:#171026; }
.guild-stats>span { align-items:center; justify-content:center; gap:8px; padding:0 20px; text-align:center; }
.guild-stats>span+span { border-left:1px solid #9471b34d; }
.guild-stats .archive-stat-label { font-size:14px; font-weight:500; line-height:1.4; color:#e0cee9; }
.guild-stats strong { font-size:40px; line-height:1.15; font-weight:600; letter-spacing:-.025em; margin:0; color:#f4cb9a; font-variant-numeric:tabular-nums; }
@media(max-width:760px) {
  .topbar .brand { font-size:14px; }
  .guild-welcome { padding:22px; max-width:none; }
  .guild-welcome h1 { font-size:36px; }
  .guild-welcome p:not(.guild-world) { margin-bottom:18px; }
  .guild-stats { margin:16px 0 20px; padding:20px 0; }
  .guild-stats>span { padding:0 8px; gap:8px; }
  .guild-stats .archive-stat-label { font-size:12px; max-width:9ch; min-height:34px; display:flex; align-items:center; justify-content:center; }
  .guild-stats strong { font-size:30px; }
}
@media(max-width:370px) { .topbar .brand { font-size:12px; } .guild-stats strong { font-size:27px; } }
