/* Catalog presentation. Base controls and dialogs live in styles.css. */
:root { --bg:#f3f7f6; --ink:#183c34; --green:#165c48; --green2:#217860; --line:#dbe6e0; --muted:#5c7069; --accent:#28765d; --soft:#e8f2ed; }
body { font-size:16px; }
.wrap { max-width:1400px; padding-left:36px; padding-right:36px; }
header { background:#164d3d; }
header::after { right:12%; top:-50px; font-size:290px; color:#ffffff08; }
.topbar { padding:22px 0; border-bottom:1px solid #ffffff20; }
.brand b { font-size:20px; letter-spacing:-.03em; }
.brand small { font-size:12px; }
.brand-icon { background:#ffffff10; }
.top-right { font-size:12px; letter-spacing:.04em; }
.hero { max-width:900px; padding:32px 0 36px; }
.hero h1 { font-family:Georgia,'Hiragino Mincho ProN',serif; font-weight:500; font-size:clamp(36px,4vw,54px); letter-spacing:-.035em; line-height:1.1; }
.hero p { font-size:16px; max-width:610px; }
.eyebrow { font-size:12px; }
main { padding-top:24px; }
.backup-bar { display:flex; justify-content:space-between; gap:20px; align-items:center; padding:16px 20px; border:1px solid #bed6cb; border-radius:12px; background:#e8f2ed; margin-bottom:22px; }
.backup-bar b { display:block; font-size:15px; }
.backup-bar span { display:block; color:#496458; font-size:14px; margin-top:3px; }
.backup-buttons { display:flex; flex-shrink:0; gap:8px; }
.solid,.outline,.tab,.chip { font-size:14px; min-height:42px; }
.tab { padding:10px 18px; border-radius:8px; }
.tabs { margin-bottom:22px; }
.stat { padding:17px 20px; box-shadow:none; border-radius:12px; }
.stat .label { font-size:14px; }
.stat .number { font-size:31px; }
.stats { gap:14px; }
.main-grid { grid-template-columns:minmax(0,1fr) 270px; gap:24px; }
.panel { border-radius:14px; box-shadow:none; padding:22px; }
.section-head h2 { font-size:22px; font-weight:650; }
.section-head { align-items:baseline; }
.controls { grid-template-columns:1fr 145px; }
input[type=search],input[type=text],input[type=date],select,textarea { font-size:16px; min-height:46px; }
select { appearance:none; padding-right:36px; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='m1 1 5 5 5-5' stroke='%23183c34' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 14px center; }
.filters { gap:6px; }
.chip { padding:7px 12px; font-size:13px; }
.catalog-info { font-size:13px; gap:10px; margin:16px 0; }
.books { grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; }
.book { border-radius:10px; padding:12px; gap:10px; min-width:0; border-top:4px solid var(--accent); box-shadow:0 4px 12px #193d2e05; }
.book:hover { border-color:var(--accent); box-shadow:0 7px 18px #193d2e10; }
.book h3 { font-size:16px; line-height:1.65; min-height:3.3em; margin-top:3px; }
/* Match the level stripes on the original ASK covers. */
.level-0 { --accent:#246f99; --soft:#e6f4fc; }
.level-1 { --accent:#a93c6a; --soft:#fceaf2; }
.level-2 { --accent:#b83245; --soft:#fdecef; }
.level-3 { --accent:#876007; --soft:#fff4cd; }
.level-4 { --accent:#526f12; --soft:#f0f6d9; }
.level-pill { background:var(--soft); color:var(--accent); font-size:12px; padding:4px 8px; }
.book-code { font-size:12px; }
.cover-frame { height:225px; position:relative; width:100%; display:flex; align-items:center; justify-content:center; overflow:hidden; background:#f0f3f1; border-radius:6px; }
.cover-frame img { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; padding:6px; background:#f0f3f1; }
.cover-fallback { height:100%; width:100%; padding:16px; background:var(--soft); color:var(--accent); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px; text-align:center; }
.cover-fallback>span[lang=ja] { font-family:'Hiragino Mincho ProN','Yu Mincho',serif; font-weight:600; font-size:20px; line-height:1.7; overflow-wrap:anywhere; }
.cover-series { font-size:10px; letter-spacing:.04em; }
.cover-fallback small { font-size:12px; opacity:.85; margin-top:auto; }
.book-sub { font-size:13px; }
.book-actions { align-items:flex-start; gap:8px; }
.check-label { font-size:14px; min-height:40px; }
.bottom-row { flex:1; justify-content:flex-end; flex-wrap:wrap; }
.heart { min-width:40px; min-height:40px; }
.stars { order:3; width:100%; justify-content:flex-end; }
.star { min-height:36px; min-width:28px; font-size:24px; }
.mini,.side-foot,.tip,.small-note,.field label { font-size:14px; }
.levelhead { font-size:14px; }
.levelhead b { color:var(--accent); }
.progress>div { background:var(--accent); }
.levelrow { padding:6px 0; border-radius:5px; }
.levelrow:focus-visible { outline:3px solid #9bd3b3; outline-offset:4px; }
.side-title { font-size:16px; }
.sidestack { position:static; gap:18px; }
.sidestack .section-head h2 { font-size:16px; }
.badge-count { font-size:13px; color:var(--muted); white-space:nowrap; }
.next-badge-panel { background:#fbfdfb; }
.next-badge-icon { color:#ae6a15; font-size:36px; background:#fff0d4; border:1px solid #ead5af; width:68px; height:68px; border-radius:50%; display:grid; place-items:center; margin:8px 0 12px; }
#nextBadge h3 { font-size:18px; margin:0 0 6px; }
#nextBadge .progress { margin-top:16px; }
.wide { width:100%; margin-bottom:10px; }
.badge-panel { margin-top:20px; }
.badge-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin:22px 0; }
.achievement { display:flex; gap:16px; align-items:flex-start; padding:20px; border:1px solid var(--line); border-radius:12px; background:#fafcfb; }
.achievement.earned { border-color:#bad7c5; background:#edf7ee; }
.achievement-icon { flex:0 0 52px; height:52px; display:grid; place-items:center; border-radius:50%; font-family:Georgia,serif; font-size:26px; color:var(--accent); background:var(--soft); border:1px solid var(--line); }
.achievement.earned .achievement-icon { background:#f9e9bc; color:#7b5616; border-color:#dfc47b; }
.achievement-status { font-size:12px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); }
.achievement h3 { margin:5px 0; font-size:16px; }
.achievement p { margin:4px 0 14px; font-size:14px; color:var(--muted); }
.achievement .progress { margin-bottom:5px; }
.detail-cover .cover-frame { height:210px; margin-bottom:20px; }
.detail-cover .cover-fallback { max-width:180px; }
.profile-item { padding:16px; }
.profile-item div { font-size:14px; margin-top:5px; }
footer { font-size:13px; }
@media(min-width:1500px) { .cover-frame { height:250px; } }
@media(max-width:1120px) { .books { grid-template-columns:repeat(2,minmax(0,1fr)); } .badge-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } .top-right { max-width:250px; text-align:right; } }
@media(max-width:870px) { .main-grid { grid-template-columns:1fr; } .books { grid-template-columns:repeat(3,minmax(0,1fr)); } .sidestack { grid-template-columns:1fr 1fr; } .backup-bar { align-items:flex-start; } .backup-buttons { flex-direction:column; } .cover-frame { height:200px; } }
@media(max-width:640px) { .wrap { padding-left:16px; padding-right:16px; } .hero { padding:24px 0 28px; } .hero h1 { font-size:38px; } .hero .eyebrow { font-size:10px; } .topbar { padding:16px 0; } .backup-bar { flex-direction:column; gap:12px; padding:16px; } .backup-buttons { flex-direction:row; width:100%; } .backup-buttons button { flex:1; } .stats { gap:10px; } .stat { padding:14px; } .stat .label { font-size:13px; } .panel { padding:16px; } .books { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; } .book { padding:9px; } .book-top { gap:5px; flex-wrap:wrap; } .book-code { font-size:11px; } .cover-frame { height:180px; } .cover-fallback { padding:10px; gap:8px; } .cover-fallback>span[lang=ja] { font-size:17px; } .cover-series { font-size:9px; } .book h3 { font-size:14px; } .book-actions { display:block; } .bottom-row { justify-content:space-between; } .stars { justify-content:flex-start; } .star { min-width:25px; } .catalog-info>span:last-child { display:none; } .controls { grid-template-columns:1fr 112px; } .controls select { font-size:14px; padding-left:9px; } .chip { min-height:40px; padding:7px 11px; } .section-head h2 { font-size:20px; } .sidestack,.badge-grid { grid-template-columns:1fr; } .tab { padding:9px 12px; } .tabs { gap:8px; } .achievement { padding:18px; } }
@media(prefers-reduced-motion:reduce) { * { scroll-behavior:auto!important; transition:none!important; } }

/* Compact navigation and catalog refinements. */
header::after { display:none; }
.topbar { padding:12px 0; }
.brand { gap:12px; align-items:center; }
.brand b { font-size:clamp(13px,1.35vw,18px); letter-spacing:0; font-weight:600; line-height:1.5; }
.brand-icon { width:36px; height:36px; flex:0 0 36px; font-size:22px; border-radius:8px; }
.hero { max-width:none; padding:22px 0 26px; }
.hero h1 { font-family:inherit; font-size:clamp(23px,2.6vw,36px); font-weight:650; line-height:1.25; letter-spacing:-.025em; margin:0; }
.catalog-filters { display:flex; gap:12px; flex-wrap:wrap; margin:14px 0; align-items:end; }
.catalog-filters label { font-size:12px; color:var(--muted); display:grid; gap:5px; }
.catalog-filters select { font-size:14px; min-height:42px; }
.catalog-filters .ruby-toggle { display:flex; align-items:center; min-height:42px; gap:7px; font-size:14px; }
.ruby-toggle input { width:17px; height:17px; accent-color:var(--green); }
.level--1 { --accent:#73609d; --soft:#f0ebfa; }
.level-5 { --accent:#357b73; --soft:#e2f4ef; }
.book h3 { line-height:2; min-height:3.8em; }
rt { font-size:.58em; font-weight:400; }

.source-label { font-size:12px; color:var(--muted); }
.book-links { display:flex; flex-wrap:wrap; gap:6px 12px; font-size:12px; line-height:1.6; }
.book-links a { color:var(--green); text-underline-offset:3px; }
#backupBar { margin-top:24px; }
#backupBar summary { cursor:pointer; font-weight:650; padding:4px 0; }
#backupBar .actions { display:flex; flex-wrap:wrap; gap:10px; }
#backupBar .identity { max-width:350px; }
#backupBar .side-title { margin-top:16px; }
.achievement-toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); max-width:calc(100vw - 32px); width:410px; z-index:100; border:1px solid #c4aa65; border-radius:12px; background:#173f33; color:white; box-shadow:0 6px 30px #0003; padding:18px 20px 23px; overflow:hidden; font:inherit; font-size:15px; text-align:left; cursor:pointer; }
.achievement-toast[hidden] { display:none; }
.achievement-countdown { position:absolute; left:0; bottom:0; height:4px; width:100%; background:#ebc66d; transform-origin:left; }
.counting .achievement-countdown { animation:badge-countdown 3s linear forwards; }
@keyframes badge-countdown { from {transform:scaleX(1)} to {transform:scaleX(0)} }
.toast { z-index:110; }
@media(max-width:640px) { .topbar { padding:10px 0; } .brand b { font-size:12px; } .hero { padding:18px 0 22px; } .hero h1 { font-size:24px; } .catalog-filters { gap:8px; } .catalog-filters label { flex:1; min-width:110px; } .catalog-filters .ruby-toggle { flex-basis:100%; min-height:28px; } .book-links { font-size:11px; } .book h3 { font-size:14px; } }
@media(prefers-reduced-motion:reduce) { .counting .achievement-countdown { animation:none; } }

/* Single-row club header; smaller screens wrap the club name naturally. */
.topbar { display:flex; justify-content:space-between; align-items:center; gap:24px; border:0; padding:15px 0; }
.brand { min-width:0; }
.brand b { font-size:15px; }
.tracker-title { font-size:19px; line-height:1.3; margin:0; white-space:nowrap; font-weight:650; letter-spacing:0; }
.progress-tools { display:flex; align-items:center; justify-content:space-between; gap:16px; margin:20px 0; font-size:13px; color:var(--muted); }
#backupBar { margin-top:20px; }
.progress-tools .backup-buttons { flex-direction:row; flex-wrap:wrap; }
.danger { color:#a13737; border-color:#dcbaba; }
.solid.danger { background:#9e3434; color:white; }
.book-code { text-align:right; white-space:normal; }
.reader-settings { margin-top:24px; }
.reader-settings summary { font-weight:600; cursor:pointer; margin-bottom:14px; }
.reader-settings .identity { max-width:350px; margin:10px 0; }
#resetDialog p { line-height:1.6; }
@media(max-width:640px) { .topbar { gap:12px; } .brand b { font-size:11px; } .tracker-title { font-size:14px; } .brand { gap:8px; } .brand-icon { flex-basis:30px; width:30px; height:30px; font-size:20px; } .progress-tools { align-items:flex-start; flex-direction:column; gap:9px; } .progress-tools .backup-buttons { width:100%; gap:6px; } .progress-tools button { padding:8px 10px; font-size:12px; } }

.hide-furigana rt { display:none; }

/* Compact navigation and search controls. */
.tabs { border-bottom:1px solid var(--line); gap:24px; }
.tab { border:0; border-bottom:3px solid transparent; border-radius:0; background:transparent; padding:12px 2px; }
.tab.active { background:transparent; border-color:var(--green); }
.controls { grid-template-columns:minmax(0,1fr); }
.catalog-filters { display:grid; grid-template-columns:1fr 1fr 1.4fr; gap:12px; }
.catalog-filters label { min-width:0; display:flex; flex-direction:column; gap:6px; }
.stats { grid-template-columns:1.4fr 1fr 1fr; }
.finished-total { display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; }
.completion-percent { color:var(--green); background:#e8f4ed; border-radius:20px; padding:4px 9px; font-size:14px; font-weight:700; }
.about-view { max-width:760px; margin-bottom:24px; line-height:1.7; }
.about-view a { color:var(--green); text-underline-offset:3px; }
@media(max-width:640px) {
 .catalog-filters { grid-template-columns:1fr 1fr; }
 .catalog-filters label:last-child { grid-column:1/-1; }
 .stats { grid-template-columns:1fr 1fr; }
 .stats .stat:first-child { grid-column:1/-1; }
 .tabs { gap:24px; }
}

/* Header destinations and personal settings. */
.header-tools,.header-nav { display:flex; align-items:center; gap:20px; }
.header-tools { flex-shrink:0; }
.header-nav { gap:6px; }
.nav-button { background:transparent; color:#fff; border:1px solid transparent; border-radius:8px; padding:10px 13px; font-size:14px; font-weight:650; min-height:44px; cursor:pointer; }
.nav-button.active { background:#ffffff18; border-color:#ffffff50; }
.nav-button:hover { background:#ffffff20; }
.profile-button { width:44px; padding:9px; display:grid; place-items:center; }
.text-button { border:0; padding:0; background:transparent; color:var(--green); text-decoration:underline; text-underline-offset:3px; font:inherit; cursor:pointer; }
.reader-settings { margin:20px 0; }
.reader-settings summary { font-weight:700; cursor:pointer; }
.reader-settings .progress-tools { flex-direction:column; align-items:flex-start; margin-bottom:0; }
@media(max-width:1000px) { .topbar { flex-wrap:wrap; gap:10px; } .header-tools { width:100%; justify-content:space-between; } }
@media(max-width:640px) { .header-tools { gap:12px; } .nav-button { padding:9px 11px; } .reader-settings .backup-buttons { flex-wrap:wrap; } }

/* Keep content clear of the header at every breakpoint. */
main.wrap { padding-top:24px; }
@media(max-width:640px) { main.wrap { padding-top:18px; } .header-tools { flex-wrap:wrap; } .header-nav { flex-wrap:wrap; } }

/* Summary and search share a column; the sidebar starts beside the summary. */
@media(min-width:871px) {
 .dashboard.browsing { display:grid; grid-template-columns:minmax(0,1fr) 270px; gap:24px; align-items:start; }
 .dashboard.browsing > .stats { grid-column:1; grid-row:1; margin-bottom:0; }
 .dashboard.browsing > .main-grid { display:contents; }
 .dashboard.browsing #shelfView > .panel { grid-column:1; grid-row:2; min-width:0; }
 .dashboard.browsing .sidestack { grid-column:2; grid-row:1 / span 2; }
}

/* A tall sidebar must not stretch the summary row when results shrink. */
@media(min-width:871px) { .dashboard.browsing { grid-template-rows:min-content 1fr; } }

.reading-card-panel { margin:20px 0; }
#readingCard { display:block; width:100%; height:auto; border-radius:14px; margin:20px 0; border:1px solid var(--line); }
.card-actions { display:flex; gap:10px; margin-bottom:10px; }
.card-nickname { display:grid; gap:6px; max-width:320px; font-size:14px; }
.favorite-picker { margin-top:22px; }
.favorite-picker summary { cursor:pointer; font-weight:650; margin-bottom:10px; }
#cardChoices { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin-top:12px; }
#cardChoices label { display:grid; gap:6px; font-size:13px; min-width:0; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
@media(max-width:640px) { #cardChoices { grid-template-columns:1fr; } }

.profile-item .cover-wrap {height:140px; margin-bottom:12px;}
.profile-item img {height:140px;max-width:100%;object-fit:contain;}
.profile-item button {margin-top:10px;}

.profile > .reading-card-panel:first-child {margin-top:0;}
.card-nickname {margin-top:16px;}

/* Compact cover shelves. Each cell contributes to the continuous row shelf. */
.profile-list.bookshelf {display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:24px 0;padding:8px 0 20px;}
.shelf-book {position:relative;min-width:0;padding:14px 12px 10px;border-bottom:7px solid #d9e5dc;box-shadow:0 4px 2px -2px #214b401c;display:flex;align-items:flex-end;justify-content:center;}
.shelf-cover {position:relative;display:flex;align-items:flex-end;justify-content:center;width:100%;height:155px;padding:0;border:0;border-radius:3px;background:transparent;cursor:pointer;}
.shelf-cover img {display:block;max-width:100%;max-height:155px;width:auto;height:auto;object-fit:contain;box-shadow:2px 3px 5px #173b3026;transition:transform .15s;}
.shelf-cover:focus-visible {outline:3px solid #237d65;outline-offset:5px;}
.shelf-cover:hover img,.shelf-cover:focus-visible img {transform:translateY(-4px);}
.shelf-heart {position:absolute;right:0;top:4px;width:26px;height:26px;display:grid;place-items:center;border-radius:50%;background:#fff;color:#b5467c;box-shadow:0 1px 5px #173b3033;font-size:16px;}
.shelf-placeholder {height:145px;width:100px;background:#e3ece5;display:grid;place-items:center;font-size:32px;}
.shelf-tooltip {position:absolute;top:calc(100% + 4px);left:0;z-index:20;width:max-content;max-width:210px;padding:12px;background:#174d3f;color:white;border-radius:8px;box-shadow:0 5px 18px #153b3033;opacity:0;visibility:hidden;pointer-events:none;font-size:12px;line-height:1.5;}
.shelf-tooltip b {display:block;font-size:14px;margin-bottom:5px;}.shelf-tooltip span {display:block;}
.shelf-book:focus-within .shelf-tooltip {opacity:1;visibility:visible;}
@media(hover:hover){.shelf-book:hover .shelf-tooltip {opacity:1;visibility:visible;}}
.shelf-book:nth-child(8n) .shelf-tooltip {left:auto;right:0;}
.bookshelf .empty {grid-column:1/-1;}
@media(max-width:1200px){.profile-list.bookshelf{grid-template-columns:repeat(6,minmax(0,1fr));}.shelf-book:nth-child(6n) .shelf-tooltip{left:auto;right:0;}}
@media(max-width:800px){.profile-list.bookshelf{grid-template-columns:repeat(4,minmax(0,1fr));}.shelf-book:nth-child(4n) .shelf-tooltip{left:auto;right:0;}}
@media(max-width:480px){.profile-list.bookshelf{grid-template-columns:repeat(3,minmax(0,1fr));gap:18px 0;}.shelf-book{padding:8px 7px;border-bottom-width:5px;}.shelf-cover,.shelf-cover img{max-height:125px;}.shelf-cover{height:125px;}.shelf-book:nth-child(3n) .shelf-tooltip{left:auto;right:0;}}
