/* 1.3.0 — readable panel on every screen, ladder in the menu, council card, chronicle. */
:root{--icon-f:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M8 15V5' stroke='%23e2c25a' stroke-width='1.6' fill='none'/><ellipse cx='8' cy='3.5' rx='1.8' ry='2.6' fill='%23e2c25a'/><ellipse cx='5.4' cy='7' rx='1.6' ry='2.4' fill='%23e2c25a' transform='rotate(-30 5.4 7)'/><ellipse cx='10.6' cy='7' rx='1.6' ry='2.4' fill='%23e2c25a' transform='rotate(30 10.6 7)'/><ellipse cx='5.6' cy='10.6' rx='1.5' ry='2.2' fill='%23e2c25a' transform='rotate(-30 5.6 10.6)'/><ellipse cx='10.4' cy='10.6' rx='1.5' ry='2.2' fill='%23e2c25a' transform='rotate(30 10.4 10.6)'/></svg>");
--icon-w:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><rect x='1' y='5' width='14' height='6' rx='3' fill='%23a8743f'/><ellipse cx='13' cy='8' rx='2.2' ry='3' fill='%23d9b07a'/><ellipse cx='13' cy='8' rx='1' ry='1.4' fill='%23a8743f'/></svg>");
--icon-g:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><circle cx='8' cy='8' r='6.5' fill='%23f2cf3d'/><circle cx='8' cy='8' r='4.4' fill='none' stroke='%23b8901c' stroke-width='1.2'/></svg>");
--icon-s:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M1 12L4 4L10 2L15 8L12 14L4 15Z' fill='%23bac9c5'/><path d='M4 4L7 10L15 8M7 10L4 15' fill='none' stroke='%236d8380'/></svg>");}
.cost .c::before{width:12px;height:12px;border-radius:0;margin-right:3px;vertical-align:-1px;background:center/contain no-repeat}
.c.f::before{background-image:var(--icon-f)}.c.w::before{background-image:var(--icon-w)}.c.g::before{background-image:var(--icon-g)}.c.s::before{background-image:var(--icon-s)}
.c.lack{color:#ff9d8a;text-decoration:underline dotted}

/* ---- bottom panel: grows with its content, scrolls instead of clipping ---- */
#bottom{display:flex;flex-direction:column}
#panel{min-height:0;max-height:min(42vh,230px);overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;padding-bottom:6px;position:relative}
#panel .row{flex-wrap:nowrap}
#panel .row.build{display:grid;grid-auto-flow:column;grid-template-rows:repeat(2,auto);grid-auto-columns:max-content;gap:6px;overflow-x:auto;overflow-y:hidden;padding:4px 0 6px;scrollbar-width:none}
#panel .row.build::-webkit-scrollbar{display:none}
#panel .row.build .act.pic{min-width:150px}
.buildCats{display:flex;align-items:center;gap:5px;padding:4px 0 1px;font-size:11px;color:#b8c3ae;overflow-x:auto;scrollbar-width:none}
.buildCats::-webkit-scrollbar{display:none}
.buildCats button{flex:none;padding:4px 9px;border-radius:12px;border:1px solid #6d7c6155;background:#1b3028;color:#d8dfc9;font-size:11px}
.buildCats button.on{background:#d2bb7d;color:#183123;border-color:#d2bb7d;font-weight:700}
#panelToggle{position:absolute;right:8px;top:-14px;width:40px;height:26px;border-radius:7px 7px 0 0;border:1px solid #b0a16c77;border-bottom:0;background:#102820f0;color:#e6dcb8;font-size:14px;line-height:1;z-index:1}
#bottom.collapsed #panel,#bottom.collapsed .buildCats{display:none!important}
#bottom #panel:not(:has(button)){min-height:0;max-height:70px}
.act .cost{flex-wrap:wrap}
.chip{min-height:38px}

/* ---- HUD extras ---- */
#alertBtn{position:absolute;left:50%;transform:translateX(-50%);top:calc(92px + env(safe-area-inset-top,0px));z-index:7;background:#7a2418f0;color:#fff3e6;border:1px solid #f0a08a;border-radius:6px;padding:8px 14px;font-size:13px;font-weight:700;box-shadow:0 4px 16px #0006;animation:alert-pulse 1.2s ease-in-out infinite}
@keyframes alert-pulse{0%,100%{box-shadow:0 4px 16px #0006}50%{box-shadow:0 0 0 6px #c8392e55}}
@media(max-width:700px){#alertBtn{top:calc(126px + env(safe-area-inset-top,0px));font-size:12px;padding:7px 10px}}
#bChronicle{margin-right:4px}
#council{position:absolute;left:18px;top:112px;width:240px;background:#102b25d6;border:1px solid #9c996347;border-radius:6px;padding:9px 11px 9px;box-shadow:0 5px 18px #0003;z-index:4;font-size:12px;line-height:1.35;color:#d7e1cb}
#councilHead{display:flex;justify-content:space-between;width:100%;background:none;border:0;padding:0 0 4px;color:#d0bd84;font-size:9px;letter-spacing:.14em;text-transform:uppercase;cursor:pointer;text-align:left}
#councilHead b{font-weight:700}#councilCount{color:#aebf9d;letter-spacing:0}
#councilHead{padding-right:34px;min-height:32px;align-items:center;gap:8px}
#councilToggle{position:absolute;right:3px;top:3px;width:36px;height:36px;border:0;background:transparent;color:#d0bd84;font-size:23px;line-height:1}
#council.collapsed #councilText,#council.collapsed #councilMeta,#council.collapsed #councilTier{display:none}
#councilText{margin:0;font-size:12.5px;color:#f0eadb}
#councilMeta{display:flex;justify-content:space-between;gap:8px;margin-top:4px;font-size:11px;color:#c9d5b9}
#councilReward{color:#e5cf8f}
#councilTier{border-top:1px solid #87947744;margin-top:6px;padding-top:5px;font-size:10.5px;color:#aebf9d}
#council:empty{display:none}

/* ---- menu: ladder ---- */
#ladderBox{display:grid;gap:5px;margin-top:2px}
#ladderBox label{font-size:12px;color:#d6cead}
.ladderRow{display:flex;align-items:stretch;gap:6px}
.ladderRow button{flex:none;width:44px;min-height:46px;border-radius:6px;border:1px solid #c8bc7c66;background:#182f27;color:#f5efd9;font-size:22px;line-height:1}
.ladderRow button:disabled{opacity:.35}
.ladderInfo{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:center;gap:2px;border:1px solid #c8bc7c66;border-radius:6px;padding:6px 10px;background:#182f27}
.ladderInfo b{font-size:14px;color:#f3e7c2}.ladderInfo span{font-size:11px;line-height:1.3;color:#b9c3ad}
#ladderBest{font-size:11px;color:#babda9;line-height:1.35}
#menuLinks{display:flex;gap:16px;flex-wrap:wrap;margin-top:-2px}
#scrMenu .card{gap:10px}

/* ---- chronicle screen ---- */
#scrChronicle .card{gap:12px}
#chronTabs{margin:2px 0 4px}
#chronBody{min-height:120px}
.chronList{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:6px}
.chronList li{display:grid;grid-template-columns:22px 48px 1fr;gap:8px;align-items:baseline;padding:8px 10px;border:1px solid #8c986233;border-radius:6px;background:#28433355;font-size:13px;line-height:1.4;color:#d4dcc6}
.chronList li i{font-style:normal;color:#d9c48c;text-align:center}
.chronList li time{font-variant-numeric:tabular-nums;color:#9fb092;font-size:12px}
.chronList li.w3{border-color:#c9b57a88;background:#2f4a3a88;color:#f0e8d2}
.chronList li.k-event{border-style:dashed}
.cityGrid{display:grid;grid-template-columns:1.2fr 1fr;gap:14px}
.cityTier{grid-column:1/-1;padding:16px 18px;border:1px solid #a8ac7955;border-radius:8px;background:#25403277}
.cityTier small,.cityLadder small{font-size:9px;letter-spacing:.15em;color:#d0bd84}
.cityTier b{display:block;font:26px Georgia,serif;color:#e8d6a0;margin:4px 0 6px}
.cityTier p{margin:4px 0;font-size:13px;line-height:1.5;color:#c3ccb8}
.cityTier .cityNext{color:#e9dfbf}
.cityStats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.cityStats div{padding:8px 10px;border:1px solid #8c986233;border-radius:6px;background:#28433355}
.cityStats small{display:block;font-size:10px;color:#a0b18e}.cityStats b{font-size:16px;color:#ebe1c2}
.cityLadder ul{list-style:none;padding:0;margin:6px 0 0}
.cityLadder li{display:flex;justify-content:space-between;gap:10px;padding:7px 10px;border-left:3px solid #4a5f4a;margin-bottom:5px;font-size:12px;color:#9fb092;background:#1f352c88}
.cityLadder li.done{border-color:#b7a76b;color:#d9d3b8}.cityLadder li.now{background:#38503f;color:#f3e7c2}
.cityLadder li b{font-weight:700}
.questList{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:5px}
.questList li{display:grid;grid-template-columns:20px 1fr auto;gap:8px;align-items:baseline;padding:8px 10px;border:1px solid #8c986233;border-radius:6px;font-size:13px;color:#8fa38b;background:#1f352c66}
.questList li i{font-style:normal;color:#d9c48c}
.questList li small{color:#b9a86f;font-size:11px;white-space:nowrap}
.questList li.done{color:#c4cdb4;background:#28433355}.questList li.done i{color:#8fd08f}
.questList li.now{background:#38503f;color:#f3e7c2;border-color:#c9b57a88}.questList li.now em{font-style:normal;color:#e5cf8f}
.questList li.skip{opacity:.45}

/* ---- phones ---- */
@media(max-width:700px){
 #council{left:10px;top:92px;width:min(230px,56vw);padding:7px 9px;font-size:11px}
 #councilText{font-size:11.5px}#councilMeta{font-size:10px}#councilTier{font-size:10px}
 #bChronicle{display:none}
 #panel{max-height:min(38vh,250px)}
 #panel .row.build .act.pic{min-width:138px}
 .cityGrid{grid-template-columns:1fr}.cityStats{grid-template-columns:repeat(3,1fr)}
 .chronList li{grid-template-columns:18px 40px 1fr;font-size:12px}
 .questList li{grid-template-columns:18px 1fr;font-size:12px}.questList li small{grid-column:2;white-space:normal}
 .ladderInfo b{font-size:13px}
}
@media(orientation:landscape) and (max-height:520px){
 #panel{max-height:100px;padding:5px 8px 3px}
 #tools{padding:3px 6px 5px}
 #panel .row.build{grid-template-rows:auto}
 #tools button{padding:7px 2px;font-size:10px}
 #tools #tBox{min-height:36px}
 .ic{width:36px;height:36px}
 .act{padding:5px 9px}
 .ptitle{font-size:15px}
 #council{top:104px;left:10px;width:210px;padding:5px 8px}
 #councilMeta,#councilTier{display:none}
 #councilText{font-size:11px}
 #mini{width:84px;height:84px;top:52px;right:10px}
 #zoomTools{top:142px;right:10px}#zoomTools button{width:28px;height:28px}
 #bChronicle{display:none}
 #ladderBox{grid-column:1/-1}
}
@media(max-height:600px) and (orientation:landscape){
 #matchOptions small,#ladderBest,#scrMenu .edition{display:none}
 #scrMenu .card{padding-bottom:10px}
 #ladderBox{grid-column:1/-1;display:grid;grid-template-columns:100px 1fr;align-items:center;gap:5px}
 .ladderRow button{min-height:36px;width:38px;font-size:18px}
 .ladderInfo{padding:3px 8px;gap:0}.ladderInfo b{font-size:12px}.ladderInfo span{font-size:10px}
 #menuLinks{gap:12px}
}
@media(min-width:1200px){
 #panel{max-height:260px}
 #panel .row.build{display:flex;flex-wrap:wrap;overflow:visible}
 #council{top:122px}
}
@media(pointer:coarse){
 #councilHead{min-height:44px;padding-right:40px}
 #councilToggle{width:44px;height:44px}
 #panelToggle{height:44px;width:44px;top:-36px}
 .buildCats button{min-height:44px;padding:8px 12px}
 .ladderRow button{min-height:44px;min-width:44px}
}
@media(prefers-reduced-motion:reduce){#panelToggle{transition:none}#alertBtn{animation:none}}

.costResourceName{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
