/* Reading and navigation improvements; visual palette belongs to lab.css. */
.tb-search{position:relative;display:flex;align-items:center}
.tb-search input{width:100%;padding-right:42px}
.tb-search>button{position:absolute;right:5px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:34px;height:34px;border:0;background:transparent;color:inherit}
.tb-search>button svg{width:19px;height:19px}
.pending-doc{display:flex;align-items:baseline;justify-content:space-between;gap:10px;padding:8px 0;font-size:13px;color:var(--sub)}
.pending-doc small{flex:none;font-size:10px;opacity:.8}
.input-legend{margin:16px 0;border:1px solid var(--rule);border-radius:12px;padding:10px 14px}
.input-legend summary{cursor:pointer;font-size:13px;font-weight:700;min-height:24px;align-content:center}
.input-legend p{font-size:13px;line-height:1.8}
.result-count{font:500 13px var(--f-ui);color:var(--sub);margin-left:6px}
.table-scroll-hint{font-size:12px;color:var(--sub);text-align:right;margin:8px 0 4px}
.table-scroll-hint[hidden]{display:none}
.tw:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.gear-open{padding:0;border:0;background:none;text-align:left;font:inherit;font-weight:700;color:inherit;cursor:pointer}
.gear-open:hover{text-decoration:underline}
.lab-panel-empty .lab-guide-empty{min-height:0;padding:12px 16px;display:flex;gap:12px;align-items:center;justify-content:flex-start}
.lab-panel-empty .lab-guide-empty>svg{width:22px;height:22px;padding:0;background:none;box-shadow:none;flex:none}
.lab-panel-empty .lab-guide-empty p{margin:0}
.pt-recent{display:flex;align-items:center;justify-content:center;gap:10px}
@media(max-width:800px){
 .s-doc .tb-in{flex-wrap:wrap;row-gap:8px;padding-bottom:10px}
 .s-doc .tb-search{display:flex;order:5;width:100%;flex:1 0 100%;margin:0}
 .s-doc .tb-search input{height:40px}
 .s-doc .tb-search .sugg{width:100%;max-height:55vh;overflow:auto}
 .s-doc .tb-menu{margin-left:auto}
 .s-doc .tree{top:118px;max-height:calc(100dvh - 118px);overflow:auto}
 .s-doc .art .info{grid-template-columns:78px minmax(0,1fr)}
 .s-doc .info .pic{padding:8px}
 .s-doc .info .pic .ic{--s:64px!important}
 .s-doc .info .cap{display:none}
 .s-doc .info table th,.s-doc .info table td{padding:5px 9px;font-size:12px}
 .moves-wrap,.gear-list{overflow:visible}
 .moves-table,.moves-table tbody,.gear-list table,.gear-list tbody{display:block;width:100%}
 .moves-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 .moves-table tbody tr{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px 12px;padding:14px 12px;margin:10px 0;border:1px solid var(--rule);border-radius:12px}
 .moves-table tbody td{position:static!important;min-width:0!important;padding:0;border:0;background:transparent!important;white-space:normal;line-height:1.65;font-size:14px}
 .moves-table tbody td:first-child{font-weight:750}
 .moves-table tbody td:nth-child(2)::before{content:'대미지 ';font-size:11px;color:var(--sub)}
 .moves-table .dm{display:none}
 .moves-table tbody td:nth-child(3){font-size:12px}
 .moves-table tbody td:last-child{grid-column:1/-1;padding-top:7px;border-top:1px solid var(--rule)}
 .moves-table tbody td:last-child:empty{display:none}
 .gear-list .gear-row{display:block;margin:10px 0;padding:12px;border:1px solid var(--rule);border-radius:12px}
 .gear-list .gear-row td{display:block;min-width:0!important;padding:0;border:0;white-space:normal}
 .gear-list .gear-row td+td{margin-top:12px;padding-top:12px;border-top:1px solid var(--rule)}
 .gear-list .cell>span:last-child{min-width:0;overflow-wrap:anywhere}
 .gear-list .cd{font-size:13px;line-height:1.7}
 .lab-panel-empty .ch{margin-bottom:6px}
 .lab-panel-empty .lab-guide-empty{padding:8px 12px}
}
/* Stable header: the same unified search occupies the centre on inner pages. */
.tb-in{position:relative;justify-content:space-between}
.tb-links{margin-left:auto!important;margin-right:0!important}
.tb-search{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:280px;margin:0!important}
.tb-search input{width:100%}
.tb-menu{margin-left:8px}
.pt-search{position:relative}
.pt-search input{padding-right:44px;min-width:0}
.pt-search .record-clear{position:absolute;right:100px;top:50%;transform:translateY(-50%);width:32px;height:32px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--sub);font-size:24px;box-shadow:none}
.pt-search .record-clear:hover{background:#ede6f5}
@media(max-width:1000px){
 .tb-search{width:220px;display:flex}
}
@media(max-width:800px){
 .tb-in{flex-wrap:wrap}
 .tb-search,.s-doc .tb-search{position:relative;left:auto;top:auto;transform:none;display:flex;order:5;flex:1 0 100%;width:100%;margin:0!important}
 .tb:has(.tb-search) .tb-in{padding-bottom:10px;row-gap:8px}
 .tb-search .sugg{width:100%;max-height:55vh;overflow:auto}
 .pt-search .record-clear{right:76px}
}
@media(prefers-reduced-motion:reduce){.docmain,.mag-wrap,.portal{animation:none!important}}
@media(min-width:801px){.tb .tb-search[data-search]{position:absolute;display:flex;left:50%;top:50%;transform:translate(-50%,-50%)}}
/* One route transition; avoid layered delayed entrances restarting on each visit. */
.lab-hero-back,.lab-banner-title,.lab-search,.lab-category,.lab-panel{animation:none}
.lab-mascot{animation:lab-float 6s ease-in-out infinite}
.tb{view-transition-name:site-header}
::view-transition-old(root){animation:route-out 140ms ease both}
::view-transition-new(root){animation:route-in 240ms cubic-bezier(.2,.65,.3,1) both}
::view-transition-old(site-header),::view-transition-new(site-header){animation:none;mix-blend-mode:normal}
@keyframes route-out{to{opacity:0}}
@keyframes route-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.pt-card,.sheet{animation:route-in 240ms ease-out both}
.category-chips{gap:7px;margin-block:16px}
.category-count{margin-left:6px;font-size:10px;opacity:.7}
@media(prefers-reduced-motion:reduce){::view-transition-old(root),::view-transition-new(root),.pt-card,.sheet,.lab-mascot{animation:none!important}}
.header-search-toggle{display:grid;place-items:center;flex:none;width:40px;height:40px;margin-left:14px;border:1px solid #bca4d34a;border-radius:50%;background:#ffffff09;color:#e4d7f6;cursor:pointer}
.header-search-toggle svg{width:20px;height:20px}
.header-search-toggle:hover,.header-search-toggle[aria-expanded=true]{background:#7850a3;color:white}
.tb .tb-search[data-search]{position:absolute;display:flex;left:auto;right:0;top:calc(100% + 10px);transform:none;width:min(390px,calc(100vw - 32px));padding:8px;border:1px solid #d7c7e7;border-radius:16px;background:#30253f;box-shadow:0 12px 30px #21152c33;z-index:30;animation:route-in 160ms ease-out}
.tb .tb-search input{height:42px;background:#ffffff0c;border:1px solid #ffffff24;padding-right:38px}
.tb .tb-search .sugg{top:calc(100% + 5px);width:100%;right:0;left:auto;max-height:65vh;overflow:auto}
.tb:has(.tb-search) .tb-in{padding-bottom:0;row-gap:0}
.record-title-reset{font:inherit;letter-spacing:inherit;color:inherit;text-shadow:inherit;border:0;background:none;padding:0;cursor:pointer}
.record-title-reset:hover{opacity:.85}
.pet-stat-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-top:16px}
.pet-stat-card{border:1px solid #ded1e9;border-radius:16px;background:#fff;overflow:hidden;min-width:0}
.pet-card-title{display:flex;align-items:center;gap:12px;padding:16px;background:#f7f2fc}
.pet-card-title h3{margin:0;font-size:15px;color:#382b49}
.pet-stat-table{width:100%;table-layout:fixed;font-size:13px;border:0}
.pet-stat-table th,.pet-stat-table td{min-width:0;padding:9px 2px;text-align:center;white-space:normal;border-bottom:1px solid #eee7f4}
.pet-stat-table thead th{font-size:12px;background:#fcfaff;color:#746184;font-weight:700}
.pet-stat-table tbody th{font-size:12px;color:#746184;background:#fcfaff}
.pet-stat-table .raised{color:#573575;font-weight:700}
.pet-stat-table .zero{color:#d7cede}
.pet-stat-table tbody tr:last-child>*{border-bottom:0}
@media(max-width:1000px){.pet-stat-grid{grid-template-columns:1fr}}
@media(max-width:800px){.header-search-toggle{width:32px;height:32px;margin-left:6px}.tb .tb-search[data-search]{flex:none;order:initial;right:16px;top:calc(100% + 8px)}.s-doc .tree{top:64px;max-height:calc(100dvh - 64px)}}
.medal-condition{max-width:310px;margin-top:5px;white-space:normal;font-size:12px;font-weight:400;color:#6e5c7e}
.medal-condition summary{cursor:pointer;font-size:11px}
.medal-condition p{margin:8px 0;line-height:1.7;color:#44344f}
.medal-condition small{font-size:10px;color:#8d7b9b}
.pet-display-bar{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin:16px 0;font-size:13px;font-weight:700}
.pet-stats-switch{display:flex;align-items:center;gap:7px;background:#e6dfee;border:0;border-radius:999px;padding:5px;width:72px;cursor:pointer;color:#786885}
.pet-stats-switch span{width:22px;height:22px;flex:none;border-radius:50%;background:white;box-shadow:0 1px 4px #38244830;transition:transform .18s}
.pet-stats-switch b{font-size:10px}
.pet-stats-switch[aria-checked=true]{background:#7954a3;color:white;flex-direction:row-reverse}
.pet-open{width:100%;text-align:left;border:0;cursor:pointer;color:#382b49;font-size:14px;font-weight:700;min-height:84px}
.pet-open:hover{background:#eee5f8}
.pet-stat-grid.stats-off{grid-template-columns:repeat(3,minmax(0,1fr))}
.pet-stat-table th{font-size:12px!important;letter-spacing:0}
#pet-dialog{width:min(620px,calc(100vw - 32px));box-sizing:border-box;padding:24px;border:1px solid #d7c9e5;border-radius:22px;background:#fff;color:#382b49;box-shadow:0 24px 80px #21122e33;animation:route-in .2s ease-out}
#pet-dialog::backdrop{background:#21162e80;backdrop-filter:blur(4px)}
.pet-dialog-top{display:flex;align-items:center;gap:12px}
.pet-dialog-top h2{font-size:20px;margin:0;flex:1}
.pet-dialog-close{border:0;background:#f2edf8;border-radius:50%;width:34px;height:34px;font-size:24px;color:#705582;cursor:pointer}
.pet-level-control{display:flex;align-items:center;justify-content:center;gap:12px;margin:24px 0}
.pet-level-control output{font-size:30px;font-weight:800;font-variant-numeric:tabular-nums;min-width:80px}
.pet-level-control>div{display:flex;flex-direction:column;gap:4px}
.pet-level-control button{border:1px solid #dcd0e8;background:#f6f1fc;color:#654285;border-radius:7px;width:34px;height:25px;cursor:pointer;font-size:18px;line-height:1}
.pet-level-control button:disabled{opacity:.3;cursor:default}
.pet-dialog-stats{border:1px solid #e1d6e9;border-radius:12px;overflow:hidden}
@media(max-width:800px){.pet-stat-grid.stats-off{grid-template-columns:repeat(2,minmax(0,1fr))}#pet-dialog{padding:18px}.pet-dialog-top h2{font-size:17px}.pet-stat-table th,.pet-stat-table td{padding:10px 1px;font-size:12px}.pet-open{padding:12px;gap:8px;font-size:13px}}
.medal-actions{display:flex;gap:10px;margin-top:5px}
.medal-actions button{padding:0;border:0;background:none;color:#806893;font-size:11px;cursor:pointer;font-weight:500}
.medal-actions button:hover{color:#593478;text-decoration:underline}
#medal-popover{position:fixed;inset:auto;margin:0;width:max-content;max-width:min(280px,calc(100vw - 24px));max-height:230px;box-sizing:border-box;padding:12px 15px;border:1px solid #dacbe6;border-radius:12px;background:#fff;color:#473650;box-shadow:0 7px 26px #2f163326;font-size:12px;line-height:1.7;overflow:auto;animation:route-in .14s ease-out}
#medal-popover p{margin:0;white-space:normal;overflow-wrap:anywhere}
#medal-popover p+p{margin-top:9px;padding-top:9px;border-top:1px solid #eee7f4}
