/* Adaa — site features layered on top of the design: command palette, signal check, score card,
   ambient Ad-Man life, cursor cell trail. Markup for these lives in index.html and assets/js/features.js. */

/* 0. Shared: the hidden attribute wins over these elements' own display */
[data-palette][hidden],[data-share][hidden],[data-check-quiz][hidden],[data-check-result][hidden],[data-check-back][hidden],[data-check-flags][hidden],[data-check-empty][hidden],[data-palette-empty][hidden],[data-game-share][hidden]{display:none!important}

/* 1. Shared: toast */
[data-toast]{position:fixed;left:50%;bottom:28px;z-index:95;transform:translate(-50%,16px);display:flex;align-items:center;gap:12px;width:max-content;max-width:min(520px,calc(100vw - 32px));padding:12px 16px;border:1px solid rgba(255,255,255,0.18);background:#001529;color:#FFFFFF;font-family:'Courier New',monospace;font-size:12.5px;letter-spacing:0.02em;line-height:1.45;box-shadow:0 24px 48px -24px rgba(0,0,0,0.6);opacity:0;pointer-events:none;transition:opacity 220ms ease,transform 220ms ease}
[data-toast][data-on]{opacity:1;transform:translate(-50%,0)}
[data-toast] i{display:block;width:10px;height:10px;flex:none;background:#4D7EFF}

/* 2. Command palette */
[data-palette-open]{display:inline-flex;align-items:center;gap:8px;flex:none;margin:0;padding:6px 10px;border:1px solid rgba(255,255,255,0.18);background:transparent;color:rgba(255,255,255,0.72);font-family:'Courier New',monospace;font-size:12.5px;letter-spacing:0.02em;line-height:1;cursor:pointer;transition:color 200ms ease,border-color 200ms ease}
[data-palette-open]:hover{color:#FFFFFF;border-color:rgba(255,255,255,0.5)}
[data-palette-open] svg{display:block;width:16px;height:12px}
@media (max-width:900px){[data-palette-open] span{display:none}[data-palette-open]{padding:8px}}
@media (max-width:900px) and (hover:none) and (pointer:coarse){[data-palette-open] span{display:inline}[data-palette-open]{padding:8px 10px}}
[data-palette]{position:fixed;inset:0;z-index:90;display:flex;justify-content:center;align-items:flex-start;padding:min(14vh,120px) 16px 16px;background:rgba(0,25,45,0.72);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}
[data-palette-panel]{width:100%;max-width:600px;display:flex;flex-direction:column;background:#001529;border:1px solid rgba(255,255,255,0.18);box-shadow:0 40px 80px -32px rgba(0,0,0,0.7);animation:palIn 180ms cubic-bezier(.2,.7,.3,1) both}
@keyframes palIn{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:none}}
[data-palette-input]{flex:1;min-width:0;margin:0;padding:0;border:0;background:transparent;color:#FFFFFF;font-family:'Courier New',monospace;font-size:15px;letter-spacing:0.02em;outline:none}
[data-palette-input]::placeholder{color:rgba(255,255,255,0.35)}
/* 16px so iOS Safari does not zoom in when the palette opens */
@media (max-width:760px),(hover:none) and (pointer:coarse){[data-palette-input]{font-size:16px}}
[data-palette] kbd{font-family:'Courier New',monospace;font-size:11px;letter-spacing:0.04em;color:rgba(255,255,255,0.5);border:1px solid rgba(255,255,255,0.18);padding:3px 6px}
[data-palette-list]{list-style:none;margin:0;padding:8px;max-height:min(56vh,440px);overflow:auto;overscroll-behavior:contain}
[data-palette-group]{margin:0;padding:12px 10px 6px;font-family:'Courier New',monospace;font-size:11px;letter-spacing:0.08em;text-transform:uppercase;color:rgba(255,255,255,0.4)}
[data-palette-item]{display:flex;align-items:center;gap:12px;padding:10px 10px;cursor:pointer;color:rgba(255,255,255,0.72);transition:background 120ms ease,color 120ms ease}
[data-palette-item] i{display:block;width:10px;height:10px;flex:none;background:var(--c,#4D7EFF);opacity:0.55;transition:opacity 120ms ease}
[data-palette-item] b{font-weight:600;font-size:14.5px;color:#FFFFFF}
[data-palette-item] small{display:block;margin-top:2px;font-family:'Courier New',monospace;font-size:12px;letter-spacing:0.02em;color:rgba(255,255,255,0.5)}
[data-palette-item] mark{background:transparent;color:#4D7EFF}
[data-palette-item] span:last-child{margin-left:auto;font-family:'Courier New',monospace;font-size:11px;letter-spacing:0.04em;color:rgba(255,255,255,0.35);flex:none}
[data-palette-item][aria-selected="true"]{background:rgba(77,126,255,0.14);color:#FFFFFF}
[data-palette-item][aria-selected="true"] i{opacity:1}
[data-palette-item][aria-selected="true"] span:last-child{color:#4D7EFF}
[data-palette-empty]{margin:0;padding:22px 18px;font-family:'Courier New',monospace;font-size:12.5px;letter-spacing:0.02em;color:rgba(255,255,255,0.5)}
[data-palette-hints]{display:flex;flex-wrap:wrap;gap:14px;margin:0;padding:10px 16px;border-top:1px solid rgba(255,255,255,0.1);font-family:'Courier New',monospace;font-size:11.5px;letter-spacing:0.02em;color:rgba(255,255,255,0.4)}
html[data-palette-lock]{overflow:hidden}

/* 3. Signal check */
[data-check-answer]{background:transparent;border:1px solid rgba(0,25,45,0.22);color:#00192D;font-family:inherit;font-size:14px;font-weight:600;padding:14px 22px;cursor:pointer;transition:border-color 200ms ease,background 200ms ease,color 200ms ease}
[data-check-answer]:hover{border-color:#043BC1;background:rgba(4,59,193,0.06)}
[data-check-answer="yes"]:hover{border-color:var(--c,#043BC1);background:color-mix(in srgb,var(--c,#043BC1) 12%,transparent)}
[data-check-answer][data-picked]{border-color:#043BC1;background:#043BC1;color:#FFFFFF}
[data-check-cells] i{display:block;width:10px;height:10px;background:#00192D;opacity:0.1;transition:opacity 200ms ease,background 200ms ease}
[data-check-cells] i[data-a="yes"]{opacity:1}
[data-check-cells] i[data-a="no"]{opacity:0.28}
[data-check-cells] i[data-a="unsure"]{opacity:0.55}
[data-check-cells] i[data-now]{outline:2px solid #043BC1;outline-offset:2px;opacity:0.35}
[data-check-statement]{animation:checkIn 260ms cubic-bezier(.2,.7,.3,1) both}
@keyframes checkIn{from{opacity:0;transform:translateX(-10px)}to{opacity:1;transform:none}}
[data-check-score] span{margin-left:.22em;font-size:.4em;font-weight:700;letter-spacing:-0.01em;color:rgba(0,25,45,0.55)}
[data-check-bar] i{display:block;flex:1;height:10px;background:#00192D;opacity:0.1}
[data-check-bar] i[data-a="yes"]{opacity:1}
[data-check-bar] i[data-a="unsure"]{opacity:0.5}
[data-check-bar] i[data-a="no"]{opacity:0.1}
[data-check-flags]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
[data-check-flags] li{display:flex;align-items:center;gap:14px;padding:12px 0;border-top:1px solid #E2E7F2}
[data-check-flags] li:last-child{border-bottom:1px solid #E2E7F2}
[data-check-flags] li > i{display:block;width:10px;height:10px;flex:none;background:var(--c,#043BC1)}
[data-check-flags] li[data-kind="unsure"] > i{opacity:0.45}
[data-check-flags] b{display:block;font-family:'Courier New',monospace;font-size:13px;letter-spacing:0.02em;font-weight:400;color:#00192D}
[data-check-flags] small{display:block;font-size:12.5px;color:rgba(0,25,45,0.55)}
[data-check-flags] button{margin-left:auto;flex:none;background:none;border:0;padding:0;font-family:inherit;font-size:13px;font-weight:600;color:#043BC1;cursor:pointer;display:inline-flex;align-items:center;gap:8px;transition:color 200ms ease,gap 200ms ease}
[data-check-flags] button:hover{color:#1A52D4;gap:12px}
[data-check-empty]{margin:0;font-size:15px;line-height:1.6;color:rgba(0,25,45,0.68)}
[data-check-link]{background:none;border:0;padding:0;font-family:inherit;font-size:13px;color:rgba(0,25,45,0.55);text-decoration:underline;text-underline-offset:3px;cursor:pointer;transition:color 200ms ease}
[data-check-link]:hover{color:#043BC1}
@media (max-width:880px){[data-check-flags] li{flex-wrap:wrap}[data-check-flags] button{margin-left:24px}}
@media (prefers-reduced-motion:reduce){[data-check-statement]{animation:none}}

/* 4. Score card */
[data-share]{position:fixed;inset:0;z-index:90;display:flex;justify-content:center;align-items:center;padding:16px;background:rgba(0,25,45,0.72);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}
[data-share-panel]{width:100%;max-width:640px;display:flex;flex-direction:column;gap:16px;padding:18px;background:#001529;border:1px solid rgba(255,255,255,0.18);box-shadow:0 40px 80px -32px rgba(0,0,0,0.7);animation:palIn 180ms cubic-bezier(.2,.7,.3,1) both}
[data-share-panel] img{display:block;width:100%;height:auto;border:1px solid rgba(255,255,255,0.1)}
[data-share-actions]{display:flex;flex-wrap:wrap;gap:10px}
[data-share-actions] button{font-family:inherit;font-size:13.5px;font-weight:600;padding:12px 18px;cursor:pointer;transition:background 200ms ease,border-color 200ms ease,color 200ms ease}
[data-share-close]{margin-left:auto;background:none;border:0;padding:0;font-family:'Courier New',monospace;font-size:12.5px;letter-spacing:0.02em;color:rgba(255,255,255,0.5);text-decoration:underline;text-underline-offset:3px;cursor:pointer}
[data-share-close]:hover{color:#FFFFFF}

/* 5. Ambient Ad-Man life */
[data-ambient]{position:fixed;inset:0;z-index:45;overflow:hidden;pointer-events:none}
[data-ambient] [data-sprite]{position:absolute;left:0;top:0;width:44px;height:44px;will-change:transform}
[data-ambient] [data-sprite] svg{position:absolute;inset:0;width:100%;height:100%;display:block}
[data-sprite="aman"] svg{transform:rotate(90deg)}
[data-sprite="aman"][data-face="left"] svg{transform:rotate(-90deg)}
[data-sprite="aman"] [data-frame="0"]{animation:introF0 260ms linear infinite}
[data-sprite="aman"] [data-frame="1"]{animation:introF1 260ms linear infinite}
[data-sprite="aman"] [data-frame="2"]{animation:introF2 260ms linear infinite}
[data-sprite="ghost"] [data-body]{transition:fill 120ms ease}
[data-sprite="ghost"][data-fright] [data-body]{fill:#043BC1}
[data-sprite="ghost"][data-fright] [data-pupil]{display:none}
@media print{[data-ambient],[data-trail],[data-toast],[data-palette],[data-share],[data-palette-open]{display:none!important}}

/* 6. Cursor cell trail */
[data-trail]{position:fixed;inset:0;z-index:59;pointer-events:none;display:block}
@media (max-width:880px),(pointer:coarse),(prefers-reduced-motion:reduce){[data-trail]{display:none!important}}

/* header: once the nav links hide on narrow screens, the palette button keeps to the right edge */
@media (max-width:760px){[data-palette-open]{margin-left:auto}}
/* touch: the Menu button takes taps a few pixels around its border (a 44px target) without growing the header */
@media (hover:none) and (pointer:coarse){[data-palette-open]{position:relative}[data-palette-open]::after{content:"";position:absolute;left:-6px;right:-6px;top:-8px;bottom:-8px}}

/* 7. The receipt (footer line + dialog) */
[data-receipt-dialog]{position:fixed;inset:0;z-index:90;display:flex;justify-content:center;align-items:flex-start;padding:min(8vh,64px) 16px 16px;overflow:auto;background:rgba(0,25,45,0.72);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}
[data-receipt-panel]{width:100%;max-width:640px;display:flex;flex-direction:column;gap:14px;padding:18px;background:#001529;border:1px solid rgba(255,255,255,0.18);box-shadow:0 40px 80px -32px rgba(0,0,0,0.7);animation:palIn 180ms cubic-bezier(.2,.7,.3,1) both}
[data-receipt-close]{margin-left:auto;background:none;border:0;padding:0;font-family:'Courier New',monospace;font-size:12.5px;letter-spacing:0.02em;color:rgba(255,255,255,0.5);text-decoration:underline;text-underline-offset:3px;cursor:pointer}
[data-receipt-close]:hover{color:#FFFFFF}
[data-receipt-table]{width:100%;border-collapse:collapse;font-family:'Courier New',monospace;font-size:12.5px;letter-spacing:0.02em;color:rgba(255,255,255,0.72)}
[data-receipt-table] th{text-align:left;font-weight:400;color:rgba(255,255,255,0.4);padding:0 8px 6px 0;border-bottom:1px solid rgba(255,255,255,0.1)}
[data-receipt-table] td{padding:6px 8px 6px 0;border-bottom:1px solid rgba(255,255,255,0.06);vertical-align:top;overflow-wrap:anywhere}
[data-receipt-table] small{color:rgba(255,255,255,0.4)}
[data-receipt-facts]{margin:0;font-family:'Courier New',monospace;font-size:12.5px;letter-spacing:0.02em;line-height:1.9;color:#FFFFFF}
[data-receipt-timing]{display:grid;grid-template-columns:repeat(auto-fill,minmax(118px,1fr));gap:10px}
[data-receipt-timing] span{display:flex;flex-direction:column;gap:2px;min-width:0}
[data-receipt-timing] b{font-family:Syne,sans-serif;font-weight:700;font-size:18px;letter-spacing:-0.01em;color:#FFFFFF}
[data-receipt-timing] small{font-family:'Courier New',monospace;font-size:11px;letter-spacing:0.02em;color:rgba(255,255,255,0.4)}
[data-receipt-actions]{display:flex;flex-wrap:wrap;gap:10px}
[data-receipt-actions] button{background:transparent;border:1px solid rgba(255,255,255,0.5);color:#FFFFFF;font-family:inherit;font-size:13.5px;font-weight:600;padding:11px 16px;cursor:pointer;transition:background 200ms ease,border-color 200ms ease}
@media print{[data-receipt-dialog],[data-receipt]{display:none!important}}
@media (prefers-reduced-motion:reduce){[data-palette-panel],[data-share-panel],[data-receipt-panel]{animation:none}}
