@import url('https://fonts.googleapis.com/css2?family=Darumadrop+One&family=Zen+Maru+Gothic:wght@500;700;900&display=swap');

* { box-sizing: border-box; }
html, body { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
body { margin: 0; min-height: 100vh; display: grid; place-items: center; color: #fff; background: radial-gradient(circle at 50% 0%, #344e9b, #151b4d 62%, #0c1030); font-family: "Zen Maru Gothic", sans-serif; }
.game-shell { width: min(1100px, 96vw); padding: 18px 0 22px; }
header { display: flex; align-items: end; justify-content: space-between; padding: 0 5px 13px; }
.eyebrow { color: #aeeffc; font-size: 11px; font-weight: 900; letter-spacing: .17em; } h1 { margin: 2px 0 0; font: 900 30px "Zen Maru Gothic", sans-serif; letter-spacing: .04em; }
.title-heading, .message h2.title-heading { font-family: "Darumadrop One", sans-serif; font-weight: 400; }
.scoreboard { display: flex; align-items: center; gap: 20px; font-size: 14px; font-weight: 700; } .scoreboard b { color: #ffe66d; font-size: 22px; } .scoreboard i { font-style: normal; color: #c8d2ff; }
.audio-controls { display: flex; align-items: center; gap: 7px; color: #dbe7ff; font-size: 11px; white-space: nowrap; }.audio-controls button { width: 30px; height: 30px; margin: 0; padding: 0; box-shadow: none; font: 16px sans-serif; }.audio-controls button:active { transform: none; box-shadow: none; }.audio-controls input { width: 72px; accent-color: #ffdb55; vertical-align: middle; }
.ranking-button { margin: 0; padding: 7px 12px; box-shadow: 0 3px #d58a26; font: 12px "Zen Maru Gothic", sans-serif; white-space: nowrap; }.ranking-button:active { transform: translateY(2px); box-shadow: 0 1px #d58a26; }
.game-frame { position: relative; overflow: hidden; border: 5px solid #fff; border-radius: 19px; box-shadow: 0 16px 0 #0b1239, 0 25px 35px #05072488; background: #75d7f5; }
canvas { display: block; width: 100%; height: auto; image-rendering: auto; }
.message { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; text-align: center; background: linear-gradient(#10184eb5,#162754b5); transition: opacity .2s; } .message.hidden { opacity: 0; pointer-events: none; }
.message h2 { margin: 0; font: 900 52px "Zen Maru Gothic", sans-serif; text-shadow: 4px 4px #10134a; } .message p { font-weight: 700; }
.rankings { display: grid; grid-template-columns: repeat(2, minmax(190px, 1fr)); gap: 13px; width: min(620px, 90%); margin: 13px 0 4px; text-align: left; }.ranking-card { overflow: hidden; border: 2px solid #93b9ec; border-radius: 11px; background: #101b4bcc; }.ranking-card h3 { margin: 0; padding: 7px 12px; background: #324985; font-size: 13px; }.ranking-card ol { max-height: 172px; margin: 0; padding: 5px 12px 7px 34px; overflow: auto; font-size: 12px; }.ranking-card li { display: flex; justify-content: space-between; padding: 2px 0; color: #edf4ff; }.ranking-card li:first-child { color: #ffe66d; font-weight: 900; }.ranking-card li span:last-child { font-variant-numeric: tabular-nums; }
.name-entry { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 14px 0 4px; }.name-entry input { width: 180px; border: 2px solid #dbe7ff; border-radius: 100px; padding: 10px 16px; background: #fff; color: #263864; font: 700 16px "Zen Maru Gothic", sans-serif; outline: none; }.name-entry button { margin: 0; padding: 10px 18px; font-size: 16px; }
button { margin-top: 11px; border: 0; border-radius: 100px; padding: 13px 35px; background: #ffdb55; box-shadow: 0 5px #d58a26; color: #283864; font: 900 21px "Zen Maru Gothic", sans-serif; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: wait; filter: grayscale(.6); opacity: .7; }
button:active { transform: translateY(4px); box-shadow: 0 1px #d58a26; }.controls { margin: 17px 0 0; text-align: center; font-size: 13px; font-weight: 700; color: #dbe7ff; } kbd { display: inline-block; min-width: 24px; margin: 0 2px; padding: 2px 6px; border: 1px solid #aab9eb; border-radius: 5px; background: #273568; }
.title-ranking-button { margin-top: 15px; padding: 9px 22px; background: #8fb5ff; box-shadow: 0 4px #4968b0; font-size: 16px; }
.options-button, .mobile-controls, .options-panel { display: none; }
/* Touch devices and narrow browser windows use the mobile controls in either
   orientation.  The previous landscape-only query left portrait phones on
   the desktop keyboard layout. */
@media (max-width: 900px) {
  body { min-height: 100svh; }
  .game-shell { width: 100vw; min-height: 100svh; display: flex; flex-direction: column; padding: 5px 8px 8px; }
  header { padding: 0 3px 5px; align-items: center; }
  .eyebrow { display: none; }
  h1 { margin: 0; font-size: clamp(17px, 3.2vw, 24px); }
  .scoreboard { gap: 8px; font-size: 10px; flex-direction: row; align-items: center; }
  .scoreboard b { font-size: 14px; }
  .ranking-button { display: none; }
  .audio-controls { display: none; }
  .game-frame { width: 100%; aspect-ratio: 16 / 9; max-height: calc(100svh - 45px); margin: auto; border-width: 3px; border-radius: 11px; box-shadow: 0 7px 0 #0b1239, 0 12px 18px #05072488; }
  .game-frame canvas { width: 100%; height: 100%; object-fit: fill; }
  .game-frame { touch-action: none; }
  .controls { display: none; }
  .options-button { display: block; position: absolute; top: 8px; right: 8px; z-index: 12; margin: 0; padding: 6px 10px; border: 2px solid #fff; background: #263c86dd; color: #fff; font-size: 18px; line-height: 1; box-shadow: 0 3px #111a4d; }
  .game-frame.mobile-playing .mobile-controls { display: flex; }
  .mobile-controls { position: absolute; inset: auto 12px 10px; z-index: 10; align-items: end; justify-content: space-between; pointer-events: none; }
  .move-buttons { display: flex; gap: 10px; pointer-events: auto; }
  .mobile-controls button { width: clamp(52px, 11vw, 82px); height: clamp(44px, 10vw, 68px); margin: 0; padding: 0; border: 2px solid #ffffffcc; border-radius: 15px; background: #263c86cc; color: #fff; font: 900 clamp(20px, 4vw, 30px) "Zen Maru Gothic", sans-serif; box-shadow: 0 4px #101946; touch-action: none; user-select: none; -webkit-user-select: none; }
  .mobile-controls .jump-button { width: clamp(78px, 18vw, 130px); background: #d44c79dd; font-size: clamp(15px, 3vw, 22px); pointer-events: auto; }
  .mobile-controls button.pressed, .options-button:active { transform: translateY(3px); box-shadow: 0 1px #101946; filter: brightness(1.18); }
  .options-panel { position: absolute; inset: 0; z-index: 20; display: grid; place-content: center; justify-items: center; gap: 15px; background: #10184ee8; text-align: center; }
  .options-panel[hidden] { display: none; }
  .options-panel h2 { margin: 0; font: 400 clamp(30px, 7vw, 48px) "Darumadrop One", sans-serif; text-shadow: 3px 3px #10134a; }
  .options-panel label { display: grid; gap: 8px; font-weight: 900; font-size: clamp(14px, 3vw, 20px); }
  .options-panel input { width: clamp(170px, 42vw, 300px); accent-color: #ffdb55; }
  .options-panel button { margin: 0; padding: 10px 28px; font-size: clamp(16px, 3vw, 22px); }
  .title-ranking-button { display: block; margin-top: 10px; font-size: clamp(14px, 3vw, 20px); }
}
@media (max-width: 900px) and (orientation: portrait) {
  .game-shell { padding: 8px 6px 14px; }
  header { flex-wrap: wrap; gap: 4px 10px; }
  .scoreboard { margin-left: auto; }
  .game-frame { max-height: none; margin-top: 8px; }
}
@media (max-width: 600px) { header { align-items: start; } h1 { font-size: 22px; }.scoreboard { gap: 7px; flex-direction: column; font-size: 11px; align-items: end; }.scoreboard b { font-size: 16px; }.message h2 { font-size: 35px; }.message p { font-size: 13px; padding: 0 18px; }.rankings { gap: 7px; }.ranking-card h3 { font-size: 11px; }.ranking-card ol { font-size: 10px; } }
