/* Popups in Ashen Days' own look (2026-11-30): a worn field-radio dossier instead of the engine's glass dialogs.
   Dark scuffed sheet with torn top and bottom edges, a strip of tape holding it, the title on a stamped label strip,
   a short flicker and a static/scanline pass on open. Sounds on open/close come from js/popups.js.
   Covers: dialogs (.dlg: confirm, daily reward, 18+, kit buy...), level-up notice (.lvl-note), toasts, sign-up / log-in
   (.auth-pop), legal pages (.legal-modal), the tour card and the cookie bar. Loaded last, overrides shell-b.css. */
:root {
  --pp-sheet: #1a1814; --pp-sheet2: #23201a; --pp-ink: #ebe3d3; --pp-ink2: rgba(235, 227, 211, .7);
  --pp-tape: rgba(206, 190, 150, .5); --pp-stamp: #c8321f; --pp-label: #0f0e0c;
  --pp-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .95 0 0 0 0 .85 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --pp-sheet-bg: var(--pp-grain),
    radial-gradient(120% 70% at 12% 0%, rgba(255, 238, 200, .06), transparent 60%),
    radial-gradient(60% 50% at 92% 100%, rgba(0, 0, 0, .35), transparent 70%),
    radial-gradient(30% 22% at 78% 18%, rgba(120, 90, 50, .1), transparent 70%),
    linear-gradient(180deg, var(--pp-sheet2), var(--pp-sheet));
  /* torn top and bottom edges (the sides stay straight) */
  --pp-torn: polygon(0 6px, 4% 2px, 9% 7px, 14% 3px, 19% 8px, 25% 1px, 31% 6px, 36% 2px, 42% 7px, 48% 3px, 53% 8px, 59% 2px, 65% 6px, 70% 1px, 76% 7px, 82% 3px, 87% 8px, 93% 2px, 100% 6px,
    100% calc(100% - 5px), 95% calc(100% - 1px), 90% calc(100% - 7px), 84% calc(100% - 2px), 78% calc(100% - 8px), 72% calc(100% - 3px), 66% calc(100% - 6px), 60% 100%, 54% calc(100% - 7px), 47% calc(100% - 2px), 41% calc(100% - 8px), 35% calc(100% - 3px), 29% calc(100% - 7px), 22% calc(100% - 1px), 16% calc(100% - 6px), 10% calc(100% - 2px), 5% calc(100% - 8px), 0 calc(100% - 3px));
}

/* ---------- backdrop: darker, a static/scanline pass when a popup opens ---------- */
.modal-bg { background: radial-gradient(ellipse at center, rgba(8, 7, 6, .62), rgba(3, 3, 2, .88)); -webkit-backdrop-filter: blur(3px) grayscale(.4); backdrop-filter: blur(3px) grayscale(.4); }
.modal-bg::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 3px), var(--pp-grain);
  animation: pp-static .55s steps(6) forwards; }
@keyframes pp-static { 0% { opacity: .9; background-position: 0 0, 0 0; } 60% { opacity: .5; background-position: 0 2px, 40px 20px; } 100% { opacity: 0; background-position: 0 4px, 80px 50px; } }

/* ---------- the dossier sheet ---------- */
.dlg, .auth-pop .auth-box, .legal-modal, .tour-card {
  position: relative; isolation: isolate; color: var(--pp-ink);
  background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; border-radius: 0;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, .6)) drop-shadow(0 2px 2px rgba(0, 0, 0, .5));
  animation: pp-in .42s steps(1, end) both, pp-drop .42s cubic-bezier(.2, .8, .2, 1) both;
}
.dlg::before, .auth-pop .auth-box::before, .legal-modal::before, .tour-card::before {
  content: ''; position: absolute; inset: 0; z-index: -1; background: var(--pp-sheet-bg); clip-path: var(--pp-torn);
}
/* a strip of tape over the top edge */
.dlg::after, .auth-pop .auth-box::after, .tour-card::after {
  content: ''; position: absolute; top: -9px; left: 50%; width: 92px; height: 22px; margin-left: -46px; transform: rotate(-3deg); z-index: 3;
  background: var(--pp-grain), linear-gradient(180deg, rgba(225, 210, 170, .55), var(--pp-tape)); pointer-events: none;
  clip-path: polygon(2% 0, 98% 4%, 100% 30%, 97% 55%, 100% 100%, 3% 96%, 0 70%, 3% 40%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
/* flicker in like a bad signal, then settle */
@keyframes pp-in { 0% { opacity: 0; } 12% { opacity: .85; } 22% { opacity: .1; } 34% { opacity: 1; } 46% { opacity: .55; } 58%, 100% { opacity: 1; } }
@keyframes pp-drop { from { transform: translateY(10px) rotate(-.6deg); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .dlg, .auth-pop .auth-box, .legal-modal, .tour-card, .lvl-note, .toast { animation: none; } .modal-bg::after { display: none; } }

.dlg { width: min(500px, 100%); padding: 30px 26px 24px; }
.dlg-k, #app .dlg-k { font: 400 14px/1.3 'Ubuntu Mono', ui-monospace, monospace; color: var(--pp-ink2); letter-spacing: 0; text-transform: none; display: flex; gap: 6px; align-items: center; margin: 0 0 8px; }
.dlg-k .mic, .dlg-k svg { color: var(--pp-stamp); }
/* the title sits on a stamped label strip */
.dlg h2, .tour-card h3 {
  display: inline-block; position: relative; margin: 2px 0 0 -6px; padding: 6px 14px 7px 12px; max-width: calc(100% - 36px);
  font: 700 25px/1.1 var(--fd); letter-spacing: .01em; color: #f3ecdf; text-shadow: none;
  background: var(--pp-grain), linear-gradient(180deg, #14120f, var(--pp-label)); transform: rotate(-1deg);
  box-shadow: inset 0 0 0 2px rgba(200, 50, 31, .55), inset 0 0 0 4px rgba(15, 14, 12, 1), inset 0 0 0 5px rgba(200, 50, 31, .25), 0 2px 0 rgba(0, 0, 0, .4);
  clip-path: polygon(0 3%, 6% 0, 100% 2%, 99% 50%, 100% 97%, 40% 100%, 1% 98%, 0 60%);
}
.dlg-m { color: var(--pp-ink2); font: 400 14px 'Ubuntu Mono', ui-monospace, monospace; margin-top: 10px; }
.dlg-b { margin: 16px 0 20px; color: var(--pp-ink); font-size: 15px; line-height: 1.55; }
.dlg-b .mute, .dlg-b .small.mute { color: var(--pp-ink2); }
.dlg-f { gap: 10px; padding-top: 6px; }
.dlg-x, .auth-x { top: 16px; right: 14px; width: 32px; height: 32px; border-radius: 4px; background: rgba(0, 0, 0, .35); color: var(--pp-ink); box-shadow: none; font-size: 14px; }
.dlg-x:hover, .auth-x:hover { background: rgba(200, 50, 31, .35); }
.dlg .btn, .auth-pop .auth-box .btn, #cookie-bar .btn { border-radius: 6px; }
.dlg .btn.ghost { background: rgba(0, 0, 0, .3); color: var(--pp-ink); }
.dlg .btn.ghost:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .45); }
/* daily reward rows inside the sheet: lines of a ration log, today's line marked in red */
.dlg .dly-row .dly { background: rgba(0, 0, 0, .26); box-shadow: none; border-radius: 3px; }
.dlg .dly-row .dly.now { background: linear-gradient(90deg, rgba(200, 50, 31, .3), rgba(200, 50, 31, .08)); box-shadow: inset 4px 0 0 var(--pp-stamp); }
.dlg .dly-row .dly .dly-d { font: 400 14px 'Ubuntu Mono', ui-monospace, monospace; letter-spacing: 0; text-transform: none; color: var(--pp-ink2); }

/* ---------- sign-up / log-in ---------- */
.auth-pop .auth-pop-in { width: min(440px, 100%); }
.auth-pop .auth-box { padding: 32px 24px 26px; }
.auth-pop .auth-box input { background: rgba(0, 0, 0, .35); border-radius: 4px; box-shadow: inset 0 1px 0 rgba(0, 0, 0, .4); color: var(--pp-ink); font-family: 'Ubuntu Mono', ui-monospace, monospace; font-size: 15px; }
.auth-pop .auth-box .seg { background: rgba(0, 0, 0, .32); border-radius: 6px; }
.auth-pop .auth-x { top: 18px; right: 14px; }

/* ---------- legal pages ---------- */
.legal-modal { padding: 30px 26px 26px; }
.legal-modal::after { content: none; }

/* ---------- tour card ---------- */
.tour-card { padding: 22px 18px 18px; }
.tour-card h3 { font-size: 19px; margin-top: 4px; }
.tour-k { font: 400 13px 'Ubuntu Mono', ui-monospace, monospace; color: var(--pp-ink2); }

/* ---------- toasts: torn radio-log slips ---------- */
.toast { position: relative; display: flex; gap: 10px; align-items: center; padding: 12px 16px 12px 14px; color: var(--pp-ink);
  background: var(--pp-grain), linear-gradient(90deg, #211e18, #171511); -webkit-backdrop-filter: none; backdrop-filter: none; border-radius: 0;
  box-shadow: none; filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .55));
  font: 400 15px/1.35 'Ubuntu Mono', ui-monospace, monospace;
  clip-path: polygon(0 0, 100% 2px, calc(100% - 4px) 30%, 100% 52%, calc(100% - 3px) 76%, 100% 100%, 0 calc(100% - 2px));
  animation: pp-in .36s steps(1, end) both, pp-slide .3s cubic-bezier(.2, .8, .2, 1) both; }
/* signal bars in front of the text */
.toast::before { content: ''; flex: none; width: 14px; height: 12px; background:
  linear-gradient(var(--pp-ink2), var(--pp-ink2)) 0 100% / 3px 40% no-repeat, linear-gradient(var(--pp-ink2), var(--pp-ink2)) 5px 100% / 3px 70% no-repeat,
  linear-gradient(var(--pp-ink2), var(--pp-ink2)) 10px 100% / 3px 100% no-repeat; }
.toast.err { background: var(--pp-grain), linear-gradient(90deg, #3a120b, #22100b); }
.toast.err::before { background: linear-gradient(#ff6a55, #ff6a55) 0 100% / 3px 40% no-repeat, linear-gradient(rgba(255, 106, 85, .3), rgba(255, 106, 85, .3)) 5px 100% / 3px 70% no-repeat,
  linear-gradient(rgba(255, 106, 85, .3), rgba(255, 106, 85, .3)) 10px 100% / 3px 100% no-repeat; }
@keyframes pp-slide { from { transform: translateY(8px); } to { transform: none; } }

/* ---------- level-up notice: a big stamped slip, not blocking ---------- */
.lvl-note { position: fixed; left: 50%; top: 92px; z-index: 650; transform: translateX(-50%); pointer-events: none;
  display: grid; justify-items: center; gap: 2px; padding: 18px 34px 20px; isolation: isolate; color: var(--pp-ink);
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, .65)); animation: pp-in .45s steps(1, end) both, pp-lvl 3.6s ease forwards; }
.lvl-note::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--pp-sheet-bg); clip-path: var(--pp-torn); }
.lvl-note b { font: 800 44px/1 var(--fd); letter-spacing: .02em; color: #f3ecdf; padding: 4px 16px 6px; transform: rotate(-2deg);
  box-shadow: inset 0 0 0 3px var(--pp-stamp), inset 0 0 0 6px var(--pp-label), inset 0 0 0 7px rgba(200, 50, 31, .4); background: var(--pp-label); }
.lvl-note span { font: 400 15px 'Ubuntu Mono', ui-monospace, monospace; color: var(--pp-ink2); margin-top: 8px; }
@keyframes pp-lvl { 0% { transform: translateX(-50%) scale(1.06); } 10% { transform: translateX(-50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%); } }
@media (max-width: 699px) { .lvl-note { top: 70px; padding: 14px 22px 16px; } .lvl-note b { font-size: 34px; } }

/* ---------- cookie bar: a taped slip in the corner ---------- */
#cookie-bar { isolation: isolate; color: var(--pp-ink); background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; border-radius: 0; box-shadow: none;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, .6)); padding: 16px 16px 14px; animation: pp-in .4s steps(1, end) .1s both; }
#cookie-bar::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--pp-sheet-bg); clip-path: var(--pp-torn); }
#cookie-bar::after { content: ''; position: absolute; top: -8px; right: 26px; width: 64px; height: 18px; transform: rotate(4deg);
  background: var(--pp-grain), linear-gradient(180deg, rgba(225, 210, 170, .55), var(--pp-tape)); clip-path: polygon(2% 0, 98% 4%, 100% 100%, 3% 96%, 0 50%); pointer-events: none; }
#cookie-bar .cb-t b { font: 700 17px var(--fd); }
#cookie-bar .cb-t span { color: var(--pp-ink2); }
#cookie-bar a { color: var(--pp-ink); }
#cookie-bar .btn.ghost { background: rgba(0, 0, 0, .35); color: var(--pp-ink); }

/* ---------- volume popover under the music / sound buttons (js/sfx.js): hidden unless .show ---------- */
.vol-pop { display: none; width: 180px; padding: 12px 14px 14px; color: var(--pp-ink); border-radius: 6px;
  background: var(--pp-grain), linear-gradient(180deg, #211e18, #151310); box-shadow: 0 14px 34px rgba(0, 0, 0, .6); }
.vol-pop.show { display: block; animation: pp-in .3s steps(1, end) both; }
.vol-pop .vp-h { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font: 600 14px var(--fd); }
.vol-pop .vp-v { font: 400 13px 'Ubuntu Mono', ui-monospace, monospace; color: var(--pp-ink2); }
/* dark track, red fill up to the value (--p, set by js/sfx.js) */
.vol-pop input[type=range] { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 18px; margin: 0; background: transparent; cursor: pointer; }
.vol-pop input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, #c8321f 0 var(--p, 50%), rgba(0, 0, 0, .55) var(--p, 50%) 100%); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6); }
.vol-pop input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5px; border-radius: 50%; background: #ebe3d3; box-shadow: 0 2px 6px rgba(0, 0, 0, .6); }
.vol-pop input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(0, 0, 0, .55); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6); }
.vol-pop input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: #c8321f; }
.vol-pop input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #ebe3d3; box-shadow: 0 2px 6px rgba(0, 0, 0, .6); }
.vol-pop input[type=range]:focus-visible { outline: 2px solid rgba(200, 50, 31, .7); outline-offset: 3px; }

/* phones: the sheet keeps clear of the screen edges */
@media (max-width: 699px) {
  .dlg { padding: 28px 18px 20px; }
  .dlg h2 { font-size: 21px; }
  .dlg-f { justify-content: stretch; } .dlg-f .btn { flex: 1 1 auto; }
}
