:root {
  --ink: #172033;
  --ink-soft: #516072;
  --shell: #fff9f1;
  --glass: rgba(255, 255, 255, 0.72);
  --line: rgba(23, 32, 51, 0.12);
  --berry: #f64f78;
  --orange: #ff9f43;
  --lemon: #ffd166;
  --mint: #58d7b7;
  --sky: #48bdf5;
  --violet: #8c6cf7;
  --shadow: 0 18px 42px rgba(26, 40, 71, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

html {
  overflow: hidden;
}

body {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 209, 102, 0.42), transparent 24%),
    radial-gradient(circle at 84% 18%, rgba(72, 189, 245, 0.36), transparent 24%),
    radial-gradient(circle at 50% 92%, rgba(88, 215, 183, 0.34), transparent 30%),
    linear-gradient(155deg, #fff8e8 0%, #f8f0ff 43%, #e9fbff 100%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

button,
a {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  width: min(100%, 520px);
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  padding:
    max(12px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: clamp(6px, 1.2dvh, 10px);
  overflow: hidden;
}

.title-screen {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding:
    max(16px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 20% 16%, rgba(255, 209, 102, 0.52), transparent 28%),
    radial-gradient(circle at 84% 22%, rgba(72, 189, 245, 0.42), transparent 28%),
    radial-gradient(circle at 52% 88%, rgba(88, 215, 183, 0.42), transparent 34%),
    linear-gradient(155deg, #fff8e8 0%, #f8f0ff 43%, #e9fbff 100%);
}

.title-screen.hidden {
  display: none;
}

.server-loader {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.18), transparent 34%),
    rgba(23, 32, 51, 0.18);
  backdrop-filter: blur(4px) saturate(1.05);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
  pointer-events: auto;
  cursor: wait;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.server-loader.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.game-shell.is-server-loading > :not(.server-loader) {
  filter: blur(1.5px) saturate(0.96);
  pointer-events: none;
}

.server-loader-card {
  width: min(236px, 100%);
  min-height: 52px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 255, 255, 0.9), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(196, 247, 255, 0.66));
  box-shadow: 0 22px 50px rgba(20, 32, 50, 0.24);
  transform: translateY(0) scale(1);
  transition: transform 0.18s ease;
}

.server-loader.hidden .server-loader-card {
  transform: translateY(10px) scale(0.96);
}

.server-loader-jelly {
  position: relative;
  width: 26px;
  height: 22px;
  border-radius: 13px 13px 10px 10px;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.92) 0 12%, transparent 13%),
    linear-gradient(180deg, #ff7aa8, #f64f78);
  box-shadow:
    inset 0 -4px 0 rgba(201, 35, 86, 0.18),
    0 6px 12px rgba(246, 79, 120, 0.24);
  animation: serverJellyBounce 0.72s ease-in-out infinite;
}

.server-loader-jelly::before,
.server-loader-jelly::after {
  content: "";
  position: absolute;
  top: 11px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #1d2c3f;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.74);
}

.server-loader-jelly::before {
  left: 8px;
}

.server-loader-jelly::after {
  right: 8px;
}

.server-loader-track {
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.26)),
    rgba(72, 189, 245, 0.2);
  box-shadow:
    inset 0 2px 5px rgba(49, 64, 82, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.78);
}

.server-loader-fill {
  position: absolute;
  inset: 2px auto 2px 2px;
  width: 46%;
  border-radius: 999px;
  background:
    radial-gradient(circle at 24% 35%, rgba(255, 255, 255, 0.92), transparent 18%),
    linear-gradient(90deg, #ff9f43, #f64f78 48%, #48bdf5);
  box-shadow:
    0 0 12px rgba(246, 79, 120, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  animation: serverJellySlide 0.98s ease-in-out infinite;
}

@keyframes serverJellyBounce {
  0%, 100% {
    transform: translateY(1px) scale(1.08, 0.92);
  }
  50% {
    transform: translateY(-3px) scale(0.94, 1.08);
  }
}

@keyframes serverJellySlide {
  0% {
    left: -46%;
    transform: scaleX(0.82);
  }
  45% {
    transform: scaleX(1.18);
  }
  100% {
    left: 100%;
    transform: scaleX(0.82);
  }
}

.title-brand {
  width: fit-content;
}

.title-hero {
  width: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  padding-bottom: clamp(20px, 4.8dvh, 42px);
  text-align: center;
}

.title-hero h1 {
  max-width: 100%;
  font-size: clamp(42px, 10vw, 66px);
}

.title-jelly-grid {
  width: min(88%, 360px);
  max-width: 100%;
  align-self: center;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(4px, 1dvh, 10px) clamp(6px, 2vw, 12px);
  padding: clamp(6px, 1.4dvh, 12px);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 18%, rgba(246, 79, 120, 0.16), transparent 28%),
    radial-gradient(circle at 86% 18%, rgba(255, 209, 102, 0.28), transparent 28%),
    radial-gradient(circle at 82% 76%, rgba(88, 215, 183, 0.18), transparent 34%),
    rgba(255, 255, 255, 0.46);
  overflow: visible;
}

.title-jelly-grid img {
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 10px 12px rgba(246, 79, 120, 0.18));
  pointer-events: none;
}

.title-actions {
  width: min(100%, 320px);
  max-width: 100%;
  display: grid;
  gap: 16px;
  align-self: end;
  justify-self: center;
  margin-bottom: clamp(10px, 3dvh, 28px);
}

.title-actions button {
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-size: 17px;
  font-weight: 950;
  cursor: pointer;
}

.title-play {
  background: linear-gradient(180deg, #ff8b4a, #f25b73);
  box-shadow: 0 10px 0 #b94354, 0 20px 34px rgba(242, 91, 115, 0.22);
}

.title-rank {
  background: linear-gradient(180deg, #4cc8f5, #6675f7);
  box-shadow: 0 10px 0 #4350bb, 0 20px 34px rgba(76, 151, 245, 0.22);
}

.topbar {
  min-height: 76px;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 82px;
  align-items: center;
  gap: 10px;
}

.brand-link {
  min-width: 0;
  color: #314052;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 24px rgba(49, 64, 82, 0.08);
}

.title-lockup {
  min-width: 0;
  text-align: center;
}

.kicker {
  margin: 0 0 2px;
  color: #7b6f90;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(29px, 7.4vw, 42px);
  line-height: 0.95;
  letter-spacing: 0;
  color: #1d2c3f;
  text-shadow:
    0 2px 0 #ffffff,
    0 10px 24px rgba(246, 79, 120, 0.18);
}

.icon-command {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #243348;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.55));
  box-shadow: 0 10px 24px rgba(49, 64, 82, 0.12);
  cursor: pointer;
}

.icon-command:active {
  transform: translateY(2px);
  box-shadow: 0 6px 18px rgba(49, 64, 82, 0.1);
}

.icon-command:focus-visible {
  outline: 3px solid rgba(246, 79, 120, 0.34);
  outline-offset: 2px;
}

.home-command {
  position: relative;
  justify-self: start;
}

.home-command::before {
  content: "";
  width: 18px;
  height: 18px;
  border-top: 4px solid #243348;
  border-left: 4px solid #243348;
  border-radius: 3px 0 0 0;
  transform: translateY(3px) rotate(45deg);
}

.home-command::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 22px;
  width: 18px;
  height: 14px;
  border: 4px solid #243348;
  border-top: 0;
  border-radius: 0 0 4px 4px;
  transform: translateX(-50%);
}

.score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}

.score-tile {
  width: min(100%, 172px);
  min-height: 54px;
  padding: 8px 14px 7px;
  border: 1px solid rgba(255,255,255,0.68);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(255,255,255,0.42));
  box-shadow: 0 12px 26px rgba(49, 64, 82, 0.09);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.score-tile span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.score-tile strong {
  margin-top: 2px;
  color: #1d2c3f;
  font-size: clamp(22px, 5.8vw, 30px);
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
  white-space: nowrap;
}

.play-area {
  min-height: 0;
  display: grid;
  place-items: center;
}

.stage-frame {
  position: relative;
  width: min(100%, calc(100dvh - 240px));
  max-width: 492px;
  max-height: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,0.78);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.52), rgba(255,255,255,0.24)),
    linear-gradient(135deg, rgba(255, 209, 102, 0.45), rgba(72, 189, 245, 0.22) 44%, rgba(246, 79, 120, 0.25));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.stage-frame::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 8px;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.28) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.22) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.28;
}

.pixi-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.pixi-stage canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  touch-action: none;
}

.quick-guide {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
}

.quick-guide.is-visible {
  opacity: 1;
}

.guide-hand {
  position: absolute;
  left: 60%;
  top: 56%;
  width: 46px;
  height: 46px;
  border-radius: 50% 50% 44% 44%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.92), transparent 16px),
    linear-gradient(145deg, #fff2cf, #ffb86b);
  box-shadow:
    0 8px 18px rgba(125, 67, 34, 0.2),
    inset 0 -5px 0 rgba(210, 121, 58, 0.2);
  transform: translate(-50%, -50%) rotate(-18deg);
  animation: handSwipe 1.32s cubic-bezier(.5,0,.2,1) infinite;
}

.guide-hand::after {
  content: "";
  position: absolute;
  left: 30px;
  top: 30px;
  width: 18px;
  height: 52px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe6ba, #ffac63);
  transform: rotate(-34deg);
  box-shadow: inset 0 -5px 0 rgba(210, 121, 58, 0.2);
}

@keyframes handSwipe {
  0% { transform: translate(42%, -50%) rotate(-18deg) scale(0.92); opacity: 0; }
  16% { opacity: 1; }
  72% { transform: translate(-160%, -50%) rotate(-18deg) scale(1); opacity: 1; }
  100% { transform: translate(-192%, -50%) rotate(-18deg) scale(0.92); opacity: 0; }
}

.message-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding:
    max(18px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  background: rgba(24, 33, 48, 0.28);
  backdrop-filter: blur(8px);
  overflow-y: auto;
}

.message-modal.hidden {
  display: none;
}

.message-card {
  width: min(100%, 330px);
  max-height: calc(100dvh - 42px);
  overflow-y: auto;
  padding: 22px 18px 18px;
  border: 1px solid rgba(255,255,255,0.78);
  border-radius: 8px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.94), rgba(255,250,240,0.82)),
    radial-gradient(circle at 50% 0%, rgba(255,209,102,0.42), transparent 60%);
  box-shadow: 0 22px 52px rgba(20, 32, 50, 0.24);
  overscroll-behavior: contain;
}

.message-eyebrow {
  margin: 0 0 2px;
  color: #f24c70;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.message-card h2 {
  margin: 0;
  color: #1d2c3f;
  font-size: clamp(32px, 10vw, 48px);
  line-height: 1;
  letter-spacing: 0;
}

.message-card p {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.rank-submit-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(29, 44, 63, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.rank-submit-panel.hidden {
  display: none;
}

.final-score-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.final-score-line strong {
  color: #f24c70;
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0;
}

.rank-submit-panel input {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(29, 44, 63, 0.17);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 850;
  text-align: center;
}

.rank-submit-panel input:focus {
  outline: 2px solid rgba(72, 189, 245, 0.34);
  border-color: rgba(72, 189, 245, 0.72);
}

.rank-submit-buttons {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 0.84fr;
  gap: 8px;
}

.rank-submit-buttons button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 950;
  background: linear-gradient(180deg, #4cc8f5, #6675f7);
  box-shadow: 0 7px 0 #4350bb, 0 14px 24px rgba(76, 151, 245, 0.2);
  cursor: pointer;
}

.rank-submit-buttons button + button {
  color: #314052;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(49, 64, 82, 0.12);
}

.rank-submit-buttons button:disabled,
.rank-submit-panel input:disabled {
  opacity: 0.62;
  cursor: default;
}

.submit-status {
  min-height: 18px;
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 850;
}

.submit-status.ok {
  color: #008f76;
}

.submit-status.fail {
  color: #d84462;
}

.message-actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.message-actions.is-single {
  grid-template-columns: 1fr;
}

.message-actions button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 950;
  background: linear-gradient(180deg, #ff8b4a, #f25b73);
  box-shadow: 0 9px 0 #b94354, 0 18px 32px rgba(242, 91, 115, 0.22);
  cursor: pointer;
}

.message-actions button + button {
  background: linear-gradient(180deg, #4cc8f5, #6675f7);
  box-shadow: 0 9px 0 #4350bb, 0 18px 32px rgba(76, 151, 245, 0.22);
}

.rank-modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(24, 33, 48, 0.32);
  backdrop-filter: blur(8px);
}

.rank-modal.hidden {
  display: none;
}

.rank-card {
  width: min(100%, 354px);
  max-height: min(90%, 560px);
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,250,240,0.9)),
    radial-gradient(circle at 18% 4%, rgba(255,209,102,0.44), transparent 56%);
  box-shadow: 0 22px 52px rgba(20, 32, 50, 0.26);
}

.rank-card-head {
  display: grid;
  grid-template-columns: 1fr 38px;
  align-items: start;
  gap: 10px;
}

.rank-card-head p {
  margin: 0 0 2px;
  color: #f24c70;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.rank-card-head h2 {
  margin: 0;
  color: #1d2c3f;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
}

.rank-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(29, 44, 63, 0.12);
  border-radius: 8px;
  color: #314052;
  background: rgba(255, 255, 255, 0.72);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.rank-content {
  margin-top: 14px;
  display: grid;
  gap: 8px;
  overflow-y: auto;
  padding-right: 2px;
}

.rank-row {
  min-height: 44px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 8px;
  border: 1px solid rgba(29, 44, 63, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.rank-row.top1 {
  background: rgba(255, 238, 175, 0.86);
  border-color: rgba(255, 159, 67, 0.54);
}

.rank-row.top2 {
  background: rgba(236, 248, 255, 0.86);
  border-color: rgba(72, 189, 245, 0.4);
}

.rank-row.top3 {
  background: rgba(255, 231, 218, 0.86);
  border-color: rgba(246, 79, 120, 0.35);
}

.rank-row.me {
  outline: 2px solid rgba(246, 79, 120, 0.28);
}

.rank-pos {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 28px;
  border-radius: 999px;
  background: rgba(29, 44, 63, 0.08);
  color: #314052;
  font-size: 13px;
  font-weight: 950;
}

.rank-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-score {
  color: #f24c70;
  font-size: 14px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.rank-loading,
.rank-empty,
.rank-error {
  padding: 24px 12px;
  border: 1px dashed rgba(29, 44, 63, 0.14);
  border-radius: 8px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.46);
  font-size: 14px;
  font-weight: 850;
  text-align: center;
}

.control-dock {
  display: grid;
  place-items: center;
  min-height: 0;
  padding-bottom: clamp(18px, 3dvh, 28px);
}

.swipe-pad {
  position: relative;
  height: clamp(78px, 10.5dvh, 92px);
  width: min(174px, 45vw);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 5px;
  padding: 3px;
}

.swipe-pad::before {
  content: "";
  position: absolute;
  inset: 17% 21%;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 10px;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.86), transparent 25%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.44), rgba(72, 189, 245, 0.16));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 10px 22px rgba(49, 64, 82, 0.08);
}

.swipe-pad::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.34) 58%, rgba(72, 189, 245, 0.18));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    0 6px 14px rgba(49, 64, 82, 0.1);
  transform: translate(-50%, -50%);
}

.swipe-pad button {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: 10px;
  color: #314052;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.56)),
    radial-gradient(circle at 50% 0%, rgba(88, 215, 183, 0.28), transparent 72%);
  box-shadow:
    0 5px 0 rgba(72, 189, 245, 0.18),
    0 10px 18px rgba(49, 64, 82, 0.1),
    inset 0 1px 0 rgba(255,255,255,0.82);
  font-size: 0;
  font-weight: 950;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s ease;
}

.swipe-pad button::before {
  content: "";
  width: 11px;
  height: 11px;
  border-top: 3px solid #243348;
  border-right: 3px solid #243348;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.8));
}

.swipe-pad button:active {
  transform: translateY(3px) scale(0.96);
  box-shadow:
    0 2px 0 rgba(72, 189, 245, 0.2),
    0 5px 12px rgba(49, 64, 82, 0.09),
    inset 0 2px 6px rgba(49, 64, 82, 0.08);
}

.swipe-pad button:focus-visible {
  outline: 3px solid rgba(246, 79, 120, 0.34);
  outline-offset: 2px;
}

.swipe-pad button[data-dir="up"] {
  grid-column: 2;
  grid-row: 1;
}

.swipe-pad button[data-dir="up"]::before {
  transform: translateY(2px) rotate(-45deg);
}

.swipe-pad button[data-dir="left"] {
  grid-column: 1;
  grid-row: 2;
}

.swipe-pad button[data-dir="left"]::before {
  transform: translateX(2px) rotate(-135deg);
}

.swipe-pad button[data-dir="down"] {
  grid-column: 2;
  grid-row: 3;
}

.swipe-pad button[data-dir="down"]::before {
  transform: translateY(-2px) rotate(135deg);
}

.swipe-pad button[data-dir="right"] {
  grid-column: 3;
  grid-row: 2;
}

.swipe-pad button[data-dir="right"]::before {
  transform: translateX(-2px) rotate(45deg);
}

@media (min-width: 720px) {
  body {
    display: grid;
    place-items: center;
  }

  .game-shell {
    width: 520px;
    min-height: auto;
    height: min(100vh, 910px);
  }
}

@media (max-height: 720px) {
  .topbar {
    min-height: 54px;
  }

  .title-screen {
    gap: 8px;
  }

  .title-hero h1 {
    font-size: clamp(40px, 11vw, 58px);
  }

  .title-jelly-grid {
    width: min(78%, 280px);
    gap: 4px 7px;
    padding: 7px;
  }

  .score-tile {
    min-height: 46px;
  }

  .stage-frame {
    width: min(100%, calc(100dvh - 234px));
  }

  .control-dock {
    padding-bottom: 18px;
  }

  .swipe-pad {
    width: 150px;
    height: 78px;
    gap: 4px;
  }

  .swipe-pad::after {
    width: 18px;
    height: 18px;
  }
}

@media (max-height: 640px) {
  .control-dock {
    padding-bottom: 14px;
  }

  .swipe-pad {
    width: 138px;
    height: 72px;
  }
}

@media (max-width: 430px) {
  .game-shell {
    padding:
      max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .topbar {
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    gap: 7px;
  }

  .title-screen {
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(26px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .title-hero {
    padding-bottom: clamp(28px, 7dvh, 58px);
  }

  .title-hero h1 {
    font-size: clamp(42px, 12vw, 56px);
  }

  .title-jelly-grid {
    width: min(86%, 310px);
  }

  .title-actions button {
    min-height: 50px;
    font-size: 16px;
  }

  .title-actions {
    width: min(100%, 292px);
    gap: 14px;
    margin-bottom: clamp(18px, 6dvh, 48px);
  }

  .message-modal {
    padding:
      max(12px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(18px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .message-card {
    max-height: calc(100dvh - 30px);
    padding: 16px 14px 12px;
  }

  .message-card h2 {
    font-size: clamp(28px, 8vw, 38px);
  }

  .rank-submit-panel {
    margin-top: 10px;
    padding: 10px;
  }

  .message-actions {
    margin-top: 10px;
  }

  .rank-submit-panel input {
    min-height: 38px;
    margin-top: 8px;
  }

  .rank-submit-buttons button,
  .message-actions button {
    min-height: 38px;
    box-shadow: 0 6px 0 #4350bb, 0 12px 22px rgba(76, 151, 245, 0.2);
  }

  .rank-submit-buttons button + button {
    box-shadow: inset 0 0 0 1px rgba(49, 64, 82, 0.12);
  }

  .message-actions button {
    box-shadow: 0 6px 0 #b94354, 0 12px 22px rgba(242, 91, 115, 0.2);
  }

  .message-actions button + button {
    box-shadow: 0 6px 0 #4350bb, 0 12px 22px rgba(76, 151, 245, 0.2);
  }

  .brand-link {
    padding: 9px 8px;
    font-size: 12px;
  }

  .icon-command {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  h1 {
    font-size: clamp(27px, 7vw, 32px);
  }

  .score-row {
    justify-items: center;
  }

  .score-tile {
    width: min(100%, 154px);
    padding-inline: 6px;
  }

  .score-tile strong {
    font-size: clamp(18px, 5vw, 23px);
  }
}
