/* MIU POPS — MIU BLOCKS 高級ネオンUI準拠 */
:root {
  --bg-deep: #080008;
  --bg-mid: #0a0012;
  --neon-pink: #ff4fd8;
  --neon-pink-dim: #c93aa8;
  --neon-pink-hot: #ff2fc8;
  --neon-cyan: #7ef9ff;
  --neon-soft: #ffb8e8;
  --text: #ffe8f8;

  --lux-glass: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.28) 0%,
    rgba(255, 180, 220, 0.14) 25%,
    rgba(255, 77, 166, 0.08) 50%,
    rgba(12, 0, 10, 0.65) 100%
  );
  --lux-border: rgba(255, 230, 248, 0.75);
  --lux-neon-sm: 0 0 12px rgba(255, 255, 255, 0.8), 0 0 24px rgba(255, 77, 166, 0.7);
  --lux-neon-md: 0 0 20px rgba(255, 255, 255, 0.6), 0 0 40px rgba(255, 77, 166, 0.75), 0 0 70px rgba(255, 45, 138, 0.35);
  --lux-neon-lg: 0 0 30px rgba(255, 120, 200, 0.9), 0 0 60px rgba(255, 77, 166, 0.8), 0 0 100px rgba(255, 45, 138, 0.45);
  --lux-glass-shadow:
    0 0 28px rgba(255, 77, 166, 0.45),
    0 0 56px rgba(255, 45, 138, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    inset 0 -12px 32px rgba(255, 45, 138, 0.15);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

@keyframes score-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

html {
  height: 100%;
}

html,
body {
  overflow: hidden;
  touch-action: manipulation;
  font-family: "Helvetica Neue", "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg-deep);
  color: var(--text);
}

body {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(255, 77, 166, 0.2) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 0% 100%, rgba(255, 45, 138, 0.12) 0%, transparent 50%),
    linear-gradient(180deg, #080008 0%, #12000e 50%, #080008 100%);
}

.bg-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 77, 166, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 77, 166, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.1) 2px,
    rgba(0, 0, 0, 0.1) 4px
  );
  transition: opacity 0.4s;
}

body.is-playing .scanlines {
  opacity: 0.12;
}

body.is-home .bg-grid {
  opacity: 0;
}

body.is-home .scanlines {
  opacity: 0;
}

body.is-playing .bg-grid {
  opacity: 0;
}

#app {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  overflow: hidden;
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  padding: calc(6px + var(--safe-top)) 10px calc(6px + var(--safe-bottom));
}

.screen.active {
  display: flex;
}

/* ----- ロゴ ----- */
.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.08rem;
  font-weight: 900;
  line-height: 0.9;
  text-align: center;
  letter-spacing: 0.06em;
  filter: drop-shadow(0 0 14px rgba(255, 79, 216, 0.75));
}

.logo-line {
  display: block;
}

.logo-line--miu {
  font-size: 1em;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, #fff 0%, #ffd9f7 38%, var(--neon-pink) 72%, var(--neon-pink-hot) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo-heart {
  display: inline-block;
  margin-left: 0.06em;
  font-size: 0.82em;
  color: #ff8ee8;
  -webkit-text-fill-color: #ff8ee8;
  text-shadow: var(--lux-neon-sm);
}

.logo-line--sub {
  font-size: 0.74em;
  letter-spacing: 0.24em;
  padding-left: 0.24em;
  background: linear-gradient(180deg, #fff 0%, #c8f8ff 35%, var(--neon-cyan) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo-panel {
  padding: 18px 34px 20px;
  border-radius: 22px;
  border: 1.5px solid rgba(255, 220, 240, 0.72);
  background: var(--lux-glass);
  box-shadow: var(--lux-neon-lg), var(--lux-glass-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.is-home .logo-panel {
  background: rgba(8, 0, 18, 0.42);
  border-color: rgba(255, 200, 240, 0.55);
  box-shadow:
    0 0 18px rgba(255, 77, 166, 0.45),
    0 0 32px rgba(255, 45, 138, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

body.is-home .logo {
  filter:
    drop-shadow(0 0 10px rgba(255, 79, 216, 0.9))
    drop-shadow(0 0 22px rgba(255, 45, 138, 0.65));
}

body.is-home .tagline {
  text-shadow:
    0 0 10px rgba(126, 249, 255, 0.9),
    0 0 20px rgba(126, 249, 255, 0.5);
}

body.is-home .hint {
  color: rgba(255, 220, 245, 0.82);
  text-shadow: 0 0 10px rgba(255, 79, 216, 0.55);
}

.tagline {
  margin-top: 0.5rem;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  color: var(--neon-cyan);
  text-shadow: 0 0 12px rgba(126, 249, 255, 0.75);
}

.hint {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: rgba(255, 200, 235, 0.65);
  margin-top: 0.25rem;
}

/* ----- HOME ----- */
#screen-home {
  position: relative;
  justify-content: flex-end;
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.boot-splash {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 24px;
  background: rgba(4, 0, 10, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  cursor: pointer;
  touch-action: manipulation;
}

.boot-splash[hidden] {
  display: none;
}

.boot-splash__title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.2rem, 6vw, 1.6rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #ffd4f4;
  text-shadow:
    0 0 12px rgba(255, 79, 216, 0.9),
    0 0 24px rgba(255, 45, 138, 0.55);
}

.boot-splash__text {
  margin: 0;
  font-size: clamp(0.85rem, 4.2vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.28em;
  color: #fff;
  text-shadow: 0 0 14px rgba(255, 79, 216, 0.85);
  animation: boot-pulse 1.4s ease-in-out infinite;
}

.boot-splash__sub {
  margin: 0.15rem 0 0;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: rgba(255, 220, 245, 0.82);
}

@keyframes boot-pulse {
  0%, 100% { opacity: 0.72; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1); }
}

body.is-boot-waiting .home-ui {
  pointer-events: none;
}

body.is-home #screen-home.active::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    url("title.png") center 6% / cover no-repeat,
    linear-gradient(180deg, #120818 0%, #080008 100%);
  pointer-events: none;
}

body.is-home #screen-home.active::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(8, 0, 16, 0) 0%,
    rgba(8, 0, 16, 0) 48%,
    rgba(8, 0, 16, 0.28) 78%,
    rgba(8, 0, 16, 0.82) 100%
  );
}

.home-ui {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.38rem;
  padding: 0.65rem 12px calc(8px + var(--safe-bottom));
  background: linear-gradient(
    180deg,
    rgba(8, 0, 16, 0) 0%,
    rgba(8, 0, 16, 0.32) 52%,
    rgba(8, 0, 16, 0.9) 100%
  );
}

#screen-home > * {
  position: relative;
  z-index: 1;
}

#screen-home .logo-panel {
  margin-top: 0;
  width: min(88vw, 280px);
  padding: 5px 12px 6px;
  border-radius: 12px;
  background: rgba(8, 0, 18, 0.2);
  border: 1px solid rgba(255, 200, 240, 0.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 0 10px rgba(255, 77, 166, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
}

#screen-home .level-select,
#screen-home .neon-btn--settings,
#screen-home .neon-btn--hero,
#screen-home .hint {
  width: min(88vw, 280px);
}

#screen-home .logo {
  flex-direction: column;
  align-items: center;
  gap: 0;
  font-size: clamp(1.1rem, 6vw, 1.45rem);
  line-height: 0.92;
  width: 100%;
}

#screen-home .logo-line--sub {
  font-size: 0.7em;
  letter-spacing: 0.2em;
  padding-left: 0.2em;
}

body.is-home #screen-home .logo {
  filter:
    drop-shadow(0 0 8px rgba(255, 79, 216, 0.85))
    drop-shadow(0 0 16px rgba(255, 45, 138, 0.45));
}

#screen-home .tagline {
  margin-top: 0.22rem;
  width: 100%;
  text-align: center;
  font-size: 0.48rem;
  letter-spacing: 0.24em;
  padding-left: 0.24em;
  opacity: 0.9;
}

#screen-home .hint {
  margin-top: 0;
  font-size: 0.54rem;
  color: rgba(255, 220, 245, 0.68);
}

body.is-home .neon-btn--hero {
  background: rgba(255, 79, 216, 0.22);
  border-color: rgba(255, 180, 240, 0.95);
  box-shadow:
    0 0 20px rgba(255, 79, 216, 0.75),
    0 0 40px rgba(255, 79, 216, 0.35),
    inset 0 0 16px rgba(255, 79, 216, 0.25);
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.8),
    0 0 18px rgba(255, 79, 216, 0.95);
}

body.is-home .neon-btn--settings {
  width: min(88vw, 280px);
  min-height: 2rem;
  padding: 0.4rem 1.25rem;
  font-size: 0.56rem;
  letter-spacing: 0.2em;
  background: rgba(8, 0, 18, 0.5);
  border-color: rgba(255, 160, 230, 0.7);
  box-shadow:
    0 0 10px rgba(255, 79, 216, 0.3),
    inset 0 0 8px rgba(255, 79, 216, 0.1);
}

body.is-home .neon-btn--hero {
  min-height: 2.65rem;
  padding: 0.65rem 2rem;
  font-size: clamp(0.78rem, 3.8vw, 0.92rem);
}

#screen-home .level-select {
  gap: 5px;
}

#screen-home .level-btn {
  min-height: 38px;
  padding: 6px 2px;
  font-size: 0.82rem;
  border-radius: 8px;
}

.settings-panel {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.settings-panel[hidden] {
  display: none;
}

.settings-panel__backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  background: rgba(4, 0, 10, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
}

.settings-panel__card {
  position: relative;
  z-index: 1;
  width: min(88vw, 300px);
  padding: 18px 18px 16px;
  border-radius: 18px;
  border: 1.5px solid rgba(255, 180, 240, 0.75);
  background: rgba(8, 0, 18, 0.92);
  box-shadow:
    0 0 24px rgba(255, 79, 216, 0.45),
    0 0 48px rgba(255, 45, 138, 0.2),
    inset 0 0 20px rgba(255, 79, 216, 0.12);
}

.settings-title {
  margin: 0 0 14px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-align: center;
  color: #ffd8f4;
  text-shadow: 0 0 10px rgba(255, 79, 216, 0.8);
}

.settings-row {
  display: grid;
  grid-template-columns: 2.4rem 1fr 2.6rem;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.settings-row--vol {
  align-items: start;
}

.settings-vol {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 2px;
}

.settings-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255, 200, 235, 0.9);
  padding-top: 4px;
}

.settings-val {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--neon-cyan);
  text-align: right;
  padding-top: 2px;
  text-shadow: 0 0 10px rgba(126, 249, 255, 0.75);
  font-variant-numeric: tabular-nums;
}

.settings-meter {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.35);
}

.settings-meter__fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.08s ease-out;
}

.settings-meter--bgm .settings-meter__fill {
  background: linear-gradient(90deg, rgba(255, 79, 216, 0.85), rgba(255, 180, 240, 1));
  box-shadow: 0 0 8px rgba(255, 79, 216, 0.65);
}

.settings-meter--se .settings-meter__fill {
  background: linear-gradient(90deg, rgba(126, 249, 255, 0.85), rgba(180, 255, 255, 1));
  box-shadow: 0 0 8px rgba(126, 249, 255, 0.55);
}

.settings-range {
  width: 100%;
  height: 8px;
  margin: 0;
  --vol-pct: 70%;
  accent-color: var(--neon-pink);
  cursor: pointer;
  touch-action: manipulation;
  background: transparent;
}

.settings-range--bgm {
  accent-color: #ff6ed8;
}

.settings-range--se {
  accent-color: #7ef9ff;
}

.neon-btn--settings-close {
  display: block;
  width: 100%;
  margin-top: 6px;
  min-height: 2.4rem;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
}

body.is-home .diff-btn {
  background: rgba(8, 0, 18, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.level-select {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 6px;
  width: min(92vw, 320px);
}

.level-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  padding: 8px 4px;
  border: 1.5px solid rgba(255, 79, 216, 0.55);
  border-radius: 10px;
  background: rgba(8, 0, 18, 0.55);
  color: #ffc8ef;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px rgba(255, 79, 216, 0.45);
  box-shadow:
    0 0 10px rgba(255, 79, 216, 0.2),
    inset 0 0 8px rgba(255, 79, 216, 0.1);
  touch-action: manipulation;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.level-btn.is-active {
  color: #fff;
  border-color: rgba(255, 200, 240, 0.95);
  background: rgba(255, 79, 216, 0.32);
  box-shadow:
    0 0 18px rgba(255, 79, 216, 0.6),
    0 0 32px rgba(255, 79, 216, 0.28),
    inset 0 0 12px rgba(255, 79, 216, 0.28);
}

.difficulty-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(3, auto);
  gap: 8px;
  width: min(92vw, 300px);
}

.diff-btn {
  min-height: 44px;
  padding: 10px 8px;
  border: 1.5px solid rgba(255, 79, 216, 0.55);
  border-radius: 12px;
  background: rgba(16, 2, 28, 0.55);
  color: #ffc8ef;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-shadow: 0 0 8px rgba(255, 79, 216, 0.45);
  box-shadow:
    0 0 10px rgba(255, 79, 216, 0.2),
    inset 0 0 8px rgba(255, 79, 216, 0.1);
  touch-action: manipulation;
  cursor: pointer;
}

.diff-btn.is-active {
  color: #fff;
  border-color: rgba(255, 200, 240, 0.9);
  background: rgba(255, 79, 216, 0.28);
  box-shadow:
    0 0 18px rgba(255, 79, 216, 0.55),
    0 0 32px rgba(255, 79, 216, 0.25),
    inset 0 0 12px rgba(255, 79, 216, 0.25);
}

.diff-btn[data-diff="expert"].is-active {
  border-color: rgba(126, 249, 255, 0.85);
  background: rgba(126, 249, 255, 0.18);
  box-shadow:
    0 0 18px rgba(126, 249, 255, 0.45),
    0 0 32px rgba(126, 249, 255, 0.2),
    inset 0 0 12px rgba(126, 249, 255, 0.18);
}

.diff-btn[data-diff="insane"].is-active {
  background: linear-gradient(135deg, rgba(255, 79, 216, 0.35), rgba(126, 249, 255, 0.2));
}

.diff-btn--miu.is-active,
.diff-btn[data-diff="miu"].is-active {
  color: #fff;
  border-color: rgba(255, 220, 255, 0.95);
  background: linear-gradient(135deg, rgba(255, 79, 216, 0.45), rgba(255, 180, 80, 0.28), rgba(126, 249, 255, 0.28));
  box-shadow:
    0 0 22px rgba(255, 79, 216, 0.65),
    0 0 36px rgba(255, 200, 80, 0.35),
    0 0 48px rgba(126, 249, 255, 0.28),
    inset 0 0 14px rgba(255, 79, 216, 0.28);
  text-shadow:
    0 0 10px rgba(255, 79, 216, 0.9),
    0 0 18px rgba(255, 200, 120, 0.55);
}

.diff-btn:active {
  transform: scale(0.97);
}

/* ----- HUD：スコア + NEXT ----- */
.hud {
  width: 100%;
  max-width: var(--board-max-w, 320px);
  flex-shrink: 0;
  padding: 2px 0 6px;
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.diff-badge {
  flex-shrink: 0;
  width: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 6px;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 200, 230, 0.5);
  background: var(--lux-glass);
  box-shadow: var(--lux-neon-sm), var(--lux-glass-shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.diff-badge-label {
  font-size: 0.42rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #ffa6e8;
  text-shadow: 0 0 8px rgba(255, 79, 216, 0.6);
}

.diff-badge-value {
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #f7eeff;
  text-align: center;
  line-height: 1.1;
  text-shadow: 0 0 10px rgba(255, 79, 216, 0.8);
}

.diff-badge-value[data-mode="insane"] {
  background: linear-gradient(90deg, #ff4fd8, #7ef9ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.diff-badge-value[data-mode="miu"] {
  background: linear-gradient(90deg, #ff4fd8, #ffd060, #7ef9ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 6px rgba(255, 79, 216, 0.75));
}

.diff-badge--pulse {
  animation: speed-badge-pulse 0.48s ease-out;
}

.speed-badge {
  flex-shrink: 0;
  width: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 6px;
  border-radius: 14px;
  border: 1.5px solid rgba(126, 249, 255, 0.45);
  background: var(--lux-glass);
  box-shadow:
    0 0 12px rgba(126, 249, 255, 0.22),
    var(--lux-glass-shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.speed-badge-label {
  font-size: 0.42rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #9ef8ff;
  text-shadow: 0 0 8px rgba(126, 249, 255, 0.65);
}

.speed-badge-value {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #e8fcff;
  text-align: center;
  line-height: 1.1;
  text-shadow: 0 0 10px rgba(126, 249, 255, 0.75);
}

.speed-badge--pulse {
  animation: speed-badge-pulse 0.48s ease-out;
}

@keyframes speed-badge-pulse {
  0% {
    transform: scale(1);
    box-shadow:
      0 0 12px rgba(126, 249, 255, 0.22),
      var(--lux-glass-shadow);
  }
  45% {
    transform: scale(1.07);
    border-color: rgba(255, 200, 255, 0.85);
    box-shadow:
      0 0 22px rgba(126, 249, 255, 0.55),
      0 0 28px rgba(255, 79, 216, 0.35),
      var(--lux-glass-shadow);
  }
  100% {
    transform: scale(1);
  }
}

.stat-card--score {
  flex: 1;
  min-width: 0;
}

.preview-card {
  position: relative;
  flex-shrink: 0;
  width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 8px 6px;
  border-radius: 16px;
  border: 2px solid rgba(255, 200, 230, 0.55);
  background: var(--lux-glass);
  box-shadow: var(--lux-neon-md), var(--lux-glass-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
}

.preview-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 40%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, transparent 100%);
  pointer-events: none;
}

.preview-label {
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #ffa6e8;
  text-shadow: 0 0 8px rgba(255, 79, 216, 0.7);
}

#next-preview {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 88 / 108;
}

.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 12px 20px 14px;
  border-radius: 20px;
  border: 2px solid rgba(255, 200, 230, 0.55);
  background: var(--lux-glass);
  box-shadow: var(--lux-neon-md), var(--lux-glass-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 45%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, transparent 100%);
  pointer-events: none;
}

.stat-crown {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 0.7rem;
  color: #ffb8e8;
  text-shadow: var(--lux-neon-sm);
}

.stat-label {
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: #ffa6e8;
  text-shadow: 0 0 10px rgba(255, 79, 216, 0.7);
}

.stat-value {
  font-size: clamp(1.75rem, 8vw, 2.1rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #f7eeff;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.6),
    0 0 20px rgba(255, 77, 166, 0.9),
    0 0 36px rgba(255, 45, 138, 0.5);
  display: inline-block;
}

.stat-value.score-pop {
  animation: score-pop 0.3s ease-out;
}

.stat-value--final {
  font-size: clamp(2rem, 10vw, 2.5rem);
}

/* ----- ゲーム画面 ----- */
#screen-game {
  position: relative;
  justify-content: flex-start;
  gap: clamp(2px, 0.6vh, 5px);
  padding-top: max(4px, var(--safe-top));
  padding-bottom: max(4px, var(--safe-bottom));
  overflow: hidden;
}

#screen-game::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url("1.jpg") center center / cover no-repeat;
  pointer-events: none;
}

#screen-game::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(8, 0, 16, 0.04) 0%,
    rgba(8, 0, 16, 0.02) 50%,
    rgba(8, 0, 16, 0.14) 100%
  );
}

#screen-game[data-game-level="1"]::before { background-image: url("1.jpg"); }
#screen-game[data-game-level="2"]::before { background-image: url("2.jpg"); }
#screen-game[data-game-level="3"]::before { background-image: url("3.jpg"); }
#screen-game[data-game-level="4"]::before { background-image: url("4.jpg"); }
#screen-game[data-game-level="5"]::before { background-image: url("5.jpg"); }

#screen-game .hud,
#screen-game .board-wrap,
#screen-game .controls-panel {
  position: relative;
  z-index: 1;
  width: var(--game-layout-w, min(92vw, 320px));
  max-width: min(96vw, 430px);
  margin-inline: auto;
}

body.is-playing .diff-badge,
body.is-playing .speed-badge,
body.is-playing .stat-card,
body.is-playing .preview-card {
  background: rgba(8, 0, 18, 0.52);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

body.is-playing .controls-panel {
  background: linear-gradient(
    to top,
    rgba(10, 0, 18, 0.88) 55%,
    rgba(10, 0, 18, 0.45) 100%
  );
}

.board-wrap {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.board-shell {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 5px;
  flex-shrink: 0;
  height: auto;
}

.board-shell::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 26px;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 77, 166, 0.22) 0%, transparent 60%);
  pointer-events: none;
}

.board-frame-outer {
  position: relative;
  padding: 3px;
  border-radius: 22px;
  background: linear-gradient(
    180deg,
    rgba(255, 240, 250, 0.9) 0%,
    rgba(255, 77, 166, 0.7) 50%,
    rgba(255, 45, 138, 0.65) 100%
  );
  box-shadow: var(--lux-neon-lg);
}

.board-frame {
  position: relative;
  padding: 10px;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  background: linear-gradient(
    160deg,
    rgba(255, 230, 248, 0.75) 0%,
    rgba(255, 100, 180, 0.55) 30%,
    rgba(255, 45, 138, 0.5) 60%,
    rgba(255, 180, 220, 0.6) 100%
  );
  box-shadow:
    inset 0 0 30px rgba(255, 77, 166, 0.25),
    inset 0 2px 0 rgba(255, 255, 255, 0.6);
}

.frame-top-neon {
  position: absolute;
  top: 5px;
  left: 12%;
  right: 12%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #fff, #ffb8e8, #fff, transparent);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.9), 0 0 24px rgba(255, 77, 166, 0.8);
  z-index: 6;
  pointer-events: none;
}

.frame-crest {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #ffb8e8;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.35), rgba(255, 77, 166, 0.25));
  border: 2px solid rgba(255, 230, 248, 0.85);
  border-radius: 50%;
  box-shadow: var(--lux-neon-md);
  z-index: 7;
  pointer-events: none;
}

.frame-heart-side {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  color: #ffb8e8;
  text-shadow: var(--lux-neon-sm);
  z-index: 5;
  pointer-events: none;
}

.frame-heart-side--l {
  left: -8px;
}

.frame-heart-side--r {
  right: -8px;
}

.board-frame-inner {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(8, 0, 16, 0.16);
  box-shadow:
    inset 0 0 50px rgba(255, 77, 166, 0.15),
    inset 0 0 80px rgba(255, 45, 138, 0.08);
}

.board-frame-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 120, 200, 0.35);
  box-shadow: inset 0 0 40px rgba(255, 77, 166, 0.12);
  pointer-events: none;
  z-index: 3;
}

.board-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 6 / 12;
  height: auto;
  flex-shrink: 0;
  overflow: hidden;
}

.board-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#board-bg {
  z-index: 0;
}

#board {
  z-index: 1;
  background: transparent;
}

/* ----- 連鎖バナー ----- */
.chain-banner {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
}

.chain-banner--show {
  opacity: 1;
}

.chain-banner__flash {
  position: absolute;
  inset: -8%;
  border-radius: 12px;
  background: radial-gradient(
    ellipse 85% 75% at 50% 50%,
    rgba(255, 100, 210, 0.55) 0%,
    rgba(255, 45, 160, 0.22) 45%,
    transparent 72%
  );
  opacity: 0;
  transform: scale(0.6);
}

.chain-banner__burst {
  position: absolute;
  width: 92%;
  max-width: 320px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 140, 230, 0.55) 0%,
    rgba(255, 60, 180, 0.35) 35%,
    transparent 68%
  );
  box-shadow:
    0 0 40px rgba(255, 77, 166, 0.7),
    0 0 80px rgba(255, 45, 138, 0.45);
  transform: scale(0.15);
  opacity: 0;
}

.chain-banner__ring {
  position: absolute;
  width: 78%;
  max-width: 280px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid rgba(255, 180, 240, 0.85);
  box-shadow:
    0 0 20px rgba(255, 77, 166, 0.9),
    inset 0 0 24px rgba(255, 120, 220, 0.35);
  transform: scale(0.3);
  opacity: 0;
}

.chain-banner__text {
  position: relative;
  z-index: 2;
  margin: 0;
  font-weight: 900;
  font-style: italic;
  text-align: center;
  line-height: 0.95;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transform: scale(0.2);
  opacity: 0;
  color: #fff;
  text-shadow:
    0 0 12px #fff,
    0 0 28px rgba(255, 77, 166, 1),
    0 0 56px rgba(255, 45, 160, 0.95),
    0 0 90px rgba(255, 30, 140, 0.65);
  -webkit-text-stroke: 1.5px rgba(255, 200, 245, 0.45);
}

.chain-banner--show .chain-banner__text {
  animation: chain-text-pop 1.38s cubic-bezier(0.18, 1, 0.32, 1) forwards;
}

.chain-banner--show .chain-banner__burst {
  animation: chain-burst 1.38s ease-out forwards;
}

.chain-banner--show .chain-banner__ring {
  animation: chain-ring 1.38s ease-out forwards;
}

.chain-banner--show .chain-banner__flash {
  animation: chain-flash 1.38s ease-out forwards;
}

@keyframes chain-text-pop {
  0% {
    transform: scale(0.2);
    opacity: 0;
  }
  14% {
    transform: scale(1.28);
    opacity: 1;
  }
  32% {
    transform: scale(1.05);
    opacity: 1;
  }
  58% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(0.92);
    opacity: 0;
  }
}

@keyframes chain-burst {
  0% {
    transform: scale(0.15);
    opacity: 0;
  }
  18% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1.65);
    opacity: 0;
  }
}

@keyframes chain-ring {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  20% {
    transform: scale(1.05);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.55);
    opacity: 0;
  }
}

@keyframes chain-flash {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  12% {
    transform: scale(1.05);
    opacity: 0.95;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

.chain-tier-2 .chain-banner__text {
  font-size: clamp(2rem, 12vw, 3rem);
}

.chain-tier-3 .chain-banner__text {
  font-size: clamp(2.35rem, 13.5vw, 3.4rem);
  text-shadow:
    0 0 14px #fff,
    0 0 36px rgba(255, 77, 166, 1),
    0 0 64px rgba(255, 45, 160, 1),
    0 0 100px rgba(126, 249, 255, 0.55);
}

.chain-tier-4 .chain-banner__text {
  font-size: clamp(2.65rem, 14.5vw, 3.75rem);
  background: linear-gradient(180deg, #fff 0%, #ffc8f0 35%, #ff4fd8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter:
    drop-shadow(0 0 14px rgba(255, 77, 166, 1))
    drop-shadow(0 0 32px rgba(255, 45, 160, 0.95))
    drop-shadow(0 0 48px rgba(126, 249, 255, 0.7));
}

.chain-banner--show.chain-tier-fever .chain-banner__text {
  font-size: clamp(2.1rem, 12.5vw, 3.2rem);
  letter-spacing: 0.03em;
  background: linear-gradient(90deg, #fff 0%, #7ef9ff 30%, #ff4fd8 65%, #fff 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter:
    drop-shadow(0 0 18px rgba(255, 77, 166, 1))
    drop-shadow(0 0 40px rgba(126, 249, 255, 0.95))
    drop-shadow(0 0 64px rgba(255, 45, 160, 0.85));
  animation: chain-text-pop 1.38s cubic-bezier(0.18, 1, 0.32, 1) forwards,
    fever-shimmer 0.45s ease-in-out 3 alternate;
}

.chain-tier-fever .chain-banner__burst {
  width: 98%;
  background: radial-gradient(
    circle,
    rgba(126, 249, 255, 0.5) 0%,
    rgba(255, 77, 166, 0.4) 38%,
    transparent 70%
  );
  box-shadow:
    0 0 50px rgba(126, 249, 255, 0.65),
    0 0 90px rgba(255, 77, 166, 0.55);
}

.chain-tier-fever .chain-banner__flash {
  background: radial-gradient(
    ellipse 90% 80% at 50% 50%,
    rgba(126, 249, 255, 0.35) 0%,
    rgba(255, 100, 210, 0.45) 40%,
    transparent 75%
  );
}

.chain-tier-levelup .chain-banner__text {
  font-size: clamp(1.6rem, 9vw, 2.4rem);
  letter-spacing: 0.06em;
  background: linear-gradient(90deg, #ffd060 0%, #fff 40%, #7ef9ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter:
    drop-shadow(0 0 12px rgba(255, 208, 96, 0.95))
    drop-shadow(0 0 28px rgba(126, 249, 255, 0.75));
}

.chain-tier-levelup .chain-banner__burst {
  width: 88%;
  background: radial-gradient(
    circle,
    rgba(255, 208, 96, 0.45) 0%,
    rgba(126, 249, 255, 0.35) 42%,
    transparent 72%
  );
}

.board-stage.chain-shake {
  animation: chain-stage-shake 0.42s ease-out;
}

@keyframes chain-stage-shake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-3px, 2px);
  }
  40% {
    transform: translate(3px, -2px);
  }
  60% {
    transform: translate(-2px, -1px);
  }
  80% {
    transform: translate(2px, 1px);
  }
}

@keyframes fever-shimmer {
  from {
    background-position: 0% center;
  }
  to {
    background-position: 100% center;
  }
}

body.is-playing .board-shell {
  filter: drop-shadow(0 0 20px rgba(255, 77, 166, 0.2));
  background: transparent;
}

body.is-playing .board-shell::before {
  opacity: 0;
}

body.is-playing .board-frame-outer {
  padding: 2px;
  background: linear-gradient(
    180deg,
    rgba(255, 220, 245, 0.95) 0%,
    rgba(255, 79, 216, 0.88) 48%,
    rgba(255, 45, 138, 0.82) 100%
  );
}

body.is-playing .board-frame {
  padding: 4px;
  border-width: 2px;
  border-color: rgba(255, 210, 240, 0.78);
  background: transparent;
  box-shadow: none;
}

body.is-playing .board-frame-inner {
  background: transparent;
  box-shadow: none;
}

body.is-playing .board-frame-inner::before {
  border-color: rgba(255, 130, 210, 0.35);
  box-shadow: inset 0 0 12px rgba(255, 77, 166, 0.08);
}

body.is-playing .board-stage {
  background: url("1.jpg") center center / cover no-repeat;
}

body.is-playing #screen-game[data-game-level="1"] .board-stage { background-image: url("1.jpg"); }
body.is-playing #screen-game[data-game-level="2"] .board-stage { background-image: url("2.jpg"); }
body.is-playing #screen-game[data-game-level="3"] .board-stage { background-image: url("3.jpg"); }
body.is-playing #screen-game[data-game-level="4"] .board-stage { background-image: url("4.jpg"); }
body.is-playing #screen-game[data-game-level="5"] .board-stage { background-image: url("5.jpg"); }

body.is-playing .board-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(36, 8, 30, 0.22);
}

body.is-playing #board-bg,
body.is-playing #board {
  background: transparent !important;
}

body.is-playing .board-stage canvas {
  z-index: 1;
}

@keyframes combo-shell-flash {
  0% {
    filter: drop-shadow(0 0 28px rgba(255, 77, 166, 0.55));
  }
  100% {
    filter: drop-shadow(0 0 20px rgba(255, 77, 166, 0.2));
  }
}

.board-shell.board-combo-pulse {
  animation: combo-shell-flash 0.55s ease-out;
}

.board-shell.board-combo-pulse--hot {
  animation: combo-shell-flash-hot 0.6s ease-out;
}

@keyframes combo-shell-flash-hot {
  0% {
    filter: drop-shadow(0 0 42px rgba(255, 77, 166, 0.85))
      drop-shadow(0 0 28px rgba(126, 249, 255, 0.45));
  }
  100% {
    filter: drop-shadow(0 0 20px rgba(255, 77, 166, 0.2));
  }
}

body.is-playing .stat-card--score {
  border-color: rgba(255, 220, 248, 0.65);
}

body.is-playing .controls-panel {
  border-top-color: rgba(255, 79, 216, 0.42);
  box-shadow: 0 -8px 32px rgba(255, 77, 166, 0.12);
}

body.is-playing .ctrl-btn {
  border-color: rgba(255, 120, 220, 0.65);
}

/* ----- ボタン ----- */
.neon-btn {
  padding: 0.55rem 1.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #ffd3f4;
  background: rgba(255, 79, 216, 0.12);
  border: 2px solid var(--neon-pink);
  border-radius: 999px;
  cursor: pointer;
  box-shadow:
    0 0 16px rgba(255, 79, 216, 0.55),
    0 0 32px rgba(255, 79, 216, 0.28),
    inset 0 0 14px rgba(255, 79, 216, 0.18);
  text-shadow: 0 0 10px rgba(255, 79, 216, 0.8);
  touch-action: manipulation;
}

.neon-btn:active {
  background: rgba(255, 79, 216, 0.28);
  transform: scale(0.97);
}

.neon-btn--hero {
  min-width: min(80vw, 240px);
  padding: 0.95rem 2.8rem;
  font-size: clamp(0.95rem, 4.5vw, 1.15rem);
  letter-spacing: 0.16em;
}

.neon-btn--compact {
  flex: 1;
  padding: 0.65rem 0.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
}

.home-btn {
  flex: 1;
  min-height: 2.55rem;
  padding: 0.55rem 0.5rem;
  border: 1px solid rgba(255, 79, 216, 0.75);
  border-radius: 999px;
  background: rgba(10, 0, 18, 0.85);
  color: var(--neon-pink);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-shadow: 0 0 8px rgba(255, 79, 216, 0.65);
  box-shadow:
    0 0 12px rgba(255, 79, 216, 0.28),
    inset 0 0 10px rgba(255, 79, 216, 0.1);
  touch-action: manipulation;
}

.home-btn:active {
  background: rgba(255, 79, 216, 0.22);
  transform: scale(0.97);
}

/* ----- コントロール ----- */
.controls-panel {
  width: 100%;
  max-width: var(--board-max-w, 320px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 2px;
  border-top: 1px solid rgba(255, 79, 216, 0.28);
  background: linear-gradient(
    to top,
    rgba(10, 0, 18, 0.92) 50%,
    rgba(10, 0, 18, 0.55) 85%,
    transparent
  );
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr 1fr;
  gap: 8px;
}

.ctrl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
  min-height: 52px;
  padding: 0.2rem;
  font: inherit;
  color: var(--neon-pink);
  background: rgba(255, 79, 216, 0.1);
  border: 1px solid rgba(255, 79, 216, 0.55);
  border-radius: 12px;
  cursor: pointer;
  box-shadow:
    0 0 12px rgba(255, 79, 216, 0.22),
    inset 0 0 8px rgba(255, 79, 216, 0.14);
  user-select: none;
  touch-action: manipulation;
}

.ctrl-btn--main {
  background: rgba(255, 79, 216, 0.16);
  border-color: var(--neon-pink);
  box-shadow:
    0 0 16px rgba(255, 79, 216, 0.38),
    inset 0 0 10px rgba(255, 79, 216, 0.2);
}

.ctrl-btn--hard {
  width: min(88%, 280px);
  align-self: center;
  min-height: 68px;
  padding: 0.7rem 1.25rem;
  flex-direction: row;
  gap: 0.65rem;
  border-width: 2px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 79, 216, 0.32), rgba(126, 249, 255, 0.22));
  border-color: rgba(200, 240, 255, 0.9);
  box-shadow:
    0 0 22px rgba(126, 249, 255, 0.45),
    0 0 36px rgba(255, 79, 216, 0.32),
    inset 0 0 16px rgba(255, 79, 216, 0.22);
}

.ctrl-btn--hard .ctrl-icon {
  font-size: 1.85rem;
  color: #c8f8ff;
  text-shadow: 0 0 12px rgba(126, 249, 255, 0.9);
}

.ctrl-btn--hard .ctrl-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #ffe8f8;
}

.ctrl-btn--hard:active {
  background: linear-gradient(135deg, rgba(255, 79, 216, 0.38), rgba(126, 249, 255, 0.22));
}

.ctrl-icon {
  font-size: 1.15rem;
  line-height: 1;
  text-shadow: 0 0 8px rgba(255, 79, 216, 0.65);
}

.ctrl-label {
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  color: var(--neon-pink-dim);
  text-shadow: 0 0 6px rgba(255, 79, 216, 0.45);
}

.ctrl-btn:active {
  background: rgba(255, 79, 216, 0.32);
  box-shadow: 0 0 18px rgba(255, 79, 216, 0.55);
  transform: scale(0.97);
}

.action-bar {
  display: flex;
  gap: 8px;
}

/* ----- GAME OVER ----- */
#screen-over {
  justify-content: center;
}

.game-over-panel {
  width: min(92vw, 320px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 0.95rem 1.1rem;
  border: 2px solid rgba(255, 200, 230, 0.55);
  border-radius: 22px;
  background: var(--lux-glass);
  box-shadow: var(--lux-neon-lg), var(--lux-glass-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.go-ad {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.go-ad[hidden] {
  display: none;
}

.go-ad__eyebrow {
  margin: 0;
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: rgba(255, 200, 235, 0.88);
  text-shadow: 0 0 10px rgba(255, 79, 216, 0.65);
}

.go-ad__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.65rem 0.75rem 0.7rem;
  border: 1.5px solid rgba(255, 160, 230, 0.75);
  border-radius: 16px;
  background: rgba(8, 0, 18, 0.55);
  box-shadow:
    0 0 16px rgba(255, 79, 216, 0.35),
    inset 0 0 14px rgba(255, 79, 216, 0.1);
  text-decoration: none;
  color: inherit;
  touch-action: manipulation;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.go-ad__card:active {
  transform: scale(0.98);
  box-shadow:
    0 0 22px rgba(255, 79, 216, 0.5),
    inset 0 0 16px rgba(255, 79, 216, 0.16);
}

.go-ad__jacket-wrap {
  display: block;
  padding: 3px;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    rgba(255, 180, 240, 0.9),
    rgba(126, 249, 255, 0.55)
  );
  box-shadow: 0 0 14px rgba(255, 79, 216, 0.45);
}

.go-ad__jacket {
  display: block;
  width: min(42vw, 120px);
  height: min(42vw, 120px);
  object-fit: cover;
  border-radius: 11px;
  background: rgba(8, 0, 16, 0.4);
}

.go-ad__title {
  font-size: clamp(0.72rem, 3.6vw, 0.82rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
  color: #ffe8f8;
  text-shadow:
    0 0 10px rgba(255, 79, 216, 0.75),
    0 0 18px rgba(255, 45, 138, 0.35);
  line-height: 1.35;
}

.go-ad__cta {
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #1ed760;
  text-shadow: 0 0 10px rgba(30, 215, 96, 0.55);
}

.overlay-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--neon-pink);
  text-shadow: 0 0 14px rgba(255, 79, 216, 0.85);
}

.stat-card--final {
  width: 100%;
  padding: 14px 16px;
}

.game-over-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.game-over-actions .neon-btn,
.game-over-actions .home-btn {
  width: 100%;
  min-height: 2.55rem;
}

/* 縦が狭い端末：HUD・操作をコンパクトに */
@media (max-height: 740px) {
  #screen-home {
    justify-content: flex-end;
    gap: 0;
    padding-top: max(6px, var(--safe-top));
  }

  #screen-home .home-ui {
    padding-top: 0.5rem;
    gap: 0.32rem;
  }

  #screen-home .logo-panel {
    padding: 4px 10px 5px;
  }

  #screen-home .logo,
  body.is-home #screen-home .logo {
    font-size: clamp(1rem, 5.5vw, 1.3rem);
  }

  #screen-home .tagline {
    font-size: 0.44rem;
    letter-spacing: 0.2em;
    padding-left: 0.2em;
    margin-top: 0.18rem;
  }

  #screen-home .level-btn {
    min-height: 34px;
    font-size: 0.76rem;
  }

  .logo-panel {
    padding: 14px 26px 16px;
  }

  .hud {
    padding: 0 0 4px;
    gap: 5px;
  }

  .diff-badge {
    width: 52px;
    padding: 6px 4px;
  }

  .speed-badge {
    width: 52px;
    padding: 6px 4px;
  }

  .stat-card {
    padding: 8px 14px 10px;
  }

  .stat-value {
    font-size: clamp(1.45rem, 7vw, 1.85rem);
  }

  .preview-card {
    width: 68px;
    padding: 6px 6px 4px;
  }

  .board-frame {
    padding: 7px;
  }

  .board-shell {
    padding: 4px;
  }

  .ctrl-btn {
    min-height: 46px;
  }
}

@media (max-height: 660px) {
  .stat-card {
    padding: 6px 12px 8px;
  }

  .stat-value {
    font-size: clamp(1.3rem, 6.5vw, 1.6rem);
  }

  .preview-card {
    width: 62px;
  }

  #next-preview {
    max-height: 72px;
    object-fit: contain;
  }

  .controls {
    gap: 6px;
  }

  .ctrl-btn {
    min-height: 42px;
  }

  .ctrl-icon {
    font-size: 1rem;
  }

  .neon-btn--compact,
  .home-btn {
    min-height: 2.35rem;
    padding: 0.45rem 0.4rem;
    font-size: 0.62rem;
  }
}

/* スマホ：テトリス風サイズ（盤面中央・HUD/操作は全幅） */
@media (max-width: 480px) {
  #app {
    max-width: none;
  }

  .screen {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  #screen-home {
    padding-left: max(10px, env(safe-area-inset-left, 0px));
    padding-right: max(10px, env(safe-area-inset-right, 0px));
  }

  #screen-game.active {
    align-items: stretch;
    gap: 0;
    padding-top: max(1px, var(--safe-top));
    padding-bottom: max(1px, var(--safe-bottom));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  #screen-game .hud,
  #screen-game .controls-panel {
    width: 100%;
    max-width: none;
    margin-inline: 0;
    flex-shrink: 0;
  }

  #screen-game .board-wrap {
    width: 100%;
    max-width: none;
    margin-inline: 0;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .board-shell {
    width: var(--game-layout-w, 100%);
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    padding: 0;
  }

  .board-frame-outer {
    padding: 1px;
    border-radius: 10px;
  }

  .board-frame {
    padding: 2px;
    border-radius: 8px;
  }

  .frame-crest,
  .frame-heart-side {
    display: none;
  }

  .board-stage {
    width: 100%;
    height: auto;
    aspect-ratio: 6 / 12;
  }

  .hud {
    padding: 0 1px 0;
    gap: 1px;
  }

  .diff-badge,
  .speed-badge {
    width: auto;
    min-width: 30px;
    flex: 0 1 auto;
    padding: 1px 2px;
    border-radius: 7px;
  }

  .diff-badge-label,
  .speed-badge-label {
    font-size: 0.32rem;
    letter-spacing: 0.05em;
  }

  .diff-badge-value {
    font-size: 0.4rem;
  }

  .speed-badge-value {
    font-size: 0.42rem;
  }

  .stat-card {
    padding: 2px 5px 3px;
    border-radius: 8px;
  }

  .stat-label {
    font-size: 0.34rem;
  }

  .stat-value {
    font-size: clamp(0.88rem, 5vw, 1.15rem);
    line-height: 1;
  }

  .preview-card {
    width: auto;
    min-width: 32px;
    flex-shrink: 0;
    padding: 1px 2px 0;
    border-radius: 8px;
  }

  .preview-label {
    font-size: 0.32rem;
  }

  #next-preview {
    max-height: 44px;
  }

  .controls-panel {
    padding: 0 2px max(0px, var(--safe-bottom));
    gap: 2px;
  }

  .controls {
    grid-template-columns: 1.15fr 0.95fr 1.15fr 1.15fr;
    gap: 3px;
  }

  .ctrl-btn {
    min-height: 36px;
    border-radius: 8px;
    padding: 0.08rem;
  }

  #btn-left,
  #btn-right,
  #btn-rotate {
    min-height: 38px;
    padding: 0.15rem 0.08rem;
  }

  #btn-left .ctrl-icon,
  #btn-right .ctrl-icon,
  #btn-rotate .ctrl-icon {
    font-size: 1.1rem;
  }

  #btn-left .ctrl-label,
  #btn-right .ctrl-label,
  #btn-rotate .ctrl-label {
    font-size: 0.42rem;
  }

  #btn-down {
    min-height: 36px;
  }

  .ctrl-btn--hard {
    width: min(86%, 260px);
    min-height: 44px;
    padding: 0.35rem 0.85rem;
  }

  .ctrl-btn--hard .ctrl-icon {
    font-size: 1.4rem;
  }

  .ctrl-btn--hard .ctrl-label {
    font-size: 0.66rem;
  }

  .ctrl-icon {
    font-size: 0.88rem;
  }

  .ctrl-label {
    font-size: 0.4rem;
  }

  .action-bar {
    gap: 3px;
  }

  .neon-btn--compact,
  .home-btn {
    min-height: 1.65rem;
    padding-top: 0.28rem;
    padding-bottom: 0.28rem;
    font-size: 0.52rem;
  }

  body.is-playing .board-frame-outer {
    padding: 1px;
  }

  body.is-playing .board-frame {
    padding: 2px;
  }

  body.is-playing .controls-panel {
    background: linear-gradient(
      to top,
      rgba(10, 0, 18, 0.82) 40%,
      rgba(10, 0, 18, 0.35) 100%
    );
  }
}

@media (max-width: 480px) and (max-height: 700px) {
  .hud {
    gap: 2px;
  }

  .diff-badge,
  .speed-badge {
    width: 38px;
    padding: 2px 2px;
  }

  .preview-card {
    width: 44px;
    min-width: 44px;
  }

  #next-preview {
    max-height: 50px;
  }

  .stat-card {
    padding: 3px 6px 4px;
  }

  .stat-value {
    font-size: clamp(0.95rem, 5.5vw, 1.25rem);
  }

  .ctrl-btn {
    min-height: 36px;
  }

  #btn-left,
  #btn-right,
  #btn-rotate {
    min-height: 40px;
  }

  .ctrl-btn--hard {
    min-height: 48px;
    width: min(86%, 260px);
  }

  .neon-btn--compact,
  .home-btn {
    min-height: 1.75rem;
  }
}

@media (min-width: 481px) {
  .board-shell {
    width: 100%;
    max-width: 100%;
  }
}

/* スマホ：装飾抑制 */
@media (max-width: 380px) {
  #screen-home .logo-panel {
    padding: 4px 10px 5px;
    width: min(86vw, 260px);
  }

  #screen-home .level-select,
  #screen-home .neon-btn--settings,
  #screen-home .neon-btn--hero,
  #screen-home .hint {
    width: min(86vw, 260px);
  }

  #screen-home .logo,
  body.is-home #screen-home .logo {
    font-size: clamp(0.95rem, 5.2vw, 1.2rem);
  }

  .frame-crest,
  .frame-heart-side {
    display: none;
  }

  .board-shell::before {
    opacity: 0.6;
  }

  .screen {
    padding-left: 8px;
    padding-right: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stat-value.score-pop,
  .chain-banner--show .chain-banner__text,
  .chain-banner--show .chain-banner__burst,
  .chain-banner--show .chain-banner__ring,
  .chain-banner--show .chain-banner__flash,
  .chain-banner--show.chain-tier-fever .chain-banner__text,
  .board-stage.chain-shake {
    animation: none;
  }

  .chain-banner--show .chain-banner__text {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 380px) {
  .chain-tier-2 .chain-banner__text {
    font-size: clamp(1.85rem, 11.5vw, 2.6rem);
  }

  .chain-tier-3 .chain-banner__text {
    font-size: clamp(2.1rem, 12.5vw, 2.9rem);
  }

  .chain-tier-4 .chain-banner__text {
    font-size: clamp(2.35rem, 13.5vw, 3.2rem);
  }

  .chain-tier-fever .chain-banner__text {
    font-size: clamp(1.95rem, 11.5vw, 2.75rem);
  }
}
