/* Painted-world HUD: small timber fittings, brass edges and carved keycaps. */
.quick-actions{--action-height:44px;gap:7px;max-width:none;align-items:center;filter:drop-shadow(0 4px 3px #090e1680)}
.quick-actions>button,.quick-actions>.key-counter{
 position:relative;height:var(--action-height);min-height:var(--action-height);
 border:2px solid #ac8448;border-radius:5px;padding:0 11px;
 background:repeating-linear-gradient(0deg,transparent 0 8px,#ebc2810a 8px 9px,transparent 9px 15px),linear-gradient(#59402c,#35261e);
 box-shadow:inset 0 1px #ebcb8c,inset 0 -3px #251b17,inset 2px 0 #745337,inset -2px 0 #745337,0 2px #1d1714;
 color:#f4dfb6;text-shadow:0 2px #251a17;gap:8px;transition:filter .15s,transform .15s;
}
.quick-actions>:is(button,.key-counter)::before,.quick-actions>:is(button,.key-counter)::after{content:"";position:absolute;top:calc(50% - 1px);width:2px;height:2px;background:#e1b76f;box-shadow:0 1px #211a17}
.quick-actions>:is(button,.key-counter)::before{left:4px}.quick-actions>:is(button,.key-counter)::after{right:4px}
.quick-actions>button:hover{background:repeating-linear-gradient(0deg,transparent 0 8px,#ebc2810a 8px 9px,transparent 9px 15px),linear-gradient(#715136,#483021);border-color:#e1b66e;transform:translateY(-2px)}
.quick-actions>button:active{transform:translateY(1px)}
.quick-actions>button:focus-visible,.controls button:focus-visible{outline:2px solid #ffe5ac;outline-offset:4px}
.quick-actions button .action-label{display:block;margin:0;font:600 12px/1.1 var(--font-ui);letter-spacing:.04em}
.quick-actions .hud-icon{display:block;flex:none;width:21px;height:24px;filter:drop-shadow(1px 2px #20170e);image-rendering:pixelated}
.quick-actions button[data-action=help]{width:38px;height:var(--action-height);padding:0}
.quick-actions button[data-action=help] .hud-icon{width:16px;height:20px}
.quick-actions>:is(.key-counter,button[data-action=games],button[data-action=archive]){min-width:104px}
.quick-actions>.key-counter{gap:6px;padding:0 9px}
.quick-actions .key-counter img{width:24px;height:26px;object-fit:contain}
.quick-actions .key-counter span{font:700 13px/1 var(--font-mono);color:#eac986;letter-spacing:.03em}

.controls.plate{
 padding:9px 18px 8px;gap:18px;border:2px solid #8f6e42;border-radius:6px;
 background:repeating-linear-gradient(0deg,transparent 0 6px,#dfb37d06 6px 7px,transparent 7px 11px),linear-gradient(#3d3027f5,#241f1bf5);
 box-shadow:inset 0 1px #c9a56e,inset 0 -3px #181815,0 3px 0 #151a1b,0 7px 18px #07101c60;
}
.controls.plate::before,.controls.plate::after{content:"";position:absolute;top:12px;bottom:12px;width:3px;border-top:3px solid #c4a06a;border-bottom:3px solid #c4a06a;filter:drop-shadow(1px 1px #171713)}
.controls.plate::before{left:6px}.controls.plate::after{right:6px}
.control-group{display:flex;flex-direction:column;align-items:center;gap:7px;position:relative}
.control-group+.control-group::before{content:"";position:absolute;left:-10px;top:3px;height:36px;border-left:1px solid #b28a4a40}
.key-pair{display:flex;gap:6px}
.controls button{
 width:34px;height:30px;padding:0;border:1px solid #be965c;border-radius:3px;
 color:#f5dfb1;text-shadow:0 2px #261d16;background:linear-gradient(#695239,#493623);
 box-shadow:inset 0 1px #d0ac70,inset 0 -2px #38291c,0 3px #191917,0 4px #987245;
 font:700 15px/1 var(--font-mono);transition:filter .12s,transform .12s;
}
.controls #jump{width:58px;font-size:11px}.controls #dash{width:52px;font-size:11px}
.controls #jump,.controls #dash{background:linear-gradient(#695239,#493623)}
.controls button:hover:not(:disabled){filter:brightness(1.22)}
.controls button:active,.controls button.pressed{transform:translateY(3px);box-shadow:inset 0 1px #b69967,0 1px #987245}
.controls button:disabled{opacity:1;color:#887c67;border-color:#65543d;background:linear-gradient(#40372b,#302a22);box-shadow:inset 0 1px #6d5c43,0 3px #181815,0 4px #524530;text-shadow:none}
.control-caption{font:10px/1 var(--font-ui);letter-spacing:.12em;color:#dbc6a0;text-shadow:0 1px #161816}
@media(min-width:1600px) and (min-height:950px){
 .quick-actions{--action-height:50px}.quick-actions button .action-label{font-size:13px}.quick-actions .hud-icon{width:24px;height:27px}
 .controls.plate{padding:11px 22px 9px;gap:21px}.controls button{width:39px;height:34px;font-size:18px}.controls #jump{width:64px;font-size:12px}.controls #dash{width:58px;font-size:12px}.control-caption{font-size:11px}
}
@media(min-width:651px) and (max-width:1050px){
 .hud{left:22px;right:22px;gap:12px}.quick-actions{--action-height:40px;gap:5px}.quick-actions>button{padding:0 8px;gap:5px}.quick-actions button .action-label{font-size:11px}.quick-actions .hud-icon{width:18px;height:21px}.quick-actions button[data-action=help]{width:32px}
}
@media(max-width:650px){
 .hud{left:14px;right:14px;gap:8px}.quick-actions{display:grid;grid-template-columns:repeat(3,46px);gap:5px;max-width:none;--action-height:34px;flex:none}
 .quick-actions>.key-counter{grid-column:1/3;grid-row:1;justify-self:end;padding:0 8px;min-width:77px}
 .quick-actions button[data-action=help]{display:inline-flex;grid-column:3;grid-row:1;width:34px;justify-self:end}
 .quick-actions>button:not([data-action=help]){grid-row:2;display:flex;flex-direction:column;height:48px;min-height:48px;padding:4px 2px;gap:3px}
 .quick-actions button .action-label{display:block;font-size:9px;letter-spacing:0}.quick-actions .hud-icon{width:18px;height:21px}
 .quick-actions .key-counter img{width:23px;height:25px}.quick-actions .key-counter span{font-size:12px}
 .location{padding:9px;gap:6px}.location small{font-size:5px}.location #chapter-name{font-size:11px}
 .controls.plate{padding:6px 12px 6px;gap:12px;max-width:100%}.controls button{width:44px;height:44px;font-size:17px;min-height:44px}.controls #jump{width:53px;font-size:11px}.controls #dash{width:49px;font-size:11px}.control-group{gap:7px}.control-caption{font-size:10px}.control-group+.control-group::before{left:-7px;height:42px}
 .game-footer{gap:17px}.controls{position:relative;left:auto;bottom:auto;transform:none}
}
@media(max-width:360px){.quick-actions{grid-template-columns:repeat(3,44px);gap:4px}.hud{left:11px;right:11px}.location-icon{display:none}.controls.plate{gap:12px;padding:9px 11px}.controls button{width:37px}.controls #jump{width:51px}.controls #dash{width:49px}.control-group+.control-group::before{left:-7px}}
@media(min-width:651px) and (max-width:740px){
 .hud .location{min-width:0;padding:9px;gap:7px}.location small{font-size:6px}.location #chapter-name{font-size:12px}
 .controls.plate{padding:8px 14px;gap:11px}.control-group+.control-group::before{left:-7px}.minimap{width:230px;gap:8px}
}
@media(max-height:520px) and (min-width:651px){.controls.plate{padding:7px 16px;gap:16px}.control-group{flex-direction:row;gap:7px}.controls button{height:29px;width:30px}.controls #jump{width:55px}.controls #dash{width:48px}.control-group+.control-group::before{height:25px;left:-9px}.control-caption{font-size:10px}}

/* The key counter uses the same wood and dimensions as the adjacent tools. */
@media(min-width:651px) and (max-width:1050px){.quick-actions>:is(.key-counter,button[data-action=games],button[data-action=archive]){min-width:92px}}
@media(max-width:650px){
 .quick-actions>:is(.key-counter,button[data-action=games],button[data-action=archive]){min-width:0}
 .quick-actions>.key-counter{grid-column:2;grid-row:1;justify-self:stretch;width:100%;height:48px;min-height:48px;padding:0 3px;gap:1px}
 .quick-actions .key-counter img{width:17px;height:22px}.quick-actions .key-counter span{font-size:10px}
 .quick-actions button[data-action=help]{width:100%;height:48px;min-height:48px}
}

/* Windows desktop controls need more physical area and larger labels. */
.platform-windows .control-caption,.platform-windows .quick-actions button .action-label{line-height:1.3}
@media(min-width:651px){
 .platform-windows .quick-actions{--action-height:63px;gap:10px}
 .platform-windows .quick-actions>button{padding-inline:16px;gap:10px}
 .platform-windows .quick-actions button .action-label{font-size:16px}
 .platform-windows .quick-actions .hud-icon{width:29px;height:32px}
 .platform-windows .quick-actions>:is(.key-counter,button[data-action=games],button[data-action=archive]){min-width:142px}
 .platform-windows .quick-actions>.key-counter{padding-inline:14px;gap:10px}
 .platform-windows .quick-actions .key-counter img{width:34px;height:36px}
 .platform-windows .quick-actions .key-counter span{font-size:19px}
 .platform-windows .quick-actions button[data-action=help]{width:56px;padding:0}
 .platform-windows .quick-actions button[data-action=help] .hud-icon{width:22px;height:28px}
 .platform-windows .controls.plate{padding:14px 27px 13px;gap:26px}
 .platform-windows .controls button{width:50px;height:45px;font-size:22px}
 .platform-windows .controls #jump{width:84px;font-size:16px}
 .platform-windows .controls #dash{width:74px;font-size:16px}
 .platform-windows .control-caption{font-size:14px}
 .platform-windows .control-group{gap:10px}
 .platform-windows .control-group+.control-group::before{left:-14px;height:52px}
}
@media(min-width:651px) and (max-width:1050px){
 .platform-windows .quick-actions{--action-height:56px;gap:7px}
 .platform-windows .quick-actions>button{padding-inline:10px;gap:7px}
 .platform-windows .quick-actions button .action-label{font-size:14px}
 .platform-windows .quick-actions>:is(.key-counter,button[data-action=games],button[data-action=archive]){min-width:118px}
 .platform-windows .quick-actions .hud-icon{width:24px;height:28px}
 .platform-windows .quick-actions button[data-action=help]{width:46px}
 .platform-windows .hud .location{min-width:0;padding:9px;gap:7px}
 .platform-windows .location small{font-size:6px}
 .platform-windows .location #chapter-name{font-size:12px}
}
@media(min-width:651px) and (max-width:800px){
 .platform-windows .controls.plate{padding:12px 20px;gap:17px}
 .platform-windows .controls button{width:44px;height:42px;font-size:21px}
 .platform-windows .controls #jump{width:72px;font-size:14px}
 .platform-windows .controls #dash{width:65px;font-size:14px}
 .platform-windows .control-caption{font-size:13px}
 .platform-windows .control-group+.control-group::before{left:-10px;height:45px}
}
@media(max-width:650px){
 .platform-windows .quick-actions{grid-template-columns:repeat(3,54px)}
 .platform-windows .quick-actions button .action-label{font-size:11px}
 .platform-windows .quick-actions .hud-icon{width:22px;height:24px}
 .platform-windows .quick-actions button[data-action=help] .hud-icon{width:20px;height:24px}
 .platform-windows .quick-actions .key-counter img{width:20px;height:25px}
 .platform-windows .quick-actions .key-counter span{font-size:12px}
 .platform-windows .controls button{font-size:20px}
 .platform-windows .controls #jump,.platform-windows .controls #dash{font-size:13px}
 .platform-windows .control-caption{font-size:12px}
}
@media(min-width:1051px) and (max-width:1200px){
 .platform-windows .game-footer .controls{position:relative;left:auto;transform:none}
 .platform-windows .game-footer .demo-label{display:none}
}

/* The earned cup occupies the original counter so the toolbar keeps its layout. */
.key-counter .replay-trophy:not([hidden]){
 position:absolute;inset:0;width:100%;height:100%;min-width:0;min-height:0;margin:0;padding:0;
 background:transparent;border:0;border-radius:3px;box-shadow:none;cursor:pointer;
}
.key-counter .replay-trophy[hidden]{display:none}
.key-counter:has(.replay-trophy:not([hidden])){border-color:#e0b468}
.key-counter:has(.replay-trophy:not([hidden])) #key-count{display:none}
.quick-actions .key-counter:has(.replay-trophy:not([hidden])) img{
 width:auto;height:72%;aspect-ratio:1;image-rendering:pixelated;
 filter:drop-shadow(0 0 2px #ffda80) drop-shadow(0 0 4px #ecac419e);
}
.key-counter .replay-trophy:focus-visible{outline:2px solid #fff0b5;outline-offset:3px}
/* Java-style advancement toast, docked just above the lower-right HUD. */
.game-footer{anchor-name:--journey-footer}
.trophy-reveal{
 --toast-edge:max(12px,env(safe-area-inset-right));
 --trophy-duration:9s;
 position:fixed;inset:auto var(--toast-edge) calc(var(--compliance-height) + 108px) auto;
 z-index:32;box-sizing:border-box;margin:0;width:536px;
 max-width:calc(100% - var(--toast-edge) - max(12px,env(safe-area-inset-left)));
 display:flex;align-items:center;gap:24px;padding:14px 28px 14px 18px;
 border:4px solid #101010;border-radius:4px;background:#242424;color:white;
 box-shadow:inset 0 0 0 4px #585858,inset 0 0 0 8px #353535,0 4px 0 #0009;
 pointer-events:none;overflow:visible;animation:trophy-slide var(--trophy-duration) both;
}
@supports (bottom:anchor(top)){
 .trophy-reveal{position-anchor:--journey-footer;bottom:calc(anchor(top, 140px) + 8px)}
}
.trophy-medal{position:relative;display:block;flex:none;width:88px;height:88px}
.trophy-medal img{display:block;width:100%;height:100%;image-rendering:pixelated}
@media(prefers-reduced-motion:no-preference){
 .trophy-medal::before,.trophy-medal::after{content:"";position:absolute;pointer-events:none}
 .trophy-medal::before{
  inset:0;mask:url("assets/explorer-cup.svg") center/contain no-repeat;
  background:linear-gradient(112deg,transparent 43%,#ffdc8555 47%,#fff5cbd6 50%,#ffdf8744 54%,transparent 57%) 100% 0/280% 100% no-repeat;
  animation:trophy-sheen .65s ease-in-out .55s both;
 }
 .trophy-medal::after{
  top:0;right:12%;width:18px;height:18px;background:#fff3bd;
  clip-path:polygon(40% 0,60% 0,60% 27%,73% 27%,73% 40%,100% 40%,100% 60%,73% 60%,73% 73%,60% 73%,60% 100%,40% 100%,40% 73%,27% 73%,27% 60%,0 60%,0 40%,27% 40%,27% 27%,40% 27%);
  animation:trophy-star .52s ease-out 1.02s both;
 }
}
@keyframes trophy-sheen{from{background-position:100% 0}to{background-position:0 0}}
@keyframes trophy-star{0%,100%{opacity:0;transform:scale(.5)}40%{opacity:1;transform:scale(1)}}
.trophy-inscription{display:grid;gap:4px;text-align:left;font:600 32px/1.24 var(--font-mono);text-shadow:3px 3px #131313}
.trophy-inscription small{color:#ffff55;font:inherit}
.trophy-inscription strong{color:#fff;font:inherit}
@keyframes trophy-slide{
 0%{transform:translateX(calc(100% + var(--toast-edge) + 4px))}
 4%,95%{transform:translate(0)}
 100%{transform:translateY(var(--trophy-drop,100dvh))}
}
@media(max-width:650px){
 .trophy-reveal{width:444px;gap:18px;padding:12px 24px 12px 16px}
 .trophy-medal{width:72px;height:72px}
 .trophy-inscription{font-size:28px}
 @supports not (bottom:anchor(top)){.trophy-reveal{bottom:calc(var(--compliance-height) + 174px)}}
}
@media(prefers-reduced-motion:reduce){.trophy-reveal{animation:trophy-quiet var(--trophy-duration) both!important}}
@keyframes trophy-quiet{from,to{opacity:1}}

/* Keep the movement pad at its original size on landscape phones. */
@media screen and (orientation: landscape) and (pointer: coarse) and (max-height: 520px) {
 .hud .location, .hud .quick-actions, .game-footer .minimap {
  transform: scale(.88);
 }
 .hud .location { transform-origin: top left; }
 .hud .quick-actions { transform-origin: top right; }
 .game-footer .minimap { transform-origin: bottom right; }
}
