/* Tasks (AC91, build 50; docs/TASKS.md). One bounded dialog: title + (?),
   Daily/Weekly tabs, the milestone track (points badge, reward stops, bar,
   Claim All), the reset line and the task list, the only scroll region.
   AC102 (build 52): denser rows (44px icon column, 52px rows) and a smaller
   milestone track (44px badge, 30px reward tiles); buttons keep 44px faces.
   AC131 (build 56): no tabs; the daily and weekly tracks stack at the top, each
   with its name, reset line and own small Claim (milestones only). */
#modal:has(.tasks-panel){width:min(410px,calc(100vw - 28px));padding:14px 14px 12px;background:linear-gradient(165deg,var(--cream-200),var(--row-inset))}
#modal:has(.tasks-panel)>button.secondary{width:100%;min-height:var(--tier-full-h);margin:10px 0 0;padding:8px 10px;font:var(--tier-full-fs)/1.1 Lucky;flex:none}
#modal:has(.tasks-panel)>button.secondary:before{inset:0}
.tasks-panel{position:relative;display:flex;flex-direction:column;gap:7px;min-height:0;flex:0 1 auto}
.tasks-header{display:grid;grid-template-columns:var(--tier-compact) minmax(0,1fr) var(--tier-compact);align-items:center}
.tasks-header h1{grid-column:2;margin:0;text-align:center;font:30px/1.1 Lucky}
.tasks-header .help-button{grid-column:3}
/* Milestone tracks (AC131: daily over weekly, one screen) */
.tasks-tracks{display:grid;gap:6px}
.tasks-track{display:grid;grid-template-columns:44px minmax(0,1fr);grid-template-rows:auto auto;gap:2px 8px;align-items:center;padding:5px 10px 8px;border:3px solid #2f2a35;border-radius:16px;background:linear-gradient(#f4f1ff,#e1dbf6);box-shadow:inset 0 2px #ffffff,0 3px #1f1a26}
.tasks-track[data-period=weekly]{background:linear-gradient(#eaf8ff,#d2e9f6)}
/* The Claim sits above the last stops: 10px under the head keep its 3px lip at
   least 4px above their "+1" / check chips (6px / 5px over the tile). */
.tasks-track-head{grid-column:1/3;display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;margin-bottom:10px}
.tasks-track-name{display:flex;align-items:baseline;flex-wrap:wrap;gap:0 8px;min-width:0}
.tasks-track-name b{font:19px/1.1 Lucky;color:#3a3150}
.tasks-track-name small{font:800 12px/1.2 system-ui;color:#6c6290;white-space:nowrap}
.tasks-points{position:relative;display:grid;place-items:center;width:44px;height:44px}
.tasks-points img{position:absolute;inset:0;width:44px;height:44px;object-fit:contain;filter:drop-shadow(0 2px 0 #1f1a2655)}
.tasks-points b{position:relative;font:15px/1 Lucky;color:#fff;-webkit-text-stroke:3px #1d2a5c;paint-order:stroke fill}
.tasks-track-body{position:relative;min-width:0;padding:0 22px 0 4px}
.tasks-nodes{position:relative;height:42px;margin:0;padding:0;list-style:none}
.tasks-node{position:absolute;bottom:0;left:var(--at);transform:translateX(-50%);display:grid;justify-items:center;gap:1px}
.tasks-node-rewards{position:relative;display:grid;place-items:center}
.tasks-node small{font:800 10px/1 system-ui;color:#5b5276}
.tasks-node .task-reward{width:30px;height:30px;border-radius:7px}
.tasks-node .task-reward img{width:20px;height:20px;margin-top:-4px}
.tasks-node .task-reward b{font-size:9.5px}
.tasks-node.is-ready .task-reward{box-shadow:0 0 0 2px var(--shine-100),0 0 12px 3px #ffd34d;animation:tasks-node-glow 1.6s ease-in-out infinite alternate}
.tasks-node.is-claimed .task-reward{filter:saturate(.35) brightness(.9)}
.tasks-node-check{position:absolute;right:-5px;top:-5px;display:grid;place-items:center;width:16px;height:16px;border:2px solid var(--ink-plum);border-radius:50%;background:#7bd94f;font:900 10px/1 system-ui;font-style:normal;color:#173b0c}
.tasks-node-more{position:absolute;left:-7px;top:-6px;padding:0 3px;border:1.5px solid var(--ink-plum);border-radius:6px;background:var(--cream-200);font:800 10px/1.3 system-ui;font-style:normal;color:#3b2e24}
.tasks-bar{position:relative;height:10px;margin:0 -18px 0 0;border:2px solid var(--ink-plum);border-radius:999px;background:#2f3346;overflow:hidden}
.tasks-bar i{display:block;height:100%;border-radius:999px;background:linear-gradient(#8de8ff,#36a9e8);box-shadow:inset 0 2px #ffffff99;transition:width .35s ease-out}
#modal .tasks-track-claim{flex:none;min-width:76px;margin:0}
#modal .tasks-track-claim.is-ready{--small-top:var(--btn-claim-top);--small-bottom:var(--btn-claim-bottom);--small-edge:var(--btn-claim-edge);--small-lip:var(--btn-claim-lip);--small-shine:var(--btn-claim-shine)}
#modal .tasks-track-claim:disabled{--small-top:var(--btn-disabled-top);--small-bottom:var(--btn-disabled-bottom);--small-lip:var(--btn-disabled-lip);--small-shine:var(--btn-disabled-shine);opacity:1}
/* Reward tiles shared by the track (and the reward overlay names) */
.task-reward{position:relative;display:grid;place-items:center;width:40px;height:40px;border:2px solid var(--ink-plum);border-radius:8px;background:linear-gradient(#ffcf7d,#f09b45);box-shadow:inset 0 2px #ffffff80,inset 0 -3px #00000026}
.task-reward img{width:27px;height:27px;margin-top:-5px;object-fit:contain}
.task-reward b{position:absolute;left:0;right:0;bottom:1px;font:11px/1 Lucky;color:#fff;text-align:center;-webkit-text-stroke:2.4px var(--ink-plum);paint-order:stroke fill}
/* Reset line */
.tasks-reset{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin:0 4px}
.tasks-reset span{font:19px/1.1 Lucky;color:#5a3e23}
.tasks-reset small{font:800 12px/1.2 system-ui;color:#9b6a3a;white-space:nowrap}
/* Task list (the dialog's one scroll region) */
.tasks-list{display:flex;flex-direction:column;gap:5px;min-height:0;max-height:min(46dvh,380px);overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y;padding:6px;border-radius:14px;background:#efdcb5;box-shadow:inset 0 2px 5px #6b4a2244;outline-offset:2px}
:root:not([data-input-modality=keyboard]) .tasks-list:focus{outline:none}
.task-row{position:relative;flex:none;display:grid;grid-template-columns:44px minmax(0,1fr) auto;align-items:center;gap:0 8px;min-height:52px;padding:3px 6px 3px 4px;border:2.5px solid #c9a86a;border-radius:13px;background:var(--paper);box-shadow:0 2px #9a7748;animation:task-row-in .26s ease-out both;animation-delay:calc(min(var(--i,0),7) * 35ms)}
.task-row.is-claimable{border-color:#e0a83a;background:linear-gradient(var(--cream-250),#ffe9b0);box-shadow:0 2px #9a7748,0 0 0 2px #ffe08a88}
.task-row.is-claimed{border-color:#b9ad95;background:#e4dccb;box-shadow:0 2px #8e836d}
.task-row.is-claimed .task-copy b{color:#7a6d5a}
.task-row.is-locked{opacity:.78}
.task-icon{position:relative;display:grid;place-items:center;width:44px;height:42px;border-radius:9px;background:var(--row-inset)}
.task-icon>img,.task-icon>svg{width:31px;height:31px;object-fit:contain}
.task-row.is-claimed .task-icon>img,.task-row.is-claimed .task-icon>svg{filter:saturate(.3)}
.task-points{position:absolute;left:-2px;bottom:-4px;display:flex;align-items:center;gap:0}
.task-points img{width:20px;height:20px;object-fit:contain}
.task-points span{margin-left:-4px;font:12px/1 Lucky;color:#fff;-webkit-text-stroke:2.6px #1d2a5c;paint-order:stroke fill}
.task-copy{display:grid;gap:3px;min-width:0}
.task-copy b{font:15px/1.1 Lucky;color:#4a321c;overflow-wrap:anywhere}
.task-bar{position:relative;display:block;height:14px;border:2px solid var(--ink-plum);border-radius:999px;background:#33303c;overflow:hidden}
.task-bar i{display:block;height:100%;background:linear-gradient(var(--honey-300),#f2a531);box-shadow:inset 0 2px #ffffff80}
.task-row.is-claimable .task-bar i,.task-row.is-claimed .task-bar i{background:linear-gradient(#bdf06a,#64b62c)}
.task-bar small{position:absolute;inset:0;display:grid;place-items:center;font:11px/1 Lucky;color:#fff;-webkit-text-stroke:2.4px var(--ink-plum);paint-order:stroke fill}
#modal .task-action{box-sizing:border-box;width:88px;min-width:88px;max-width:88px;height:44px;min-height:44px;margin:0;padding:4px 12px}
#modal .task-action.is-go{--small-top:var(--active-top);--small-bottom:var(--active-bottom);--small-lip:var(--active-lip);--small-shine:var(--active-shine)}
#modal .task-action.is-claim{--small-top:var(--btn-claim-top);--small-bottom:var(--btn-claim-bottom);--small-edge:var(--btn-claim-edge);--small-lip:var(--btn-claim-lip);--small-shine:var(--btn-claim-shine)}
.task-done{display:grid;place-items:center;width:76px;height:40px}
.task-done svg{width:32px;height:32px}
.task-locked{display:grid;justify-items:center;gap:1px;width:76px;color:#6d5a40}
.task-locked svg{width:20px;height:20px}
.task-locked small{font:800 11px/1.1 system-ui}
/* Points that fly to the badge (presentation only) */
.task-fly-star{position:absolute;z-index:20;width:28px;height:28px;pointer-events:none;will-change:transform,opacity}
/* Help */
#modal:has(.tasks-help){width:min(390px,calc(100vw - 28px))}
.tasks-help h1{margin:0 0 8px;text-align:center}
.tasks-help p{margin:0 0 8px;font:15px/1.42 system-ui;color:#3b3024}
@keyframes task-row-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
@keyframes tasks-node-glow{from{box-shadow:0 0 0 2px var(--shine-100),0 0 6px 1px #ffd34d}to{box-shadow:0 0 0 2px var(--shine-100),0 0 14px 4px #ffd34d}}
@media(prefers-reduced-motion:reduce){.task-row,#modal .task-action.is-claim,.tasks-node.is-ready .task-reward{animation:none}.tasks-bar i{transition:none}}
@media(max-height:700px){.tasks-header h1{font-size:26px}.tasks-list{max-height:min(40dvh,270px)}.tasks-track{padding:4px 8px 6px}.tasks-reset span{font-size:18px}}
/* The dialog never leaves the safe area: the list is the part that gives way. */
#modal.hub-reward-modal:has(.tasks-panel),#modal.hub-reward-modal:has(.mail-panel){max-height:calc(100dvh - 2 * max(var(--safe-top,env(safe-area-inset-top,0px)),var(--safe-bottom,env(safe-area-inset-bottom,0px))) - 16px)}
#modal .tasks-panel,#modal .mail-panel{flex:1 1 auto;min-height:0}
#modal .tasks-panel>*:not(.tasks-list),#modal .mail-panel>*:not(.inbox-list){flex:none}
#modal .tasks-list{flex:0 1 auto;min-height:136px}
#modal .mail-panel .inbox-list{flex:0 1 auto;min-height:180px}
/* Help sheets (Tasks, Inbox): one full-width Got It. */
#modal:has(.tasks-help)>button.secondary{width:100%;min-height:var(--tier-full-h);margin:10px 0 0;padding:8px 10px;font:var(--tier-full-fs)/1.1 Lucky}
#modal:has(.tasks-help)>button.secondary:before{inset:0}
/* AC512 (build 118 feedback): a festival task whose destination is still locked keeps its
   Go tappable with the painted padlock; a tap opens the shared unlock note. Fishing keeps
   the sealed dark plum face below; AC726 gives Moonleaf the shared disabled palette. */
#modal .secondary.is-locked:is(.moonleaf-task-action,.fishing-task-action){--small-top:#6a5470;--small-bottom:#3d2f46;--small-edge:#1d1622;--small-lip:#2b2133;--small-shine:#8d7896;gap:4px;color:#ffe9b0;opacity:1;filter:none}
#modal .secondary.is-locked:is(.moonleaf-task-action,.fishing-task-action)>.event-lock{position:static;flex:none;width:17px;height:20px;margin-top:-1px;filter:drop-shadow(0 1px 0 var(--vs-ink))}
/* AC726: the Moonleaf locked Go still opens its unlock explanation, but uses
   the shared disabled palette rather than the older purple task face. */
#modal .secondary.is-locked.moonleaf-task-action{--small-top:var(--btn-disabled-top);--small-bottom:var(--btn-disabled-bottom);--small-edge:var(--btn-disabled-edge);--small-lip:var(--btn-disabled-lip);--small-shine:var(--btn-disabled-shine);color:var(--cream-50);filter:saturate(.3)}
