/* Don't Let Him Fall - style.css
   Sticker-cartoon UI: grape ink outlines, hard offset shadows, Lilita One
   display + Fredoka UI type, a spirit-level danger meter, hanging event signs
   and an incident-report game-over card. */
:root {
  --ink: #2b1e3f; --ink-soft: #5a4a78; --sky: #8ed8f8;
  --banana: #ffd23f; --tomato: #ff5d5d; --mint: #3ddc97; --cloud: #fff8ec; --grape: #7b5cfa; --wood: #c98b4f;
  --display: "Lilita One", "Baloo 2", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --ui: "Fredoka", "Nunito", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky); color: var(--ink); font-family: var(--ui); }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#app { position: fixed; inset: 0; overflow: hidden; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }
button { font-family: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { position: absolute; inset: auto 0 40%; text-align: center; font: 600 18px var(--ui); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 18px/1 var(--ui); color: var(--ink); background-color: var(--cloud); border: 3px solid var(--ink); border-radius: 14px; padding: 12px 18px; box-shadow: 0 5px 0 var(--ink); cursor: pointer; transition: transform .07s ease, box-shadow .07s ease, background-color .12s; touch-action: manipulation; }
.btn:hover { background-color: #fff; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
:focus-visible { outline: 3px dashed var(--grape); outline-offset: 4px; }
.btn-play { font: 400 34px/1 var(--display); letter-spacing: .02em; background-color: var(--banana); border-radius: 22px; padding: 16px 48px 18px; box-shadow: 0 7px 0 var(--ink); }
.btn-play:hover { background-color: #ffdc63; }
.btn-play:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--ink); }
.btn-small { font-size: 15px; padding: 10px 12px; border-radius: 11px; box-shadow: 0 4px 0 var(--ink); }
.btn-small:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn small { font: 500 12px/1.1 var(--ui); color: var(--ink-soft); }
.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 12px; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.off .wave, .icon-btn:not(.off) .cross { display: none; }

/* screens and cards */
.screen { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; padding: calc(14px + var(--st)) calc(14px + var(--sr)) calc(14px + var(--sb)) calc(14px + var(--sl)); }
.panel { justify-content: center; background: rgba(43, 30, 63, .42); z-index: 20; }
.card { width: min(92vw, 460px); max-height: 100%; overflow: auto; background: var(--cloud); border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 8px 0 var(--ink); padding: 20px 20px 22px; }
.card h2 { margin: 0 0 12px; font: 400 32px/1 var(--display); letter-spacing: .01em; }
.card p { margin: 0 0 12px; font: 500 16px/1.45 var(--ui); max-width: 60ch; }
.card .btn { width: 100%; margin-top: 10px; }
.card-row { display: flex; gap: 8px; }
.card-row .btn { flex: 1; }

/* menu */
.menu { justify-content: space-between; pointer-events: none; }
.menu > * { pointer-events: auto; }
.menu-top { display: flex; flex-direction: column; align-items: center; text-align: center; }
.logo { margin: 6px 0 8px; display: flex; flex-direction: column; align-items: center; font: 400 clamp(48px, 14vw, 92px)/.9 var(--display); color: var(--banana); letter-spacing: .01em; }
.logo .w { display: block; white-space: nowrap; }
.logo .w1 { transform: rotate(-4deg) translateX(-6%); }
.logo .w2 { transform: rotate(2.5deg) translateX(5%); font-size: .8em; }
.logo .w3 { transform: rotate(-7deg) translate(-3%, 3%); font-size: 1.24em; }
.logo .ch { display: inline-block; -webkit-text-stroke: .1em var(--ink); paint-order: stroke fill; text-shadow: 0 .075em 0 var(--ink); transform: rotate(var(--r)); animation: wobble 2.8s ease-in-out infinite; animation-delay: calc(var(--i) * -.19s); }
@keyframes wobble { 0%, 100% { transform: rotate(var(--r)) translateY(0); } 50% { transform: rotate(calc(var(--r) * -1)) translateY(-3px); } }
.tagline { margin: 6px 0 0; font: 600 16px/1.3 var(--ui); background: var(--cloud); border: 3px solid var(--ink); border-radius: 999px; padding: 6px 14px; box-shadow: 0 3px 0 var(--ink); }
.menu-bottom { display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(100%, 440px); }
.menu-actions { display: flex; flex-direction: column; align-items: stretch; gap: 12px; width: 100%; }
.btn-daily { flex-direction: column; gap: 5px; padding: 10px 16px; }
.menu-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.menu-best { margin: 0; font: 600 14px var(--ui); background: rgba(255, 248, 236, .85); border-radius: 999px; padding: 4px 12px; }
.menu-best:empty { display: none; }

/* HUD */
.hud { position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px; padding: calc(10px + var(--st)) calc(12px + var(--sr)) 0 calc(12px + var(--sl)); pointer-events: none; }
.hud-score { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.score { font: 400 34px/1 var(--display); color: var(--banana); -webkit-text-stroke: .14em var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.mult { font: 700 13px/1 var(--ui); background: var(--mint); border: 2px solid var(--ink); border-radius: 999px; padding: 4px 9px; box-shadow: 0 2px 0 var(--ink); }
.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.timer { font: 600 20px/1 var(--ui); background: var(--cloud); border: 3px solid var(--ink); border-radius: 10px; padding: 5px 12px; box-shadow: 0 3px 0 var(--ink); font-variant-numeric: tabular-nums; }
.tube { position: relative; width: 150px; height: 24px; border: 3px solid var(--ink); border-radius: 999px; background-color: #a8f0cc; box-shadow: inset 0 4px 0 rgba(255, 255, 255, .55), 0 3px 0 var(--ink); }
.tube::before { content: ""; position: absolute; left: 50%; top: 2px; bottom: 2px; width: 26px; margin-left: -13px; border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); opacity: .55; }
.bubble { position: absolute; top: 3px; left: 50%; width: 22px; height: 12px; margin-left: -11px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: transform .08s linear; }
.hud-btns { justify-self: end; display: flex; gap: 8px; pointer-events: auto; }

/* event sign, warning chip, toasts */
.sign { position: absolute; z-index: 6; top: calc(98px + var(--st)); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(92vw, 520px); pointer-events: none; }
.sign-board { position: relative; padding: 12px 18px 14px; background: var(--wood); border: 3px solid var(--ink); border-radius: 10px; box-shadow: inset 0 0 0 4px var(--sign, var(--banana)), 0 6px 0 var(--ink); text-align: center; transform-origin: 50% -70px; }
.sign-board::before, .sign-board::after { content: ""; position: absolute; top: -70px; width: 3px; height: 70px; background: var(--ink); }
.sign-board::before { left: 22%; }
.sign-board::after { right: 22%; }
.sign-board.swing { animation: swing 1.5s cubic-bezier(.2, .9, .3, 1) both; }
.sign.leaving .sign-board { animation: leave .35s ease-in forwards; }
.sign-title { font: 400 28px/1 var(--display); color: var(--cloud); -webkit-text-stroke: .12em var(--ink); paint-order: stroke fill; letter-spacing: .02em; }
.sign-line { margin-top: 8px; font: 700 14px/1.25 var(--ui); background: var(--cloud); border: 2px solid var(--ink); border-radius: 6px; padding: 5px 9px; }
.sign-bar { margin-top: 8px; height: 6px; border-radius: 3px; background: rgba(43, 30, 63, .3); overflow: hidden; }
.sign-bar i { display: block; height: 100%; background: var(--sign, var(--banana)); transform-origin: left; }
@keyframes swing { 0% { transform: translateY(-170px) rotate(-8deg); } 30% { transform: translateY(0) rotate(7deg); } 50% { transform: rotate(-4deg); } 70% { transform: rotate(2.5deg); } 85% { transform: rotate(-1deg); } 100% { transform: rotate(0); } }
@keyframes leave { to { transform: translateY(-190px) rotate(4deg); opacity: 0; } }
.warn { position: absolute; z-index: 6; top: calc(100px + var(--st)); left: 50%; transform: translateX(-50%); font: 700 15px/1 var(--ui); color: #fff; background: var(--tomato); border: 3px solid var(--ink); border-radius: 999px; padding: 7px 14px; box-shadow: 0 4px 0 var(--ink); white-space: nowrap; animation: pulse .45s ease-in-out infinite alternate; pointer-events: none; }
@keyframes pulse { to { transform: translateX(-50%) scale(1.06); } }
.toasts { position: absolute; z-index: 6; left: 50%; top: 36%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.toast { font: 400 26px/1.1 var(--display); color: var(--banana); -webkit-text-stroke: .13em var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); white-space: nowrap; animation: toast 1.6s ease-out forwards; }
.toast.big { font-size: 46px; color: var(--cloud); }
.toast.mint { color: var(--mint); }
.toast.small { font: 700 15px/1.25 var(--ui); color: var(--ink); -webkit-text-stroke: 0; text-shadow: none; background: var(--cloud); border: 3px solid var(--ink); border-radius: 10px; padding: 6px 10px; white-space: normal; max-width: 80vw; text-align: center; }
@keyframes toast { 0% { transform: scale(.4); opacity: 0; } 12% { transform: scale(1.12); opacity: 1; } 22% { transform: scale(1); } 80% { opacity: 1; transform: translateY(-6px); } 100% { opacity: 0; transform: translateY(-24px); } }
#vignette { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: radial-gradient(ellipse at center, rgba(255, 93, 93, 0) 52%, rgba(255, 70, 70, .6) 100%); opacity: 0; transition: opacity .2s; }

/* touch controls + desktop hint */
.touch { position: absolute; inset: 0; z-index: 4; touch-action: none; }
.pad { position: absolute; bottom: calc(20px + var(--sb)); width: 96px; height: 96px; border-radius: 50%; border: 3px solid var(--ink); background: rgba(255, 248, 236, .75); box-shadow: 0 5px 0 var(--ink); display: grid; place-items: center; pointer-events: none; transition: transform .06s, background-color .06s, box-shadow .06s; }
.pad svg { width: 40px; height: 40px; }
.pad-left { left: calc(18px + var(--sl)); }
.pad-right { right: calc(18px + var(--sr)); }
.pad.on { background: var(--banana); transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.steady { position: absolute; left: 50%; bottom: calc(26px + var(--sb)); width: 82px; height: 82px; margin-left: -41px; padding: 0; border-radius: 50%; border: 3px solid var(--ink); background: var(--cloud); box-shadow: 0 5px 0 var(--ink); font: 700 13px/1 var(--ui); display: grid; place-items: center; touch-action: none; cursor: pointer; }
.ring { position: absolute; inset: -10px; width: calc(100% + 20px); height: calc(100% + 20px); transform: rotate(-90deg); pointer-events: none; }
.ring circle { fill: none; stroke: var(--mint); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 289; stroke-dashoffset: 289; }
.ring circle.track { stroke: rgba(43, 30, 63, .18); stroke-dashoffset: 0; }
.steady.ready { background: #d4f7e6; animation: ready .9s ease-in-out infinite alternate; }
.steady.active { background: var(--mint); }
@keyframes ready { to { box-shadow: 0 5px 0 var(--ink), 0 0 0 8px rgba(61, 220, 151, .35); } }
.key-hint { position: absolute; z-index: 5; left: 50%; bottom: calc(16px + var(--sb)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; font: 600 14px var(--ui); background: rgba(255, 248, 236, .9); border: 3px solid var(--ink); border-radius: 999px; padding: 6px 14px 6px 8px; box-shadow: 0 3px 0 var(--ink); pointer-events: none; }
.key-hint .dial { position: relative; width: 28px; height: 28px; }
.key-hint .ring { inset: 0; width: 100%; height: 100%; }
.key-hint.ready { background: #d4f7e6; }
kbd { display: inline-block; font: 700 12px/1 var(--ui); border: 2px solid var(--ink); border-bottom-width: 4px; border-radius: 6px; padding: 3px 6px; background: #fff; }

/* game over: incident report */
.over { justify-content: flex-end; background: linear-gradient(rgba(43, 30, 63, 0) 35%, rgba(43, 30, 63, .28)); }
.report { position: relative; width: min(94vw, 440px); max-height: 100%; overflow: auto; background: var(--cloud); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 8px 0 var(--ink); padding: 16px 18px 18px; transform: rotate(-1deg); animation: rise .5s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes rise { from { transform: translateY(110%) rotate(4deg); } to { transform: translateY(0) rotate(-1deg); } }
.report-head { display: flex; justify-content: space-between; align-items: baseline; font: 600 13px var(--ui); color: var(--ink-soft); border-bottom: 2px dashed var(--ink); padding-bottom: 8px; margin-bottom: 8px; }
.report-title { font: 400 18px/1 var(--display); color: var(--ink); letter-spacing: .02em; }
.report-sub { margin: 0 0 6px; font: 600 15px var(--ui); }
.cause-label { margin: 0; font: 600 12px var(--ui); color: var(--ink-soft); }
.cause { margin: 2px 0 6px; font: 400 30px/1.02 var(--display); color: var(--tomato); -webkit-text-stroke: .07em var(--ink); paint-order: stroke fill; }
.cause-desc { margin: 0 0 12px; font: 500 15px/1.4 var(--ui); }
.report-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0 0 10px; }
.report-stats div { border-top: 2px solid rgba(43, 30, 63, .15); padding-top: 6px; }
.report-stats dt { font: 600 12px var(--ui); color: var(--ink-soft); }
.report-stats dd { margin: 2px 0 0; font: 400 26px/1 var(--display); font-variant-numeric: tabular-nums; }
.stamp { position: absolute; right: 12px; top: 46px; font: 400 20px/1 var(--display); color: var(--tomato); border: 4px solid var(--tomato); border-radius: 8px; padding: 5px 9px; transform: rotate(11deg); background: rgba(255, 248, 236, .85); animation: stamp .35s .45s cubic-bezier(.2, 1.7, .4, 1) both; }
@keyframes stamp { from { transform: rotate(11deg) scale(2.4); opacity: 0; } to { transform: rotate(11deg) scale(1); opacity: 1; } }
.unlock-note, .daily-note { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 8px 10px; font: 700 14px/1.3 var(--ui); background: #e9fbf2; border: 2px solid var(--ink); border-radius: 12px; }
.unlock-note canvas { width: 48px; height: 48px; flex: none; }
.daily-note { background: #fff3c4; }
.report .btn-play { width: 100%; }
.over-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.replay-tag { position: absolute; top: calc(12px + var(--st)); left: calc(12px + var(--sl)); font: 700 13px/1 var(--ui); color: #fff; background: var(--tomato); border: 2px solid var(--ink); border-radius: 6px; padding: 5px 8px; box-shadow: 0 2px 0 var(--ink); }
.replay-tag::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #fff; animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* panels */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; margin-bottom: 6px; }
.char { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 6px 10px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 4px 0 var(--ink); font: 600 15px/1.1 var(--ui); cursor: pointer; text-align: center; }
.char canvas { width: 72px; height: 72px; }
.char small { font: 500 12px/1.25 var(--ui); color: var(--ink-soft); }
.char.sel { background: var(--banana); }
.char.locked { background: #ece6f4; cursor: default; }
.records { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; margin: 0 0 6px; align-items: baseline; }
.records dt { font: 500 15px/1.3 var(--ui); }
.records dd { margin: 0; font: 400 21px/1 var(--display); text-align: right; font-variant-numeric: tabular-nums; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 2px dashed rgba(43, 30, 63, .2); font: 600 17px var(--ui); }
.toggle { appearance: none; -webkit-appearance: none; flex: none; width: 56px; height: 32px; margin: 0; border-radius: 999px; border: 3px solid var(--ink); background: #e5def0; position: relative; cursor: pointer; transition: background-color .15s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: transform .15s; }
.toggle:checked { background: var(--mint); }
.toggle:checked::after { transform: translateX(24px); }
.setting input[type=range] { width: 150px; accent-color: var(--grape); }
.help-list { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 12px; }
.help-list li { display: flex; gap: 12px; align-items: flex-start; font: 500 16px/1.4 var(--ui); }
.help-list .key { flex: none; display: flex; gap: 4px; min-width: 64px; }
.share-card img { display: block; width: 100%; max-width: 300px; margin: 0 auto 6px; border: 3px solid var(--ink); border-radius: 14px; }
.share-msg { min-height: 1.4em; text-align: center; font: 600 14px/1.35 var(--ui); margin: 10px 0 0; }

/* layouts */
@media (min-width: 560px) { .menu-row { grid-template-columns: repeat(4, 1fr); } }
@media (min-aspect-ratio: 23/20) {
  .menu { display: grid; grid-template-columns: minmax(300px, 44vw); align-content: center; justify-content: start; gap: 18px; padding-left: calc(28px + var(--sl)); }
  .logo { font-size: clamp(44px, 7.2vw, 92px); }
  .over { align-items: flex-end; justify-content: center; background: linear-gradient(90deg, rgba(43, 30, 63, 0) 40%, rgba(43, 30, 63, .28)); }
}
@media (min-aspect-ratio: 23/20) and (max-height: 540px) {
  .logo { font-size: 36px; margin: 0; }
  .tagline { display: none; }
  .menu { gap: 10px; }
  .btn-play { font-size: 24px; padding: 10px 28px 12px; }
  .btn-daily { padding: 8px 12px; }
  .menu-actions { gap: 8px; }
  .score { font-size: 26px; }
  .timer { font-size: 16px; }
  .pad { width: 76px; height: 76px; }
  .steady { width: 64px; height: 64px; margin-left: -32px; }
  .sign { top: calc(78px + var(--st)); }
  .sign-title { font-size: 22px; }
  .report { padding: 12px 14px 14px; }
  .cause { font-size: 24px; }
  .report-stats dd { font-size: 20px; }
}
@media (max-width: 380px) {
  .tube { width: 112px; }
  .score { font-size: 28px; }
  .timer { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .logo .ch, .sign-board.swing, .toast, .report, .stamp, .warn, .steady.ready { animation: none !important; }
}

/* Gus on the Brink edition: warm illustrated materials and local system type. */
.logo{font-family:ui-rounded,"Arial Rounded MT Bold","Trebuchet MS",sans-serif!important}.tagline{font-family:Georgia,serif!important;font-size:clamp(15px,2vw,21px)!important;letter-spacing:.07em}.source-credit{position:fixed;bottom:5px;right:9px;z-index:16;font:7px system-ui;color:#3d3d4699;max-width:88vw;text-align:right}.source-credit a{color:inherit;text-underline-offset:2px}.report .source-credit{display:none}@media(max-width:600px){.source-credit{font-size:5px;right:6px;bottom:3px}.tagline{font-size:15px!important}}
