/* Trustfall 2: a full-window canvas level, glass HUD, phone buttons, and the album of deaths and hats. */
@font-face { font-family: "Unbounded"; font-weight: 800; font-display: swap; src: url("/assets/fonts/unbounded-800.woff2") format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 500; font-display: swap; src: url("/assets/fonts/sora-500.woff2") format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 700; font-display: swap; src: url("/assets/fonts/sora-700.woff2") format("woff2"); }

:root { --spawn: #31e981; --ink-on-spawn: #0b1a12; --imp: #b23cff; --font-display: "Unbounded", system-ui, sans-serif; --font-body: "Sora", system-ui, sans-serif; --fg: #f4f1ea; --fg-2: rgba(244, 241, 234, 0.72); --line: rgba(255, 255, 255, 0.16); --glass: rgba(12, 10, 28, 0.55); --glass-2: rgba(255, 255, 255, 0.08); --bg: #1a0a2e; }
body[data-world="reunion"] { --bg: #ffe2b0; }
body[data-world="vault"] { --bg: #0f2d3a; }
body[data-world="signals"] { --bg: #ffd1ea; }
body[data-world="bounds"] { --bg: #081226; }
body[data-world="dejavu"] { --bg: #2a1b4a; }
body[data-world="gold"] { --bg: #2b1606; }
body[data-world="clock"] { --bg: #0e2440; }
body[data-world="trust"] { --bg: #12061f; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-weight: 500; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-font-smoothing: antialiased; touch-action: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; }
#game { position: fixed; inset: 0; display: block; touch-action: none; outline: 0; }

.hud { position: fixed; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: max(10px, env(safe-area-inset-top)) 12px 8px; pointer-events: none; z-index: 5; }
.hud-brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; pointer-events: auto; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; }
.hud-brand svg { width: 28px; height: 28px; display: block; }
.hud-title { font-family: var(--font-display); font-size: 0.9rem; font-weight: 800; margin: 0; }
.hud-chip { display: flex; flex-direction: column; line-height: 1.1; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; min-width: 70px; }
.hud-chip span { font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-2); font-weight: 700; }
.hud-chip b { font-family: var(--font-display); font-size: 1rem; font-weight: 800; }
.hud-timer b { color: #ff6b6b; }
.hud-chip[hidden] { display: none; }
.hud-actions { margin-left: auto; display: flex; gap: 6px; pointer-events: auto; }
.icon-btn { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); color: var(--fg); display: grid; place-items: center; cursor: pointer; transition: transform 0.15s, background 0.15s; }
.icon-btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.14); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
#btn-sound .ic-off { display: none; }
#btn-sound[aria-pressed="false"] .ic-on { display: none; }
#btn-sound[aria-pressed="false"] .ic-off { display: block; }


.pad { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-right)); pointer-events: none; }
.pad[hidden] { display: none; }
.pad-left { display: flex; gap: 12px; }
.pad-btn { pointer-events: auto; width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--fg); display: grid; place-items: center; cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent; }
.pad-btn svg { width: 34px; height: 34px; }
.pad-btn.is-down { background: rgba(49, 233, 129, 0.45); border-color: var(--spawn); }
.pad-jump { width: 86px; height: 86px; }

.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(10px); z-index: 20; background: rgba(20, 20, 28, 0.92); border: 1px solid var(--line); color: var(--fg); padding: 10px 16px; border-radius: 999px; font-size: 0.88rem; font-weight: 700; opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast[hidden] { display: none; }

.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(5, 3, 16, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); overflow: auto; }
.overlay[hidden] { display: none; }
.card { width: 100%; max-width: 440px; color: var(--fg); background: linear-gradient(180deg, rgba(40, 24, 64, 0.97), rgba(14, 8, 30, 0.99)); border: 1px solid var(--line); border-radius: 26px; padding: 26px 24px 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); animation: pop 0.28s cubic-bezier(.2,.9,.2,1.2); max-height: calc(100dvh - 32px); overflow: auto; }
@keyframes pop { from { transform: scale(0.92) translateY(10px); opacity: 0; } }
.kicker { margin: 0 0 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--spawn); }
.card h2 { margin: 0 0 14px; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.1; }
.muted { color: var(--fg-2); margin: 0; line-height: 1.55; font-size: 0.95rem; }
.muted.small { font-size: 0.8rem; margin-top: 12px; }
.imp-line { margin: 12px 0 0; font-weight: 700; color: #e2b9ff; font-size: 0.95rem; }
.imp-line:empty { display: none; }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 999px; border: 1.5px solid transparent; font-weight: 700; font-size: 0.95rem; cursor: pointer; text-decoration: none; color: inherit; transition: transform 0.15s, box-shadow 0.15s; }
.btn-primary { background: var(--spawn); color: var(--ink-on-spawn); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(49, 233, 129, 0.35); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { border-color: var(--fg); }
.btn[hidden] { display: none; }
.how { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.how li { display: flex; gap: 14px; align-items: flex-start; color: var(--fg-2); line-height: 1.5; font-size: 0.93rem; }
.how-ic { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }
.how-ic svg { width: 26px; height: 26px; fill: currentColor; }
.ic-a { background: linear-gradient(180deg, #31e981, #1a9c6a); }
.ic-b { background: linear-gradient(180deg, #ff6b6b, #b02a2a); }
.ic-c { background: linear-gradient(180deg, #d7a8ff, #7a3fd0); }
.keys { margin: 16px 0 0; font-size: 0.78rem; color: var(--fg-2); line-height: 1.7; }
.card kbd { font-family: inherit; font-weight: 700; font-size: 0.78em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--glass-2); margin: 0 1px; }
.card-win { text-align: center; }
.card-win .card-actions { justify-content: center; }
.stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0 10px; font-size: 1.8rem; line-height: 1; }
.stars i { font-style: normal; color: rgba(255, 255, 255, 0.18); }
.stars i.on { color: #ffd166; text-shadow: 0 0 14px rgba(255, 209, 102, 0.6); }

.card-levels { max-width: 560px; }
.world-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.world-tab { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 7px 12px; font-size: 0.8rem; font-weight: 700; cursor: pointer; color: var(--fg-2); }
.world-tab.is-on { background: var(--spawn); color: var(--ink-on-spawn); border-color: var(--spawn); }
.world-tab.is-locked { opacity: 0.45; }
.level-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.level-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; border: 1px solid var(--line); background: var(--glass-2); border-radius: 14px; padding: 10px 12px; cursor: pointer; min-height: 70px; }
.level-btn:hover { border-color: var(--fg); }
.level-btn.is-cur { border-color: var(--spawn); box-shadow: 0 0 0 2px rgba(49, 233, 129, 0.35) inset; }
.level-btn.is-locked { opacity: 0.4; cursor: not-allowed; }
.level-btn b { font-family: var(--font-display); font-weight: 800; font-size: 0.78rem; }
.level-btn small { color: var(--fg-2); font-size: 0.72rem; line-height: 1.2; }
.level-btn .lv-stars { color: #ffd166; font-size: 0.72rem; letter-spacing: 0.05em; }
.level-btn .lv-stars.none { color: rgba(255, 255, 255, 0.25); }

@media (max-width: 560px) {
  .hud { gap: 5px; padding-left: 8px; padding-right: 8px; }
  .hud-brand { padding: 3px; }
  .hud-title { display: none; }
  .hud-chip { min-width: 0; padding: 4px 8px; }
  .hud-chip span { font-size: 0.52rem; }
  .hud-chip b { font-size: 0.82rem; }
  .hud-actions { gap: 4px; }
  .icon-btn { width: 32px; height: 32px; }
  .icon-btn svg { width: 16px; height: 16px; }
  #btn-help, #btn-top, #btn-album { display: none; }
  .level-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  #pts { font-size: 0.78rem; }
  .hud-chip:nth-of-type(3) { display: none; }
}
@media (max-height: 460px) {
  .pad-btn { width: 58px; height: 58px; }
  .pad-jump { width: 68px; height: 68px; }
  .pad { padding-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) { .card, .stars i.on { animation: none; } }

/* additions for the sequel */
.hud-coins b { color: #ffd84d; }
.hud-chip.is-drain b { color: #ff6b6b; }
.trust-line { margin: 10px 0 0; font-size: 0.82rem; color: var(--fg-2); }
.trust-line:empty { display: none; }
.stars i.on { animation: star-pop 0.42s both; }
@keyframes star-pop { from { transform: scale(0) rotate(-40deg); opacity: 0; } 70% { transform: scale(1.3); } }
.overlay.is-peek { background: rgba(5, 3, 16, 0.1); backdrop-filter: none; -webkit-backdrop-filter: none; place-items: start center; padding-top: 86px; }
.overlay.is-peek .card { max-width: 380px; padding: 16px 18px 14px; }
.overlay.is-peek .card h2 { font-size: 1.05rem; margin-bottom: 4px; }
.overlay.is-peek .card-actions { margin-top: 12px; }
.card-album { max-width: 620px; }
.album-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.album-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-height: min(52vh, 420px); overflow: auto; padding-right: 4px; touch-action: pan-y; }
.album-item { position: relative; display: flex; flex-direction: column; gap: 3px; text-align: left; border: 1px solid var(--line); background: var(--glass-2); border-radius: 14px; padding: 10px 12px; min-height: 64px; color: inherit; font: inherit; }
.album-item b { font-family: var(--font-display); font-weight: 800; font-size: 0.74rem; }
.album-item small { color: var(--fg-2); font-size: 0.7rem; line-height: 1.25; }
.album-item span { position: absolute; right: 10px; top: 8px; font-size: 0.7rem; color: #ffd166; font-weight: 700; }
.album-item.is-locked { opacity: 0.45; }
.hat-item { cursor: pointer; align-items: center; text-align: center; }
.hat-item canvas { width: 64px; height: 64px; }
.hat-item.is-cur { border-color: var(--spawn); box-shadow: 0 0 0 2px rgba(49, 233, 129, 0.35) inset; }
.hat-item.is-locked { cursor: default; }
@media (max-width: 560px) { .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.load-fail { position: fixed; inset: 0; z-index: 40; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; background: #12061f; color: var(--fg); font-weight: 700; }
.load-fail p { margin: 0; }
.album-grid, .overlay { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.28) transparent; }
.album-grid::-webkit-scrollbar, .overlay::-webkit-scrollbar { width: 8px; }
.album-grid::-webkit-scrollbar-track, .overlay::-webkit-scrollbar-track { background: transparent; }
.album-grid::-webkit-scrollbar-thumb, .overlay::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.28); border-radius: 8px; }
