/* Rank hero typography and badge styling: each level carries its own accent. */
.hero.rank-clickable > div,.friend-rank-summary > div { display:grid; grid-template-columns:auto auto; align-items:end; column-gap:8px; }
.hero.rank-clickable > div > p,.friend-rank-summary > div > p { grid-column:1 / -1; width:fit-content; margin-bottom:5px; padding:4px 9px; border-radius:999px; background:var(--rank-soft); color:var(--rank-heading,var(--rank-accent)); opacity:1; font-size:12px; font-weight:900; letter-spacing:.06em; }
.hero.rank-clickable > div > strong,.friend-rank-summary > div > strong { color:var(--rank-number); font-weight:950; letter-spacing:-.035em; text-shadow:0 2px 8px var(--rank-shadow); }
.hero.rank-clickable > div > strong + span,.friend-rank-summary > div > strong + span { align-self:end; margin-bottom:6px; color:var(--rank-unit,var(--rank-number)); font-size:15px; font-weight:900; }
.hero.rank-clickable .rank-badge,.friend-rank-summary .rank-badge { grid-column:1 / -1; display:inline-flex!important; align-items:center; justify-content:center; width:fit-content; margin:10px 0 0!important; padding:6px 13px; border:1px solid var(--rank-badge-line); border-radius:11px 18px 18px 11px; background:var(--rank-badge-bg); color:var(--rank-badge-text); box-shadow:0 5px 14px var(--rank-shadow),inset 0 1px rgba(255,255,255,.45); font-size:12px!important; font-weight:950; letter-spacing:.08em; }
.hero.rank-clickable .rank-badge::before,.friend-rank-summary .rank-badge::before { content:''; width:6px; height:6px; margin-right:7px; border-radius:50%; background:currentColor; }
.hero.rank-1 { --rank-accent:#174c35; --rank-heading:#ffd95a; --rank-number:#ffffff; --rank-unit:#d7f7e4; --rank-soft:#ffd95a; --rank-badge-bg:#fff3b8; --rank-badge-text:#103c2b; --rank-badge-line:#ffe07a; --rank-mark-bg:#fff8dc; --rank-mark-border:#ffd24b; --rank-shadow:rgba(8,42,28,.34); }
.hero.rank-2 { --rank-accent:#075c79; --rank-heading:#fff06a; --rank-number:#ffffff; --rank-unit:#d8f8ff; --rank-soft:#fff06a; --rank-badge-bg:#fff4a8; --rank-badge-text:#064b65; --rank-badge-line:#fff38a; --rank-mark-bg:#fffce4; --rank-mark-border:#ffd83f; --rank-shadow:rgba(2,62,86,.34); }
.hero.rank-3 { --rank-accent:#741123; --rank-heading:#ffffff; --rank-number:#ffe45c; --rank-unit:#ffffff; --rank-soft:#ffe45c; --rank-badge-bg:#172f45; --rank-badge-text:#ffffff; --rank-badge-line:#ffe45c; --rank-mark-bg:#fffdf0; --rank-mark-border:#172f45; --rank-shadow:rgba(76,4,21,.4); background:linear-gradient(125deg,#8e2031,#d65b62)!important; }
.hero.rank-4 { --rank-accent:#43166a; --rank-heading:#bfffe1; --rank-number:#ffffff; --rank-unit:#ffe76a; --rank-soft:#bfffe1; --rank-badge-bg:#fff0a8; --rank-badge-text:#3d155e; --rank-badge-line:#fff07b; --rank-mark-bg:#f4fff8; --rank-mark-border:#65e0ad; --rank-shadow:rgba(43,9,69,.38); background:linear-gradient(125deg,#54227b,#9b5bc1)!important; }
.hero.rank-5 { --rank-accent:#604100; --rank-heading:#173c54; --rank-number:#102f43; --rank-unit:#5b250e; --rank-soft:#173c54; --rank-badge-bg:#173c54; --rank-badge-text:#ffffff; --rank-badge-line:#0d2d41; --rank-mark-bg:#fff9e1; --rank-mark-border:#173c54; --rank-shadow:rgba(85,55,0,.28); }
.hero.rank-6 { --rank-accent:#2e3f48; --rank-heading:#682b86; --rank-number:#142f3b; --rank-unit:#7b3c10; --rank-soft:#682b86; --rank-badge-bg:#243c4a; --rank-badge-text:#ffffff; --rank-badge-line:#172f3b; --rank-mark-bg:#fff7cf; --rank-mark-border:#633181; --rank-shadow:rgba(42,55,62,.22); }
.hero.rank-7 { --rank-accent:#102c70; --rank-heading:#ffcf4c; --rank-number:#ffffff; --rank-unit:#bfffe1; --rank-soft:#ffcf4c; --rank-badge-bg:#ffcf4c; --rank-badge-text:#10285e; --rank-badge-line:#ffe57d; --rank-mark-bg:#fffbea; --rank-mark-border:#ffcf4c; --rank-shadow:rgba(7,23,72,.4); }
.hero.rank-8 { --rank-accent:#5a2c13; --rank-heading:#8cfff0; --rank-number:#ffffff; --rank-unit:#ffe38d; --rank-soft:#8cfff0; --rank-badge-bg:#102f42; --rank-badge-text:#ffffff; --rank-badge-line:#7de7da; --rank-mark-bg:#f3fffb; --rank-mark-border:#62d7c8; --rank-shadow:rgba(57,24,6,.38); }
.hero.rank-9 { --rank-accent:#3d4b52; --rank-heading:#6b237f; --rank-number:#162f3a; --rank-unit:#793910; --rank-soft:#6b237f; --rank-badge-bg:#57216b; --rank-badge-text:#ffffff; --rank-badge-line:#401753; --rank-mark-bg:#fff8d7; --rank-mark-border:#6b237f; --rank-shadow:rgba(45,58,64,.23); }
.hero.rank-10 { --rank-accent:#5d4300; --rank-heading:#252052; --rank-number:#172d48; --rank-unit:#6b220c; --rank-soft:#252052; --rank-badge-bg:#252052; --rank-badge-text:#ffffff; --rank-badge-line:#171334; --rank-mark-bg:#fffbed; --rank-mark-border:#252052; --rank-shadow:rgba(75,52,0,.31); }
@media (max-width:420px) { .hero.rank-clickable > div > strong,.friend-rank-summary > div > strong { font-size:41px; } .hero.rank-clickable .rank-badge,.friend-rank-summary .rank-badge { padding:6px 11px; } }
.rank-row-3 { border-left-color:#c52c52!important; }
.rank-row-4 { border-left-color:#7d3ca5!important; }

/* User-requested mobile density: large 1, medium 3, small 5 columns. */
.card-grid.size-large .card-image { height:auto!important; min-height:260px; aspect-ratio:4/3; background-size:contain!important; background-position:center; background-repeat:no-repeat; background-color:#e7eee8; }
.friend-view-grid.size-large .friend-view-card img,
.friend-view-grid.size-large .friend-view-card video { width:100%; height:auto!important; max-height:none; aspect-ratio:auto; object-fit:contain!important; background:#e7eee8; }
.friend-view-grid .friend-view-card { display:flex; flex-direction:column; align-self:stretch; height:100%; overflow:hidden; }
.friend-view-grid .friend-view-card > img,
.friend-view-grid .friend-view-card > video { flex:0 0 auto; display:block; width:100%; margin:0; object-fit:cover; }
.friend-view-grid .friend-view-card > div { flex:1 1 auto; width:100%; }
@media (max-width:699px) {
  .card-grid.size-large { grid-template-columns:1fr; }
  .card-grid.size-medium { grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
  .card-grid.size-small { grid-template-columns:repeat(5,minmax(0,1fr)); gap:4px; }
  .card-grid.size-medium .card-image { height:calc((100vw - 52px)/3); min-height:88px; max-height:132px; }
  .card-grid.size-small .card { border-radius:7px; }
  .card-grid.size-small .card-image { height:calc((100vw - 52px)/5); min-height:52px; max-height:72px; }
  .card-grid.size-small .card-body { padding:4px; }
  .card-grid.size-small .card h3 { font-size:9px; line-height:1.25; }
  .card-grid.size-small .rarity { font-size:8px; letter-spacing:-2px; }
  .card-grid.size-small .species-alerts { display:none; }
  .card-grid.size-large .card-image { min-height:240px; }
  .friend-view-grid.size-large { grid-template-columns:1fr; }
  .friend-view-grid.size-medium { grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
  .friend-view-grid.size-small { grid-template-columns:repeat(5,minmax(0,1fr)); gap:4px; }
  .friend-view-grid.size-medium .friend-view-card > img,
  .friend-view-grid.size-medium .friend-view-card > video { height:calc((100vw - 52px)/3); min-height:88px; max-height:132px; object-fit:cover; }
  .friend-view-grid.size-small .friend-view-card { border-radius:7px; }
  .friend-view-grid.size-small .friend-view-card > img,
  .friend-view-grid.size-small .friend-view-card > video { height:calc((100vw - 52px)/5); min-height:52px; max-height:72px; object-fit:cover; }
  .friend-view-grid.size-small .friend-view-card > div { padding:4px; }
  .friend-view-grid.size-small h3 { margin:0; font-size:9px; line-height:1.25; overflow-wrap:anywhere; }
  .friend-view-grid.size-small p { display:none; }
}

/* Species explorer: a focused, premium discovery surface. */
.species-explorer { position:relative; isolation:isolate; overflow:hidden; margin:22px 0; padding:22px!important; border:1px solid #a9ceb8!important; border-radius:24px!important; background:linear-gradient(145deg,#f7fcf6 0%,#edf8f0 58%,#e6f3ee 100%)!important; box-shadow:0 12px 30px rgba(21,83,49,.1),inset 0 1px rgba(255,255,255,.9); }
.species-explorer::after { content:''; position:absolute; z-index:-1; width:150px; height:150px; right:-64px; top:-72px; border-radius:50%; background:radial-gradient(circle,rgba(73,169,111,.18),rgba(73,169,111,0) 70%); }
.species-explorer h2 { display:flex; align-items:center; gap:10px; margin:0 0 8px!important; color:#134e35; font-size:21px!important; font-weight:950; letter-spacing:.025em; }
.species-explorer h2::before { content:'⌕'; display:grid; place-items:center; width:34px; height:34px; flex:0 0 34px; border-radius:11px; background:linear-gradient(145deg,#1e6948,#3d8b61); color:#fff; box-shadow:0 5px 12px rgba(20,83,45,.2); font-size:21px; }
.species-explorer > p { max-width:560px; margin:0 0 15px!important; color:#466456!important; font-size:13px!important; font-weight:650; line-height:1.75; }
.species-explorer > .search { position:relative; min-height:55px; padding:0 15px!important; border:2px solid #b6d3bd!important; border-radius:17px!important; background:rgba(255,255,255,.94)!important; box-shadow:0 7px 17px rgba(22,77,47,.08),inset 0 1px 2px rgba(18,70,43,.03); transition:border-color .18s ease,box-shadow .18s ease,transform .18s ease; }
.species-explorer > .search::before { content:'⌕'; flex:0 0 auto; color:#1c6a49; font-size:23px; font-weight:900; }
.species-explorer > .search:focus-within { border-color:#2e8058!important; box-shadow:0 0 0 4px rgba(46,128,88,.14),0 9px 22px rgba(22,77,47,.12); transform:translateY(-1px); }
.species-explorer #speciesSearch { min-width:0; padding:15px 0!important; color:#173d2d; font-size:16px; font-weight:750; }
.species-explorer #speciesSearch::placeholder { color:#81998d; font-weight:650; }
.species-explorer #speciesResults:not(:empty) { margin-top:13px; padding:2px 14px 5px; border:1px solid #c9ddce; border-radius:15px; background:rgba(255,255,255,.86); }
.species-explorer .species-result { background:transparent; }
@media (max-width:420px) { .species-explorer { padding:18px!important; } .species-explorer h2 { font-size:19px!important; } .species-explorer > p { font-size:12px!important; } }

/* App masthead: refined brand treatment without reducing tap space. */
.topbar { position:relative; min-height:74px; gap:12px; padding:8px 0 11px; }
.topbar::after { content:''; position:absolute; left:0; right:0; bottom:0; height:1px; background:linear-gradient(90deg,#2f7b55 0%,#91ba73 42%,rgba(145,186,115,0) 88%); }
.topbar > div:first-child { position:relative; min-width:0; padding-left:16px; }
.topbar > div:first-child::before { content:''; position:absolute; left:0; top:2px; bottom:1px; width:5px; border-radius:999px; background:linear-gradient(180deg,#7eac5e,#1d6546); box-shadow:0 3px 8px rgba(29,101,70,.2); }
.topbar .eyebrow { display:flex; align-items:center; gap:7px; width:fit-content; margin:0 0 4px; color:#4d7b5e; font-size:9px; font-weight:950; letter-spacing:.22em; }
.topbar .eyebrow::before { content:''; width:17px; height:2px; border-radius:2px; background:#76a75b; }
.topbar h1 { position:relative; margin:0; color:#143b2d; font-size:clamp(25px,7vw,32px); font-weight:950; letter-spacing:.015em; line-height:1.12; text-shadow:0 1px rgba(255,255,255,.8); }
.topbar h1::after { content:'✦'; position:absolute; right:-20px; top:-5px; color:#d3a422; font-size:11px; text-shadow:0 2px 5px rgba(130,90,0,.18); }
.topbar .weather-widget { flex:0 0 auto; }
.topbar .avatar { flex:0 0 44px; width:44px; height:44px; border:2px solid rgba(255,255,255,.9); background:linear-gradient(145deg,#dff0d7,#bad9b3); box-shadow:0 5px 14px rgba(22,76,48,.15); }
@media (max-width:420px) {
  .topbar { gap:8px; }
  .topbar > div:first-child { padding-left:13px; }
  .topbar h1 { font-size:25px; }
  .topbar h1::after { right:-16px; }
  .topbar .eyebrow { font-size:8px; letter-spacing:.17em; }
}

/* v179: original rank identity — custom number, unit and arrow crest. */
.hero.rank-clickable,
.friend-rank-summary { position:relative; isolation:isolate; overflow:hidden; border:2px solid color-mix(in srgb,var(--rank-number) 42%,transparent); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--rank-number) 24%,transparent),inset 0 -22px 45px rgba(0,0,0,.08),0 12px 27px var(--rank-shadow); }
.hero.rank-clickable::before,
.friend-rank-summary::before { content:''; position:absolute; z-index:-1; width:185px; height:185px; right:-56px; top:-72px; transform:rotate(18deg); background:linear-gradient(135deg,color-mix(in srgb,var(--rank-number) 20%,transparent),transparent 58%); clip-path:polygon(50% 0,62% 35%,100% 50%,62% 65%,50% 100%,38% 65%,0 50%,38% 35%); }
.hero.rank-clickable::after,
.friend-rank-summary::after { content:''; position:absolute; z-index:-1; left:20px; right:125px; bottom:14px; height:2px; background:linear-gradient(90deg,color-mix(in srgb,var(--rank-number) 68%,transparent),transparent); }
.hero.rank-clickable > div,
.friend-rank-summary > div { display:grid; grid-template-columns:auto auto; align-items:end; column-gap:10px; }
.hero.rank-clickable > div > p,
.friend-rank-summary > div > p { grid-column:1 / -1; display:flex; align-items:center; gap:7px; width:auto; margin:0 0 2px; padding:0; border-radius:0; background:none; color:var(--rank-heading,var(--rank-number)); opacity:1; font-size:12px; font-weight:900; letter-spacing:.13em; }
.hero.rank-clickable > div > p::before,
.friend-rank-summary > div > p::before { content:'◆'; color:var(--rank-soft); font-size:8px; text-shadow:0 1px 4px var(--rank-shadow); }
.hero.rank-clickable > div > strong,
.friend-rank-summary > div > strong { position:relative; color:var(--rank-number); font-size:52px; font-weight:950; letter-spacing:-.06em; line-height:1; text-shadow:0 3px 0 color-mix(in srgb,var(--rank-accent) 55%,transparent),0 7px 14px var(--rank-shadow); }
.hero.rank-clickable > div > strong + span,
.friend-rank-summary > div > strong + span { align-self:center; margin:9px 0 0; padding:0 0 0 9px; border-left:3px solid color-mix(in srgb,var(--rank-unit,var(--rank-number)) 68%,transparent); color:var(--rank-unit,var(--rank-number)); font-size:14px; font-weight:950; letter-spacing:.08em; line-height:1.15; }

/* Rank 3: keep the cherry blossom crisp against the crimson field. */
.hero.rank-3 .hero-leaf { border-radius:50%; background:radial-gradient(circle,rgba(255,249,232,.58) 0 38%,rgba(255,226,233,.22) 54%,transparent 72%); }
.hero.rank-3 .hero-leaf img { filter:drop-shadow(0 0 2px #fff7e8) drop-shadow(0 0 7px rgba(255,231,238,.9)) drop-shadow(0 6px 7px rgba(75,4,23,.48)); }
.hero.rank-clickable .rank-badge,
.friend-rank-summary .rank-badge { grid-column:1 / -1; display:inline-flex!important; align-items:center; justify-content:flex-start; width:fit-content; min-width:94px; margin:12px 0 0!important; padding:7px 20px 7px 12px; border:1px solid var(--rank-badge-line); border-radius:4px; clip-path:polygon(0 0,calc(100% - 12px) 0,100% 50%,calc(100% - 12px) 100%,0 100%,7px 50%); background:linear-gradient(135deg,var(--rank-badge-bg),color-mix(in srgb,var(--rank-badge-bg) 70%,var(--rank-accent))); color:var(--rank-badge-text); box-shadow:none; font-size:12px!important; font-weight:950; letter-spacing:.12em; }
.hero.rank-clickable .rank-badge::before,
.friend-rank-summary .rank-badge::before { content:'✦'; width:auto; height:auto; margin-right:7px; border-radius:0; background:none; color:currentColor; font-size:10px; }

/* v179: substantial museum-style frame, not a thin line. */
#library .card-grid .card,
.friend-view-grid .friend-view-card { border:4px solid #96620d!important; outline:2px solid #f1d16a; outline-offset:-5px; box-shadow:inset 0 0 0 4px rgba(103,63,4,.2),0 9px 21px rgba(76,49,7,.2)!important; }
#library .card-grid .card::after,
.friend-view-grid .friend-view-card::after { inset:5px; border:2px solid rgba(255,225,127,.78); color:#ffe99f; }
.species-dialog .species-emoji { padding:12px!important; border:9px solid #96620d!important; outline:3px solid #f5d86f; outline-offset:-8px; border-radius:24px!important; background:linear-gradient(145deg,#704607,#f4d164 18%,#a26b0b 40%,#ffe897 62%,#835306 83%,#e4b947)!important; box-shadow:inset 0 0 0 4px #664004,inset 0 0 0 7px rgba(255,239,178,.72),0 13px 31px rgba(76,49,7,.3)!important; }
.species-dialog .species-emoji::before,
.species-dialog .species-emoji::after { top:7px; color:#fff0a0; font-size:17px; text-shadow:0 2px #634004; }
.species-dialog .species-emoji::before { left:9px; }
.species-dialog .species-emoji::after { right:9px; }
.species-dialog .species-emoji img { border:3px solid #73500e!important; box-shadow:0 0 0 2px #f5d97c; }
.detail-photo { border:9px solid #96620d!important; outline:3px solid #f5d86f; outline-offset:-8px; box-shadow:inset 0 0 0 4px #664004,inset 0 0 0 7px rgba(255,239,178,.68),0 13px 31px rgba(76,49,7,.28)!important; }
.detail-photo::before,
.detail-photo::after { color:#fff0a0; font-size:17px; text-shadow:0 2px #634004; }
.friend-detail-media { padding:10px!important; border:9px solid #96620d!important; outline:3px solid #f5d86f; outline-offset:-8px; background:linear-gradient(145deg,#704607,#f4d164 30%,#a26b0b 62%,#ffe897)!important; box-shadow:inset 0 0 0 4px #664004,0 13px 31px rgba(76,49,7,.28)!important; }
@media (max-width:420px) {
  .hero.rank-clickable > div > strong,.friend-rank-summary > div > strong { font-size:46px; }
  #library .card-grid.size-small .card,.friend-view-grid.size-small .friend-view-card { border-width:2px!important; outline-width:1px; outline-offset:-3px; }
}

/* v180: hand-drawn WildDex masthead lockup. */
.topbar .brand-lockup { display:flex; align-items:center; gap:9px; min-width:0; padding-left:0!important; }
.topbar .brand-lockup::before { display:none; }
.brand-emblem { display:grid; place-items:center; flex:0 0 43px; width:43px; height:43px; border:2px solid #174f38; border-radius:13px 17px 13px 17px; background:linear-gradient(145deg,#f5fbef,#dcefdc); box-shadow:inset 0 0 0 2px #fff,0 5px 12px rgba(20,76,48,.17); transform:rotate(-2deg); }
.brand-emblem svg { display:block; width:37px; height:37px; overflow:visible; fill:none; stroke:#174f38; stroke-width:3; stroke-linecap:round; stroke-linejoin:round; }
.brand-emblem .brand-book { fill:#fff9df; }
.brand-emblem .brand-leaf { fill:#7fb254; }
.brand-emblem .brand-vein { stroke:#f5da65; stroke-width:2; }
.brand-emblem .brand-spark { stroke:#d39a10; stroke-width:3.4; }
.brand-words { display:block; min-width:0; }
.topbar .brand-words .eyebrow { margin:0 0 3px; color:#52765d; font-size:8px; letter-spacing:.2em; }
.topbar .brand-words .eyebrow::before { width:12px; background:#d2a326; }
.topbar .brand-words h1 { display:inline-block; position:relative; padding-bottom:5px; color:#123c2c; font-size:clamp(23px,6vw,29px); font-weight:950; letter-spacing:-.015em; text-shadow:0 2px #fff,0 4px 8px rgba(22,74,48,.14); }
.topbar .brand-words h1::before { content:''; position:absolute; left:0; right:19%; bottom:0; height:3px; border-radius:4px; background:linear-gradient(90deg,#1c6848,#8eb85e 68%,#d7a521); box-shadow:0 2px 5px rgba(21,80,49,.17); }
.topbar .brand-words h1::after { content:'✦'; right:-16px; top:-8px; color:#d5a51c; font-size:10px; }
@media (max-width:420px) {
  .topbar .brand-lockup { gap:4px; }
  .brand-emblem { flex-basis:32px; width:32px; height:32px; border-radius:10px 13px 10px 13px; }
  .brand-emblem svg { width:28px; height:28px; }
  .topbar .brand-words h1 { font-size:18px; white-space:nowrap; }
  .topbar .brand-words .eyebrow { font-size:7px; letter-spacing:.13em; }
}

/* Record library controls. */
#library .section-heading { position:relative; min-height:48px; margin:27px 0 11px!important; padding-left:14px; }
#library .section-heading::before { content:''; position:absolute; left:0; top:7px; bottom:7px; width:5px; border-radius:5px; background:linear-gradient(180deg,#80ad5d,#1d6747); }
#library .section-heading h2 { color:#153d2e; font-size:22px; font-weight:950; letter-spacing:.02em; }
#library .record-sort-select { width:auto!important; min-width:132px; max-width:178px!important; height:44px!important; padding:8px 34px 8px 13px!important; border:1px solid #b9d0bf; border-radius:14px; background-color:#fff; color:#1c5f42; box-shadow:0 5px 13px rgba(21,72,45,.08); font-size:13px!important; font-weight:900; }
#library .record-sort-select:focus { border-color:#2d8058; outline:3px solid rgba(45,128,88,.14); }
#library > #search.record-search-under-title,
#library > #search.record-search-below-heading { min-height:55px; margin:12px 0 13px!important; padding:0 15px; border:2px solid #c0d4c2; border-radius:17px; background:linear-gradient(145deg,#fff,#f9fcf8); box-shadow:0 7px 17px rgba(22,77,47,.07),inset 0 1px #fff; transition:border-color .18s ease,box-shadow .18s ease; }
#library > #search:focus-within { border-color:#2e8058; box-shadow:0 0 0 4px rgba(46,128,88,.13),0 9px 21px rgba(22,77,47,.1); }
#library > #search > span { display:grid; place-items:center; width:27px; height:27px; flex:0 0 27px; border-radius:9px; background:#e1f0e5; color:#176341; font-size:18px; font-weight:950; }
#library > #search input { padding:15px 0; color:#173d2d; font-size:15px; font-weight:700; }
#library > #search input::placeholder { color:#82958b; font-weight:650; }
#library .size-buttons { display:inline-flex; justify-self:end; float:right; gap:0; width:fit-content; margin:0 0 14px!important; padding:4px; border:1px solid #c5d7c7; border-radius:15px; background:#edf4ee; box-shadow:inset 0 1px 2px rgba(20,70,43,.05); }
#library .size-buttons button { min-width:43px; height:38px; margin:0; padding:0 12px; border:0; border-radius:11px; background:transparent; color:#607569; font-size:13px; font-weight:900; transition:background .16s ease,color .16s ease,box-shadow .16s ease; }
#library .size-buttons button.active { background:linear-gradient(145deg,#1c6848,#2e8059); color:#fff; box-shadow:0 4px 10px rgba(20,83,45,.24),inset 0 1px rgba(255,255,255,.2); }
#library .size-buttons button:focus-visible { outline:3px solid rgba(46,128,88,.25); outline-offset:2px; }
#library .card-grid { clear:both; }
#library .card-grid .card,
.friend-view-grid .friend-view-card { position:relative; border:2px solid #b88925!important; background:#fffdf7; box-shadow:inset 0 0 0 2px #f3dda0,0 7px 18px rgba(91,62,13,.12),0 1px 2px rgba(52,36,7,.12); }
#library .card-grid .card::after,
.friend-view-grid .friend-view-card::after { content:''; position:absolute; z-index:2; inset:4px; border:1px solid rgba(218,177,73,.42); border-radius:calc(1em - 4px); pointer-events:none; }
#library .card-grid .card:hover,
.friend-view-grid .friend-view-card:hover { border-color:#d1a43b!important; box-shadow:inset 0 0 0 2px #f6e5b0,0 10px 23px rgba(91,62,13,.18),0 2px 4px rgba(52,36,7,.13); transform:translateY(-1px); }
#library .card-grid .card-image,
.friend-view-grid .friend-view-card > img,
.friend-view-grid .friend-view-card > video { border-bottom:1px solid #d6b766; }
.species-dialog .species-emoji { position:relative; padding:8px; border:3px solid #b88925!important; border-radius:20px!important; background:linear-gradient(145deg,#f8e8b6,#c59630 42%,#f6e3a5 72%,#a9781a)!important; box-shadow:inset 0 0 0 2px #fff0bd,inset 0 0 0 5px rgba(116,77,9,.2),0 10px 25px rgba(89,59,7,.2); }
.species-dialog .species-emoji::before,
.species-dialog .species-emoji::after { content:'◆'; position:absolute; z-index:3; top:4px; color:#fff1b3; font-size:12px; line-height:1; text-shadow:0 1px #805a0b; pointer-events:none; }
.species-dialog .species-emoji::before { left:6px; }
.species-dialog .species-emoji::after { right:6px; }
.species-dialog .species-emoji img { width:auto; max-width:100%; border:1px solid #8e681b; border-radius:12px; background:#e7eee8!important; }
.detail-photo { position:relative; border:3px solid #b88925; outline:2px solid #f5dda0; outline-offset:-7px; box-shadow:inset 0 0 0 5px rgba(116,77,9,.16),0 9px 23px rgba(89,59,7,.18); }
.detail-photo::before,
.detail-photo::after { content:'◆'; position:absolute; z-index:3; top:7px; color:#fff1b3; font-size:12px; line-height:1; text-shadow:0 1px #805a0b; pointer-events:none; }
.detail-photo::before { left:9px; }
.detail-photo::after { right:9px; }
.friend-detail-media { padding:6px; border:3px solid #b88925; border-radius:19px!important; background:linear-gradient(145deg,#f6e4aa,#bd8c28)!important; box-shadow:inset 0 0 0 2px #ffefbb,0 9px 23px rgba(89,59,7,.18); }
@media (max-width:420px) {
  #library .section-heading h2 { font-size:20px; }
  #library .record-sort-select { min-width:124px; max-width:148px!important; }
  #library .size-buttons button { min-width:39px; height:36px; padding:0 10px; }
  #library .card-grid.size-small .card,
  .friend-view-grid.size-small .friend-view-card { border-width:1px!important; box-shadow:inset 0 0 0 1px #efd995,0 4px 9px rgba(91,62,13,.1); }
  #library .card-grid.size-small .card::after,
  .friend-view-grid.size-small .friend-view-card::after { inset:2px; }
}
