/* 奶蛙图鉴: shares the cream modal skin and the sandbox panel's layout. */
.modal.codex-modal{display:flex;flex-direction:column;width:min(680px,100%);max-height:calc(100% - 20px);min-height:0;overflow:hidden;padding:14px 18px 12px;text-align:left}
.codex-modal>.mini,.codex-modal>h2{flex-shrink:0;text-align:center}
.codex-modal>h2{margin:2px 0 8px}
.codex-tabs{display:flex;gap:4px;flex-shrink:0;padding-bottom:6px;border-bottom:2px dotted #d3c393}
.codex-tabs button{flex:1 1 0;display:flex;align-items:baseline;justify-content:center;gap:6px;min-width:0;min-height:40px;padding:4px 6px;border:2px solid #b9a774;border-bottom-width:4px;border-radius:6px;background:#f6ebcb;color:var(--ink-2);font:800 14px/1.1 var(--font-ui);white-space:nowrap;touch-action:manipulation}
.codex-tabs button small{font-size:11px;font-weight:700;opacity:.8}
.codex-tabs button[aria-selected=true]{border-color:var(--leaf-dark);background:var(--leaf);color:#fff6da}
.codex-body{flex:1 1 auto;min-height:0;display:grid;grid-template-columns:minmax(0,2fr) minmax(0,3fr);gap:10px;overflow:hidden;padding:8px 0 4px}
.codex-list,.codex-reading{min-width:0;min-height:0;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y}
.codex-list{padding:4px 5px}
.codex-detail{display:flex;gap:14px;align-items:center;min-height:104px;margin-bottom:10px;padding:10px 12px;border:2px solid #d3c393;border-radius:8px;background:#fffaf0}
.codex-reading .codex-detail{flex-direction:column;align-items:flex-start;margin-bottom:0}
.codex-detail-art{flex:none;display:grid;place-items:center;width:92px;height:92px;border-radius:6px;background:#efe3c1}
.codex-detail-art canvas{width:92px;height:92px;image-rendering:pixelated}
.codex-detail-art .item-texture,.codex-detail-art .resource-symbol{width:72px;height:72px;flex-basis:72px;font-size:36px}
.codex-detail h3{margin:0 0 2px;color:var(--ink);font-size:17px;font-weight:900}
.codex-detail p{margin:2px 0!important;color:var(--ink-2)!important;font-size:13px!important;line-height:1.6!important}
.codex-detail .codex-meta{color:#8a7a52!important;font-size:12px!important;font-weight:800}
.codex-empty{justify-content:center;text-align:center}
.codex-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:6px}
.codex-cell{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:3px;min-width:0;min-height:96px;padding:6px 4px;border:2px solid #a8986a;border-bottom-width:4px;border-radius:6px;background:#fdf4dc;color:var(--ink);font:800 12px/1.25 var(--font-ui);text-align:center;touch-action:manipulation}
.codex-cell>span:last-of-type{min-width:0;overflow-wrap:anywhere}
.codex-cell canvas{width:56px;height:56px;image-rendering:pixelated}
.codex-cell .item-texture,.codex-cell .resource-symbol{width:52px;height:52px;flex-basis:52px;min-width:52px;font-size:24px}
.codex-cell[aria-pressed=true]{border-color:var(--leaf-dark);background:#e2eecb;box-shadow:inset 0 0 0 2px #fff6da}
.codex-cell.unknown{border-style:dashed;background:#efe6cc;color:#a39468;cursor:default}
.codex-unknown{display:grid;place-items:center;width:52px;height:52px;border-radius:50%;background:#e2d6b2;color:#b3a376;font-size:26px;font-weight:900}
.codex-owned{position:absolute;top:-6px;right:-5px;display:grid;place-items:center;width:18px;height:18px;border:2px solid var(--leaf-dark);border-radius:50%;background:var(--leaf);color:#fff6da;font-size:11px;font-style:normal;font-weight:900}
.codex-note{margin:10px 0 0!important;color:#7a6c48!important;font-size:12px!important}
.codex-modal>.primary{flex-shrink:0;margin:8px auto 0!important;min-height:44px;padding:8px 26px}

/* Title cover: a 图鉴 tab on the artwork's top-right corner. */
.cover-codex{position:absolute;top:16px;right:18px;z-index:2;display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:6px 14px;border:2px solid var(--frame-dark);border-radius:8px;background:#fffaf0ee;color:var(--ink);font:900 14px/1 var(--font-ui);box-shadow:3px 3px 0 #00000040;touch-action:manipulation}
.cover-codex::before{content:'';width:16px;height:16px;background:currentColor;-webkit-mask:var(--codex-icon) center/contain no-repeat;mask:var(--codex-icon) center/contain no-repeat}
.cover-codex small{color:#8a7a52;font-size:11px;font-weight:800}
.cover-codex:hover{background:#fff3cf}
:root{--codex-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M0 1h4l1 1 1-1h4v8H6L5 10 4 9H0zm1 1v6h3l.5.5V2.5L4 2zm8 0H6l-.5.5v6L6 8h3z'/%3E%3C/svg%3E")}
.mobile-menu-grid [data-menu-action=codexOpen]{--icon:var(--codex-icon)}

@media (max-width:780px),(pointer:coarse),(max-width:1100px) and (max-height:600px){
 .modal.codex-modal{width:min(660px,100%);padding:10px 14px 8px;max-height:calc(var(--game-vh,100dvh) - 20px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))}
 .codex-modal>.mini{display:none}
 .codex-modal>h2{margin:0 0 6px;font-size:17px}
 .codex-tabs button{min-height:38px;font-size:13px}
 .codex-detail{min-height:84px;padding:8px 10px;gap:10px}
 .codex-detail-art,.codex-detail-art canvas{width:72px;height:72px}
 .codex-detail-art .item-texture{width:60px;height:60px;flex-basis:60px}
 .codex-grid{grid-template-columns:repeat(auto-fill,minmax(84px,1fr))}
 .codex-cell{min-height:84px;font-size:11px}
 .codex-cell canvas{width:48px;height:48px}
 .codex-cell .item-texture,.codex-cell .resource-symbol,.codex-unknown{width:44px;height:44px;flex-basis:44px;min-width:44px}
 .codex-modal>.primary{min-height:42px;padding:6px 22px;font-size:14px}
 .cover-codex small{display:none}
 .cover-codex{top:max(10px,env(safe-area-inset-top,0px));right:max(12px,env(safe-area-inset-right,0px));min-height:44px;padding:5px 11px;font-size:13px}
}
@media (max-height:340px){.codex-modal>h2{display:none}.codex-detail{min-height:72px}}
@media (max-height:450px),(max-width:550px){
 .codex-body{gap:6px;grid-template-columns:minmax(0,.95fr) minmax(0,1.3fr)}
 .codex-reading .codex-detail{display:block;padding:6px 8px}
 .codex-detail-art,.codex-detail-art canvas{width:46px;height:46px}
 .codex-detail-art{float:left;margin:0 7px 3px 0}
 .codex-detail-art .item-texture,.codex-detail-art .resource-symbol{width:40px;height:40px;flex-basis:40px}
}
