:root {
  --neon: #ccff00;
  --bg: #fff8e8;
  --cream: #fff8e8;
  --panel: #fff8e8;
  --ink: #101509;
  --muted: #3e4b20;
  --gold: #e8a230;
  --pepe: #6fbf57;
  --shirt: #2b44ff;
  --danger: #e07070;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Keep the arcade in on the tender cursor, including its own iframe view. */
@media (pointer: fine) {
  html,
  html *,
  html *::before,
  html *::after {
    cursor: url("../tendie-cursor.png") 4 1, auto !important;
  }
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "VT323", monospace;
  overflow: hidden;
  user-select: none;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

html.is-embed .site-chrome {
  display: none;
}

html.is-embed #frame {
  width: min(96vw, calc((100dvh - 1.5rem) * 16 / 9));
  height: min(calc(100dvh - 1.5rem), calc(96vw * 9 / 16));
}

.site-chrome {
  width: min(100% - 2.5rem, 96rem);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin-inline: auto;
  min-height: 102px;
  color: var(--ink);
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  border-bottom: 1px solid var(--ink);
}

.site-wordmark,
.site-home {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-family: "Anton", Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 2.125rem;
  letter-spacing: -0.015em;
  line-height: 1;
  text-decoration: none;
}

.site-wordmark img {
  width: 42px;
  height: 54px;
  object-fit: contain;
}

.site-chrome p {
  margin: 0;
  text-align: center;
}

.site-home {
  justify-self: end;
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.875rem;
  letter-spacing: 0;
}

#frame {
  position: relative;
  width: min(92vw, calc((100dvh - 8.75rem) * 16 / 9));
  height: min(calc(100dvh - 8.75rem), calc(92vw * 9 / 16));
  margin: auto;
  background: #000;
  border: 2px solid var(--ink);
  box-shadow:
    0 0 0 8px var(--neon),
    12px 12px 0 var(--ink);
  border-radius: 0;
  overflow: hidden;
}

#frame,
#frame * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

#frame img {
  -webkit-user-drag: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
  touch-action: none;
}

#hud {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 56px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  pointer-events: none;
  z-index: 2;
}

.tendie-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffe14a;
  border: 4px solid #111;
  padding: 6px 10px 6px 6px;
  box-shadow: 3px 3px 0 #111;
}

.tendie-box img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.tendie-box .label {
  font-family: "VT323", monospace;
  font-size: 16px;
  color: #111;
  letter-spacing: 0;
}

.tendie-box #tendie-count {
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  color: #111;
  text-shadow: none;
}

.hud-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-block .label {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: #111;
  letter-spacing: 1px;
}

.hud-block span:last-child {
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  color: #111;
  text-shadow: 2px 2px 0 #fff;
}

.powerup-hud {
  display: contents;
}

.speed-box {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  background: #6fbf57;
  border: 4px solid #111;
  padding: 7px 12px 6px;
  box-shadow: 3px 3px 0 #111;
  z-index: 5;
}

.speed-box #speed-mult {
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  color: #111;
  line-height: 1.2;
}

.speed-box .label {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: #111;
  letter-spacing: 1px;
}

#combo {
  position: absolute;
  top: 70px;
  left: 14px;
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: #2b44ff;
  text-shadow: 2px 2px 0 #fff;
  pointer-events: none;
  z-index: 2;
  animation: combo-pop 0.35s ease-out;
}

@keyframes combo-pop {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(80, 90, 70, 0.28);
  z-index: 3;
}

.panel {
  text-align: center;
  padding: 22px 28px 20px;
  max-width: 520px;
  background: var(--cream);
  border: 3px solid var(--ink);
  box-shadow: 8px 8px 0 var(--neon);
}

.title-pepe {
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin-bottom: 4px;
}

.kicker {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  color: #a12217;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

h1 {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(22px, 4.2vw, 34px);
  line-height: 1.35;
  color: var(--ink);
  text-shadow: 4px 4px 0 var(--neon);
  margin-bottom: 16px;
}

.blurb,
.stats {
  font-size: 22px;
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.2;
}

.hint {
  margin-top: 14px;
  font-size: 18px;
  color: #5a6354;
}

.orientation-tip {
  display: none;
}

.noscript-message {
  position: fixed;
  inset: 50% auto auto 50%;
  width: min(90vw, 520px);
  padding: 24px;
  translate: -50% -50%;
  color: var(--ink);
  background: var(--panel);
  border: 5px solid #111;
  box-shadow: 6px 6px 0 #111;
  font-size: 22px;
  text-align: center;
}

button {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: var(--cream);
  background: var(--ink);
  border: 3px solid var(--ink);
  padding: 14px 18px;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--neon);
}

button:hover {
  color: var(--ink);
  background: var(--neon);
  filter: none;
}

button:active {
  transform: translateY(2px);
  box-shadow: 2px 2px 0 #111;
}

.heli-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ff8a9a;
  border: 4px solid #111;
  padding: 6px 10px 6px 6px;
  box-shadow: 3px 3px 0 #111;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: #111;
}

.heli-box img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.heli-meter-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 72px;
}

.heli-meter {
  width: 72px;
  height: 8px;
  background: #111;
  border: 2px solid #111;
  overflow: hidden;
}

#heli-meter-fill {
  width: 100%;
  height: 100%;
  background: #ffe14a;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

#heli-meter-fill.wait {
  background: #c9c6d6;
}

.giga-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f7931a;
  border: 4px solid #111;
  padding: 6px 10px 6px 6px;
  box-shadow: 3px 3px 0 #111;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: #111;
}

.giga-box img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

#mute-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  color: var(--ink);
  background: var(--neon);
}

#mute-btn.muted {
  color: #666;
  background: #c8c2b4;
  border-color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}

.hidden {
  display: none !important;
}

.dead-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.btn-share {
  color: var(--ink);
  background: var(--neon);
}

.btn-share:disabled {
  cursor: wait;
  filter: grayscale(0.35);
  opacity: 0.72;
}

.share-status {
  min-height: 1.2em;
  margin-top: 10px;
  font-size: 18px;
  color: #2b44ff;
}

#new-best {
  color: #2b44ff;
  min-height: 1.2em;
}

@media (hover: none) and (pointer: coarse),
  (max-width: 700px),
  (orientation: landscape) and (max-height: 500px) {
  .site-chrome {
    display: none;
  }

  #frame {
    width: min(100vw, calc(100dvh * 16 / 9));
    height: min(100dvh, calc(100vw * 9 / 16));
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    padding:
      max(16px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    background: rgba(63, 72, 58, 0.76);
  }

  .panel {
    width: min(100%, 520px);
    max-width: none;
    padding: 18px 20px 16px;
    border-width: 4px;
    box-shadow: 5px 5px 0 #111;
  }

  .title-pepe {
    width: 80px;
    height: 80px;
  }

  h1 {
    font-size: clamp(22px, 8vw, 30px);
    margin-bottom: 12px;
  }

  .blurb,
  .stats {
    font-size: 19px;
    margin-bottom: 16px;
  }

  .hint {
    margin-top: 10px;
    font-size: 16px;
  }

  .orientation-tip {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 12px 0 0;
    padding: 8px 10px;
    color: #111;
    background: var(--neon);
    border: 3px solid #111;
    box-shadow: 3px 3px 0 #111;
    font-size: 14px;
    line-height: 1.25;
    text-align: left;
  }

  .orientation-tip strong {
    font-family: "Press Start 2P", monospace;
    font-size: 8px;
    letter-spacing: 0.4px;
  }

  .orientation-icon {
    flex: 0 0 auto;
    font-family: "Press Start 2P", monospace;
    font-size: 25px;
    line-height: 1;
  }

  button {
    min-height: 44px;
  }

  #mute-btn {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
  }

  #hud {
    top: 8px;
    left: 8px;
    right: 52px;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .tendie-box {
    gap: 5px;
    border-width: 3px;
    padding: 4px 7px 4px 4px;
  }

  .tendie-box img {
    width: 28px;
    height: 28px;
  }

  .tendie-box .label,
  .tendie-box #tendie-count {
    font-size: 12px;
  }

  .hud-block .label,
  .giga-box,
  .heli-box {
    font-size: 7px;
  }

  .hud-block span:last-child {
    font-size: 11px;
  }

  .speed-box {
    position: static;
    flex: 0 0 auto;
    margin-left: auto;
    gap: 2px;
    border-width: 3px;
    padding: 4px 6px 3px;
    box-shadow: 2px 2px 0 #111;
  }

  .speed-box #speed-mult {
    font-size: 11px;
  }

  .speed-box .label {
    font-size: 6px;
  }

  .powerup-hud {
    position: absolute;
    top: 42px;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
  }

  .giga-box,
  .heli-box {
    gap: 4px;
    border-width: 3px;
    padding: 3px 5px 3px 3px;
    box-shadow: 2px 2px 0 #111;
    font-size: 6px;
  }

  .giga-box img,
  .heli-box img {
    width: 24px;
    height: 24px;
  }

  .heli-meter-col {
    gap: 3px;
    min-width: 54px;
  }

  .heli-meter {
    width: 54px;
    height: 6px;
    border-width: 1px;
  }
}

@media ((hover: none) and (pointer: coarse) and (orientation: portrait)),
  ((max-width: 700px) and (orientation: portrait)) {
  .orientation-tip {
    display: flex;
  }
}

@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 480px),
  (max-width: 700px) and (orientation: landscape) and (max-height: 480px),
  (orientation: landscape) and (max-height: 480px) {
  .overlay {
    padding:
      max(8px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
  }

  .panel {
    width: min(84vw, 600px);
    padding: 10px 18px 9px;
  }

  .title-pepe {
    width: 58px;
    height: 58px;
    margin-bottom: 0;
  }

  .kicker {
    font-size: 7px;
    margin-bottom: 5px;
  }

  h1 {
    font-size: clamp(18px, 4.5vw, 26px);
    line-height: 1.18;
    margin-bottom: 7px;
    text-shadow: 3px 3px 0 #6fbf57;
  }

  .blurb,
  .stats {
    font-size: 16px;
    line-height: 1.05;
    margin-bottom: 8px;
  }

  .hint,
  .share-status {
    margin-top: 6px;
    font-size: 14px;
  }

  .orientation-tip {
    display: none;
  }

  button {
    min-height: 40px;
    border-width: 3px;
    padding: 9px 13px;
    font-size: 9px;
    box-shadow: 3px 3px 0 #111;
  }

  .dead-actions {
    gap: 8px;
  }

  #new-best {
    min-height: 0;
  }
}
