.root{--bg:#0f1724;--card:#0b1220;--accent:#7dd3fc;--muted:#94a3b8}
:root{--bg:#0f1724;--card:#0b1220;--accent:#7dd3fc;--muted:#94a3b8}
*{box-sizing:border-box;font-family:Inter,Segoe UI,Arial,Helvetica,sans-serif}
html,body{height:100%;margin:0;background:linear-gradient(180deg,var(--bg),#071223);color:#e6eef6;overflow:hidden}

/* Disable text selection globally to block marking */
html, body, * {
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

/* Centered game container that scales with viewport but prevents scrollbars */
#game{width: min(1200px, 98vw);height: min(820px, 96vh);margin:calc((100vh - min(820px,96vh))/2) auto;display:flex;flex-direction:column;border-radius:10px;padding:8px;box-shadow:0 10px 40px rgba(2,6,23,0.7);background:linear-gradient(180deg,rgba(255,255,255,0.02),rgba(255,255,255,0.01));overflow:hidden}

#hud{display:flex;gap:12px;padding:8px;align-items:flex-start;flex:0 0 auto}
#inventory,#helpers{background:rgba(255,255,255,0.03);padding:10px;border-radius:8px}
#playarea{position:relative;margin:8px;border:2px dashed rgba(255,255,255,0.03);overflow:hidden;border-radius:8px;flex:1;min-height:0}
/* spawned resource icons: larger and icon-only, no label box */
.material{position:absolute;width:56px;height:56px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:28px;background:radial-gradient(circle at 30% 30%,rgba(255,255,255,0.08),transparent),linear-gradient(135deg,var(--accent),#60a5fa);color:#022;cursor:pointer;user-select:none;box-shadow:0 6px 18px rgba(2,6,23,0.6)}
.material.small{width:42px;height:42px;font-size:20px}
.material.large{width:72px;height:72px;font-size:36px}
.material.floaty{animation:float 4s ease-in-out infinite}

/* helper avatar visuals */
.helper-avatar{position:absolute;width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:20px;background:linear-gradient(135deg,#ffd98a,#ffb86b);box-shadow:0 8px 18px rgba(0,0,0,0.5);z-index:30;transition:left .06s linear,top .06s linear}
.helper-avatar.small{width:34px;height:34px;font-size:16px}

/* resource tiles (top bar) */
.resourceTile{display:flex;flex-direction:column;align-items:center;justify-content:center;width:64px;height:64px;border-radius:8px;background:rgba(255,255,255,0.02);color:#eaf6ff}
.resourceTile.locked{opacity:.35}
.resourceTile.sufficient{background:linear-gradient(135deg, rgba(16,185,129,0.22), rgba(34,197,94,0.16));border:1px solid rgba(16,185,129,0.24);box-shadow:0 18px 48px rgba(16,185,129,0.14), 0 12px 36px rgba(2,6,23,0.20);transform:translateY(-3px);animation:glowPulseGreen 2.6s ease-in-out infinite}
.resourceTile.sufficient{background:linear-gradient(135deg, rgba(16,185,129,0.22), rgba(34,197,94,0.16));border:1px solid rgba(16,185,129,0.24);box-shadow:0 18px 48px rgba(16,185,129,0.14), 0 12px 36px rgba(2,6,23,0.20);transform:translateY(-3px);animation:glowPulseGreen 2.6s ease-in-out infinite}
.resIcon{font-size:26px}
.resCount{font-size:12px;color:var(--muted);margin-top:4px}

/* unlock box on the left (shows only items that are currently unlockable) */
#unlockBox{background:rgba(255,255,255,0.02);padding:8px;border-radius:8px;min-width:200px}
#unlockList{display:flex;flex-direction:column;gap:6px;margin-top:6px}
.unlock-row{display:flex;justify-content:space-between;align-items:center;padding:6px;background:rgba(255,255,255,0.01);border-radius:6px}
.unlock-row .unlock-btn{padding:6px 8px;border-radius:6px;border:none;background:#06b6d4;color:white}
/* make unlock buttons look inactive when disabled */
.unlock-row .unlock-btn:disabled{
	opacity:0.45;
	background:rgba(255,255,255,0.02);
	color:var(--muted);
	cursor:default;
	pointer-events:none;
}

/* Highlight and clickable whole box when unlockable */
.unlock-row.can-unlock{background:linear-gradient(135deg, rgba(125,211,252,0.06), rgba(96,165,250,0.03));border:1px solid rgba(125,211,252,0.10);cursor:pointer;transition:transform .08s ease,box-shadow .12s ease}
.unlock-row.can-unlock:hover{transform:translateY(-2px);box-shadow:0 8px 24px rgba(2,6,23,0.35)}
.unlock-row:focus{outline:2px solid rgba(125,211,252,0.14);outline-offset:2px}
.unlock-hint{color:var(--muted);font-size:12px;margin-top:4px}
.unlock-hdr{color:var(--muted);font-size:12px;margin-top:6px;margin-bottom:4px}

/* helper locked preview */
.helper-row.helper-locked{opacity:0.48}
.helper-lock-note{color:var(--muted);font-size:12px}
/* small indicator shown when a helper type is fully hired */
.helper-max-note{color:#a7f3d0;font-size:12px;font-weight:600}

/* quest status */
.q-status{color:var(--muted);font-size:12px;min-width:120px;text-align:right}

/* Quests styling */
#questsPanel{background:rgba(255,255,255,0.02);padding:8px;border-radius:8px}
.quest-row{display:flex;justify-content:space-between;align-items:center;padding:6px 0;border-bottom:1px dashed rgba(255,255,255,0.03)}
.q-desc{color:var(--muted);font-size:12px;margin-top:4px}
.q-progress{color:var(--muted);font-size:12px;min-width:48px;text-align:right;margin-right:8px}

/* Quest row highlights */
.quest-row.quest-available{background:linear-gradient(90deg, rgba(125,211,252,0.04), rgba(96,165,250,0.02));border:1px solid rgba(125,211,252,0.08);cursor:pointer;transition:transform .08s ease,box-shadow .12s ease}
.quest-row.quest-available:hover{transform:translateY(-2px);box-shadow:0 8px 20px rgba(2,6,23,0.25)}
.quest-row.quest-ready{background:linear-gradient(90deg, rgba(16,185,129,0.04), rgba(34,197,94,0.02));border:1px solid rgba(16,185,129,0.08);cursor:pointer}
.quest-row:focus{outline:2px solid rgba(125,211,252,0.12);outline-offset:2px}
.quest-row.quest-available .q-status{color:#7dd3fc;font-weight:600}
.quest-row.quest-ready .q-status{color:#10b981;font-weight:600}
.quest-row.quest-activate{border-color:rgba(125,211,252,.48);background:linear-gradient(105deg,rgba(125,211,252,.10),rgba(125,211,252,.025))}
.quest-row.quest-activate .q-status:before{content:'↗ ';font-size:15px}
.quest-row.quest-claim{border-color:rgba(169,229,193,.65);background:linear-gradient(105deg,rgba(169,229,193,.16),rgba(246,201,105,.06));box-shadow:0 0 0 1px rgba(169,229,193,.12),0 10px 28px rgba(0,0,0,.18)}
.quest-row.quest-claim .q-status:before{content:'✦ ';font-size:14px}
.quest-panel-mixed{position:relative;border-color:rgba(246,201,105,.38)!important;box-shadow:inset 3px 0 0 #7dd3fc,inset -3px 0 0 #a9e5c1,0 16px 35px rgba(0,0,0,.12)!important}
.quest-panel-mixed>strong:after{content:'  •  activate + claim';margin-left:6px;color:var(--gold);font:600 10px "Trebuchet MS",sans-serif;letter-spacing:.3px}

/* Explicit upgrade structure: Spawn and Yield are separate action rows. */
#upgrades .upgrade-actions{display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-auto-rows:max-content!important;gap:7px!important;width:100%!important;min-width:0!important}
#upgrades .upgrade-action{display:flex!important;flex-direction:column!important;align-items:flex-start!important;gap:3px!important;width:100%!important;min-width:0!important}
#upgrades .upgrade-action .costIcons{order:-1!important;display:flex!important;justify-content:flex-start!important;align-items:center!important;flex-wrap:nowrap!important;width:auto!important;max-width:100%!important;min-height:20px!important;margin:0!important;overflow:visible!important}
#upgrades .upgrade-action>.btn{order:2!important;width:auto!important;min-width:92px!important;max-width:100%!important}

@media (max-width:680px){
	#upgrades .upgrade-actions{gap:8px!important}
	#upgrades .upgrade-action>.btn{min-width:88px!important}
	#upgrades .upgrade-action .costIcons .ci{padding:2px 5px}
}

/* Unlock cards: title and readiness stay together, with the cost as a clean second line. */
#unlockList .unlock-row{display:block!important;padding:9px 8px!important;min-height:0}
#unlockList .unlock-content{display:block;width:100%;min-width:0}
#unlockList .unlock-title{display:flex;align-items:center;gap:7px;min-height:22px;line-height:1.2}
#unlockList .unlock-title strong{font-size:13px}
#unlockList .unlock-hint{display:inline-flex;align-items:center;min-height:18px;padding:2px 6px;border:1px solid rgba(246,201,105,.42);border-radius:99px;background:rgba(246,201,105,.12);color:var(--gold);font-size:10px;font-weight:700;line-height:1}
#unlockList .unlock-content>.costIcons{display:flex!important;align-items:center;gap:5px;margin:6px 0 0!important;width:max-content;max-width:100%;overflow:visible}
#unlockList .unlock-content>.costIcons .ci{margin:0;padding:4px 7px;border-radius:8px}
#unlockList .unlock-row.can-unlock{border-color:rgba(246,201,105,.38);background:linear-gradient(135deg,rgba(246,201,105,.10),rgba(125,211,252,.035))}
#unlockList .unlock-row.can-unlock .costIcons .ci.sufficient{box-shadow:0 0 0 2px rgba(246,201,105,.12),0 5px 15px rgba(0,0,0,.16);transform:none;animation:none}

/* Desktop panels stay inside the game frame and scroll internally. */
@media (min-width:681px){
	#mainRow{flex:1 1 auto;height:auto;min-height:0;overflow:hidden}
	#leftSidebar,#rightColumn{min-height:0;overflow:hidden}
	#leftSidebar .panel,#rightColumn .panel{display:flex;flex-direction:column;min-height:0;overflow:hidden}
	#unlockBox{flex:0 0 auto}
	#upgradesPanel,#helpersPanel{flex:1 1 0}
	#questsPanel{flex:0 0 auto}
	#upgrades,#helpers{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden}
	#quests{flex:0 0 auto;max-height:none;overflow:visible}
}

/* Upgrade list: one action per row, with its cost kept beside the button. */
#upgrades .mat-upgrade-row{display:grid;grid-template-columns:1fr;align-items:stretch;gap:5px;padding:8px 6px!important}
#upgrades .mat-upgrade-row>div:first-child{display:flex;align-items:center;min-height:24px}
#upgrades .mat-upgrade-row>div:last-child{display:grid;grid-template-columns:1fr;gap:4px;justify-content:stretch;align-items:stretch;width:100%}
#upgrades .mat-upgrade-row .btn-wrap{display:grid;grid-template-columns:max-content minmax(0,1fr);align-items:center;gap:6px;width:100%;min-width:0}
#upgrades .mat-upgrade-row .btn{justify-self:start;min-width:92px}
#upgrades .mat-upgrade-row .costIcons{display:flex;justify-content:flex-end;align-items:center;flex-wrap:nowrap;min-width:0;overflow:hidden}
#upgrades .mat-upgrade-row .costIcons .ci{flex:0 1 auto;min-width:0}
#upgrades .mat-upgrade-row .costIcons .ci-count{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* Put each cost immediately above its own upgrade button. */
#upgrades .mat-upgrade-row>div:last-child{gap:7px}
#upgrades .mat-upgrade-row .btn-wrap{display:flex;flex-direction:column;align-items:stretch;gap:3px;width:100%}
#upgrades .mat-upgrade-row .costIcons{order:-1;justify-content:flex-start;width:100%;min-height:22px}
#upgrades .mat-upgrade-row .btn{justify-self:stretch;width:100%;min-width:0}

/* Scrollable lists stay usable without browser-default scrollbar clutter. */
.scrollList{scrollbar-width:thin;scrollbar-color:rgba(169,229,193,.38) transparent;overscroll-behavior:contain}
.scrollList::-webkit-scrollbar{width:6px;height:6px}
.scrollList::-webkit-scrollbar-track{background:transparent}
.scrollList::-webkit-scrollbar-thumb{background:linear-gradient(180deg,rgba(169,229,193,.58),rgba(125,211,252,.38));border:1px solid rgba(8,19,26,.7);border-radius:99px}
.scrollList::-webkit-scrollbar-thumb:hover{background:var(--mint)}
@media (max-width:680px){
	.scrollList{scrollbar-width:thin}
	.scrollList::-webkit-scrollbar{display:block;width:5px;height:5px}
	.scrollList::-webkit-scrollbar-thumb{background:rgba(169,229,193,.5)}
	#upgrades .mat-upgrade-row{padding:8px 5px!important}
	#upgrades .mat-upgrade-row .btn{min-width:88px;padding-left:6px;padding-right:6px}
	#upgrades .mat-upgrade-row .btn-wrap{gap:5px}
}

/* Keep each material upgrade and its cost on one compact line. */
#upgrades .mat-upgrade-row{align-items:center;gap:6px}
#upgrades .mat-upgrade-row>div:first-child{flex:0 0 auto;white-space:nowrap}
#upgrades .mat-upgrade-row>div:last-child{display:flex;flex:1 1 auto;justify-content:flex-end;align-items:center;gap:5px;min-width:0}
#upgrades .mat-upgrade-row .btn-wrap{display:inline-flex;align-items:center;gap:3px;min-width:0;white-space:nowrap}
#upgrades .mat-upgrade-row .btn{min-height:29px;padding:5px 7px;font-size:10px!important;line-height:1.1}
#upgrades .mat-upgrade-row .costIcons{gap:3px;margin-left:0}
#upgrades .mat-upgrade-row .costIcons .ci{gap:3px;margin-left:0;padding:3px 5px;border-radius:6px}
#upgrades .mat-upgrade-row .costIcons .ci-icon{font-size:13px}
#upgrades .mat-upgrade-row .costIcons .ci-count{min-width:29px;font-size:10px}

/* cost icons for upgrades */
.costIcons{display:inline-flex;gap:6px;align-items:center;margin-left:8px}

/* Unified `.ci` field style — match quest reward icons */
.ci{
	display:inline-flex;
	align-items:center;
	gap:6px;
	background:rgba(255,255,255,0.02);
	padding:4px 8px;
	border-radius:8px;
	transition:transform .12s ease, box-shadow .18s ease, background .12s ease;
	color:inherit;
}
.ci .ci-icon{font-size:16px}
.ci .ci-count{font-size:12px;color:var(--muted);margin-left:6px;min-width:48px;text-align:right;display:inline-block}

/* keep costIcons compact but inherit base `.ci` appearance */
.costIcons .ci{margin-left:8px;padding:4px 6px;border-radius:6px}

/* Quest-style green sufficient highlight for all `.ci` elements */
.ci.sufficient{
	background:linear-gradient(135deg, rgba(16,185,129,0.22), rgba(34,197,94,0.16));
	border:1px solid rgba(16,185,129,0.24);
	color:#eaffef;
	box-shadow:0 18px 48px rgba(16,185,129,0.14), 0 12px 36px rgba(2,6,23,0.20);
	transform:translateY(-3px) scale(1.02);
	animation:glowPulseGreen 2.6s ease-in-out infinite;
}

/* Maintain reward box padding and same green highlight */
.quest-row .rewards-box .ci{padding:4px 8px;border-radius:8px}
.quest-row .rewards-box .ci.sufficient{
	background:linear-gradient(135deg, rgba(16,185,129,0.22), rgba(34,197,94,0.16));
	border:1px solid rgba(16,185,129,0.24);
	color:#eaffef;
	box-shadow:0 18px 48px rgba(16,185,129,0.14), 0 12px 36px rgba(2,6,23,0.20);
	transform:translateY(-3px) scale(1.02);
	animation:glowPulseGreen 2.6s ease-in-out infinite;
}

/* Quest reward box styling: show progress on reward icons and highlight when ready */
.quest-row .rewards-box{display:inline-flex;gap:6px;align-items:center;margin-right:8px}
.quest-row .rewards-box .ci{padding:4px 8px;border-radius:8px}
.quest-row .rewards-box .ci .ci-progress{font-size:11px;color:var(--muted);margin-left:6px}
.quest-row .rewards-box.ready{box-shadow:0 10px 32px rgba(2,6,23,0.16),0 0 0 4px rgba(125,211,252,0.10);transform:translateY(-2px);border-radius:10px;background:linear-gradient(90deg, rgba(125,211,252,0.04), rgba(96,165,250,0.02));}

/* Cheat overlay */
.cheat-overlay{position:fixed;inset:0;background:rgba(2,6,23,0.6);display:flex;align-items:center;justify-content:center;z-index:9999}
.cheat-box{background:var(--card);padding:18px;border-radius:10px;min-width:260px;display:flex;flex-direction:column;gap:10px;align-items:stretch}
.cheat-title{font-weight:700;color:white}
.cheat-btn{background:#06b6d4;border:none;color:#042;padding:8px 10px;border-radius:8px;cursor:pointer}
.cheat-btn:hover{opacity:0.95}

/* Save / Load controls inside the bottom controls bar */
.save-controls{margin-left:auto;display:flex;align-items:center;gap:10px;min-width:220px;justify-content:flex-end}
.save-controls .mat-upgrade-row{display:flex;justify-content:space-between;align-items:center;gap:8px}
.save-controls .btn{margin-left:6px}

@media (max-width:680px){
	.save-controls{min-width:120px}
}

/* Hide the Cheat button visually but keep it in the layout and clickable */
.btn.cheat-hidden{opacity:0 !important;background:transparent !important;color:transparent !important;border:none !important;box-shadow:none !important}
.btn.cheat-hidden:hover,.btn.cheat-hidden:focus{opacity:0 !important}
.btn.cheat-hidden:focus{outline:none !important}

/* upgrades horizontal layout */
.upgradesRow{display:flex;gap:8px;align-items:center}
.upgradesRow .btn{flex:0 0 auto}

@keyframes float{0%{transform:translateY(0)}50%{transform:translateY(-8px)}100%{transform:translateY(0)}}

.pop{animation:pop .28s ease}
@keyframes pop{0%{transform:scale(.8)}60%{transform:scale(1.08)}100%{transform:scale(1)}}

/* helper busy state visual (subtle pulse) */
.helper-avatar.busy{box-shadow:0 10px 30px rgba(0,0,0,0.6), 0 0 0 4px rgba(255,255,255,0.02) inset}

#stats{min-width:180px}
.scrollList{max-height:280px;overflow:auto;padding:6px}
.scrollList::-webkit-scrollbar{width:10px}
.scrollList::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.06);border-radius:6px}

/* main layout: left sidebar, center play area, right helpers */
#topBar{width:100%;display:flex;justify-content:center;padding:6px}
#resourceBar{flex:1 1 auto;display:flex;flex-wrap:wrap;gap:8px;justify-content:center;align-items:center;padding:6px;max-height:120px;overflow:auto}
#mainRow{display:flex;flex:1 1 auto;height:calc(100% - 160px);gap:8px;padding:8px}
#leftSidebar{flex:0 0 240px;min-width:200px;display:flex;flex-direction:column;gap:8px}
#centerArea{flex:1 1 auto;display:flex;flex-direction:column}
#rightColumn{flex:0 0 240px;min-width:200px;display:flex;flex-direction:column;gap:8px}
.scrollList::-webkit-scrollbar{width:10px}
.scrollList::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.06);border-radius:6px}

#panels{display:flex;flex-direction:row;gap:8px;flex-wrap:wrap}
#panels{display:flex;flex-direction:row;gap:8px;flex-wrap:wrap}
#materialsPanel,#helpersPanel,#upgradesPanel{background:rgba(255,255,255,0.02);padding:8px;border-radius:8px;min-width:180px;flex:1 1 220px}

/* Generic panel card used across several containers */
.panel{background:rgba(255,255,255,0.02);padding:8px;border-radius:8px;min-width:180px}
#materialsList .mat-row{display:flex;justify-content:space-between;align-items:center;padding:6px 0;border-bottom:1px dashed rgba(255,255,255,0.03)}
.btn{background:#0ea5a6;border:none;color:white;padding:6px 8px;border-radius:6px;cursor:pointer}
.btn:disabled{opacity:.45}
/* Highlight button wrappers when their costs are met */
.btn-wrap.sufficient .btn{
	transform:translateY(-2px);
	box-shadow:0 14px 36px rgba(16,185,129,0.12), 0 0 0 6px rgba(16,185,129,0.04);
	border:1px solid rgba(16,185,129,0.12);
	animation:glowPulseGreen 2.6s ease-in-out infinite;
}
.btn-wrap.upgrade-ready .btn{position:relative;border-color:rgba(246,201,105,.78);background:linear-gradient(135deg,#c9f0c5,#a9e5c1);box-shadow:0 0 0 3px rgba(246,201,105,.12),0 8px 22px rgba(169,229,193,.18);animation:upgradeReadyPulse 2s ease-in-out infinite}
.btn-wrap.upgrade-ready .btn:after{content:'✓';display:inline-grid;place-items:center;margin-left:5px;width:15px;height:15px;border-radius:50%;background:#f6c969;color:#173638;font-size:10px}
@keyframes upgradeReadyPulse{0%,100%{filter:brightness(1);transform:translateY(0)}50%{filter:brightness(1.08);transform:translateY(-2px)}}
#controls{display:flex;align-items:flex-start;gap:12px;padding:8px;flex:0 0 auto}
.helper-pill{display:inline-block;background:rgba(255,255,255,0.04);padding:6px 8px;border-radius:8px;margin-right:6px}
.cost{color:var(--muted);font-size:13px}

#buy-helper{padding:8px 12px;border-radius:6px;border:none;background:#10b981;color:white}
#buy-helper:disabled{opacity:.4}
#log{max-width:40ch;color:var(--muted);font-size:14px}

/* Responsive behavior: stack panels on narrow screens */
@media (max-width:680px){
	#game{width:98vw;height:96vh;margin:2vh auto;padding:6px}
	#topBar{padding:6px}
	#mainRow{flex-direction:column;height:auto}
	#leftSidebar{width:100%;flex-direction:row;overflow:auto}
	#rightColumn{width:100%}
}

/* Medium screens: slightly narrower sidebars and shorter lists */
@media (max-width:980px){
    #leftSidebar{flex:0 0 220px;min-width:180px}
    #rightColumn{flex:0 0 220px;min-width:180px}
    .scrollList{max-height:220px}
}

/* Glowing ring for highlighted / actionable rows and buttons (gold) */
@keyframes glowPulseGold {
	0% { box-shadow: 0 0 0 0 rgba(255,203,51,0.18), 0 8px 20px rgba(2,6,23,0.12); }
	50% { box-shadow: 0 0 0 8px rgba(255,203,51,0.06), 0 8px 30px rgba(2,6,23,0.14); }
 100% { box-shadow: 0 0 0 0 rgba(255,203,51,0.18), 0 8px 20px rgba(2,6,23,0.12); }
}

@keyframes glowPulseGreen {
		0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.18), 0 12px 32px rgba(2,6,23,0.16); }
		50% { box-shadow: 0 0 0 8px rgba(16,185,129,0.06), 0 16px 40px rgba(2,6,23,0.18); }
	 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.18), 0 12px 32px rgba(2,6,23,0.16); }
}

/* Apply a warm golden glow and pulse when rows are actionable */
.unlock-row.can-unlock,
.unlock-row.can-unlock:focus,
.unlock-row.can-unlock:hover {
	transition: transform 160ms ease, box-shadow 160ms ease;
	transform: translateY(-1px);
	box-shadow: 0 8px 18px rgba(2,6,23,0.12), 0 0 0 3px rgba(255,203,51,0.06);
	animation: glowPulseGold 2.4s ease-in-out infinite;
	border-radius: 8px;
}

.quest-row.quest-available,
.quest-row.quest-available:focus,
.quest-row.quest-available:hover {
	transition: transform 160ms ease, box-shadow 160ms ease;
	transform: translateY(-1px);
	box-shadow: 0 8px 18px rgba(2,6,23,0.12), 0 0 0 3px rgba(255,203,51,0.06);
	animation: glowPulseGold 2.4s ease-in-out infinite;
	border-radius: 8px;
}

.quest-row.quest-ready,
.quest-row.quest-ready:focus,
.quest-row.quest-ready:hover {
	transition: transform 160ms ease, box-shadow 160ms ease;
	transform: translateY(-1px);
	box-shadow: 0 8px 18px rgba(2,6,23,0.12), 0 0 0 3px rgba(255,203,51,0.08);
	animation: glowPulseGold 2.4s ease-in-out infinite;
	border-radius: 8px;
}

/* Keyboard focus should also show the ring */
.unlock-row:focus, .quest-row:focus { outline: none; }

/* Flow animations: flying resource icons used when collecting or claiming rewards */
.flow-elem{
	position:fixed;
	pointer-events:none;
	display:flex;
	align-items:center;
	justify-content:center;
	width:28px;
	height:28px;
	border-radius:50%;
	font-size:18px;
	transform-origin:center;
	will-change:transform,opacity;
	text-shadow:0 2px 8px rgba(0,0,0,0.6);
}

.flow-elem.small{ width:20px; height:20px; font-size:14px }

/* Speech bubbles for helpers */
.speech-bubble{position:absolute;display:inline-flex;align-items:center;justify-content:center;padding:6px 10px;border-radius:10px;background:rgba(255,255,255,0.95);color:#042;box-shadow:0 8px 18px rgba(2,6,23,0.35);font-size:13px;pointer-events:none;transition:opacity .18s ease,transform .2s ease}
.speech-bubble .speech-text{max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.speech-bubble:after{content:'';position:absolute;left:50%;transform:translateX(-50%);bottom:-6px;width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid rgba(255,255,255,0.95)}

.speech-bubble.small{padding:4px 8px;font-size:12px}

/* Gatherlight interface */
:root{
	--bg-deep:#08131a;
	--bg-mid:#10252a;
	--panel:#122a2c;
	--panel-strong:#173638;
	--line:rgba(194,236,204,.14);
	--text:#eff8e9;
	--muted:#9db8ad;
	--mint:#a9e5c1;
	--gold:#f6c969;
	--coral:#ef927d;
}
html,body{background:radial-gradient(circle at 50% -15%,#28534d 0,#122b30 38%,var(--bg-deep) 78%);color:var(--text);font-family:"Trebuchet MS","Gill Sans",sans-serif}
body{touch-action:manipulation}
#game{width:min(1440px,100vw);height:min(940px,100vh);margin:0 auto;padding:18px 22px 14px;border-radius:0;background:linear-gradient(145deg,rgba(255,255,255,.045),rgba(255,255,255,.01) 45%,rgba(2,10,15,.2));box-shadow:none}
#topBar{display:grid;grid-template-columns:230px minmax(180px,1fr) minmax(280px,2fr);align-items:center;gap:20px;padding:0 2px 16px;border-bottom:1px solid var(--line)}
.brand-lockup{display:flex;align-items:center;gap:11px}.brand-mark{display:grid;place-items:center;width:38px;height:38px;border:1px solid rgba(246,201,105,.65);border-radius:12px;color:var(--gold);font-size:22px;box-shadow:0 0 22px rgba(246,201,105,.12)}
.eyebrow{color:var(--gold);font-size:9px;font-weight:bold;letter-spacing:1.8px}h1{margin:2px 0 0;font-family:Georgia,serif;font-size:24px;letter-spacing:.2px}
.run-status{display:flex;align-items:center;gap:8px;color:var(--muted);font-size:12px}.status-dot{width:7px;height:7px;border-radius:50%;background:var(--mint);box-shadow:0 0 12px var(--mint)}
#resourceBar{justify-content:flex-end;max-height:none;padding:0;gap:7px;overflow:visible}.resourceTile{width:54px;height:54px;border:1px solid var(--line);border-radius:12px;background:rgba(255,255,255,.045);transition:transform .18s ease,background .18s ease}.resourceTile:hover{transform:translateY(-3px);background:rgba(169,229,193,.1)}.resIcon{font-size:22px}.resCount{font-size:11px;color:var(--text)}
#mainRow{height:auto;min-height:0;gap:16px;padding:18px 0;overflow:hidden}#leftSidebar,#rightColumn{flex:0 0 265px;min-width:220px;gap:14px}.panel{background:linear-gradient(160deg,rgba(23,54,56,.9),rgba(12,34,37,.9));border:1px solid var(--line);border-radius:16px;padding:14px;box-shadow:0 16px 35px rgba(0,0,0,.12)}.panel>strong{display:block;color:var(--mint);font-family:Georgia,serif;font-size:16px;margin-bottom:6px}.scrollList{max-height:none;padding:2px;overflow:auto}
#centerArea{min-width:0}.centerArea{}#playarea{margin:0;border:1px solid var(--line);border-radius:22px;background:radial-gradient(circle at 50% 40%,rgba(169,229,193,.09),transparent 48%),linear-gradient(145deg,rgba(12,39,41,.95),rgba(7,22,27,.9));box-shadow:inset 0 0 0 1px rgba(255,255,255,.025),0 18px 50px rgba(0,0,0,.16)}#playarea:before{content:"";position:absolute;inset:0;background-image:linear-gradient(rgba(169,229,193,.035) 1px,transparent 1px),linear-gradient(90deg,rgba(169,229,193,.035) 1px,transparent 1px);background-size:32px 32px;mask-image:linear-gradient(to bottom,black,transparent 90%);pointer-events:none}
.material{width:58px;height:58px;background:linear-gradient(145deg,#e1f3c9,#8fd0a7);border:2px solid rgba(255,255,255,.55);box-shadow:0 8px 24px rgba(0,0,0,.3),0 0 0 5px rgba(169,229,193,.08);transition:filter .15s ease,transform .15s ease}.material:hover,.material:focus{filter:brightness(1.12);transform:scale(1.08)}.material.small{width:46px;height:46px}.material.large{width:72px;height:72px;background:linear-gradient(145deg,#ffe2a2,#e9a36e)}
.helper-avatar{border:2px solid rgba(255,255,255,.55);background:linear-gradient(145deg,#f7dca2,#e89470);box-shadow:0 8px 20px rgba(0,0,0,.35)}
.mat-row,.unlock-row,.quest-row{border-radius:10px;padding:9px 7px!important;border-bottom:1px solid rgba(194,236,204,.08);gap:8px}.mat-row>div:first-child,.unlock-row>div:first-child,.quest-row>div:first-child{min-width:0}.mat-row strong,.unlock-row strong{font-size:13px}.cost,.q-desc,.unlock-hdr,.helper-lock-note{color:var(--muted);font-size:11px}.btn,.cheat-btn{min-height:34px;padding:7px 10px;border-radius:9px;background:var(--mint);color:#0b2823;font-weight:bold;box-shadow:none;transition:transform .15s ease,filter .15s ease}.btn:hover,.cheat-btn:hover{filter:brightness(1.08);transform:translateY(-1px)}.btn:disabled{filter:grayscale(.5);opacity:.38}.ci{border:1px solid rgba(194,236,204,.11);background:rgba(255,255,255,.04);padding:3px 6px;border-radius:7px}.ci .ci-count{min-width:34px;font-size:11px}
.helper-row>div:last-child{display:flex;flex-direction:column;align-items:stretch;gap:7px;min-width:0}.helper-row .btn-wrap{display:flex;align-items:center;gap:4px;min-width:0}.helper-row .costIcons{margin-left:0;gap:3px;flex-wrap:nowrap}.helper-row .costIcons .ci{margin-left:0}
.quest-row.quest-available,.quest-row.quest-ready,.unlock-row.can-unlock{animation:none;box-shadow:none}.quest-row.quest-available{border-color:rgba(246,201,105,.35)}.quest-row.quest-ready{border-color:rgba(169,229,193,.45);background:rgba(169,229,193,.08)}.quest-row.quest-available .q-status{color:var(--gold)}.quest-row.quest-ready .q-status{color:var(--mint)}
#controls{padding:12px 0 0;border-top:1px solid var(--line);align-items:center;min-height:52px}#controls .save-controls{gap:8px}.save-controls .btn{background:transparent;color:var(--muted);border:1px solid var(--line)}
.speech-bubble{background:var(--text);color:#12352f;border-radius:9px}.log{}#log{max-width:34ch;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media (max-width:900px){#game{padding:14px 14px 10px}#topBar{grid-template-columns:210px 1fr;gap:12px}#resourceBar{grid-column:1/-1;justify-content:flex-start;overflow:auto;padding-bottom:2px}.run-status{justify-self:end}#mainRow{gap:10px}#leftSidebar,#rightColumn{flex-basis:210px}}
@media (max-width:680px){html,body{overflow:auto}#game{width:100%;height:auto;min-height:100vh;padding:12px 10px;overflow:visible}#topBar{grid-template-columns:1fr auto;padding-bottom:12px}.brand-lockup{gap:8px}.brand-mark{width:32px;height:32px;font-size:18px}h1{font-size:20px}.run-status{font-size:10px;max-width:120px}.run-status #log{max-width:94px}#resourceBar{flex-wrap:nowrap;grid-column:1/-1}.resourceTile{flex:0 0 48px;width:48px;height:48px}.resIcon{font-size:19px}#mainRow{flex-direction:column;overflow:visible;padding:12px 0}#centerArea{order:-1;height:52vh;min-height:300px}#playarea{min-height:300px}#leftSidebar,#rightColumn{width:100%;min-width:0;flex-direction:row;overflow-x:auto;overflow-y:hidden;align-items:stretch}#leftSidebar .panel,#rightColumn .panel{flex:1 0 82vw;max-height:230px}#controls{position:sticky;bottom:0;background:rgba(8,19,26,.94);z-index:40}.save-controls{min-width:0!important}}

#mobileNav{display:none}
@media (max-width:680px){
	html,body{overflow:hidden}
	#game{height:100dvh;min-height:0;overflow:hidden}
	#mobileNav{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;padding:10px 0 2px}
	.mobile-nav-btn{min-height:38px;border:1px solid var(--line);border-radius:10px;background:rgba(255,255,255,.05);color:var(--muted);font:600 11px "Trebuchet MS",sans-serif;letter-spacing:.2px;touch-action:manipulation}
	.mobile-nav-btn.active{background:var(--mint);border-color:var(--mint);color:#0b2823}
	.mobile-nav-btn{position:relative;padding:5px 24px 5px 7px}
	.nav-badge{display:none;position:absolute;top:4px;right:5px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:var(--gold);color:#173638;font:700 10px/16px "Trebuchet MS",sans-serif;text-align:center;box-shadow:0 0 0 2px rgba(8,19,26,.55)}
	.nav-badge.visible{display:inline-block;animation:navBadgePop .25s ease-out}
	.nav-badge-activate{background:#7dd3fc}.nav-badge-claim{right:23px;background:var(--mint)}
	.quest-nav-btn.has-alert{border-color:rgba(246,201,105,.7);box-shadow:0 0 0 2px rgba(246,201,105,.1)}
	@keyframes navBadgePop{0%{transform:scale(.6);opacity:.2}100%{transform:scale(1);opacity:1}}
	#mainRow{position:relative;display:block;flex:1;padding:10px 0 0;overflow:hidden}
	#centerArea{height:100%;min-height:0}
	#playarea{height:100%;min-height:0}
	#leftSidebar,#rightColumn{display:contents}
	#leftSidebar .panel,#rightColumn .panel{display:none;position:absolute;z-index:60;top:10px;left:0;right:0;max-height:calc(100dvh - 190px);overflow:hidden;border-radius:16px;box-shadow:0 22px 60px rgba(0,0,0,.48)}
	#mainRow.menu-open #unlockBox,#mainRow.menu-open #upgradesPanel,#mainRow.menu-open #helpersPanel,#mainRow.menu-open #questsPanel{display:none}
	#mainRow.menu-open.panel-unlockBox #unlockBox,#mainRow.menu-open.panel-upgradesPanel #upgradesPanel,#mainRow.menu-open.panel-helpersPanel #helpersPanel,#mainRow.menu-open.panel-questsPanel #questsPanel{display:block}
	#mainRow.menu-open:after{content:"";position:absolute;z-index:55;inset:0;background:rgba(3,12,16,.42);pointer-events:none}
	.scrollList{max-height:calc(100dvh - 250px);padding:2px 2px 110px;overflow-y:auto;scrollbar-width:none;-ms-overflow-style:none}
	#helpers.scrollList,#upgrades.scrollList{padding:2px 2px 110px}
	.scrollList::-webkit-scrollbar{display:none;width:0;height:0}
	#controls{position:relative;z-index:70;min-height:48px;padding:7px 0 0;background:rgba(8,19,26,.96)}
	.save-controls{justify-content:center;width:100%}
	.save-controls .btn{min-height:32px;padding:5px 9px}
}

/* Final action-state pass: these rules intentionally come after the base panel theme. */
.quest-row.quest-activate{border-color:rgba(125,211,252,.55);background:linear-gradient(105deg,rgba(125,211,252,.12),rgba(125,211,252,.025));box-shadow:0 0 0 1px rgba(125,211,252,.08)}
.quest-row.quest-claim{border-color:rgba(169,229,193,.72);background:linear-gradient(105deg,rgba(169,229,193,.18),rgba(246,201,105,.08));box-shadow:0 0 0 1px rgba(169,229,193,.16),0 10px 28px rgba(0,0,0,.18)}
.quest-row.quest-activate .q-status{color:#7dd3fc}.quest-row.quest-claim .q-status{color:#a9e5c1}
.quest-panel-mixed>strong:after{content:'  •  activate + claim';margin-left:6px;color:var(--gold);font:600 10px "Trebuchet MS",sans-serif;letter-spacing:.3px}


