:root {
  --ink: #1f2a3a;
  --paper: #fdfbf6;
  --brass: #e8d9b0;
  --accent: #c2412d;
  --glow: #9fe7ff;
  --ui-font: "Helvetica Neue", Arial, system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1f2a3a;
  color: var(--paper);
  font-family: var(--ui-font);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}

button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  letter-spacing: 0.04em;
  background: var(--ink);
  z-index: 50;
  padding: 16px;
  text-align: center;
}


#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
body:not(.playing) #meter, body:not(.playing) #prompt { visibility: hidden; }

#meter {
  position: absolute;
  top: calc(12px + var(--safe-t));
  left: calc(12px + var(--safe-l));
  width: min(250px, 58vw);
  padding: 8px 10px;
  background: rgba(20, 26, 38, 0.76);
  border: 1px solid rgba(232, 217, 176, 0.35);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.rank-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 800; color: var(--brass); }
#carry-value { color: #9ff0c8; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-row { display: grid; grid-template-columns: 62px 1fr 34px; align-items: center; gap: 6px; font-size: 11px; }
.vest-row { font-size: 11px; opacity: 0.75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#vest-name { font-weight: 700; opacity: 1; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.85; }
.bar-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.bar { position: relative; height: 8px; border-radius: 5px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.bar > div { height: 100%; width: 0; border-radius: 5px; transition: width 0.25s; }
.bar .tick { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; opacity: 0.7; }
#approval-fill { background: linear-gradient(90deg, #6fb3ff, #9ff0c8); }
#stress-fill { background: linear-gradient(90deg, #ffd23f, #ff6b4a 70%, #d62828); }
#puff-fill { background: linear-gradient(90deg, #9fe7ff, #ffd23f 60%, #ff6b4a); }
.bar.stress.hot { animation: pulse 0.6s ease-in-out infinite alternate; }
@keyframes pulse { to { box-shadow: 0 0 10px #ff6b4a; } }
.delta { position: absolute; left: calc(12px + var(--safe-l) + min(250px, 58vw) + 6px); font-weight: 800; font-size: 13px; pointer-events: none; animation: rise 1.4s ease-out forwards; text-shadow: 0 1px 2px #000; }
.delta.up { color: #9ff0c8; }
.delta.down { color: #ff8a70; }
@keyframes rise { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-18px); } }

#tracker {
  position: absolute;
  top: calc(132px + var(--safe-t));
  left: calc(12px + var(--safe-l));
  width: min(250px, 58vw);
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(20, 26, 38, 0.66);
  border-left: 3px solid var(--brass);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}
#tracker strong { color: var(--brass); font-size: 13px; }
body:not(.playing) #tracker { visibility: hidden; }
#markers { position: absolute; inset: 0; overflow: hidden; }
.marker {
  position: absolute;
  left: 0;
  top: 0;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  margin: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffd23f;
  color: #1a1a1a;
  font-weight: 900;
  font-size: 19px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  animation: bob 1s ease-in-out infinite alternate;
}
.marker.q { background: #9ff0c8; }
.marker.founder { background: #9ff0c8; }
.marker.scared { background: #ff6b4a; color: #fff; animation-duration: 0.25s; }
.marker.key { min-width: 30px; height: 26px; padding: 0 7px; border-radius: 7px; background: var(--ink); color: var(--brass); border: 2px solid var(--brass); font-size: 14px; animation: none; }
.marker.urgent { min-width: 0; height: 32px; padding: 0 12px; border-radius: 8px; background: #d9361e; color: #fff; font-size: 15px; letter-spacing: 0.04em; border: 2px solid #fff; animation: urgent 0.55s ease-in-out infinite alternate; }
.marker.urgent::after { content: ""; position: absolute; left: 50%; bottom: -10px; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top: 8px solid #fff; }
.marker.urgent.edge::after { display: none; }
.marker.urgent.edge { padding-left: 34px; letter-spacing: 0; }
.marker.urgent.edge::before { content: "\25B2"; position: absolute; left: 11px; top: 50%; line-height: 1; margin-top: -8px; font-size: 14px; transform: rotate(var(--a, 0rad)); }
@keyframes urgent { from { box-shadow: 0 0 0 0 rgba(217, 54, 30, 0.75); } to { box-shadow: 0 0 0 9px rgba(217, 54, 30, 0); } }
@keyframes bob { from { margin-top: 0; } to { margin-top: -6px; } }

#bossbar, #icbar {
  position: absolute;
  top: calc(12px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 32px));
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(20, 26, 38, 0.86);
  border: 1px solid #c2412d;
  text-align: center;
}
#bossbar, #icbar { top: calc(140px + var(--safe-t)); }
@media (min-width: 700px) { #bossbar, #icbar { top: calc(12px + var(--safe-t)); } }
.boss-name { font-weight: 900; font-size: 14px; color: #ffb3a3; }
.boss-row { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; font-size: 12px; }
.pip { width: 12px; height: 12px; border-radius: 50%; background: #c2412d; }
.pip.done { background: rgba(255, 255, 255, 0.2); }
.boss-timer { height: 5px; margin-top: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.boss-timer-fill { height: 100%; width: 0; background: #ffd23f; }
#icbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; border-color: var(--brass); font-size: 13px; font-weight: 700; }
#icbar[hidden] { display: none; }
.ic-track { position: relative; height: 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.ic-fill { height: 100%; width: 50%; background: var(--brass); transition: width 0.4s; }
#icbar.good .ic-fill { background: #9ff0c8; }
#icbar.bad .ic-fill { background: #ff6b4a; }
.ic-track .tick { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; }
.ic-value { font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }

#banner {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  padding: 14px 28px;
  border-radius: 12px;
  font-size: clamp(26px, 7vw, 58px);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: nowrap;
  max-width: calc(100vw - 24px);
  background: rgba(20, 26, 38, 0.9);
  border: 3px solid var(--brass);
  color: var(--brass);
  animation: slam 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
#banner.lose { color: #ffb3a3; border-color: #c2412d; }
@keyframes slam { from { transform: translate(-50%, -50%) scale(2.2); opacity: 0; } }
#fade { position: fixed; inset: 0; z-index: 45; background: #0b0e14; animation: fadein 0.6s forwards; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }


#mg { position: fixed; inset: 0; z-index: 28; display: grid; place-items: center; padding: 16px; background: linear-gradient(rgba(10, 14, 22, 0.1), rgba(10, 14, 22, 0.5)); }
.mg-box { position: relative; width: min(600px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 14px 16px; border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45); display: flex; flex-direction: column; gap: 10px; }
.mg-box.shake { animation: shake 0.1s linear 0s 3; }
.mg-head { display: flex; flex-direction: column; gap: 2px; }
.mg-head strong { font-size: 17px; }
.mg-sub { font-size: 12px; opacity: 0.7; }
.mg-bars { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 10px; font-size: 12px; font-weight: 700; }
.mg-bar { height: 10px; border-radius: 6px; background: #e6e0d4; overflow: hidden; }
.mg-fill { height: 100%; width: 100%; background: #1f6e43; transition: width 0.1s linear; }
.mg-fill.energy { background: linear-gradient(90deg, #6fb3ff, #9ff0c8); }
.mg-fill.low { background: #c2412d; }
.net-who { font-size: 12px; font-weight: 700; color: #6e4f8a; }
.net-say { font-size: 19px; font-weight: 800; line-height: 1.3; }
.net-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chip { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 10px; border-radius: 12px; border: 2px solid #ded7c8; background: #f4efe4; color: var(--ink); text-align: left; font-size: 14px; font-weight: 700; }
.chip .k { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: var(--ink); color: var(--paper); font-size: 11px; }
.chip.right { border-color: #1f6e43; background: #dff3e7; }
.chip.wrong { border-color: #c2412d; background: #fbe1dc; }
.chip.blocked { opacity: 0.35; text-decoration: line-through; }
.net-leave { align-self: flex-end; min-height: 36px; padding: 4px 14px; border-radius: 999px; border: 1px dashed #8a948e; background: transparent; color: var(--ink); font-size: 13px; font-weight: 700; }
.net-chad { position: absolute; right: 12px; top: 12px; max-width: 60%; padding: 6px 10px; border-radius: 12px; background: #26272b; color: #ffd23f; font-size: 12px; font-weight: 800; }
.pb-note { font-size: 13px; font-weight: 700; color: #c2412d; min-height: 18px; }
.pb-slide { position: relative; aspect-ratio: 16 / 10; display: flex; flex-direction: column; gap: 6%; padding: 4% 5%; border-radius: 8px; background: #ffffff; border: 1px solid #d6d0c4; box-shadow: inset 0 0 0 6px #f3efe6; font-family: "Helvetica Neue", Arial, sans-serif; }
.pb-slide.blue { background: #eef4ff; }
.pb-el { border: 0; background: transparent; color: #1f2a3a; text-align: left; padding: 2px 4px; border-radius: 4px; font: inherit; cursor: pointer; transition: transform 0.25s, color 0.25s, font-size 0.25s; }
.pb-el:hover, .pb-el:focus-visible { outline: 2px dashed #6fb3ff; }
.pb-title { font-size: clamp(14px, 3.4vw, 20px); font-weight: 800; border-bottom: 3px solid #1f2a3a; }
.pb-logos { display: flex; justify-content: space-between; gap: 4%; }
.pb-logo { flex: 1; padding: 4% 2%; border: 2px solid #c9d2cc; border-radius: 6px; text-align: center; font-size: clamp(10px, 2.2vw, 13px); font-weight: 800; background: #f7f9f8; }
.pb-bullet { font-size: clamp(11px, 2.4vw, 14px); }
.pb-bullet::before { content: "\25A0  "; color: #1f6e43; }
.pb-page { position: absolute; right: 3%; bottom: 3%; font-size: 11px; opacity: 0.7; }

.pb-el.err-misaligned { transform: translate(16px, -9px) rotate(-3deg); }
.pb-el.err-font { font-family: "Comic Sans MS", "Chalkboard SE", "Comic Neue", cursive; font-style: italic; }
.pb-el.err-size { font-size: 1.6em; }
.pb-title.err-size { font-size: 0.62em; letter-spacing: 0.18em; }
.pb-logo.err-size { font-size: inherit; transform: scale(1.35); }
.pb-page.err-size { font-size: 2em; }
.pb-el.err-colour { color: #ff2bd6; }
.pb-el.fixed { animation: fixed 0.4s; }
@keyframes fixed { 50% { background: #dff3e7; } }
.pb-el.nope { animation: shake 0.1s linear 0s 3; background: #fbe1dc; }
.pb-foot { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; }
.pb-msg { color: #c2412d; }
@media (max-width: 520px) { .net-chips { grid-template-columns: 1fr; } .net-say { font-size: 16px; } }


#card { position: fixed; inset: 0; z-index: 28; display: grid; place-items: center; padding: 16px; background: linear-gradient(rgba(10, 14, 22, 0.15), rgba(10, 14, 22, 0.55)); }
#card.low { place-items: end center; background: linear-gradient(transparent 40%, rgba(10, 14, 22, 0.5)); }
#card.low .card-box { max-height: 58vh; max-height: 58dvh; }
.card-box {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 16px;
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-head { display: flex; flex-direction: column; gap: 3px; }
.card-title { margin: 0; font-size: 17px; line-height: 1.25; }
.card-meta { font-size: 12px; opacity: 0.7; }
.card-timer { height: 6px; border-radius: 3px; background: #e6e0d4; overflow: hidden; margin-top: 4px; }
.card-timer-fill { height: 100%; width: 100%; background: #1f6e43; transition: width 0.1s linear; }
.card-timer.low .card-timer-fill { background: #c2412d; }
.card-sheet { border: 1px solid #c9d2cc; border-radius: 6px; overflow: hidden; font-size: 13px; background: #fff; }
.sheet-title { padding: 4px 8px; background: #1f6e43; color: #fff; font-weight: 700; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-sheet table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.card-sheet td { padding: 4px 8px; border-top: 1px solid #e3e8e4; }
.card-sheet td.rownum { width: 26px; color: #8a948e; background: #f3f5f3; text-align: center; font-size: 11px; }
.card-sheet td.val { text-align: right; font-weight: 700; white-space: nowrap; }
.card-sheet tr.hl td { background: #fff4c2; }
.card-sheet tr.hl td.val { color: #c2412d; }
.card-prompt { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.35; }
.card-choices { display: flex; flex-direction: column; gap: 6px; }
.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid #ded7c8;
  background: #f4efe4;
  color: var(--ink);
  text-align: left;
  font-size: 15px;
  font-weight: 600;
}
.choice .k { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 800; }
.choice:hover:not(:disabled), .choice:focus-visible { border-color: var(--ink); outline: none; }
.choice.right { border-color: #1f6e43; background: #dff3e7; }
.choice.wrong { border-color: #c2412d; background: #fbe1dc; }
.choice:disabled { cursor: default; }
.toggle-choice { flex-wrap: wrap; }
.toggle-choice .box { flex: none; width: 22px; height: 22px; border-radius: 5px; border: 2px solid var(--ink); background: #fff; }
.toggle-choice.on .box { background: #c2412d; border-color: #c2412d; box-shadow: inset 0 0 0 3px #fff; }
.toggle-choice > span:nth-child(2) { flex: 1; min-width: 0; }
.toggle-choice .why { flex-basis: 100%; padding-left: 32px; font-size: 12px; font-weight: 500; opacity: 0.8; }
.card-hint { align-self: flex-start; min-height: 32px; padding: 4px 12px; border-radius: 999px; border: 1px dashed #8a948e; background: transparent; color: var(--ink); font-size: 13px; }
.card-uncle { align-self: flex-start; min-height: 32px; padding: 4px 12px; border-radius: 999px; border: 0; background: #c9a227; color: #1a1a1a; font-size: 13px; font-weight: 800; }
.card-hint-text { margin: 0; padding: 8px 10px; border-radius: 8px; background: #eef4ff; font-size: 14px; }
.card-feedback { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.card-feedback.good { background: #dff3e7; }
.card-feedback.bad { background: #fbe1dc; }
.card-next { align-self: flex-end; min-height: 44px; min-width: 140px; padding: 8px 20px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 800; }
.card-next:focus-visible { outline: 3px solid var(--glow); outline-offset: 2px; }
.card-splash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(circle at 70% 40%, rgba(90, 52, 22, 0.85) 0, rgba(90, 52, 22, 0.6) 14%, transparent 15%), radial-gradient(circle at 60% 55%, rgba(90, 52, 22, 0.7) 0, transparent 7%), radial-gradient(circle at 78% 30%, rgba(90, 52, 22, 0.7) 0, transparent 5%); }
.card-splash.go { animation: splash 2.4s ease-out; }

@keyframes splash { 0% { opacity: 0; transform: scale(0.4); } 8% { opacity: 1; transform: scale(1); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }
.panel-item.locked { opacity: 0.55; }
.danger { width: 100%; margin-top: 10px; min-height: 38px; border-radius: 10px; border: 1px solid rgba(255, 140, 120, 0.5); background: transparent; color: #ffb3a3; font-weight: 700; }

#buffs {
  position: absolute;
  top: calc(12px + var(--safe-t));
  right: calc(12px + var(--safe-r));
  padding: 4px 9px;
  border-radius: 999px;
  background: #4a2c1a;
  color: #f3e1c0;
  font-size: 12px;
  font-weight: 700;
}
body.touch-mode #buffs { top: calc(60px + var(--safe-t)); }

#btn-menu {
  position: absolute;
  top: calc(12px + var(--safe-t));
  right: calc(12px + var(--safe-r));
  display: none;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(232, 217, 176, 0.35);
  background: rgba(20, 26, 38, 0.72);
  color: var(--paper);
  font-size: 13px;
  font-weight: 700;
  pointer-events: auto;
}
body.touch-mode.playing #btn-menu { display: block; }

#prompt { visibility: hidden; }

#meter {
  position: absolute;
  top: calc(12px + var(--safe-t));
  left: calc(12px + var(--safe-l));
  width: min(240px, 52vw);
  padding: 8px 10px 6px;
  background: rgba(20, 26, 38, 0.72);
  border: 1px solid rgba(232, 217, 176, 0.35);
  border-radius: 10px;
  backdrop-filter: blur(4px);
}
.meter-label { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; color: var(--brass); }
#vest-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-track { margin-top: 6px; height: 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
#puff-fill { height: 100%; width: 8%; border-radius: 6px; background: linear-gradient(90deg, #9fe7ff, #ffd23f 60%, #ff6b4a); transition: width 0.15s; }
.meter-caption { margin-top: 3px; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.65; }

#buffs {
  position: absolute;
  top: calc(84px + var(--safe-t));
  left: calc(12px + var(--safe-l));
  padding: 4px 9px;
  border-radius: 999px;
  background: #4a2c1a;
  color: #f3e1c0;
  font-size: 12px;
  font-weight: 700;
}

#topbar {
  position: absolute;
  top: calc(12px + var(--safe-t));
  right: calc(12px + var(--safe-r));
  display: flex;
  gap: 6px;
  pointer-events: auto;
}
#topbar button {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(232, 217, 176, 0.35);
  background: rgba(20, 26, 38, 0.72);
  color: var(--paper);
  font-size: 12px;
  font-weight: 600;
}
#topbar button[aria-pressed="false"] { opacity: 0.6; }

#prompt {
  position: absolute;
  left: 50%;
  bottom: calc(28px + var(--safe-b));
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(20, 26, 38, 0.82);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
}
#prompt .key {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  margin-right: 4px;
  border-radius: 5px;
  background: var(--brass);
  color: var(--ink);
  text-align: center;
  font-weight: 800;
}

#toasts {
  position: absolute;
  left: 50%;
  top: calc(70px + var(--safe-t));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: calc(100vw - 32px);
}
.toast {
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(194, 65, 45, 0.92);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  transition: opacity 0.4s, transform 0.4s;
}
.toast.out { opacity: 0; transform: translateY(-8px); }
@media (max-width: 700px) { #toasts { top: calc(240px + var(--safe-t)); } }

#bubbles { position: absolute; inset: 0; overflow: hidden; }
.bubble {
  position: absolute;
  left: 0;
  top: 0;
  max-width: min(240px, 60vw);
  overflow-wrap: anywhere; 
  padding: 7px 11px;
  border-radius: 14px;
  background: #ffffff;
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
  will-change: transform;
}
.bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  margin-left: -7px;
  border: 7px solid transparent;
  border-bottom: 0;
  border-top-color: #ffffff;
}
.bubble.shout {
  background: #ffd23f;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.02em;
  animation: shake 0.12s linear 0s 6;
}
.bubble.shout::after { border-top-color: #ffd23f; }
@keyframes shake {
  0%, 100% { margin-left: 0; }
  50% { margin-left: 3px; }
}


#touch { display: none; position: fixed; inset: 0; z-index: 9; touch-action: none; }
body.touch-mode.playing #touch { display: block; }
#stick {
  position: absolute;
  width: 112px;
  height: 112px;
  margin: -56px 0 0 -56px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(20, 26, 38, 0.25);
  opacity: 0;
  pointer-events: none;
  left: 90px;
  top: calc(100% - 140px);
}
#stick.active { opacity: 1; }
#stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
}
#touch-buttons {
  position: absolute;
  right: calc(16px + var(--safe-r));
  bottom: calc(18px + var(--safe-b));
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  gap: 10px;
  align-items: end;
}
.tbtn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(20, 26, 38, 0.6);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  touch-action: none;
}
.tbtn.big { width: 80px; height: 80px; grid-column: 2; grid-row: 2; background: rgba(194, 65, 45, 0.75); }
.tbtn.small { grid-column: 2; grid-row: 1; justify-self: center; }
.tbtn[data-action="interact"] { grid-column: 1; grid-row: 2; }
.tbtn[data-action="interact"].ready { background: var(--brass); color: var(--ink); border-color: #fff; }
.tbtn.pressed { transform: scale(0.92); filter: brightness(1.3); }
body.touch-mode #prompt { bottom: calc(196px + var(--safe-b)); }


#panel {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 14, 22, 0.45);
}
#panel[hidden] { display: none; }
.panel-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 10px;
  background: #101418;
  color: var(--glow);
}
.panel-title { margin: 0; font-size: 19px; }
.panel-sub { margin: 4px 0 0; font-size: 13px; color: #cfe6ff; opacity: 0.8; }
.panel-close {
  flex: none;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--glow);
  background: transparent;
  color: var(--glow);
  font-weight: 700;
}
.panel-list { overflow-y: auto; min-height: 0; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.panel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: #efebe2;
  color: var(--ink);
  text-align: left;
}
.panel-item:hover, .panel-item:focus-visible { border-color: var(--ink); outline: none; }
.panel-item.active { background: #dff4ff; border-color: #2aa7d6; }
.swatch { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.2); }
.panel-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.panel-text strong { font-size: 15px; }
.panel-text small { font-size: 12px; opacity: 0.75; }
.panel-item em { flex: none; font-style: normal; font-weight: 800; font-size: 13px; }


#menu { position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; padding: 16px; background: rgba(10, 14, 22, 0.6); }
.menu-card {
  width: min(440px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--ink);
  border: 1px solid var(--brass);
  border-radius: 14px;
  padding: 20px;
  -webkit-user-select: none;
}
.menu-card h2 { margin: 0; color: var(--brass); font-size: 22px; }
.menu-sub { margin: 4px 0 16px; opacity: 0.8; }
#btn-resume { width: 100%; margin-bottom: 14px; }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 15px; }
.toggle { min-width: 78px; min-height: 34px; border-radius: 999px; border: 1px solid rgba(232, 217, 176, 0.5); background: transparent; color: var(--paper); font-weight: 700; }
.toggle[aria-pressed="true"] { background: var(--brass); color: var(--ink); }
.slider { display: flex; align-items: center; gap: 8px; }
.slider input { width: 120px; accent-color: var(--brass); }
.slider output { min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; opacity: 0.85; }
.menu-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.menu-links button, .back { min-height: 42px; border-radius: 10px; border: 1px solid rgba(232, 217, 176, 0.35); background: rgba(255, 255, 255, 0.06); color: var(--paper); font-weight: 700; font-size: 14px; }
.menu-links button:focus-visible, .toggle:focus-visible, .back:focus-visible, #btn-resume:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }
#ach-count { opacity: 0.7; font-weight: 500; margin-left: 4px; }
.menu-hint { margin: 12px 0 0; text-align: center; font-size: 12px; opacity: 0.55; }
.menu-version { margin: 8px 0 0; text-align: center; font-size: 11px; opacity: 0.45; font-variant-numeric: tabular-nums; }
.title-version { position: fixed; right: calc(10px + var(--safe-r)); bottom: calc(8px + var(--safe-b)); z-index: 41; font-size: 11px; opacity: 0.5; pointer-events: none; }
body.playing .title-version { display: none; }
#nepotism-badge { position: absolute; left: 50%; bottom: calc(70px + var(--safe-b)); transform: translateX(-50%); padding: 3px 10px; border-radius: 999px; background: #c9a227; color: #1a1a1a; font-size: 11px; font-weight: 900; letter-spacing: 0.08em; }
body.touch-mode #nepotism-badge { bottom: calc(240px + var(--safe-b)); }
#event { position: absolute; right: calc(12px + var(--safe-r)); top: calc(52px + var(--safe-t)); width: min(280px, 60vw); padding: 9px 11px; border-radius: 10px; background: rgba(120, 22, 12, 0.92); border: 2px solid #ffd23f; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4); }
#event .ev-kicker { font-size: 10px; font-weight: 900; letter-spacing: 0.14em; color: #ffd23f; }
#event .ev-text { font-weight: 800; font-size: 13px; margin: 2px 0 4px; }
#event .ev-goal { font-size: 12px; opacity: 0.9; }
#event .ev-bar { height: 5px; margin-top: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
#event .ev-fill { height: 100%; width: 100%; background: #ffd23f; }
body.touch-mode #event { top: calc(104px + var(--safe-t)); }
@media (max-width: 700px) { #event { top: auto; bottom: calc(250px + var(--safe-b)); right: 50%; transform: translateX(50%); } }
.panel-rows { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px 4px; color: var(--ink); }
.panel-rows div { font-size: 13.5px; line-height: 1.35; }
.portrait { float: right; margin: 0 0 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.portrait img { width: 96px; height: 96px; object-fit: cover; object-position: 50% 30%; border-radius: 50%; border: 4px solid #1f7a4a; background: #dfe7ef; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); }
.portrait figcaption { margin-top: -14px; padding: 1px 6px; border-radius: 999px; background: #1f7a4a; color: #fff; font-size: 9px; font-weight: 900; letter-spacing: 0.04em; }
.panel-rows b { display: block; font-size: 10.5px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; }
.menu-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.back { padding: 0 14px; }
#ach-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ach { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); opacity: 0.65; }
.ach.unlocked { opacity: 1; background: rgba(232, 217, 176, 0.14); }
.ach-icon { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.1); font-weight: 900; }
.ach.unlocked .ach-icon { background: var(--brass); color: var(--ink); }
.ach-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ach-text strong { font-size: 15px; }
.ach-text small { font-size: 12px; opacity: 0.8; }
.ach em { flex: none; font-style: normal; font-size: 12px; font-weight: 700; opacity: 0.8; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
.keys dt { font-weight: 800; color: var(--brass); }
.keys dd { margin: 0; opacity: 0.9; }
.toast.achievement { display: flex; flex-direction: column; gap: 2px; background: rgba(20, 26, 38, 0.94); border: 2px solid var(--brass); min-width: 220px; }
.toast.achievement small { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brass); }
.toast.achievement strong { font-size: 17px; }
.toast.achievement span { font-size: 13px; font-weight: 500; opacity: 0.85; }


#title {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(20, 26, 38, 0.25), rgba(20, 26, 38, 0.8));
  transition: opacity 0.4s;
}
#title.out { opacity: 0; pointer-events: none; }
#title[hidden] { display: none; }
.title-card { text-align: center; max-width: 560px; }
.kicker { margin: 0; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--brass); }
#title h1 {
  margin: 6px 0 8px;
  font-size: clamp(44px, 12vw, 84px);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
}
#title h1 span { color: var(--brass); }
.who { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 0 0 16px; }
.who-label { font-size: 13px; font-weight: 700; color: var(--brass); margin-right: 4px; }
.who button { min-height: 38px; padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(232, 217, 176, 0.6); background: rgba(20, 26, 38, 0.6); color: var(--paper); font-weight: 700; font-size: 14px; }
.who button[aria-checked="true"] { background: var(--brass); color: var(--ink); }
.toggle.wide { min-width: 110px; }
.tagline { margin: 0 0 22px; font-size: clamp(15px, 3.6vw, 19px); opacity: 0.92; }
#btn-start, #btn-resume {
  min-width: 180px;
  min-height: 52px;
  padding: 12px 28px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  box-shadow: 0 4px 0 #7d2416;
}
#btn-start:active, #btn-resume:active { transform: translateY(2px); box-shadow: 0 2px 0 #7d2416; }
.controls { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: 13px; opacity: 0.85; }
.controls b { color: var(--brass); }
.touch-only { display: none; }
body.touch-mode .touch-only { display: flex; }
body.touch-mode dl.touch-only { display: grid; }
body.touch-mode .desktop-only { display: none; }

#debug {
  position: fixed;
  left: 8px;
  bottom: 8px;
  z-index: 60;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
  font: 11px/1.3 ui-monospace, Menlo, monospace;
  pointer-events: none;
  max-width: calc(100vw - 16px);
}

@media (max-width: 520px) {
  .bubble { font-size: 13px; }
  .slider input { width: 96px; }
}


#share { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(10, 14, 22, 0.72); }
#share[hidden] { display: none; }
.share-card { width: min(640px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--ink); border: 1px solid var(--brass); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.share-title { margin: 0; color: var(--brass); font-size: 22px; }
.share-img { width: 100%; aspect-ratio: 1200 / 627; border-radius: 10px; background: #2a2d5c; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); }
.share-caption { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); font-size: 13px; line-height: 1.45; opacity: 0.9; -webkit-user-select: text; user-select: text; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.share-buttons button { flex: 1 1 110px; min-height: 42px; border-radius: 10px; border: 1px solid rgba(232, 217, 176, 0.35); background: rgba(255, 255, 255, 0.06); color: var(--paper); font-weight: 700; font-size: 14px; }
.share-buttons [data-share="linkedin"] { background: #0a66c2; border-color: #0a66c2; }
.share-buttons button:focus-visible, .share-continue:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }
.share-note { margin: 0; min-height: 1em; font-size: 13px; color: var(--brass); }
.share-note:empty { display: none; }
.share-continue { min-height: 46px; border-radius: 10px; border: 0; background: var(--brass); color: var(--ink); font-weight: 900; font-size: 15px; }


.lb-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lb-tabs button { min-height: 40px; border-radius: 10px; border: 1px solid rgba(232, 217, 176, 0.35); background: rgba(255, 255, 255, 0.04); color: var(--paper); font-weight: 700; font-size: 14px; }
.lb-tabs button[aria-selected="true"] { background: var(--brass); color: var(--ink); }
.lb-blurb { margin: 8px 0; font-size: 13px; opacity: 0.75; }
.lb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto; }
.lb-list li { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.lb-list li.lb-msg { display: block; text-align: center; opacity: 0.75; }
.lb-pos { font-weight: 900; color: var(--brass); }
.lb-who { min-width: 0; }
.lb-who strong { overflow-wrap: anywhere; }
.lb-who small { display: block; opacity: 0.7; font-size: 12px; overflow-wrap: anywhere; }
.lb-in { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 3px; background: #0a66c2; color: #fff; font-size: 11px; font-weight: 900; text-decoration: none; vertical-align: 2px; }
.lb-nepo { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: rgba(201, 162, 39, 0.25); color: #ffd23f; font-size: 10px; font-style: normal; font-weight: 900; text-transform: uppercase; vertical-align: 2px; }
.lb-score { font-size: 12px; font-weight: 700; text-align: right; white-space: nowrap; }
.lb-mine { margin: 8px 0 0; font-size: 13px; color: var(--brass); }
.lb-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.lb-actions button { min-height: 42px; border-radius: 10px; border: 1px solid rgba(232, 217, 176, 0.35); background: rgba(255, 255, 255, 0.06); color: var(--paper); font-weight: 700; }
.lb-actions .lb-post { background: var(--brass); color: var(--ink); border: 0; }
.lb-actions:has(.lb-remove[hidden]) .lb-post { grid-column: 1 / -1; }
#lb-form { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 16px; background: rgba(10, 14, 22, 0.72); }
#lb-form[hidden] { display: none; }
.lb-card { width: min(420px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--ink); border: 1px solid var(--brass); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.lb-card h2 { margin: 0; color: var(--brass); font-size: 22px; }
.lb-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; }
.lb-card input:not([type="checkbox"]) { min-height: 40px; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(232, 217, 176, 0.35); background: rgba(255, 255, 255, 0.08); color: var(--paper); font: inherit; font-size: 16px; font-weight: 400; }
.lb-card input:focus-visible { outline: 2px solid var(--glow); outline-offset: 1px; }
.lb-card .lb-check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; }
.lb-check input { width: 20px; height: 20px; margin: 0; flex: none; }
.lb-check a { color: var(--glow); }
.lb-form-stats, .lb-notice { margin: 0; font-size: 13px; opacity: 0.8; }
.lb-status { margin: 0; min-height: 1em; font-size: 13px; color: #ffb4a8; }
.lb-status:empty { display: none; }
.lb-form-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lb-form-buttons button { min-height: 44px; border-radius: 10px; border: 1px solid rgba(232, 217, 176, 0.35); background: rgba(255, 255, 255, 0.06); color: var(--paper); font-weight: 800; font-size: 15px; }
.lb-form-buttons .lb-submit { background: var(--brass); color: var(--ink); border: 0; }
.lb-form-buttons button:disabled { opacity: 0.5; }
.share-buttons [data-share="leaderboard"] { background: rgba(232, 217, 176, 0.18); }
.lb-list li.lb-me { background: rgba(232, 217, 176, 0.18); outline: 1px solid rgba(232, 217, 176, 0.5); }


body.playing #game { cursor: grab; }
body.playing #game.dragging { cursor: grabbing; }


#grade { position: fixed; inset: 0; pointer-events: none; z-index: 1; display: none; }
body.graded #grade { display: block; background: radial-gradient(ellipse 75% 70% at 50% 48%, transparent 55%, rgba(8, 6, 4, var(--grade-vignette)) 100%); }
body.graded #grade::before { content: ""; position: absolute; inset: 0; background: var(--grade-tint); opacity: var(--grade-tint-a); mix-blend-mode: soft-light; }

body.skiing #grade, body:not(.playing) #grade { display: none; }
body.skiing #game { filter: none; }


#callout { position: absolute; left: 50%; top: 77%; transform: translateX(-50%); z-index: 3; display: grid; gap: 6px; justify-items: center; pointer-events: none; animation: callout-in 0.35s cubic-bezier(0.3, 1.5, 0.5, 1); }
#callout .callout-text { padding: 8px 18px; background: #ffe873; color: #1d1d1f; border: 2px solid #1d1d1f; border-radius: 4px; box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35); font: 700 clamp(16px, 2.6vw, 24px) / 1.2 "Oswald", system-ui, sans-serif; text-transform: uppercase; letter-spacing: 0.03em; text-align: center; max-width: min(560px, 90vw); }
#callout .callout-bar { width: min(320px, 70vw); height: 8px; background: rgba(0, 0, 0, 0.45); border-radius: 4px; overflow: hidden; }
#callout .callout-bar i { display: block; height: 100%; background: #ffe873; animation: callout-count linear forwards; }
@keyframes callout-in { from { transform: translate(-50%, 20px) scale(0.8); opacity: 0; } }
@keyframes callout-count { from { width: 100%; } to { width: 0%; } }


#lift-ride { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
#lift-ride.closed, #lift-ride.closing { pointer-events: auto; }
#lift-ride .lr-door { position: absolute; top: 0; bottom: 0; width: 50.5%; background: linear-gradient(90deg, #8c9197, #c9ced3 30%, #a6abb1 55%, #d7dbdf 75%, #9aa0a6); box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35); transition: transform 0.75s cubic-bezier(0.5, 0, 0.3, 1); }
#lift-ride .lr-door i { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 2px, rgba(0, 0, 0, 0.04) 2px 5px); }
#lift-ride .lr-left { left: 0; border-right: 2px solid #5f646a; }
#lift-ride .lr-right { right: 0; border-left: 2px solid #5f646a; }
#lift-ride.open .lr-left, #lift-ride.opening .lr-left { transform: translateX(-102%); }
#lift-ride.open .lr-right, #lift-ride.opening .lr-right { transform: translateX(102%); }
#lift-ride.opening .lr-door { transition-duration: 0.85s; }
#lift-ride .lr-panel { position: absolute; z-index: 2; left: 50%; top: 9%; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; padding: 10px 22px; background: #121417; border: 3px solid #6f747a; border-radius: 6px; color: #ff9a3c; font: 700 clamp(28px, 6vw, 54px) / 1 "Courier Prime", ui-monospace, monospace; text-shadow: 0 0 12px rgba(255, 140, 40, 0.8); transition: opacity 0.3s; }
#lift-ride .lr-arrow { font-size: 0.6em; }
#lift-ride .lr-caption { position: absolute; z-index: 2; left: 50%; bottom: 12%; transform: translateX(-50%); padding: 6px 14px; background: rgba(18, 20, 23, 0.85); color: #f4f1ea; font: 700 clamp(14px, 2.4vw, 20px) / 1.2 "Oswald", system-ui, sans-serif; letter-spacing: 0.06em; text-transform: uppercase; border-radius: 3px; white-space: nowrap; }
#lift-ride .lr-caption:empty { display: none; }
#lift-ride.open .lr-panel, #lift-ride.opening .lr-panel, #lift-ride.opening .lr-caption { opacity: 0; }


body.calm *, body.calm *::before, body.calm *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }


#credits { position: fixed; inset: 0; z-index: 60; overflow: hidden; background: linear-gradient(rgba(8, 8, 12, 0.72), rgba(8, 8, 12, 0.9)); color: #f4f1ea; text-align: center; animation: cr-in 0.8s ease-out; }
#credits.out { opacity: 0; transition: opacity 0.6s; }
@keyframes cr-in { from { opacity: 0; } }
#credits .cr-roll { position: absolute; left: 50%; top: 100%; width: min(620px, 90vw); transform: translateX(-50%); padding-bottom: 20vh; }
#credits .cr-roll.go { animation: cr-up linear forwards; }
@keyframes cr-up { to { transform: translate(-50%, var(--travel)); } }
#credits .cr-title { font: 700 clamp(38px, 8vw, 72px) / 1 "Oswald", system-ui, sans-serif; letter-spacing: 0.04em; color: #ffe873; margin: 0 0 10px; }
#credits .cr-tagline { font: italic 16px / 1.4 "Courier Prime", monospace; opacity: 0.85; margin: 0 0 60px; }
#credits .cr-heading { font: 500 14px / 1 "Oswald", system-ui, sans-serif; letter-spacing: 0.24em; text-transform: uppercase; color: #c9a227; margin: 56px 0 18px; }
#credits .cr-line { font: 18px / 1.5 "Courier Prime", monospace; margin: 4px 0; }
#credits .cr-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; text-align: left; margin: 7px 0; font-size: 15px; line-height: 1.35; }
#credits .cr-pair span { text-align: right; opacity: 0.7; font-family: "Courier Prime", monospace; }
#credits .cr-pair strong { font: 500 17px / 1.35 "Oswald", system-ui, sans-serif; letter-spacing: 0.03em; }
#credits .cr-end { margin-top: 90px; font: 20px / 1.6 "Courier Prime", monospace; }
#credits .cr-end p:last-child { font: 700 26px / 1.4 "Oswald", system-ui, sans-serif; color: #ffe873; margin-top: 20px; }
#credits .cr-skip { position: absolute; right: calc(16px + var(--safe-r, 0px)); bottom: calc(16px + var(--safe-b, 0px)); padding: 8px 16px; background: rgba(255, 255, 255, 0.12); color: #f4f1ea; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 4px; font: 600 14px "Oswald", system-ui, sans-serif; letter-spacing: 0.08em; cursor: pointer; }
@media (max-width: 520px) { #credits .cr-pair { grid-template-columns: 1fr; gap: 2px; text-align: center; } #credits .cr-pair span { text-align: center; } }


#panel:not([hidden]) .panel-card, #card:not([hidden]) .card-box, #menu:not([hidden]) .menu-card, #share:not([hidden]) .share-card, #mg:not([hidden]) > * { animation: ui-in 0.24s cubic-bezier(0.2, 1.2, 0.4, 1); }
#panel:not([hidden]), #card:not([hidden]), #menu:not([hidden]), #share:not([hidden]) { animation: ui-dim 0.2s ease-out; }
@keyframes ui-in { from { opacity: 0; transform: translateY(18px) scale(0.97); } }
@keyframes ui-dim { from { background-color: transparent; } }


#loading .ld-box { display: grid; gap: 14px; justify-items: center; }
#loading .ld-vest { width: 64px; height: 76px; border-radius: 22px 22px 16px 16px; background: repeating-linear-gradient(180deg, #2f4a6b 0 11px, #24394f 11px 13px); box-shadow: inset 0 -6px 0 #18263a; position: relative; animation: ld-puff 1.1s ease-in-out infinite; }
#loading .ld-vest::after { content: ""; position: absolute; left: 50%; top: 4px; bottom: 6px; width: 3px; transform: translateX(-50%); background: #c9ced3; }
@keyframes ld-puff { 50% { transform: scale(1.16, 1.08); } }
#loading .ld-text { font: 700 20px / 1 "Oswald", system-ui, sans-serif; letter-spacing: 0.08em; text-transform: uppercase; }
#loading .ld-bar { width: min(260px, 70vw); height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
#loading .ld-bar i { display: block; height: 100%; width: 0%; background: #ffe873; transition: width 0.2s; }
#loading .ld-tip { max-width: min(420px, 86vw); font: italic 14px / 1.4 "Courier Prime", monospace; opacity: 0.75; }


body.pad :focus { outline: 3px solid #ffe873 !important; outline-offset: 2px; box-shadow: 0 0 0 6px rgba(255, 232, 115, 0.25); }
body.pad #prompt .key { border-radius: 50%; }


body.photo #hud, body.photo #bubbles, body.photo #grade, body.photo #touch { display: none !important; }
#photo { position: fixed; inset: 0; z-index: 55; pointer-events: none; }
#photo > * { pointer-events: auto; }
#photo .ph-top { position: absolute; top: calc(12px + var(--safe-t, 0px)); left: 50%; transform: translateX(-50%); display: flex; gap: 14px; align-items: center; padding: 6px 14px; background: rgba(12, 14, 18, 0.7); color: #f4f1ea; border-radius: 4px; font: 13px "Courier Prime", monospace; white-space: nowrap; }
#photo .ph-top strong { font: 700 15px "Oswald", system-ui, sans-serif; letter-spacing: 0.12em; color: #ffe873; }
#photo .ph-bar { position: absolute; bottom: calc(14px + var(--safe-b, 0px)); left: 50%; transform: translateX(-50%); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: max-content; max-width: 94vw; }
#photo button, #photo .ph-save { padding: 9px 14px; background: rgba(12, 14, 18, 0.78); color: #f4f1ea; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 4px; font: 600 14px "Oswald", system-ui, sans-serif; letter-spacing: 0.05em; cursor: pointer; text-decoration: none; }
#photo .ph-shoot { background: #ffe873; color: #1d1d1f; border-color: #1d1d1f; }
#photo .ph-frame-preview { position: absolute; inset: 0; pointer-events: none; }
#photo .ph-frame-preview[data-frame="polaroid"] { box-shadow: inset 0 0 0 3.5vw #f4f1ea, inset 0 -14vh 0 3.5vw #f4f1ea; }
#photo .ph-frame-preview[data-frame="cover"] { background: linear-gradient(#c0392b 0 0) top / 100% 0 no-repeat; border-top: 9vh solid rgba(192, 57, 43, 0.35); }
#photo .ph-frame-preview[data-frame="badge"] { border-bottom: 12vh solid rgba(31, 59, 90, 0.7); }
#photo .ph-frame-preview[data-frame="linkedout"] { border-top: 12vh solid rgba(255, 255, 255, 0.85); border-bottom: 22vh solid rgba(255, 255, 255, 0.85); }
#photo .ph-result { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px; background: rgba(8, 8, 12, 0.82); }
#photo .ph-result img { max-width: min(860px, 90vw); max-height: 70vh; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6); transform: rotate(-1.5deg); }
#photo .ph-result-bar { display: flex; gap: 8px; }
#photo .ph-flash { position: absolute; inset: 0; background: #fff; animation: ph-flash 0.4s ease-out forwards; pointer-events: none; }
@keyframes ph-flash { from { opacity: 0.9; } to { opacity: 0; } }
@media (max-width: 600px) { #photo .ph-help { display: none; } }


#builder { position: fixed; inset: 0; z-index: 46; display: grid; align-items: center; justify-items: end; padding: 16px max(16px, 4vw); pointer-events: none; }
#builder .bd-card { pointer-events: auto; width: min(420px, 100%); max-height: 92vh; overflow: auto; padding: 18px 20px; background: #fbf6e8; color: #1d1d1f; border: 2px solid #1d1d1f; border-radius: 4px; box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3); animation: ui-in 0.24s cubic-bezier(0.2, 1.2, 0.4, 1); }
#builder h2 { margin: 0; font: 700 26px / 1 "Oswald", system-ui, sans-serif; text-transform: uppercase; }
#builder .bd-sub { margin: 4px 0 12px; font: italic 13px "Courier Prime", monospace; opacity: 0.75; }
#builder .bd-row { display: grid; gap: 6px; margin: 10px 0; }
#builder .bd-label { font: 600 12px "Oswald", system-ui, sans-serif; letter-spacing: 0.12em; text-transform: uppercase; color: #6b5a3a; }
#builder .bd-opts { display: flex; flex-wrap: wrap; gap: 6px; }
#builder .bd-opt { padding: 5px 10px; background: #fff; border: 1.5px solid #1d1d1f; border-radius: 3px; font: 13px "Courier Prime", monospace; cursor: pointer; }
#builder .bd-opt.on { background: #1d1d1f; color: #fff; }
#builder .bd-opt.swatch { width: 30px; height: 30px; padding: 0; border-radius: 50%; }
#builder .bd-opt.swatch.on { outline: 3px solid #c0392b; outline-offset: 2px; }
#builder .bd-done { margin-top: 14px; width: 100%; padding: 10px; background: #1d1d1f; color: #fff; border: 0; border-radius: 3px; font: 700 16px "Oswald", system-ui, sans-serif; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; }
body.building #title .title-card { opacity: 0; pointer-events: none; }
@media (max-width: 700px) { #builder { align-items: end; justify-items: center; } #builder .bd-card { max-height: 55vh; } }
#lift-ride.waiting .lr-caption { animation: lr-blink 1.4s ease-in-out infinite; }
@keyframes lr-blink { 50% { opacity: 0.55; } }

html.lift-pending #loading { visibility: hidden; }
html.lift-pending::after { content: ""; position: fixed; inset: 0; z-index: 69; background: linear-gradient(90deg, #8c9197, #c9ced3 15%, #a6abb1 27%, #d7dbdf 37%, #9aa0a6 50%, #8c9197 50%, #c9ced3 65%, #a6abb1 77%, #d7dbdf 87%, #9aa0a6); }
#builder .bd-zoom { float: right; padding: 5px 10px; background: #fff; border: 1.5px solid #1d1d1f; border-radius: 3px; font: 700 12px "Oswald", system-ui, sans-serif; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; }
#photo .ph-frame-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
