/* Titles (titles-v1, docs/TITLES.md). The badge is a CSS plate whose face is the
 * title's rarity (docs/RARITY_COLORS.md hex values); the name is always the text
 * and the rarity is in the accessible label, so rarity is never color alone.
 * Motion: the shown badge on the Titles tab gets one soft shine sweep
 * (transform only), off under reduced motion. */
.title-badge{--title-face:var(--rarity-standard);--title-edge:#5b6170;--title-ink:var(--cream-50);position:relative;display:inline-flex;align-items:center;justify-content:center;max-width:100%;min-width:0;box-sizing:border-box;--badge-h:22px;height:var(--badge-h);padding:0 12px;border:2px solid var(--ink-plum);border-radius:6px;background:linear-gradient(180deg,color-mix(in srgb,var(--title-face) 78%,#fff) 0%,var(--title-face) 48%,var(--title-edge) 100%);box-shadow:0 2px #0000003d,inset 0 1px #ffffff80;color:var(--title-ink);overflow:hidden;white-space:nowrap;vertical-align:middle}
.title-badge::before,.title-badge::after{content:"";position:absolute;top:50%;width:6px;height:6px;border:1.5px solid var(--ink-plum);background:var(--title-face);transform:translateY(-50%) rotate(45deg)}
.title-badge::before{left:-5px}.title-badge::after{right:-5px}
.title-badge-text{position:relative;z-index:1;overflow:hidden;text-overflow:ellipsis;font:13px/1.3 Lucky,sans-serif;letter-spacing:.02em;-webkit-text-stroke:var(--label-stroke,.14em) var(--ink-plum);paint-order:stroke fill;filter:drop-shadow(0 .07em var(--ink-plum))}
.title-badge[data-rarity=standard]{--title-face:var(--rarity-standard);--title-edge:#6b7280}
.title-badge[data-rarity=great]{--title-face:var(--rarity-great);--title-edge:#3f8a43}
.title-badge[data-rarity=rare]{--title-face:var(--rarity-rare);--title-edge:#2f7fc0}
.title-badge[data-rarity=epic]{--title-face:var(--rarity-epic);--title-edge:#7445b0}
.title-badge[data-rarity=legendary]{--title-face:var(--rarity-legendary);--title-edge:var(--rarity-legendary-accent)}
.title-badge[data-rarity=mythic]{--title-face:var(--rarity-mythic);--title-edge:#a8303a}
.title-badge[data-rarity=transcendent]{--title-face:var(--rarity-transcendent);--title-edge:var(--rarity-transcendent-accent);background:linear-gradient(135deg,#7eeade 0%,var(--rarity-transcendent) 40%,var(--rarity-transcendent-accent) 100%)}
.title-badge.is-locked{--title-face:#b9ad98;--title-edge:#8c806b;filter:saturate(.2);opacity:.8}
/* AC458 (build 105 feedback): Fishing podium titles use the ranking medal metals
   (fishing-ranking-ui.css place colours); the rarity stays in the accessible label. */
.title-badge[data-metal=gold]{--title-face:#f3d66d;--title-edge:#c8922c;background:linear-gradient(180deg,var(--shine-100) 0%,#f3d66d 46%,#d9a93a 72%,#c8922c 100%)}
.title-badge[data-metal=silver]{--title-face:#cfd5dc;--title-edge:#8c96a3;background:linear-gradient(180deg,#ffffff 0%,#e3e8ee 40%,#b9c0c8 72%,#8c96a3 100%)}
.title-badge[data-metal=bronze]{--title-face:#e0a273;--title-edge:#a8653e;background:linear-gradient(180deg,#f8d2b2 0%,#e7b48a 40%,#c47f52 72%,#a8653e 100%)}
/* AC900: Blip's Friend takes the Temple Explorer shell (game/art/find-blip-v1 blip-front.png: highlight #a8f0b8,
   mid #70c898, shade #208060); the rarity stays Epic in the accessible label. */
.title-badge[data-look=jade]{--title-face:#70c898;--title-edge:#208060;background:linear-gradient(180deg,#a8f0b8 0%,#70c898 48%,#208060 100%)}
/* Pack trim is a semantic cosmetic style, never an item rarity. */
/* Owner 2026-11-21 ("I would simplify it the same way we simplified the frame, but it should still look fairly
   exclusive"; supersedes AC24's winged nine-slice of founder-pack-v2/badge.png): one clean plate in the Founder
   frame's colours, drawn in CSS like every other badge, so it is crisp at every --badge-h. A deep teal face, the
   family's plum outline, one polished gold rim with a dark inner edge, and one small gold star set at the left end.
   No wings, no gem, no end caps. The text keeps clear of the star (padding in plate heights). */
.title-badge[data-rarity=founder]{--title-face:#23787a;--title-edge:#11474b;--founder-rim:max(1.5px,calc(var(--badge-h)*.09));--founder-pad:0 calc(var(--badge-h)*.6) 0 calc(var(--badge-h)*1.02);padding:var(--founder-pad);min-width:calc(var(--badge-h)*3);border-radius:calc(var(--badge-h)*.3);background:linear-gradient(180deg,#3fa9a2 0%,#23787a 46%,#11474b 100%);box-shadow:0 2px #0000003d,inset 0 0 0 var(--founder-rim) #f4cf62,inset 0 var(--founder-rim) 0 var(--founder-rim) #fff0b0,inset 0 0 0 calc(var(--founder-rim) + 1px) #7a4c12}
/* Context rules set their own padding (row, inbox, reward face, training head); the star needs its side everywhere. */
:is(#modal,body) .title-badge.title-badge[data-rarity=founder]{padding:var(--founder-pad)}
.title-badge[data-rarity=founder]::after{display:none}
.title-badge[data-rarity=founder]::before{left:calc(var(--badge-h)*.26);width:calc(var(--badge-h)*.56);height:calc(var(--badge-h)*.56);border:0;background:linear-gradient(180deg,#fff3bd 0%,#ffd75e 45%,#e9a52c 100%);clip-path:polygon(50% 0,61.8% 35.3%,98% 35.3%,68.7% 57.3%,79.4% 91%,50% 70%,20.6% 91%,31.3% 57.3%,2% 35.3%,38.2% 35.3%);transform:translateY(-52%);filter:drop-shadow(0 1px 0 #0b3437)}

/* Equipment: directly under the Combat Power plaque in the hero block. */
.eq-power-block .title-badge-eq{--badge-h:24px;height:var(--badge-h)}
/* AC116: the badge's tap target (44px tall, plate unchanged, no layout shift). */
:is(#online,#modal) button.title-badge-open{display:inline-flex;align-items:center;justify-content:center;max-width:100%;min-width:44px;min-height:44px;margin:-10px 0;padding:0;border:0;border-radius:0;background:none;box-shadow:none;color:inherit;font:inherit;pointer-events:auto;cursor:pointer;-webkit-tap-highlight-color:transparent}
.eq-power-block>button.title-badge-open{margin-top:-12px}
.eq-power-block .title-badge-eq .title-badge-text{font-size:14px}

/* Rankings row (in place of the rank line) and Arena standings (below the league). */
.title-badge-plate{--badge-h:16px;height:var(--badge-h);padding:0 7px;border-width:1.5px;border-radius:4px;justify-self:start;max-width:calc(100% - 8px);margin-left:4px}
.title-badge-plate::before,.title-badge-plate::after{width:4px;height:4px;border-width:1px}
.title-badge-plate::before{left:-3px}.title-badge-plate::after{right:-3px}
.title-badge-plate .title-badge-text{font-size:10px}
.rank-person .title-badge-plate{--badge-h:14px;height:var(--badge-h);margin-top:1px}.rank-person .title-badge-plate .title-badge-text{font-size:9.5px;line-height:1.2}

/* Avatar picker → Titles tab. */
#modal .avatar-tabs.has-three{grid-template-columns:repeat(3,minmax(0,1fr))}
#modal .avatar-panel.is-titles{gap:8px}
#modal .title-card{display:grid;grid-template-columns:64px minmax(0,1fr);align-items:center;gap:10px;padding:8px 10px;border:2px solid #b39b78;border-radius:14px;background:linear-gradient(var(--card-face),#ecdcbb);box-shadow:0 2px #af95604d;text-align:left}
#modal .title-card-avatar{display:block;width:64px;height:64px}
#modal .title-card-avatar>img,#modal .title-card-avatar>.avatar-framed{display:block;width:100%;height:100%;border-radius:10px;object-fit:cover}
#modal .title-card-avatar>.avatar-framed{border-radius:7%}
#modal .title-card-info{display:grid;justify-items:start;gap:4px;min-width:0}
#modal .title-card-name{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:18px/1.1 Lucky,sans-serif;color:#3a2d2c}
#modal .title-card-power{display:inline-flex;align-items:center;gap:5px;height:24px;padding:0 10px;border:1px solid #b79a64;border-radius:13px;background:linear-gradient(#363039,#201e27);color:#ffda80}
#modal .title-card-power img{width:20px;height:20px;object-fit:contain}
#modal .title-card-power strong{font:16px/1 Lucky,sans-serif;font-variant-numeric:tabular-nums}
#modal .title-card-none{font-size:12px;color:#6d5a45}
/* AC110 (build 52, ASC AFlvN9IllSOPxI4cMUunl4o): the Combat Power pill and the title
   badge share one left edge and one 24px height on the profile card. */
#modal .title-badge-card{--badge-h:24px;margin-left:0}
#modal .title-card-info>.title-badge-open{justify-content:flex-start}
/* AC181: only the title rows scroll; the profile, tabs and Close stay fixed. */
#modal .title-list{display:grid;grid-auto-rows:max-content;align-content:start;gap:6px;max-height:min(38dvh,330px);min-height:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch;scrollbar-width:thin;padding:4px}
#modal .title-row{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"badge state" "how state";align-items:center;column-gap:8px;row-gap:3px;width:100%;min-height:52px;box-sizing:border-box;margin:0;padding:6px 10px 6px 14px;border:2px solid #c2ab86;border-radius:var(--vs-radius);background:#f7ecd3;color:#3a2d2c;text-align:left;font:inherit}
#modal .title-row .title-badge-row{grid-area:badge;justify-self:start;--badge-h:20px;height:var(--badge-h);padding:0 10px}
#modal .title-row .title-badge-row .title-badge-text{font-size:12px}
#modal .title-row-how{grid-area:how;font-size:11px;line-height:1.25;color:#5f4d3b}
#modal .title-row-state{grid-area:state;min-width:58px;padding:4px 8px;border-radius:9px;background:#e6d5b4;font-size:12px;font-weight:700;text-align:center;color:#6d5a45;font-variant-numeric:tabular-nums}
#modal .title-row.is-earned{cursor:pointer;border-color:#b39b78;background:linear-gradient(var(--card-face),#ecdcbb);box-shadow:0 2px #af95604d}
#modal .title-row.is-earned .title-row-state{background:var(--cream-300);border:1px solid #d49a2c;color:#8a5a14}
#modal .title-row.is-shown{border-color:#d49a2c;box-shadow:0 0 0 3px #f2c75c,0 2px #af95604d}
#modal .title-row.is-shown .title-row-state{background:#d49a2c;color:var(--cream-50)}
#modal .title-row.is-earned:active{scale:.97}
#modal .title-row:disabled{opacity:.7}
#modal .title-row.is-locked{opacity:.92}
#modal .title-row.is-claimed .title-row-state{background:#d9cfc0;color:#7a6c5c}
#modal .title-row.is-shown .title-badge-row>.title-badge-text::after{content:"";position:absolute;inset:-4px -40%;background:linear-gradient(100deg,transparent 30%,#ffffff8c 50%,transparent 70%);transform:translateX(-120%);animation:title-shine 2.6s ease-in-out .4s 1 both;pointer-events:none}
@keyframes title-shine{to{transform:translateX(120%)}}
@media (prefers-reduced-motion:reduce){#modal .title-row.is-shown .title-badge-row>.title-badge-text::after{animation:none;display:none}#modal .title-row.is-earned:active{scale:1}}
/* Compact heights: the rows' own Show/Shown states carry the hint, so it goes. */
@media (max-height:860px){#modal .avatar-panel.is-titles{gap:6px}#modal .avatar-panel.is-titles>p{display:none}#modal .title-list{gap:5px}#modal .title-row{min-height:44px;padding-top:3px;padding-bottom:3px;row-gap:2px}#modal .title-row-how{font-size:10.5px;line-height:1.2}#modal .title-card{grid-template-columns:48px minmax(0,1fr);gap:8px;padding:5px 8px}#modal .title-card-avatar{width:48px;height:48px}#modal .title-card-info{gap:3px}#modal .title-card-name{font-size:16px}}
@media(max-height:730px){
 #modal .avatar-panel.is-titles{gap:4px}
 #modal .avatar-panel.is-titles h1{font-size:24px;line-height:1.1}
 #modal .avatar-panel.is-titles .avatar-tabs button{min-height:44px;height:44px;padding-top:4px;padding-bottom:4px}
 #modal .title-card-info{grid-template-columns:minmax(0,1fr) auto}
 #modal .title-card-info>.title-badge,#modal .title-card-info>.title-badge-open,#modal .title-card-none{grid-column:1/-1}
 #modal .title-list{gap:3px}
 #modal .title-row{padding-top:2px;padding-bottom:2px;row-gap:1px}
 #modal:has(.avatar-panel.is-titles)>button[data-action=dismiss]{height:48px;min-height:48px;padding-top:4px;padding-bottom:4px}
}

/* AC443: earned Inbox titles retain their profile badge proportions. */
#modal .inbox-title-badge{--badge-h:30px;width:max-content;max-width:100%;height:var(--badge-h);min-width:0;padding:0 12px;white-space:nowrap}
#modal .inbox-title-badge>.title-badge-text{font-size:16px;line-height:1.2;white-space:nowrap;overflow:visible;text-overflow:clip}
#modal .mail-reward.mail-reward-title{width:auto;height:auto;min-height:36px;padding:0;border:0;border-radius:0;background:none;box-shadow:none}
#modal .inbox-reward.inbox-reward-title{padding:3px;border:0;border-radius:0;background:none;box-shadow:none}
#modal .reward-title{display:flex;align-items:center;justify-content:center;grid-column:1/-1;min-width:0;max-width:100%;list-style:none}
#modal .reward-title-face{display:flex;align-items:center;justify-content:center;min-height:44px;min-width:44px;max-width:100%;padding:8px;border:0;border-radius:0;background:none;box-shadow:none}
#modal .reward-title-face .inbox-title-badge,#modal .reward-title-detail .inbox-title-badge{--badge-h:36px;padding:0 15px}
#modal .reward-title-face .title-badge-text,#modal .reward-title-detail .title-badge-text{font-size:20px}
#modal .reward-title-detail{display:flex;align-items:center;justify-content:center;max-width:100%;min-height:60px;margin:8px auto}

/* AC458: a Fishing title row shows its ATK percentage beside the badge; while the
   claimed 30-day bonus runs, the second line shows its expiry instead of how to earn it. */
/* The chip sits beside the badge when both fit; on a narrower row (a long locked pl
   title beside its wide state pill on 375px phones) it wraps under the badge, so the
   title is never truncated. */
#modal .title-row-head{grid-area:badge;display:flex;flex-wrap:wrap;align-items:center;gap:3px 8px;min-width:0}
#modal .title-row-head>.title-badge-row{flex:0 1 auto;min-width:0}
#modal .title-bonus-chip{display:inline-flex;align-items:center;flex:none;gap:2px;height:20px;padding:0 7px 0 3px;border:1.5px solid var(--ink-plum);border-radius:10px;background:#efe3c8;box-shadow:0 1.5px #2a22304d;font:12px/1 Lucky,sans-serif;color:#5d4a34}
#modal .title-bonus-chip img{width:16px;height:16px;object-fit:contain}
#modal .title-bonus-chip.is-active{background:linear-gradient(var(--gold-50),#f2cf6b);color:#3f2c10}
#modal .title-row-how.title-row-until{font-weight:700;color:#7a4b12}

