:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #fff3dd;
  background: #21150f;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #21150f; -webkit-tap-highlight-color: transparent; touch-action: none; }
button { font: inherit; }
[hidden] { display: none !important; }

#game { display: block; width: 100%; height: 100%; outline: none; }

#hud {
  position: fixed;
  inset: max(14px, env(safe-area-inset-top)) 14px auto;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  pointer-events: none;
}

.stat {
  min-width: 90px;
  padding: 9px 12px;
  border: 1px solid #e8ba745e;
  border-radius: 11px;
  background: #21160edb;
  box-shadow: 0 6px 24px #10090566;
}
.stat span { display: block; color: #d7ad72; font-size: 9px; font-weight: 900; letter-spacing: .13em; }
.stat strong { display: block; margin-top: 2px; color: #fff0cb; font-size: 20px; font-variant-numeric: tabular-nums; }
.level-stat { min-width: 72px; }
.level-stat strong { font-size: 16px; }
.score-stat { margin-left: auto; }
#pauseButton {
  width: 42px;
  height: 42px;
  border: 1px solid #e8ba7480;
  border-radius: 11px;
  color: #fff0cb;
  background: #21160edb;
  font-weight: 900;
  pointer-events: auto;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: auto;
  background: linear-gradient(90deg, #130d0ac9, #130d0a6b 50%, #130d0ac9);
}
.menu-card {
  width: min(92vw, 560px);
  max-height: 94vh;
  overflow: auto;
  padding: clamp(24px, 5vw, 40px);
  border: 1px solid #e8bb7766;
  border-radius: 20px;
  background: linear-gradient(145deg, #2c2018f2, #19120ef5);
  box-shadow: 0 24px 80px #0e0805a8, inset 0 1px #fff3d414;
  text-align: center;
}
.eyebrow { margin: 0 0 12px; color: #e8bd7d; font-size: 10px; font-weight: 900; letter-spacing: .2em; }
h1 { margin: 0; color: #ffedc8; font: 700 clamp(46px, 11vw, 76px)/.87 Georgia, "Times New Roman", serif; text-shadow: 0 4px 24px #c46f345e; }
h1 span { color: #efa857; }
.subtitle { margin: 13px 0 19px; color: #e4b979; font-size: 12px; font-weight: 900; letter-spacing: .17em; text-transform: uppercase; }
.message { max-width: 420px; margin: 0 auto 23px; color: #e3d2be; font-size: 14px; line-height: 1.7; }
.preview-widget { position: relative; width: min(100%, 350px); margin: 0 auto 18px; }
.preview-button {
  display: flex;
  width: 100%;
  min-height: 82px;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid #e8bb7766;
  border-radius: 12px;
  color: #fff0cb;
  background: #100b08a8;
  text-align: left;
  cursor: pointer;
}
.preview-button img { width: 64px; height: 64px; border: 1px solid #f3cb8299; border-radius: 15px; box-shadow: 0 4px 14px #0008; }
.preview-button strong, .preview-button small { display: block; }
.preview-button strong { font-size: 12px; }
.preview-button small { margin-top: 3px; color: #c1ac96; font-size: 10px; }
.preview-play { margin-left: auto; color: #f3bb72; font-size: 18px; }
.preview-video {
  position: absolute;
  z-index: 3;
  top: calc(100% + 8px);
  left: 50%;
  width: min(350px, 88vw);
  aspect-ratio: 16 / 9;
  border: 1px solid #e8bb7799;
  border-radius: 13px;
  background: #100b08;
  box-shadow: 0 14px 36px #090503c9;
  object-fit: cover;
  transform: translateX(-50%);
}
.level-preview { margin: 0 auto 15px; color: #e4b979; font-size: 10px; font-weight: 700; line-height: 1.6; }
.primary-button {
  min-width: 190px;
  padding: 14px 22px;
  border: 0;
  border-radius: 11px;
  color: #2b1c12;
  background: linear-gradient(135deg, #ffdc99, #e99a4e);
  box-shadow: 0 8px 26px #e69b4a44;
  font-size: 14px;
  font-weight: 950;
  cursor: pointer;
}
.primary-button:hover { filter: brightness(1.08); }
.primary-button:focus-visible, button:focus-visible { outline: 3px solid #fff1ca; outline-offset: 3px; }
.keyboard-hint, .touch-hint { margin: 19px 0 0; color: #c1ac96; font-size: 10px; line-height: 1.8; }
.touch-hint { display: none; }
kbd { display: inline-block; min-width: 19px; padding: 1px 4px; border: 1px solid #8e765d; border-radius: 4px; color: #f7d8a2; font: inherit; font-size: 9px; }
.fine-print { margin: 17px 0 0; color: #8e7a65; font-size: 10px; }
.policy-links { display: flex; justify-content: center; gap: 9px; margin: 12px 0 0; font-size: 10px; }
.policy-links a { color: #d7bd9c; text-decoration: underline; text-underline-offset: 2px; }
.policy-links span { color: #806b56; }
.engine-error { margin: 14px 0 0; color: #ffb39e; font-size: 12px; }

.callout {
  position: fixed;
  top: 24%;
  left: 50%;
  max-width: 90vw;
  margin: 0;
  padding: 9px 16px;
  border: 1px solid #edc17a77;
  border-radius: 20px;
  color: #fff1d2;
  background: #21170fdc;
  box-shadow: 0 5px 25px #10090570;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-align: center;
  pointer-events: none;
  transform: translateX(-50%);
}

#touchControls {
  position: fixed;
  right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 14px;
  pointer-events: none;
}
.move-pad, .jump-pad { display: flex; align-items: flex-end; gap: 8px; }
#touchControls button {
  min-width: 58px;
  height: 58px;
  border: 1px solid #e9c18499;
  border-radius: 16px;
  color: #fff0d2;
  background: #281b13dd;
  box-shadow: 0 4px 16px #10090580;
  font-size: 12px;
  font-weight: 900;
  pointer-events: auto;
  touch-action: none;
}
.move-pad button { min-width: 52px; font-size: 31px !important; }
#touchControls [data-action="jump"] { width: 74px; height: 74px; color: #2b1c12; background: linear-gradient(140deg, #ffdc99, #e99a4e); }

@media (pointer: coarse) {
  .keyboard-hint { display: none; }
  .touch-hint { display: block; }
}
@media (max-width: 480px) {
  #hud { inset-inline: 8px; gap: 5px; }
  .stat { min-width: 56px; padding: 7px 5px; }
  .stat span { font-size: 8px; }
  .stat strong { font-size: 15px; }
  .level-stat { min-width: 50px; }
  .level-stat strong { font-size: 13px; }
  #pauseButton { width: 36px; height: 36px; }
  #touchControls { padding-inline: 8px; }
  .move-pad, .jump-pad { gap: 5px; }
  #touchControls button { min-width: 48px; height: 50px; border-radius: 13px; font-size: 10px; }
  .move-pad button { min-width: 43px; }
  #touchControls [data-action="jump"] { width: 62px; height: 62px; }
}
