@charset "UTF-8";

:root {
  --theme-primary: #00d2ff;
  --theme-secondary: #163a7a;
  --theme-glow: rgba(0, 210, 255, 0.55);
  --theme-bg-tint: rgba(8, 32, 64, 0.4);
  --theme-accent: #ff8a3d;
  --theme-grid: rgba(0, 210, 255, 0.08);
  --bg: #05070c;
  --well: #0a1018;
  --card: rgba(10, 16, 28, 0.92);
  --ink: #f3fbff;
  --muted: #8ec8d8;
  --accent: var(--theme-accent);
  --neon: var(--theme-primary);
  --neon-dim: var(--theme-glow);
  --border: rgba(0, 210, 255, 0.38);
  --shadow: #020308;
  --grid: #334155;
  --panel: #0c1422;
  --bg-dim: 0.5;
  --bg-blur: 0px;
  --bg-fade: 0.6s;
  --board-bg-blur: 0px;
  --board-bg-opacity: 0.8;
  --window-bg-blur: 0px;
  --window-bg-opacity: 1;
  --board-aspect: 10 / 20;
  --mobile-pad-h: 0px;
  --mobile-hud-h: 0px;
  --page-bg:
    radial-gradient(900px 520px at 28% -8%, var(--theme-bg-tint), transparent 58%),
    radial-gradient(700px 480px at 92% 108%, rgba(255, 138, 61, 0.1), transparent 52%),
    linear-gradient(180deg, #0a101c 0%, var(--bg) 48%, #04060a 100%);
}

html[data-theme="neon-blue"] {
  --theme-primary: #00d2ff;
  --theme-secondary: #163a7a;
  --theme-glow: rgba(0, 210, 255, 0.55);
  --theme-bg-tint: rgba(8, 32, 64, 0.42);
  --theme-accent: #7cf0ff;
  --border: rgba(0, 210, 255, 0.4);
  --muted: #8ec8d8;
  --theme-grid: rgba(0, 210, 255, 0.08);
}

html[data-theme="cyber-pink"] {
  --theme-primary: #ff4fa3;
  --theme-secondary: #c026d3;
  --theme-glow: rgba(255, 79, 163, 0.55);
  --theme-bg-tint: rgba(64, 8, 40, 0.48);
  --theme-accent: #ff7ad9;
  --bg: #12060e;
  --well: #1a0a14;
  --card: rgba(28, 10, 22, 0.92);
  --panel: #1a0c16;
  --border: rgba(255, 79, 163, 0.42);
  --muted: #e8a0c4;
  --ink: #fff5fb;
  --theme-grid: rgba(255, 79, 163, 0.09);
}

html[data-theme="emerald-green"] {
  --theme-primary: #22f0b2;
  --theme-secondary: #059669;
  --theme-glow: rgba(34, 240, 178, 0.52);
  --theme-bg-tint: rgba(6, 48, 36, 0.46);
  --theme-accent: #86efac;
  --bg: #050c0a;
  --well: #071612;
  --card: rgba(8, 22, 18, 0.92);
  --panel: #0a1c16;
  --border: rgba(34, 240, 178, 0.4);
  --muted: #9ad4c0;
  --theme-grid: rgba(34, 240, 178, 0.08);
}

html[data-theme="sunset-orange"] {
  --theme-primary: #ff8a3d;
  --theme-secondary: #c2410c;
  --theme-glow: rgba(255, 138, 61, 0.55);
  --theme-bg-tint: rgba(64, 28, 8, 0.46);
  --theme-accent: #ffd76a;
  --bg: #0c0805;
  --well: #16100a;
  --card: rgba(28, 16, 8, 0.92);
  --panel: #1c140c;
  --border: rgba(255, 138, 61, 0.42);
  --muted: #e0b48a;
  --theme-grid: rgba(255, 138, 61, 0.09);
}

html[data-theme="future-cyber"] {
  --theme-primary: #c084fc;
  --theme-secondary: #7c3aed;
  --theme-glow: rgba(192, 132, 252, 0.55);
  --theme-bg-tint: rgba(40, 12, 64, 0.5);
  --theme-accent: #facc15;
  --bg: #090614;
  --well: #120a1c;
  --card: rgba(18, 10, 32, 0.92);
  --panel: #160e24;
  --border: rgba(192, 132, 252, 0.42);
  --muted: #c4b0e8;
  --ink: #f8f4ff;
  --theme-grid: rgba(192, 132, 252, 0.1);
}

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

html,
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

html {
  padding: 0;
}

body {
  position: relative;
  padding: 6px;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--theme-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--theme-grid) 1px, transparent 1px),
    var(--page-bg);
  background-size: 40px 40px, 40px 40px, cover;
  background-position: center;
  background-repeat: repeat, repeat, no-repeat;
  transition: background-image var(--bg-fade, 0.6s) ease-in-out;
  color: var(--ink);
  font-family: "Malgun Gothic", "Segoe UI", "Noto Sans", "Noto Sans Arabic", "Noto Sans Devanagari", "Noto Sans Bengali", sans-serif;
}

body.modal-open {
  overflow: hidden;
  touch-action: pan-y;
}

body.has-custom-bg {
  background-color: #05070c;
  background-image: none !important;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

body.is-bg-load-failed,
body.is-stock-neon-bg {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--theme-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--theme-grid) 1px, transparent 1px),
    var(--page-bg);
  background-size: 40px 40px, 40px 40px, cover;
  background-position: center;
  background-repeat: repeat, repeat, no-repeat;
}

.scene-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--bg-fade, 0.6s) ease-in-out;
}

body.has-custom-bg .scene-bg {
  opacity: 1;
}

.scene-bg-image {
  position: absolute;
  inset: -28px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(var(--window-bg-blur, var(--bg-blur, 0px)));
  opacity: 0;
  transition: opacity var(--bg-fade, 0.6s) ease-in-out;
}

.scene-bg-image.is-visible {
  opacity: var(--window-bg-opacity, 1);
}

.scene-bg-dim {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 12, var(--bg-dim));
}

.scene-bg-extreme {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(120, 70, 255, 0.16), transparent 58%),
    linear-gradient(180deg, rgba(4, 0, 18, 0.12), rgba(0, 0, 0, 0.38));
  box-shadow: inset 0 0 70px rgba(46, 230, 255, 0.18);
  transition: opacity 0.45s ease;
}

body.is-extreme-level .scene-bg-extreme {
  opacity: 1;
  animation: extremePulse 1.35s ease-in-out infinite;
}

@keyframes extremePulse {
  0%, 100% {
    box-shadow: inset 0 0 48px rgba(46, 230, 255, 0.2), 0 0 24px rgba(168, 85, 255, 0.18);
  }
  50% {
    box-shadow: inset 0 0 92px rgba(120, 80, 255, 0.42), 0 0 40px rgba(46, 230, 255, 0.32);
  }
}

body.is-extreme-level .board-wrap {
  box-shadow: 0 0 28px rgba(46, 230, 255, 0.42), 0 0 48px rgba(168, 85, 255, 0.28);
}

.app,
.game-container,
#game-container {
  position: relative;
  z-index: 1;
  width: auto !important;
  max-width: 1080px !important;
  height: 100% !important;
  max-height: calc(100vh - 12px) !important;
  max-height: calc(100dvh - 12px) !important;
  min-height: 0 !important;
  margin: 0 auto;
  display: flex !important;
  flex-direction: row !important;
  justify-content: center !important;
  align-items: stretch !important;
  gap: 16px !important;
  padding: 0;
  box-sizing: border-box;
  touch-action: manipulation;
  overscroll-behavior: none;
}

.stage,
.game-layout {
  display: flex !important;
  flex-direction: row !important;
  justify-content: center !important;
  align-items: stretch !important;
  gap: 16px !important;
  width: auto;
  max-width: 100%;
  height: 100% !important;
  max-height: none;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
}

.board-wrap,
#board-wrap,
.game-board-container,
#board-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 0 !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: var(--board-aspect, 10 / 20) !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  order: 1;
  overflow: hidden;
  will-change: transform;
  transform-style: preserve-3d;
}

#tetris-board-wrapper::before,
#tetris-board-wrapper::after,
#board-wrapper::before,
#board-wrapper::after,
#board-canvas-wrapper::before,
#board-canvas-wrapper::after,
.board-container::before,
.board-container::after,
.game-board-container::before,
.game-board-container::after,
#board-wrap::before,
.board-wrap::before,
.board-canvas-stack::before,
.board-canvas-stack::after {
  content: none !important;
  display: none !important;
}

.board-wrap:not([class*="-flash"])::after,
#board-wrap:not([class*="-flash"])::after {
  content: none !important;
}

.board-level-watermark,
#board-level-watermark,
.level-watermark,
#level-watermark,
.board-wrap .level-stamp,
#bg-canvas + .level-watermark {
  display: none !important;
  content: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.board-wrap.has-board-bg #bg-canvas,
.board-wrap.has-board-bg .board-bg-canvas {
  background: transparent !important;
  background-image: none !important;
}

.board-bg {
  position: absolute;
  inset: 2px;
  z-index: 0;
  border-radius: 8px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--bg-fade, 0.6s) ease-in-out;
}

.board-wrap.has-board-bg .board-bg {
  opacity: 1;
}

.board-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: var(--level-bg-overlay, transparent);
  transition: background var(--bg-fade, 0.6s) ease-in-out;
}

.board-wrap[data-play-level] {
  box-shadow: 0 0 28px var(--level-bg-glow, rgba(0, 210, 255, 0.42)), 0 0 48px rgba(168, 85, 255, 0.18);
}

.board-bg-image {
  position: absolute;
  inset: -24px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(var(--board-bg-blur, 0px));
  opacity: 0;
  transition: opacity var(--bg-fade, 0.6s) ease-in-out;
}

.board-bg-image.is-visible {
  opacity: var(--board-bg-opacity, 0.8);
}

.board-wrap.has-board-bg #board,
.board-wrap.has-board-bg #tetris-canvas,
.board-wrap.has-board-bg .game-canvas,
.board-wrap.has-board-bg .board-canvas-stack,
.board-wrap.has-board-bg #tetris-board-wrapper {
  background: transparent;
  background-image: none;
}

@keyframes screen-shake {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  12% { transform: translate3d(-7px, 4px, 6px) rotate(-0.7deg); }
  24% { transform: translate3d(8px, -5px, 4px) rotate(0.8deg); }
  36% { transform: translate3d(-5px, -3px, 8px) rotate(-0.45deg); }
  48% { transform: translate3d(6px, 5px, 3px) rotate(0.55deg); }
  60% { transform: translate3d(-4px, 2px, 5px) rotate(-0.3deg); }
  76% { transform: translate3d(3px, -2px, 2px) rotate(0.2deg); }
}

@keyframes screen-shake-soft {
  0%, 100% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(-2px, 1px, 0); }
  50% { transform: translate3d(2px, -1px, 0); }
  75% { transform: translate3d(-1px, 1px, 0); }
}

@keyframes neon-zoom-flash {
  0% { transform: scale(1); filter: brightness(1); }
  40% { transform: scale(1.045); filter: brightness(1.7) saturate(1.25); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes ultra-flash-veil {
  0% { opacity: 0.92; }
  100% { opacity: 0; }
}

.board-wrap.screen-shake,
.app.screen-shake {
  animation: screen-shake 0.3s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.board-wrap.screen-shake-soft {
  animation: screen-shake-soft 0.18s ease-out both;
}

.board-wrap.is-ultra-flash,
.board-wrap.is-ultra-flash.screen-shake,
.board-wrap.is-ultra-flash.screen-shake-soft {
  animation: neon-zoom-flash 0.15s ease-out, screen-shake 0.15s ease-out;
}

.board-wrap.is-tetris-flash,
.board-wrap.is-triple-flash,
.board-wrap.is-tspin-flash,
.board-wrap.is-combo-flash,
.board-wrap.is-dad-snap-flash,
.board-wrap.is-ultra-flash {
  z-index: 3;
}

.board-wrap.is-tetris-flash::after,
.board-wrap.is-triple-flash::after,
.board-wrap.is-tspin-flash::after,
.board-wrap.is-combo-flash::after,
.board-wrap.is-dad-snap-flash::after,
.board-wrap.is-ultra-flash::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 8px;
  pointer-events: none;
  z-index: 4;
}

.board-wrap.is-ultra-flash::after {
  animation: ultra-flash-veil 0.15s ease-out forwards;
  background: radial-gradient(circle at 50% 42%, rgba(255, 247, 176, 0.55), rgba(0, 240, 255, 0.22) 55%, transparent 78%);
  box-shadow: inset 0 0 28px rgba(0, 240, 255, 0.55), 0 0 22px rgba(255, 215, 106, 0.45);
}

.board-wrap.screen-shake,
.app.screen-shake {
  animation: screen-shake 0.3s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.board-wrap.screen-shake-soft {
  animation: screen-shake-soft 0.18s ease-out both;
}

.board-wrap.is-tetris-flash,
.board-wrap.is-triple-flash,
.board-wrap.is-dad-snap-flash {
  z-index: 3;
}

.board-wrap.is-tetris-flash::after,
.board-wrap.is-triple-flash::after,
.board-wrap.is-dad-snap-flash::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 8px;
  pointer-events: none;
  z-index: 4;
}

.board-wrap.is-tetris-flash::after {
  box-shadow:
    0 0 28px rgba(46, 230, 255, 0.9),
    0 0 64px rgba(255, 255, 255, 0.35),
    inset 0 0 48px rgba(46, 230, 255, 0.28);
  background: radial-gradient(circle at 50% 48%, rgba(46, 230, 255, 0.28), transparent 62%);
  animation: tetrisFlash 0.5s ease-out;
}

.board-wrap.is-triple-flash::after {
  box-shadow:
    0 0 22px rgba(255, 214, 80, 0.7),
    inset 0 0 36px rgba(255, 214, 80, 0.18);
  background: radial-gradient(circle at 50% 48%, rgba(255, 214, 80, 0.2), transparent 62%);
  animation: tetrisFlash 0.38s ease-out;
}

.board-wrap.is-dad-snap-flash::after {
  box-shadow:
    0 0 24px rgba(255, 214, 80, 0.78),
    0 0 48px rgba(255, 214, 80, 0.28),
    inset 0 0 32px rgba(255, 214, 80, 0.16);
  background: radial-gradient(circle at 50% 48%, rgba(255, 214, 80, 0.22), transparent 64%);
  animation: tetrisFlash 0.42s ease-out;
}

.board-wrap.is-ultra-flash.is-tetris-flash::after {
  animation: ultra-flash-veil 0.15s ease-out forwards;
  background: radial-gradient(circle at 50% 42%, rgba(180, 255, 255, 0.62), rgba(0, 240, 255, 0.28) 52%, transparent 78%);
  box-shadow: inset 0 0 32px rgba(0, 240, 255, 0.7), 0 0 26px rgba(46, 230, 255, 0.55);
}

.board-wrap.is-ultra-flash.is-tspin-flash::after {
  animation: ultra-flash-veil 0.15s ease-out forwards;
  background: radial-gradient(circle at 50% 42%, rgba(232, 186, 255, 0.62), rgba(196, 77, 255, 0.3) 52%, transparent 78%);
  box-shadow: inset 0 0 32px rgba(196, 77, 255, 0.7), 0 0 26px rgba(255, 120, 255, 0.5);
}

.board-wrap.is-ultra-flash.is-combo-flash::after {
  animation: ultra-flash-veil 0.15s ease-out forwards;
  background: radial-gradient(circle at 50% 42%, rgba(255, 230, 160, 0.68), rgba(255, 120, 40, 0.28) 52%, transparent 78%);
  box-shadow: inset 0 0 32px rgba(255, 180, 40, 0.7), 0 0 26px rgba(255, 80, 40, 0.5);
}

@keyframes tetrisFlash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.board-canvas-stack,
#tetris-board-wrapper,
#board,
#tetris-canvas,
.game-canvas {
  display: block;
  position: relative;
  z-index: 1;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  max-height: none;
  aspect-ratio: var(--board-aspect, 10 / 20);
  object-fit: contain;
  margin: 0 auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background:
    radial-gradient(ellipse at 50% 36%, var(--theme-bg-tint), transparent 62%),
    var(--well);
  border: 2px solid var(--neon);
  border-radius: 10px;
  box-shadow:
    0 0 18px var(--theme-glow),
    0 0 48px var(--theme-bg-tint),
    inset 0 0 40px rgba(0, 20, 40, 0.45);
  image-rendering: pixelated;
  transition: filter 0.32s ease, box-shadow 0.32s ease;
}

.board-canvas-stack,
#tetris-board-wrapper {
  overflow: hidden;
  box-sizing: border-box;
}

#bg-canvas,
#board,
#tetris-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  max-height: none;
  margin: 0;
  aspect-ratio: auto;
  display: block;
  box-sizing: border-box;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  object-fit: fill;
  image-rendering: pixelated;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#bg-canvas {
  z-index: 1;
  pointer-events: none !important;
  background: transparent;
}

#board,
#tetris-canvas {
  z-index: 2;
  background: transparent !important;
  background-image: none !important;
}

.overlay,
#overlay,
.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: auto !important;
  height: auto !important;
  border-radius: 8px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  overflow: hidden;
  box-sizing: border-box;
}

.overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: rgba(6, 10, 18, 0.16);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
  pointer-events: none;
}

.overlay.is-result::before,
.overlay.is-conquer::before {
  background: rgba(6, 10, 18, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.overlay > * {
  position: relative;
  z-index: 1;
}

.overlay-card,
.start-overlay-card,
#start-overlay {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 14px;
  width: 90% !important;
  max-width: none !important;
  min-height: 0;
  height: auto !important;
  min-width: 0;
  box-sizing: border-box;
  background: rgba(10, 16, 26, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(0, 210, 255, 0.38) !important;
  border-radius: 20px !important;
  padding: 28px 22px 24px !important;
  box-shadow: 0 0 22px rgba(0, 210, 255, 0.22) !important;
}

.overlay.is-start .overlay-card,
.overlay.is-start .start-overlay-card,
.overlay.is-start #start-overlay {
  min-height: 0 !important;
}

.overlay.is-result .overlay-card,
.overlay.is-conquer .overlay-card {
  width: 92% !important;
  max-width: 420px !important;
  min-height: 0 !important;
  padding: 24px 18px !important;
  background: rgba(10, 15, 30, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid var(--theme-glow, #00d2ff) !important;
  border-radius: 22px !important;
  box-shadow: 0 0 36px rgba(0, 210, 255, 0.35) !important;
}

@media (min-width: 769px) {
.overlay:not(.is-result):not(.is-conquer) .overlay-card .profile-frame,
.overlay:not(.is-result):not(.is-conquer) .overlay-card .profile-avatar-container,
.overlay:not(.is-result):not(.is-conquer) .start-overlay-card .profile-frame,
.overlay:not(.is-result):not(.is-conquer) #profile-frame {
  width: min(300px, 82%) !important;
  height: auto !important;
  max-width: 300px !important;
  max-height: 300px !important;
  min-width: 0 !important;
  min-height: unset !important;
  aspect-ratio: 1 / 1 !important;
  flex: 0 0 auto !important;
  margin-bottom: 8px !important;
  box-sizing: border-box !important;
}
}

.overlay:not(.is-result):not(.is-conquer) .overlay-card .profile-frame,
.overlay:not(.is-result):not(.is-conquer) .overlay-card .profile-avatar-container,
.overlay:not(.is-result):not(.is-conquer) .start-overlay-card .profile-frame,
.overlay:not(.is-result):not(.is-conquer) #profile-frame {
  width: min(300px, 82%);
  height: auto;
  max-width: 300px;
  max-height: 300px;
  aspect-ratio: 1 / 1;
}

.brand-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.profile-frame,
.profile-avatar-container,
.profile-crop-area {
  width: 160px;
  height: 160px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  isolation: isolate;
  transform: translateZ(0);
  border: 3px solid var(--neon);
  box-shadow:
    0 0 20px var(--neon),
    0 0 42px var(--theme-glow),
    inset 0 0 16px var(--theme-bg-tint);
  background:
    radial-gradient(circle at 50% 36%, rgba(46, 230, 255, 0.2), transparent 42%),
    radial-gradient(circle at 50% 50%, #0c1824 0%, #05070c 72%);
  touch-action: none;
}

.profile-frame-sidebar {
  width: 44px;
  height: 44px;
  border-width: 2px;
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.45);
}

.profile-frame-sidebar .profile-icon,
#sidebar-profile-frame .profile-icon {
  font-size: 1.15rem;
}

.profile-frame-sidebar .profile-hint-text {
  display: none;
}

.profile-frame-mini,
.profile-crop-area {
  width: 160px;
  height: 160px;
  margin: 0 auto;
}

.profile-preview-wrap {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.profile-tune {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.profile-edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.profile-edit-actions .save-btn,
.profile-edit-actions .ghost-btn {
  min-height: 2.6rem;
}

.profile-pick-row .file-btn {
  width: 100%;
  font-family: inherit;
}

.profile-crop-area,
.profile-preview-box {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.profile-crop-area:active,
.profile-preview-box:active,
.profile-crop-canvas.is-dragging {
  cursor: grabbing;
}

.profile-crop-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-mask-image: radial-gradient(circle closest-side at 50% 50%, #000 99.6%, transparent 100%);
  mask-image: radial-gradient(circle closest-side at 50% 50%, #000 99.6%, transparent 100%);
}

.profile-crop-canvas.hidden {
  z-index: 0;
}

.profile-crop-canvas.is-dragging {
  cursor: grabbing;
}

.profile-image,
.profile-avatar-img {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center center;
  border-radius: 50%;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.profile-hint {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(4, 10, 18, 0.55);
  color: #e8fbff;
  font: inherit;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.profile-hint-text {
  font-size: 0.72rem;
}

.profile-frame:hover .profile-hint,
.profile-frame:focus-within .profile-hint,
.profile-avatar-container:hover .profile-hint {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none) {
  .profile-hint {
    opacity: 1;
    pointer-events: auto;
    background: linear-gradient(180deg, transparent 42%, rgba(4, 10, 18, 0.72) 100%);
    justify-content: flex-end;
    padding-bottom: 8px;
    font-size: 1rem;
  }

  .profile-frame-sidebar .profile-hint {
    padding-bottom: 2px;
    font-size: 0.72rem;
    background: rgba(4, 10, 18, 0.35);
  }
}

.profile-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 2px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, rgba(46, 230, 255, 0.22), transparent 58%),
    radial-gradient(circle at 50% 100%, rgba(255, 138, 61, 0.16), transparent 50%),
    #07141c;
  box-shadow:
    inset 0 0 0 3px rgba(46, 230, 255, 0.55),
    0 0 18px rgba(46, 230, 255, 0.35);
}

.profile-fallback .profile-icon-svg,
.profile-fallback .dad-neon-avatar {
  display: block;
  width: 100px;
  height: 100px;
  color: #7cf0ff;
  filter: drop-shadow(0 0 10px #00f0ff) drop-shadow(0 0 18px rgba(168, 85, 255, 0.55));
  flex-shrink: 0;
}

.profile-fallback .profile-icon-svg + .profile-icon {
  display: none;
}

.profile-frame-sidebar .profile-icon-svg,
#sidebar-profile-frame .profile-icon-svg {
  width: 28px;
  height: 28px;
}

.profile-crop-area .profile-icon-svg {
  width: 90px;
  height: 90px;
}

@media (min-width: 769px) {
.overlay:not(.is-result):not(.is-conquer) .profile-icon-svg,
.overlay:not(.is-result):not(.is-conquer) #profile-frame .profile-icon-svg,
.overlay:not(.is-result):not(.is-conquer) #profile-frame .dad-neon-avatar {
  width: 100px;
  height: 100px;
}
.overlay:not(.is-result):not(.is-conquer) .overlay-card .profile-icon,
.overlay:not(.is-result):not(.is-conquer) .start-overlay-card .profile-icon,
.overlay:not(.is-result):not(.is-conquer) #profile-frame .profile-icon {
  font-size: 90px;
}
}

.overlay-card .profile-icon,
.start-overlay-card .profile-icon,
#profile-frame .profile-icon {
  font-size: 90px;
}

.profile-icon {
  font-size: 90px;
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(0, 255, 255, 0.55));
}

#profile-frame .profile-caption,
.profile-crop-area .profile-caption {
  display: none;
}

.profile-caption {
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #00ffff;
  text-shadow: 0 0 12px #00ffff;
}

.overlay.hidden,
.clear-banner.hidden,
.modal.hidden,
.modal[hidden],
.tab-panel.hidden,
.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.modal.hidden,
.modal[hidden],
.custom-modal.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.modal.hidden *,
.modal[hidden] * {
  pointer-events: none !important;
}

#overlay-title,
.overlay-title {
  margin: 0 0 8px;
  max-width: 100%;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  color: #7cf0ff;
  -webkit-text-fill-color: #7cf0ff;
  background-image: none;
  text-shadow: 0 0 10px rgba(0, 210, 255, 0.55), 0 0 22px rgba(0, 210, 255, 0.35);
  filter: none;
}

@media (min-width: 769px) {
#overlay-title,
.overlay-title {
  font-size: 26px !important;
  font-weight: 800 !important;
  letter-spacing: 0.06em !important;
  margin-bottom: 8px !important;
  text-shadow: 0 0 10px rgba(0, 210, 255, 0.55), 0 0 22px rgba(0, 210, 255, 0.35) !important;
}

.overlay:not(.is-result):not(.is-conquer):not(.is-pause) #overlay-title,
.overlay:not(.is-result):not(.is-conquer):not(.is-pause) .overlay-title,
.overlay.is-start #overlay-title,
.overlay.is-start .overlay-title {
  display: none !important;
  font-size: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  visibility: hidden !important;
}
}

.overlay.is-result #overlay-title,
.overlay.is-conquer #overlay-title {
  font-size: 1.1rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.5px !important;
  margin-bottom: 10px !important;
  white-space: nowrap !important;
  word-break: keep-all !important;
}

.overlay-hint,
.guide-capsule {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 6px 8px;
  width: max-content;
  max-width: 100%;
  margin: 0;
  padding: 6px 10px;
  border-radius: 18px;
  border: 1px solid rgba(0, 210, 255, 0.3);
  background: rgba(0, 210, 255, 0.1);
  box-shadow:
    0 0 16px rgba(0, 210, 255, 0.16),
    inset 0 0 10px rgba(0, 210, 255, 0.08);
  color: #d7f4ff;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap !important;
  word-break: keep-all;
}

@media (min-width: 769px) {
.overlay-hint,
.guide-capsule {
  padding: 8px 16px !important;
  border-radius: 18px !important;
  font-size: 0.98rem !important;
}
}

.overlay-hint kbd {
  display: inline-block;
  min-width: 1.55em;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(154, 246, 255, 0.5);
  background: linear-gradient(180deg, rgba(52, 72, 104, 0.98), rgba(14, 22, 40, 0.98));
  color: #9af6ff;
  font: inherit;
  font-size: 0.78em;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.35;
  box-shadow:
    0 2px 0 rgba(4, 8, 16, 0.55),
    0 0 8px rgba(0, 210, 255, 0.28);
}

.overlay-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  gap: 10px;
  margin-top: 6px;
  width: 100%;
}

.overlay-actions.hidden {
  display: none !important;
}

.overlay-restart-btn,
.overlay-quit-btn {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.overlay-restart-btn {
  color: #041018;
  background: linear-gradient(180deg, #7ef0ff, #2ee6ff);
  box-shadow: 0 0 14px rgba(46, 230, 255, 0.28);
}

.overlay-quit-btn {
  color: #ffe8e8;
  background: linear-gradient(180deg, #5a1c24, #3a1016);
  border-color: rgba(255, 90, 90, 0.45);
  box-shadow: 0 0 12px rgba(255, 80, 90, 0.18);
}

.shutdown-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #020308;
  color: #d7f7ff;
  padding: 32px;
  text-align: center;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  font-weight: 700;
}

.shutdown-screen.hidden {
  display: none !important;
}

body.is-game-terminated {
  background: #020308 !important;
  background-image: none !important;
}

body.is-game-terminated .app,
body.is-game-terminated .scene-bg,
body.is-game-terminated .modal,
body.is-game-terminated #mobile-controls {
  display: none !important;
}

.sidebar,
#sidebar-container {
  position: relative;
  z-index: 2;
  width: 350px !important;
  min-width: 330px !important;
  height: 100% !important;
  margin: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  gap: 4px !important;
  overflow: hidden;
  box-sizing: border-box !important;
  flex: 0 0 350px;
  order: 2;
}

.sidebar > *:not(.sidebar-dock),
.sidebar .hud-row,
.sidebar .hud-control-grid,
.sidebar .dad-speed-row,
.sidebar .stat-box,
.sidebar .preview-panel,
.sidebar button,
.sidebar .panel-box {
  flex-shrink: 0;
}

.brand,
.sidebar-header-box,
#game-header,
.sidebar-header-custom {
  flex: 0 0 60px;
  flex-shrink: 0;
  width: 100%;
  height: 60px;
  min-height: 60px;
  max-height: 60px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  box-sizing: border-box;
  overflow: visible !important;
}

#game-header,
.brand.sidebar-header-custom {
  padding: 4px 0 0;
  box-sizing: border-box;
  overflow: visible !important;
}

.brand-top,
.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 100%;
  min-height: 50px;
  box-sizing: border-box;
  padding: 0 4px 0 0;
  margin: 0;
  overflow: visible !important;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(0, 240, 255, 0.4);
}

.header-mini-menu {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
}

.header-mini-menu .header-mini-btn,
.header-mini-menu .settings-open-btn,
.header-mini-menu .btn-guide,
.header-mini-menu .btn-diagnostics,
#header-mini-menu #settings-open,
#header-mini-menu #btn-guide,
#header-mini-menu #btn-diagnostics {
  width: auto;
  min-width: 0;
  max-width: none;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 0 8px;
  margin: 0;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
  text-indent: 0;
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.header-mini-menu .mini-ico {
  display: block;
  font-size: 1.05rem;
  line-height: 1;
  pointer-events: none;
}

#hud-diag-guide-row:empty {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

.header-mini-menu:empty {
  display: none;
}

.brand-heading {
  width: auto;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  overflow: visible !important;
}

#game-header .profile-avatar-container,
#sidebar-profile-frame,
.sidebar-header-custom .profile-avatar-container {
  width: 42px !important;
  height: 42px !important;
  max-width: 42px !important;
  max-height: 42px !important;
  border-width: 2px !important;
  border-color: var(--neon, #00d2ff) !important;
  flex-shrink: 0 !important;
  overflow: hidden;
  box-shadow:
    0 0 10px rgba(46, 230, 255, 0.95),
    0 0 20px rgba(0, 210, 255, 0.7),
    0 0 32px rgba(168, 85, 255, 0.35),
    inset 0 0 8px rgba(46, 230, 255, 0.28) !important;
}

.sidebar-header-custom .header-game-title {
  font-size: 1.68rem !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  letter-spacing: 2px !important;
  white-space: nowrap !important;
  overflow: visible !important;
  flex: 1 1 auto;
  color: #fff !important;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.95),
    0 0 16px rgba(46, 230, 255, 1),
    0 0 32px rgba(0, 210, 255, 0.85),
    0 0 48px rgba(168, 85, 255, 0.45);
}

.brand h1,
.game-main-title {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 0.95;
  text-shadow: 0 0 18px rgba(46, 230, 255, 0.45);
}

.header-util-stack,
.hud-util-stack,
.header-buttons,
.nav-buttons {
  display: flex;
  flex-direction: row;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
  position: static;
  top: auto;
  right: auto;
  left: auto;
  bottom: auto;
  inset: auto;
  margin: 0;
  padding: 0;
  transform: none;
  float: none;
}

.brand-tools {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end !important;
  gap: 4px !important;
  width: auto !important;
  margin-left: 0 !important;
  flex-shrink: 0;
}

.header-divider,
.header-full-divider,
.brand-bar,
.theme-separator,
.title-line,
#profile-separator {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0;
  flex: 0 0 auto;
  align-self: stretch !important;
  box-sizing: border-box;
  height: 2px !important;
  margin: 0 0 6px !important;
  border: none !important;
  border-radius: 999px;
  background: var(--theme-glow, #00d2ff) !important;
  box-shadow: 0 0 8px var(--theme-glow, #00d2ff) !important;
}

.tagline,
.header-sub-text {
  width: 100%;
  text-align: left;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
}

.game-actions,
.hud-control-grid,
#hud-control-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  flex: 0 0 auto;
  flex-shrink: 0;
}

.action-row-main,
.hud-row-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
  flex: 0 0 42px;
  height: 42px;
  min-height: 42px;
}

.hud-row-utility,
.utility-btn-group,
.hud-row-diag,
#hud-diag-guide-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
  flex: 0 0 36px;
  height: 36px;
  min-height: 36px;
}

#hud-diag-guide-row,
#hud-control-grid > .hud-row-utility {
  grid-template-columns: 1fr;
}

.hud-row-autoplay {
  display: flex;
  width: 100%;
  flex: 0 0 36px;
  height: 36px;
  min-height: 36px;
  flex-shrink: 0;
}

.action-row-sub,
.hud-row-sub {
  display: contents;
}

#stats-panel,
.hud-stats-row,
.stats-dashboard,
.top-dashboard {
  display: flex !important;
  flex-direction: column !important;
  grid-template-columns: none !important;
  gap: 0 !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 168px !important;
  min-height: 168px !important;
  max-height: 172px !important;
  box-sizing: border-box !important;
  align-items: stretch !important;
  flex: 0 0 168px !important;
  flex-shrink: 0;
  position: static !important;
  margin: 0 !important;
  float: none !important;
}

#block-guide-row,
.block-guide-row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
  width: 100% !important;
  height: 168px !important;
  min-height: 168px !important;
  max-height: 172px !important;
  flex: 0 0 168px !important;
  margin: 0 !important;
  min-width: 0;
  box-sizing: border-box;
  align-items: stretch;
}

#stats-bar-row,
.stats-bar-row,
#stats-bar-row.stat-grid,
.scoreboard-2x2 {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 1fr 1fr !important;
  gap: 6px !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 118px !important;
  min-height: 118px !important;
  flex: 0 0 118px;
  margin: 0 !important;
  overflow: hidden;
  box-sizing: border-box;
  flex-shrink: 0;
}

.autoplay-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 36px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(0, 240, 255, 0.55);
  border-radius: 8px;
  background: rgba(6, 14, 22, 0.82);
  color: #7cf0ff;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(46, 230, 255, 0.16);
}

.autoplay-btn.is-on {
  background: linear-gradient(90deg, #2ee6ff, #7cf0ff);
  color: #071018;
  box-shadow: 0 0 22px rgba(46, 230, 255, 0.55);
}

.dad-speed-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  flex: 0 0 36px;
  flex-shrink: 0;
}

.dad-speed-row .dad-special-btn {
  min-width: 0;
  height: 100%;
  min-height: 36px;
  padding: 0 6px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dad-speed-row .autoplay-speed-row,
.dad-speed-row .ai-speed-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  grid-column: auto;
  min-width: 0;
  min-height: 36px;
  margin: 0;
  padding: 2px 8px;
  gap: 2px 6px;
  align-content: center;
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: 8px;
  background: rgba(6, 14, 22, 0.72);
}

.utility-btn-group .mobile-pad-toggle,
.utility-btn-group .settings-open-btn,
#hud-diag-guide-row .btn-diagnostics,
#hud-diag-guide-row .btn-guide,
#btn-diagnostics,
#btn-guide {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  justify-content: center;
  align-items: center;
}

.utility-btn-group .mobile-pad-toggle,
.utility-btn-group .settings-open-btn {
  border: 1px solid rgba(46, 230, 255, 0.32);
  background: rgba(8, 16, 28, 0.72);
  color: rgba(220, 244, 255, 0.88);
  text-shadow: none;
  box-shadow: none;
}

.utility-btn-group .mobile-pad-toggle.is-on,
.utility-btn-group .mobile-pad-toggle:hover,
.utility-btn-group .mobile-pad-toggle:focus-visible,
.utility-btn-group .settings-open-btn:hover,
.utility-btn-group .settings-open-btn:focus-visible {
  border-color: #9af6ff;
  color: #fff;
  background: linear-gradient(180deg, rgba(46, 230, 255, 0.38), rgba(10, 36, 52, 0.9));
  box-shadow:
    0 0 18px rgba(46, 230, 255, 0.48),
    inset 0 0 12px rgba(46, 230, 255, 0.18);
  outline: none;
}

.dad-special-btn {
  border: 1px solid rgba(255, 214, 80, 0.55);
  background: linear-gradient(180deg, rgba(64, 42, 12, 0.88), rgba(18, 12, 4, 0.9));
  color: #ffe08a;
  text-shadow: 0 0 10px rgba(255, 214, 80, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 196, 0.16),
    0 0 14px rgba(255, 214, 80, 0.22);
}

.dad-special-btn.is-on {
  border-color: #ffe08a;
  color: #fff6c8;
  background: linear-gradient(180deg, rgba(255, 196, 72, 0.42), rgba(42, 24, 4, 0.92));
  box-shadow:
    0 0 22px rgba(255, 214, 80, 0.7),
    inset 0 0 14px rgba(255, 214, 80, 0.22);
  animation: dadSpecialPulse 1.15s ease-in-out infinite;
}

.dad-special-btn:hover,
.dad-special-btn:focus-visible {
  border-color: #ffe08a;
  outline: none;
  box-shadow: 0 0 20px rgba(255, 214, 80, 0.55);
}

@keyframes dadSpecialPulse {
  0%, 100% { box-shadow: 0 0 16px rgba(255, 214, 80, 0.42), inset 0 0 10px rgba(255, 214, 80, 0.12); }
  50% { box-shadow: 0 0 28px rgba(255, 214, 80, 0.85), inset 0 0 16px rgba(255, 214, 80, 0.28); }
}

.dad-countdown-overlay {
  position: absolute;
  inset: 2px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 8px;
  gap: 0;
  border-radius: 8px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  filter: none;
  pointer-events: none;
}

.dad-count-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 14px 8px;
  border-radius: 16px;
  background: rgba(8, 14, 24, 0.38);
  border: 1px solid rgba(255, 214, 80, 0.55);
  box-shadow:
    0 0 16px rgba(255, 214, 80, 0.28),
    0 0 22px rgba(46, 230, 255, 0.12);
}

.dad-countdown-overlay.hidden {
  display: none;
}

.dad-countdown-label {
  margin: 0;
  padding: 4px 12px;
  border: 1px solid rgba(255, 224, 138, 0.9);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(18, 12, 4, 0.72), rgba(6, 18, 28, 0.72));
  color: #fff6c8;
  font-size: clamp(0.68rem, 1.6vw, 0.88rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow:
    0 0 8px rgba(255, 214, 80, 0.9),
    0 0 12px rgba(46, 230, 255, 0.35);
  box-shadow: 0 0 12px rgba(255, 214, 80, 0.35);
}

.dad-countdown-num {
  display: block;
  font-size: clamp(1.9rem, 6.5vw, 3.1rem);
  font-weight: 900;
  line-height: 0.9;
  color: #ffe08a;
  text-shadow:
    0 0 12px rgba(255, 214, 80, 0.95),
    0 0 22px rgba(255, 196, 72, 0.45);
}

.dad-countdown-num.is-pop {
  animation: dadCountPop 0.52s cubic-bezier(0.16, 0.84, 0.32, 1);
}

.dad-countdown-num.is-resume {
  font-size: clamp(1.15rem, 3.8vw, 1.7rem);
  color: #7cf0ff;
  text-shadow:
    0 0 12px rgba(46, 230, 255, 0.95),
    0 0 22px rgba(255, 214, 80, 0.4);
}

.dad-countdown-num.is-wide {
  font-size: clamp(1.7rem, 6vw, 2.8rem);
}

@keyframes dadCountPop {
  0% { transform: scale(0.28); opacity: 0; }
  38% { transform: scale(1.22); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.board-wrap.is-dad-lock #board,
.board-wrap.is-dad-lock #tetris-canvas,
.board-wrap.is-dad-lock .board-canvas-stack,
.board-wrap.is-dad-lock #tetris-board-wrapper {
  box-shadow:
    0 0 18px rgba(255, 214, 80, 0.38),
    0 0 32px rgba(46, 230, 255, 0.18);
}

.dad-countdown-overlay.is-lock,
.dad-countdown-overlay.is-freeze {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  filter: none;
}

.dad-countdown-overlay.is-lock .dad-countdown-num,
.dad-countdown-overlay.is-freeze .dad-countdown-num {
  opacity: 0.92;
}

.board-wrap.dad-focus-active {
  z-index: 3;
}

.board-wrap.dad-focus-active #board,
.board-wrap.dad-focus-active #tetris-canvas,
.board-wrap.dad-focus-active .board-canvas-stack,
.board-wrap.dad-focus-active #tetris-board-wrapper,
#board.dad-focus-active,
#tetris-canvas.dad-focus-active {
  filter: none;
  border-color: #ffe08a;
  box-shadow:
    0 0 18px rgba(255, 214, 80, 0.42),
    0 0 28px rgba(46, 230, 255, 0.22);
}

.autoplay-speed-row,
.ai-speed-panel {
  grid-column: 1 / -1;
  margin: 0;
  padding: 4px 10px;
  gap: 2px 8px;
  border-radius: 10px;
}

.autoplay-speed-row .slider-label,
.autoplay-speed-row .slider-value,
.ai-speed-panel .slider-label,
.ai-speed-panel .slider-value {
  font-size: 0.8rem;
  line-height: 1.15;
  min-width: 0;
}

.autoplay-speed-row .slider-value {
  min-width: 4.2em;
  white-space: nowrap;
}

#autoplay-speed-settings-value {
  min-width: 11.5em;
  white-space: nowrap;
}

.dad-speed-row .ai-speed-panel .slider-label,
.dad-speed-row .ai-speed-panel .slider-value {
  font-size: 0.72rem;
  line-height: 1.1;
}

.dad-speed-row .ai-speed-panel .slider-value {
  min-width: 3.6em;
}

.autoplay-speed-row .big-slider {
  height: 18px;
  margin: 0;
}

.dad-speed-row .ai-speed-panel .big-slider {
  height: 15px;
}

.autoplay-speed-row .big-slider::-webkit-slider-runnable-track {
  height: 8px;
  border-width: 1px;
}

.autoplay-speed-row .big-slider::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border-width: 2px;
}

.autoplay-speed-row .big-slider::-moz-range-track {
  height: 8px;
  border-width: 1px;
}

.autoplay-speed-row .big-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.autoplay-badge {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 25;
  transform: translateX(-50%);
  padding: 8px 18px;
  border: 1px solid #9af6ff;
  border-radius: 999px;
  background: rgba(7, 16, 24, 0.88);
  color: #7cf0ff;
  font-family: inherit;
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(46, 230, 255, 0.7);
  box-shadow: 0 0 22px rgba(46, 230, 255, 0.4);
  pointer-events: none;
  animation: autoplayPulse 1.15s ease-in-out infinite;
}

@keyframes autoplayPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 16px rgba(46, 230, 255, 0.35); }
  50% { opacity: 0.55; box-shadow: 0 0 28px rgba(46, 230, 255, 0.7); }
}

.goal-toast {
  position: fixed;
  top: 56px;
  left: 50%;
  z-index: 26;
  transform: translateX(-50%) translateY(-8px);
  padding: 10px 22px;
  border: 1px solid #ffe08a;
  border-radius: 999px;
  background: rgba(7, 16, 24, 0.9);
  color: #ffe08a;
  font-family: inherit;
  font-size: clamp(0.95rem, 1.6vw, 1.18rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(255, 214, 80, 0.75);
  box-shadow: 0 0 22px rgba(255, 214, 80, 0.45);
  pointer-events: none;
  opacity: 0;
  overflow: visible;
}

.goal-toast.is-crown {
  border-color: #ffe08a;
  color: #fff4c2;
  text-shadow: 0 0 12px rgba(255, 214, 80, 0.85);
  box-shadow: 0 0 26px rgba(255, 214, 80, 0.55), 0 0 18px rgba(46, 230, 255, 0.35);
}

.goal-toast.is-corner {
  top: 16px;
  right: 16px;
  left: auto;
  transform: translateY(-8px);
  z-index: 80;
  max-width: min(92vw, 420px);
  padding: 8px 14px;
  border-radius: 14px;
  border-color: rgba(46, 230, 255, 0.55);
  color: #d7fbff;
  font-size: 0.92rem;
  letter-spacing: 0;
  text-shadow: 0 0 10px rgba(46, 230, 255, 0.55);
  box-shadow: 0 0 18px rgba(46, 230, 255, 0.28);
}

.goal-toast.is-in {
  animation: goalToastIn 0.28s ease-out forwards;
}

.goal-toast.is-corner.is-in {
  animation: goalToastCornerIn 0.28s ease-out forwards;
}

.goal-toast.is-corner.is-out {
  animation: goalToastCornerOut 0.36s ease-in forwards;
}

.goal-toast.is-out {
  animation: goalToastOut 0.36s ease-in forwards;
}

@keyframes goalToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes goalToastOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

@keyframes goalToastCornerIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes goalToastCornerOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

.goal-toast.is-conquer {
  top: 42px;
  max-width: min(920px, 92vw);
  padding: 14px 28px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 224, 138, 0.95);
  background:
    linear-gradient(180deg, rgba(18, 12, 4, 0.92), rgba(6, 18, 28, 0.92));
  color: #fff6c8;
  font-size: clamp(1.02rem, 2.1vw, 1.42rem);
  line-height: 1.35;
  letter-spacing: 0.03em;
  text-align: center;
  text-shadow:
    0 0 10px rgba(255, 214, 80, 0.95),
    0 0 18px rgba(46, 230, 255, 0.55);
  box-shadow:
    0 0 18px rgba(255, 214, 80, 0.55),
    0 0 34px rgba(46, 230, 255, 0.42),
    0 0 54px rgba(168, 85, 255, 0.22);
  animation: goalToastIn 0.32s ease-out forwards, conquerPulse 1.15s ease-in-out infinite 0.32s;
  overflow: visible;
}

.goal-toast.is-conquer.is-out {
  animation: goalToastOut 0.36s ease-in forwards;
}

.goal-toast-text {
  position: relative;
  z-index: 1;
}

.conquer-sparks {
  position: absolute;
  inset: -18px -28px;
  pointer-events: none;
  z-index: 0;
}

.conquer-sparks span {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  opacity: 0;
}

.goal-toast.is-conquer .conquer-sparks span {
  animation: conquerSpark 1.15s ease-out infinite;
}

.conquer-sparks span:nth-child(1) { left: 8%; top: 18%; background: #ffd76a; box-shadow: 0 0 10px #ffd76a; animation-delay: 0s; }
.conquer-sparks span:nth-child(2) { left: 22%; top: 78%; background: #7ee7ff; box-shadow: 0 0 10px #7ee7ff; animation-delay: 0.08s; }
.conquer-sparks span:nth-child(3) { left: 38%; top: 6%; background: #fff4c4; box-shadow: 0 0 10px #fff4c4; animation-delay: 0.16s; }
.conquer-sparks span:nth-child(4) { left: 54%; top: 86%; background: #ff7ad9; box-shadow: 0 0 10px #ff7ad9; animation-delay: 0.24s; }
.conquer-sparks span:nth-child(5) { left: 70%; top: 12%; background: #5ce1e6; box-shadow: 0 0 10px #5ce1e6; animation-delay: 0.32s; }
.conquer-sparks span:nth-child(6) { left: 86%; top: 72%; background: #ffd76a; box-shadow: 0 0 10px #ffd76a; animation-delay: 0.4s; }
.conquer-sparks span:nth-child(7) { left: 4%; top: 58%; background: #7ee7ff; box-shadow: 0 0 10px #7ee7ff; animation-delay: 0.48s; }
.conquer-sparks span:nth-child(8) { left: 92%; top: 28%; background: #ffb347; box-shadow: 0 0 10px #ffb347; animation-delay: 0.56s; }
.conquer-sparks span:nth-child(9) { left: 46%; top: -8%; background: #ffe08a; box-shadow: 0 0 12px #ffe08a; animation-delay: 0.2s; }
.conquer-sparks span:nth-child(10) { left: 62%; top: 102%; background: #7ee7ff; box-shadow: 0 0 10px #7ee7ff; animation-delay: 0.36s; }
.conquer-sparks span:nth-child(11) { left: 16%; top: -4%; background: #ff7ad9; box-shadow: 0 0 10px #ff7ad9; animation-delay: 0.12s; }
.conquer-sparks span:nth-child(12) { left: 80%; top: 98%; background: #fff4c4; box-shadow: 0 0 10px #fff4c4; animation-delay: 0.44s; }

@keyframes conquerPulse {
  0%, 100% {
    box-shadow:
      0 0 16px rgba(255, 214, 80, 0.48),
      0 0 28px rgba(46, 230, 255, 0.32),
      0 0 46px rgba(168, 85, 255, 0.16);
  }
  50% {
    box-shadow:
      0 0 28px rgba(255, 214, 80, 0.85),
      0 0 48px rgba(46, 230, 255, 0.58),
      0 0 70px rgba(168, 85, 255, 0.32);
  }
}

@keyframes conquerSpark {
  0% { opacity: 0; transform: scale(0.4) translateY(6px); }
  18% { opacity: 1; transform: scale(1.15) translateY(0); }
  100% { opacity: 0; transform: scale(0.2) translateY(-16px); }
}

.overlay.is-conquer::before {
  background: rgba(6, 10, 18, 0.38);
}

.overlay.is-conquer .overlay-card {
  border-color: rgba(255, 214, 80, 0.62);
  box-shadow:
    0 0 28px rgba(255, 214, 80, 0.28),
    0 0 25px rgba(0, 210, 255, 0.3);
}

.overlay.is-conquer .overlay-title {
  filter:
    drop-shadow(0 0 12px rgba(0, 210, 255, 0.8))
    drop-shadow(0 0 16px rgba(255, 214, 80, 0.35));
}

body.is-conquer-ending .board-wrap {
  box-shadow:
    0 0 28px rgba(255, 214, 80, 0.42),
    0 0 48px rgba(46, 230, 255, 0.32),
    0 0 64px rgba(168, 85, 255, 0.22);
}

.game-start-btn,
.game-end-btn {
  height: 42px;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-start-btn {
  border: 1px solid #7cffff;
  background: linear-gradient(180deg, #5cffff 0%, #00f0ff 42%, #00c8e6 100%);
  color: #041018;
  box-shadow:
    0 0 18px rgba(0, 240, 255, 0.85),
    0 0 32px rgba(0, 210, 255, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.game-start-btn.is-playing {
  border: 1px solid rgba(255, 214, 80, 0.7);
  background: linear-gradient(180deg, rgba(42, 32, 12, 0.95), rgba(18, 14, 8, 0.95));
  color: #ffe08a;
  box-shadow: 0 0 14px rgba(255, 214, 80, 0.28);
}

.game-start-btn.is-paused {
  border: 1px solid #7cffff;
  background: linear-gradient(180deg, #5cffff 0%, #00f0ff 42%, #00c8e6 100%);
  color: #041018;
  box-shadow:
    0 0 18px rgba(0, 240, 255, 0.85),
    0 0 32px rgba(0, 210, 255, 0.45);
}

.game-end-btn {
  border: 1px solid #ffb068;
  background: #1a100c;
  color: #ffb068;
  box-shadow: 0 0 12px rgba(255, 138, 61, 0.22);
}

.game-end-btn:disabled,
.game-start-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.stat-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 1fr 1fr !important;
  gap: 6px !important;
  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  align-self: stretch !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.stat-grid .card,
.stat-grid .stat-box,
#stats-bar-row .stat-box {
  min-width: 0 !important;
  height: 56px !important;
  min-height: 56px !important;
  overflow: hidden !important;
  padding: 8px 8px !important;
  box-sizing: border-box !important;
  text-align: center;
  border-radius: 8px !important;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(180deg, rgba(8, 18, 32, 0.96), rgba(4, 8, 16, 0.96));
  box-shadow:
    inset 0 0 14px rgba(0, 210, 255, 0.12),
    0 0 10px rgba(46, 230, 255, 0.16);
}

.stat-grid .label,
#stats-bar-row .label {
  font-size: 0.68rem !important;
  margin-bottom: 4px;
  opacity: 0.8;
  letter-spacing: 0.1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-grid .value,
#stats-bar-row .value {
  font-size: 1.4rem !important;
  font-weight: 800;
  line-height: 1.1 !important;
  color: #00f0ff !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.7);
}

.card {
  background: linear-gradient(180deg, rgba(16, 28, 48, 0.96), rgba(8, 12, 22, 0.96));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow:
    0 0 14px rgba(46, 230, 255, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 8px 12px 10px;
}

.label {
  color: var(--neon);
  font-size: clamp(0.82rem, 1.25vw, 1rem);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-shadow: 0 0 10px rgba(46, 230, 255, 0.5);
}

.value {
  font-size: clamp(1.45rem, 2.6vw, 2.2rem);
  font-weight: 800;
  line-height: 1.12;
  color: var(--ink);
  text-shadow: 0 0 16px rgba(243, 251, 255, 0.18);
  transition: color 0.2s ease, transform 0.2s ease;
}

.value.accent,
.value.is-record {
  color: var(--accent);
  text-shadow: 0 0 16px rgba(255, 138, 61, 0.45);
}

.value.is-record {
  transform: scale(1.06);
}

.clear-banner {
  position: absolute;
  left: 50%;
  top: 22%;
  z-index: 3;
  transform: translateX(-50%);
  padding: 10px 22px;
  border: 1px solid var(--neon);
  border-radius: 12px;
  background: rgba(8, 14, 24, 0.9);
  box-shadow: 0 0 24px var(--theme-glow);
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
  pointer-events: none;
}

.clear-banner.is-tetris {
  color: #fff6c8;
  border-color: #ffd76a;
  background: linear-gradient(180deg, rgba(64, 36, 8, 0.94), rgba(18, 10, 4, 0.92));
  box-shadow:
    0 0 28px rgba(255, 215, 106, 0.65),
    0 0 64px rgba(255, 138, 61, 0.35);
  text-shadow: 0 0 18px rgba(255, 215, 106, 0.85);
  letter-spacing: 0.08em;
  animation: tetrisBannerPop 0.45s ease-out;
}

@keyframes tetrisBannerPop {
  0% { transform: translateX(-50%) scale(0.72); opacity: 0; }
  55% { transform: translateX(-50%) scale(1.08); opacity: 1; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

.hold-next-container {
  display: contents;
}

.next-card,
.hold-card,
.preview-panel,
#next-card,
#hold-card,
#block-guide-row .preview-panel {
  min-height: 0;
  height: 100%;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  text-align: center;
  padding: 6px 6px 8px !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  position: static !important;
  margin: 0 !important;
  flex: 1 1 auto !important;
  grid-column: auto !important;
  grid-row: auto !important;
  grid-area: auto !important;
}

.hud-stats-row > .stat-grid,
.top-dashboard > .stat-grid,
#stats-panel > .stat-grid,
#stats-panel > #stats-bar-row,
#top-info-bar > .stat-grid {
  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  grid-column: auto !important;
  grid-row: auto !important;
  grid-area: auto !important;
  flex: none !important;
}

.preview-card-head {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 2px !important;
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
  font-size: 0.68rem;
}

.preview-card-head .label,
.hold-next-container .label,
#next-card .label,
#hold-card .label {
  width: auto;
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  text-align: center;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.68rem !important;
}

#btn-toggle-guide-mode,
.guide-mode-toggle {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  padding: 1px 4px;
  margin: 0;
  border-radius: 4px;
  border: 1px solid rgba(0, 240, 255, 0.4);
  background: rgba(6, 18, 28, 0.92);
  color: #7cf0ff;
  font-size: 0.7rem;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.22);
  touch-action: manipulation;
  user-select: none;
}

#btn-toggle-guide-mode:hover,
#btn-toggle-guide-mode:focus-visible {
  border-color: rgba(0, 240, 255, 0.85);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.45);
  outline: none;
}

#btn-toggle-guide-mode.is-dual,
#btn-toggle-guide-mode[aria-pressed="true"] {
  background: rgba(0, 210, 255, 0.22);
  color: #fff;
}

.hold-card.is-locked {
  opacity: 0.55;
}

#stats-panel canvas,
#block-guide-row canvas,
.preview-panel canvas,
#next-card canvas,
#hold-card canvas,
#next,
#hold,
.next-canvas,
.hold-canvas {
  display: block !important;
  width: 132px !important;
  height: 132px !important;
  max-width: 132px !important;
  max-height: 132px !important;
  aspect-ratio: 1 / 1 !important;
  flex: 0 0 132px;
  min-width: 96px;
  min-height: 96px;
  margin: auto !important;
  background: var(--well);
  border: 1px solid var(--neon-dim);
  border-radius: 10px;
  box-shadow:
    inset 0 0 18px rgba(46, 230, 255, 0.08),
    0 0 12px rgba(46, 230, 255, 0.16);
}

#mobile-right-tower,
#mobile-game-controls {
  display: contents;
}

.sidebar-dock {
  flex: 1 1 auto !important;
  min-height: 0;
  height: auto;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 5px;
  overflow: hidden;
}

#dad-cheer-banner,
.dad-cheer-banner {
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 0;
  width: 100% !important;
  height: 160px !important;
  min-height: 160px !important;
  max-height: 160px !important;
  flex: 0 0 160px !important; /* 160px 초대형 전광판 고정 */
  flex-shrink: 0 !important;
  margin: 0;
  padding: 14px 12px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.12), rgba(16, 28, 54, 0.95)) !important;
  border: 1.5px solid rgba(0, 240, 255, 0.55) !important;
  border-radius: 12px !important;
  box-shadow:
    0 0 18px rgba(0, 240, 255, 0.25),
    inset 0 0 12px rgba(0, 240, 255, 0.15) !important;
}

.cheer-header,
.dad-cheer-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  flex: 0 0 auto;
}

.dad-cheer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: auto;
  min-height: 0;
  max-width: 100%;
  padding: 2px 10px;
  border-radius: 4px;
  border: 1px solid rgba(0, 240, 255, 0.55);
  background: rgba(4, 18, 32, 0.85);
  color: #7cf0ff;
  font-size: 0.78rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.7);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.28);
  animation: dadCheerBadgePulse 1.6s ease-in-out infinite;
}

#dad-cheer-text,
#dad-cheer-msg,
.cheer-main-msg,
.dad-cheer-text,
.cheer-text {
  display: block !important;
  width: 100% !important;
  flex: 0 0 auto;
  margin: 0;
  color: #ffffff !important;
  font-size: 1.2rem !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  letter-spacing: -0.3px !important;
  text-align: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  text-shadow:
    0 0 10px rgba(0, 240, 255, 0.8),
    0 0 20px rgba(0, 240, 255, 0.4) !important;
}

html.lang-scale-compact #dad-cheer-text,
html.lang-scale-cjk #dad-cheer-text,
html.lang-scale-hi #dad-cheer-text,
html.lang-scale-ru #dad-cheer-text,
html[data-lang]:not([data-lang="ko"]) #dad-cheer-text,
html[data-lang]:not([data-lang="ko"]) #dad-cheer-msg {
  white-space: normal !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: -webkit-box !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  max-height: 2.6em !important;
  font-size: clamp(0.78rem, 1.35vw, 1.05rem) !important;
  line-height: 1.25 !important;
  word-break: keep-all;
}

html.lang-scale-compact #dad-cheer-text,
html[data-lang="de"] #dad-cheer-text,
html[data-lang="fr"] #dad-cheer-text,
html[data-lang="es"] #dad-cheer-text,
html[data-lang="pt-BR"] #dad-cheer-text,
html[data-lang="vi"] #dad-cheer-text,
html[data-lang="id"] #dad-cheer-text {
  font-size: clamp(0.64rem, 1.1vw, 0.88rem) !important;
}

html.lang-scale-hi #dad-cheer-text,
html.lang-scale-ru #dad-cheer-text,
html[data-lang="hi"] #dad-cheer-text,
html[data-lang="ru"] #dad-cheer-text {
  font-size: clamp(0.62rem, 1.05vw, 0.86rem) !important;
  word-break: break-word;
}

html.lang-scale-hi,
html[data-lang="hi"] {
  font-family: "Nirmala UI", "Noto Sans Devanagari", "Mangal", "Segoe UI", sans-serif;
}

html.lang-scale-ru,
html[data-lang="ru"] {
  font-family: "Segoe UI", "Noto Sans", "Arial", sans-serif;
}

html.lang-scale-cjk #dad-cheer-text,
html[data-lang="ja"] #dad-cheer-text,
html[data-lang="zh-CN"] #dad-cheer-text {
  font-size: clamp(0.8rem, 1.4vw, 1.08rem) !important;
}

html[data-lang] #dad-cheer-tip,
html[lang] #dad-cheer-tip {
  white-space: normal !important;
  overflow: hidden !important;
  display: -webkit-box !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  max-height: 2.5em !important;
  font-size: clamp(0.58rem, 1vw, 0.72rem) !important;
}

#game-start,
#game-end,
#btn-diagnostics,
#btn-guide,
#settings-open,
#autoplay-toggle,
#mobile-pad-toggle,
#dad-special-toggle,
#overlay-restart,
#overlay-quit {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

html.lang-scale-compact #game-start,
html.lang-scale-compact #game-end,
html.lang-scale-compact #btn-diagnostics,
html.lang-scale-compact #settings-open,
html.lang-scale-compact #autoplay-toggle,
html.lang-scale-hi #game-start,
html.lang-scale-hi #game-end,
html.lang-scale-hi #btn-diagnostics,
html.lang-scale-hi #settings-open,
html.lang-scale-ru #game-start,
html.lang-scale-ru #game-end,
html.lang-scale-ru #btn-diagnostics,
html.lang-scale-ru #settings-open {
  font-size: clamp(0.68rem, 0.92vw, 0.82rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-row #select-language,
.lang-row #lang-select {
  min-width: 0;
  width: 100%;
}

#dad-cheer-tip,
.cheer-sub-tip {
  display: block !important;
  width: 100% !important;
  flex: 0 0 auto;
  margin: 0;
  color: rgba(0, 240, 255, 0.75) !important;
  font-size: 0.72rem !important;
  font-weight: 600;
  line-height: 1.2 !important;
  letter-spacing: 0.5px !important;
  text-align: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.dad-cheer-banner.is-bounce {
  animation: dadCheerBounce 0.42s cubic-bezier(0.22, 1.4, 0.36, 1);
}

.dad-cheer-banner.is-tetris {
  border-color: rgba(255, 214, 80, 0.8) !important;
  background: linear-gradient(135deg, rgba(255, 214, 80, 0.2), rgba(28, 20, 8, 0.92)) !important;
  box-shadow:
    0 0 18px rgba(255, 214, 80, 0.45),
    inset 0 0 16px rgba(255, 214, 80, 0.12) !important;
  animation: dadCheerGoldPulse 1.05s ease-in-out infinite, dadCheerBounce 0.42s cubic-bezier(0.22, 1.4, 0.36, 1);
}

.dad-cheer-banner.is-tetris .dad-cheer-badge {
  border-color: rgba(255, 214, 80, 0.8);
  color: #ffe08a;
  text-shadow: 0 0 8px rgba(255, 214, 80, 0.8);
}

.dad-cheer-banner.is-tetris .dad-cheer-text,
.dad-cheer-banner.is-tetris .cheer-main-msg {
  color: #fff6c8;
  text-shadow: 0 0 12px rgba(255, 214, 80, 0.7);
}

.dad-cheer-banner.is-tetris .cheer-sub-tip {
  color: rgba(255, 214, 80, 0.85) !important;
}

.dad-cheer-banner.is-level {
  border-color: rgba(126, 231, 255, 0.72) !important;
}

.dad-cheer-banner.is-level #dad-cheer-text,
.dad-cheer-banner.is-level .dad-cheer-text,
.dad-cheer-banner.is-level .cheer-main-msg,
.dad-cheer-banner.is-level #dad-cheer-tip,
.dad-cheer-banner.is-level .cheer-sub-tip {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  line-height: 1.28 !important;
}

@keyframes dadCheerBadgePulse {
  0%, 100% { box-shadow: 0 0 8px rgba(0, 240, 255, 0.28); }
  50% { box-shadow: 0 0 16px rgba(0, 240, 255, 0.7); }
}

@keyframes dadCheerBounce {
  0% { transform: scale(0.94); }
  55% { transform: scale(1.045); }
  100% { transform: scale(1); }
}

@keyframes dadCheerGoldPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 214, 80, 0.28); }
  50% { box-shadow: 0 0 24px rgba(255, 214, 80, 0.75); }
}

.help,
#controls-guide {
  flex: 1 1 auto !important;
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
  margin: 0;
  padding: 8px 12px !important;
  border-width: 2px;
  border-radius: 10px;
  border-color: var(--neon);
  box-sizing: border-box;
}

.guide-open-btn,
.diag-open-btn,
#diag-open,
#guide-open {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
  gap: 4px !important;
  box-sizing: border-box;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 26px !important;
  min-height: 26px !important;
  padding: 0 10px !important;
  border-radius: 4px !important;
  font-family: inherit;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  letter-spacing: 0;
  line-height: 24px;
  cursor: pointer;
  white-space: nowrap !important;
  transform: none !important;
  position: static !important;
  margin: 0 !important;
}

#hud-diag-guide-row #btn-diagnostics,
#hud-diag-guide-row #btn-guide,
#hud-control-grid #btn-diagnostics,
#hud-control-grid #btn-guide,
#hud-control-grid #mobile-pad-toggle,
#hud-control-grid #settings-open {
  width: 100% !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 8px !important;
  font-size: 0.84rem !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

#hud-control-grid #game-start,
#hud-control-grid #game-end {
  width: 100% !important;
  height: 42px !important;
  min-height: 42px !important;
  padding: 0 8px !important;
  font-size: 0.95rem !important;
  font-weight: 800 !important;
  border-radius: 8px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.guide-open-btn,
.btn-guide,
#btn-guide {
  border: 1px solid rgba(0, 210, 255, 0.32);
  background: rgba(8, 18, 30, 0.72);
  color: rgba(220, 244, 255, 0.9);
  box-shadow: none;
}

.guide-open-btn:hover,
.guide-open-btn:focus-visible,
.btn-guide:hover,
.btn-guide:focus-visible,
#btn-guide:hover,
#btn-guide:focus-visible {
  background: rgba(46, 230, 255, 0.16);
  box-shadow: 0 0 10px rgba(46, 230, 255, 0.22);
  outline: none;
}

.diag-open-btn,
.btn-diagnostics,
#btn-diagnostics {
  border: 1px solid rgba(155, 89, 182, 0.38);
  background: rgba(18, 12, 28, 0.72);
  color: rgba(230, 214, 255, 0.9);
  box-shadow: none;
}

.diag-open-btn:hover,
.diag-open-btn:focus-visible,
.btn-diagnostics:hover,
.btn-diagnostics:focus-visible,
#btn-diagnostics:hover,
#btn-diagnostics:focus-visible {
  background: rgba(168, 85, 247, 0.2);
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.28);
  outline: none;
}

.diag-modal {
  z-index: 55;
  justify-content: flex-end;
  align-items: center;
  padding: 18px 22px 18px 18px;
  background: transparent !important;
}

#diag-modal:not(.hidden),
#diag-modal.active,
#diag-modal.open,
#diag-modal.show {
  background: transparent !important;
}

#diag-modal .modal-backdrop,
#diag-backdrop,
.diag-modal .modal-backdrop,
.diag-modal-backdrop {
  background: rgba(4, 10, 20, 0.45) !important;
  backdrop-filter: blur(2px) !important;
  -webkit-backdrop-filter: blur(2px) !important;
}

.diag-panel {
  width: min(560px, 94vw);
  max-height: min(88vh, 820px);
  margin-left: auto;
  background: linear-gradient(165deg, rgba(10, 16, 34, 0.96), rgba(6, 10, 22, 0.98));
  border: 1px solid rgba(46, 230, 255, 0.45);
  box-shadow: 0 0 40px rgba(46, 230, 255, 0.18), 0 24px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.diag-progress-wrap {
  padding: 0 18px 10px;
}

.diag-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.86rem;
  font-weight: 700;
}

.diag-current {
  color: #9af6ff;
}

.diag-percent {
  color: #ffd76a;
}

.diag-progress-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(46, 230, 255, 0.12);
  border: 1px solid rgba(46, 230, 255, 0.28);
}

.diag-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #2ee6ff, #a855f7, #ff8a3d);
  box-shadow: 0 0 12px rgba(46, 230, 255, 0.65);
  transition: width 0.18s ease;
}

.diag-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}

.diag-tool-btn {
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

#diag-log-container,
.diag-log-box {
  margin: 0 18px 12px;
}

.diag-log-toolbar {
  margin: 0 0 8px;
  align-items: center;
}

.diag-log-toolbar-bottom {
  margin: 8px 0 0;
}

.diag-action-btn {
  height: 28px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid rgba(0, 240, 255, 0.55);
  background: rgba(0, 240, 255, 0.15);
  color: #e7fbff;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.18);
  transition: background 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}

.diag-action-btn:hover {
  background: rgba(0, 240, 255, 0.28);
  border-color: rgba(126, 240, 255, 0.95);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.45);
}

.diag-action-btn:active {
  transform: translateY(1px);
  background: rgba(0, 240, 255, 0.42);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.7);
}

.diag-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.diag-modal.is-running .diag-action-btn,
body.diag-running .diag-action-btn {
  pointer-events: none;
  opacity: 0.4;
}

.diag-export-toast {
  margin: 8px 0 0;
  min-height: 1.1em;
  color: #7ef0c0;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.35);
}

.diag-export-toast.hidden {
  display: none;
}

.diag-stages {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.diag-stage {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(46, 230, 255, 0.22);
  background: rgba(8, 14, 28, 0.55);
  color: #8ec8d8;
  font-size: 0.64rem;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diag-stage.is-on {
  color: #041018;
  background: linear-gradient(90deg, #7ef0ff, #d8b4fe);
  border-color: transparent;
  box-shadow: 0 0 12px rgba(46, 230, 255, 0.4);
}

.diag-stage.is-done {
  color: #7dffb0;
  border-color: rgba(80, 255, 160, 0.35);
  background: rgba(80, 255, 160, 0.12);
}

.diag-items {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding: 0 18px 10px;
}

.diag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(8, 14, 28, 0.72);
  border: 1px solid rgba(46, 230, 255, 0.16);
  font-size: 0.8rem;
}

.diag-item-title {
  color: #d7f7ff;
}

.diag-badge {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.diag-badge.is-wait { color: #8ec8d8; background: rgba(142, 200, 216, 0.12); }
.diag-badge.is-run { color: #ffd76a; background: rgba(255, 215, 106, 0.16); }
.diag-badge.is-pass { color: #7dffb0; background: rgba(80, 255, 160, 0.16); }
.diag-badge.is-fix { color: #9ad0ff; background: rgba(80, 160, 255, 0.18); }
.diag-badge.is-fail { color: #ff8a8a; background: rgba(255, 80, 80, 0.16); }

.diag-log {
  margin: 0;
  min-height: 140px;
  max-height: 180px;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 10px;
  background: #05080f;
  border: 1px solid rgba(46, 230, 255, 0.22);
  color: #7ef0c0;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.diag-cert {
  margin: 0 18px 8px;
  padding: 10px 12px;
  border-radius: 10px;
  text-align: center;
  font-weight: 800;
  color: #041018;
  background: linear-gradient(90deg, #7ef0ff, #d8b4fe);
  box-shadow: 0 0 24px rgba(46, 230, 255, 0.45);
}

.diag-modal.is-running .modal-x,
.diag-modal.is-running .modal-backdrop {
  pointer-events: none;
}

.diag-cert.is-fail {
  color: #fff4f4;
  background: linear-gradient(90deg, #7f1d1d, #b91c1c);
  box-shadow: 0 0 24px rgba(248, 113, 113, 0.35);
}

.diag-cert.diag-all-green {
  color: #041018;
  background: linear-gradient(90deg, #7ef0a0, #7ef0ff);
  box-shadow: 0 0 24px rgba(46, 255, 160, 0.4);
}

.diag-cert.diag-core-systems {
  margin: 0 18px 10px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(126, 240, 255, 0.45);
  color: #041018;
  background: linear-gradient(135deg, rgba(126, 240, 255, 0.95), rgba(216, 180, 254, 0.92) 55%, rgba(255, 224, 138, 0.9));
  box-shadow: 0 0 28px rgba(46, 230, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  font-size: 0.92rem;
  line-height: 1.45;
  backdrop-filter: blur(10px);
}

.help .label {
  flex-shrink: 0;
  margin-bottom: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-shadow:
    0 0 16px rgba(46, 230, 255, 0.8),
    0 0 8px rgba(46, 230, 255, 0.45);
}

.help ul {
  list-style: none;
  flex: 0 1 auto;
  min-height: 0;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  overflow: hidden;
}

.help li {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 3px 5px;
  margin: 2px 0;
  font-size: 0.76rem;
  line-height: 1.2;
}

.help li:last-child {
  padding-bottom: 0;
}

.help li.help-dad {
  flex-wrap: wrap;
  align-items: center;
}

.help kbd,
.help .key-badge {
  min-width: 1.35em;
  padding: 1px 5px;
  font-size: 0.76rem;
  border-radius: 5px;
  box-shadow:
    0 0 8px rgba(46, 230, 255, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.help .key-x2 {
  padding: 2px 8px;
  font-size: 0.95em;
}

.help-sep {
  margin: 0 2px 0 1px;
  color: var(--muted);
  font-weight: 800;
}

kbd {
  display: inline-block;
  min-width: 1.45em;
  padding: 1px 6px;
  margin-right: 0;
  border: 1px solid rgba(46, 230, 255, 0.55);
  border-radius: 7px;
  background: linear-gradient(180deg, #102232, #071018);
  color: #9af6ff;
  font-family: inherit;
  font-size: 0.92em;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  box-shadow:
    0 0 8px rgba(46, 230, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.help-pause {
  font-weight: 800;
  color: #fff6e8;
}

.help-dad {
  font-weight: 800;
  color: #ffe08a;
}

.key-x2 {
  display: inline-block;
  margin: 0 2px 0 1px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(46, 230, 255, 0.16);
  border: 1px solid var(--neon);
  color: var(--neon);
  font-size: 0.88em;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 0 10px rgba(46, 230, 255, 0.55);
}

.settings-open-btn {
  margin-top: 0;
  min-height: 2.35rem;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(8, 14, 24, 0.92);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(46, 230, 255, 0.18);
}

.settings-open-btn:hover,
.settings-open-btn:focus-visible {
  border-color: var(--neon);
  box-shadow: 0 0 18px rgba(46, 230, 255, 0.4);
  outline: none;
}

.modal,
.custom-modal,
.modal-overlay,
#settings-modal,
#guide-modal,
#diag-modal,
#celebrate-modal,
#score-save-modal,
#autoplay-end-modal,
#hall-modal,
#pwa-guide-modal,
#ingame-confirm-modal,
#game-over-modal {
  position: fixed;
  inset: 0;
  z-index: -1 !important;
  padding: 18px;
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

.modal.active,
.modal.open,
.modal.show,
.modal:not(.hidden),
.custom-modal.active,
.custom-modal.open,
.custom-modal.show,
.custom-modal:not(.hidden),
#settings-modal.active,
#settings-modal.open,
#settings-modal.show,
#settings-modal:not(.hidden),
#guide-modal.active,
#guide-modal.open,
#guide-modal.show,
#guide-modal:not(.hidden),
#diag-modal.active,
#diag-modal.open,
#diag-modal.show,
#diag-modal:not(.hidden),
#celebrate-modal.active,
#celebrate-modal.open,
#celebrate-modal.show,
#celebrate-modal:not(.hidden),
#score-save-modal.active,
#score-save-modal.open,
#score-save-modal.show,
#score-save-modal:not(.hidden),
#autoplay-end-modal.active,
#autoplay-end-modal.open,
#autoplay-end-modal.show,
#autoplay-end-modal:not(.hidden),
#hall-modal.active,
#hall-modal.open,
#hall-modal.show,
#hall-modal:not(.hidden),
#pwa-guide-modal.active,
#pwa-guide-modal.open,
#pwa-guide-modal.show,
#pwa-guide-modal:not(.hidden),
#ingame-confirm-modal.active,
#ingame-confirm-modal.open,
#ingame-confirm-modal.show,
#ingame-confirm-modal:not(.hidden),
#game-over-modal.active,
#game-over-modal.open,
#game-over-modal.show,
#game-over-modal:not(.hidden) {
  display: flex !important;
  pointer-events: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 9999 !important;
  align-items: center;
  justify-content: center;
}

.modal.hidden,
.modal[hidden],
.custom-modal.hidden,
#settings-modal.hidden,
#guide-modal.hidden,
#game-over-modal.hidden,
#diag-modal.hidden,
#celebrate-modal.hidden,
#score-save-modal.hidden,
#autoplay-end-modal.hidden,
#hall-modal.hidden,
#pwa-guide-modal.hidden,
#ingame-confirm-modal.hidden {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  z-index: -1 !important;
}

.modal.hidden .modal-overlay,
.modal.hidden .modal-backdrop,
.modal[hidden] .modal-overlay,
.modal[hidden] .modal-backdrop,
#settings-modal.hidden .modal-overlay,
#guide-modal.hidden .modal-overlay {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  z-index: -1 !important;
}

.modal.active .modal-overlay,
.modal.open .modal-overlay,
.modal.show .modal-overlay,
.modal:not(.hidden) .modal-overlay,
.modal.active .modal-backdrop,
.modal.open .modal-backdrop,
.modal.show .modal-backdrop,
.modal:not(.hidden) .modal-backdrop,
#settings-modal:not(.hidden) .modal-overlay,
#guide-modal:not(.hidden) .modal-backdrop {
  display: block !important;
  pointer-events: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 0 !important;
}

.settings-modal {
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.settings-modal .modal-backdrop,
#settings-modal .modal-overlay {
  background: rgba(5, 10, 20, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
}

#settings-modal .modal-panel,
#settings-modal .modal-content {
  width: 92%;
  max-width: 560px;
  min-width: 0;
  height: auto;
  max-height: 88vh;
  padding: 22px 24px;
  overflow: hidden;
  box-sizing: border-box;
  background: linear-gradient(145deg, rgba(16, 26, 46, 0.96), rgba(8, 14, 28, 0.98));
  border: 1.5px solid rgba(0, 240, 255, 0.35);
  border-radius: 16px;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.7),
    0 0 20px rgba(0, 240, 255, 0.15);
  pointer-events: auto;
}

#settings-modal .modal-head {
  padding: 0 0 12px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.18);
}

#settings-modal .modal-head h2,
#settings-modal #settings-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #00f0ff;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
}

#settings-modal .modal-x {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.1rem;
}

#settings-modal .settings-tabs {
  padding: 10px 0 8px;
  gap: 6px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.12);
}

#settings-modal .settings-tab {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 6px;
}

#settings-modal .modal-body {
  gap: 12px;
  padding: 12px 2px 8px;
  overflow-y: auto;
}

#settings-modal .setting-block {
  gap: 6px;
  padding: 0;
  background: transparent;
  border: 0;
}

#settings-modal .settings-card {
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-sizing: border-box;
}

#settings-modal .settings-card-graphics {
  background: rgba(0, 240, 255, 0.04);
  border: 1px solid rgba(0, 240, 255, 0.15);
}

#settings-modal .settings-card-sound,
#settings-modal .settings-card-play {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#settings-modal .land-sfx-block {
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 240, 255, 0.14);
}

#settings-modal .settings-card-play {
  margin-bottom: 16px;
}

#settings-modal .settings-section-title {
  margin: 0 0 8px;
  padding-left: 8px;
  border-left: 3px solid #00f0ff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #e0f7fa;
  text-transform: uppercase;
}

#settings-modal .row-title,
#settings-modal .slider-label,
#settings-modal .toggle-name,
#settings-modal .select-row .row-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0;
}

#settings-modal .setting-hint,
#settings-modal .bgm-track,
#settings-modal .asset-badge {
  font-size: 0.72rem;
  color: rgba(180, 210, 240, 0.7);
  line-height: 1.3;
}

#settings-modal .slider-value,
#settings-modal .toggle-state {
  font-size: 0.82rem;
  font-weight: bold;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #00f0ff;
  background: rgba(0, 240, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 0;
}

#settings-modal .select-row,
#settings-modal .toggle-row,
#settings-modal .slider-row {
  min-height: 0;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  background: rgba(4, 12, 24, 0.55);
}

#settings-modal .toggle-row {
  grid-template-columns: 1fr auto auto;
  min-height: 40px;
  gap: 8px;
}

#settings-modal .switch {
  width: 42px;
  height: 22px;
}

#settings-modal .knob {
  width: 16px;
  height: 16px;
  top: 2px;
  left: 2px;
}

#settings-modal .toggle-row.is-on .knob {
  transform: translateX(20px);
}

#settings-modal #lang-select,
#settings-modal #select-language,
#settings-modal #start-level,
#settings-modal #select-preview-mode,
#settings-modal #select-block-skin,
#settings-modal #select-board-size {
  min-height: 36px;
  height: 36px;
  padding: 0 10px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 6px;
}

#settings-modal .block-skin-select-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#settings-modal .block-skin-select-wrap #select-block-skin {
  flex: 1 1 auto;
  min-width: 0;
}

#settings-modal .skin-preview-container {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  box-sizing: border-box;
  background: rgba(0, 15, 30, 0.6);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 8px;
}

#settings-modal .skin-preview-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: rgba(0, 240, 255, 0.85);
  white-space: nowrap;
  line-height: 1.2;
}

#settings-modal #skin-preview-canvas {
  display: block;
  width: 140px;
  height: 75px;
  border-radius: 4px;
  background:
    linear-gradient(rgba(0, 240, 255, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.14) 1px, transparent 1px),
    rgba(0, 10, 22, 0.85);
  background-size: 10px 10px, 10px 10px, auto;
}

#settings-modal .pwa-install-btn,
#settings-modal #btn-install-pwa {
  min-height: 36px;
  margin-top: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  border-radius: 8px;
}

#settings-modal .ghost-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  width: 100%;
}

#settings-modal .ghost-preview-row .slider-row {
  flex: 1 1 auto;
  min-width: 0;
}

#settings-modal .ghost-preview-box {
  flex: 0 0 68px;
  width: 68px !important;
  height: 68px !important;
  min-width: 68px;
  min-height: 68px;
  padding: 4px;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
  opacity: 1 !important;
  visibility: visible !important;
  background: rgba(5, 12, 24, 0.85) !important;
  border: 1px solid rgba(0, 240, 255, 0.4) !important;
  border-radius: 8px !important;
  overflow: hidden;
}

#settings-modal #ghost-preview-canvas,
#settings-modal .ghost-preview-canvas {
  width: 60px !important;
  height: 60px !important;
  display: block;
  image-rendering: auto;
  pointer-events: auto;
  opacity: 1 !important;
  visibility: visible !important;
}

#settings-modal .settings-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 12px 0 0;
  border-top: 1px solid rgba(0, 240, 255, 0.16);
}

#settings-modal .settings-foot .save-btn,
#settings-modal #settings-save,
#settings-modal .settings-done-btn {
  width: auto;
  min-height: 36px;
  height: 36px;
  padding: 0 18px;
  font-size: 0.85rem;
  font-weight: bold;
  color: #000;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, #00f0ff, #0088cc);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

#settings-modal .settings-foot .ghost-btn,
#settings-modal #settings-reset,
#settings-modal .settings-reset-btn {
  width: auto;
  min-height: 36px;
  height: 36px;
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #bbb;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  box-shadow: none;
}

body.diag-running #settings-reset,
body.diag-running .settings-reset-btn,
body.diag-running #profile-crop-canvas,
body.diag-running #profile-x,
body.diag-running #profile-y {
  pointer-events: none;
}

#settings-modal .profile-edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
}

#settings-modal .profile-edit-actions .ghost-btn,
#settings-modal .profile-edit-actions .save-btn,
#settings-modal #profile-reset,
#settings-modal #profile-save-btn {
  width: 100%;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 38px;
  padding: 0 10px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  line-height: 36px;
  border-radius: 6px;
  box-sizing: border-box;
  white-space: nowrap;
}

#settings-modal .profile-pick-row {
  width: 100%;
  margin-top: 8px;
}

#settings-modal .profile-pick-row .file-btn,
#settings-modal #profile-pick-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100% !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 38px;
  padding: 0 10px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  line-height: 36px;
  color: #00f0ff !important;
  background: rgba(0, 240, 255, 0.15) !important;
  border: 1px solid rgba(0, 240, 255, 0.5) !important;
  border-radius: 6px;
  box-shadow: none;
  box-sizing: border-box;
  white-space: nowrap;
}

#settings-modal .bgm-file-row,
#settings-modal .setting-bgm .asset-actions {
  display: grid !important;
  grid-template-columns: 1.2fr 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
  flex-wrap: nowrap;
}

#settings-modal .bgm-file-row .file-btn,
#settings-modal .bgm-pick-btn,
#settings-modal .setting-bgm .file-btn {
  display: flex !important;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px;
  padding: 0 10px !important;
  font-size: 0.84rem !important;
  font-weight: 600 !important;
  line-height: 36px;
  white-space: nowrap !important;
  border-radius: 6px;
  box-sizing: border-box;
  box-shadow: none;
}

#settings-modal .bgm-file-row .ghost-btn,
#settings-modal #bgm-restore,
#settings-modal .bgm-restore-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px;
  padding: 0 10px !important;
  font-size: 0.8rem !important;
  font-weight: 600;
  line-height: 36px;
  white-space: nowrap !important;
  color: #bbb !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 6px;
  box-shadow: none;
  box-sizing: border-box;
}

#settings-modal .video-slot .file-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px;
  padding: 0 10px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  line-height: 36px;
  color: #ffffff !important;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(0, 150, 255, 0.3)) !important;
  border: 1px solid rgba(0, 240, 255, 0.4) !important;
  border-radius: 6px;
  box-shadow: none;
  box-sizing: border-box;
  white-space: nowrap;
}

#settings-modal .video-slot-actions .file-btn {
  width: auto;
  flex: 1 1 10rem;
}

#settings-modal .video-slot .url-input,
#settings-modal .video-slot input[type="url"],
#settings-modal .video-slot input[type="text"] {
  width: 100%;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px;
  padding: 0 10px !important;
  font-size: 0.82rem !important;
  font-weight: 500;
  color: #fff !important;
  background: rgba(0, 0, 0, 0.4) !important;
  border: 1px solid rgba(0, 240, 255, 0.25) !important;
  border-radius: 6px;
  box-sizing: border-box;
}

@media (max-width: 420px) {
  #settings-modal .block-skin-select-wrap {
    flex-direction: column;
    align-items: stretch;
  }

  #settings-modal #skin-preview-canvas {
    width: 100%;
    max-width: 160px;
    height: auto;
    aspect-ratio: 140 / 75;
    margin: 0 auto;
  }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.52);
  backdrop-filter: blur(12px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(740px, 94vw);
  max-height: min(92vh, 980px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(14, 24, 42, 0.97), rgba(8, 12, 22, 0.98));
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow:
    0 0 32px rgba(46, 230, 255, 0.22),
    0 24px 80px rgba(0, 0, 0, 0.55);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--neon-dim);
}

.modal-head h2 {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  letter-spacing: 0.04em;
  text-shadow: 0 0 16px rgba(46, 230, 255, 0.4);
}

.modal-x {
  width: 3rem;
  height: 3rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #071018;
  color: var(--ink);
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 22px;
  overflow-x: hidden;
  overflow-y: auto;
  display: grid;
  gap: 14px;
  align-content: start;
}

.modal-foot {
  flex-shrink: 0;
  padding: 12px 22px 18px;
  border-top: 1px solid var(--neon-dim);
}

.settings-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

.setting-block {
  display: grid;
  gap: 8px;
}

.theme-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.theme-swatch {
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  cursor: pointer;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
  background: conic-gradient(var(--swatch-a, #00d2ff), var(--swatch-b, #163a7a));
}

.theme-swatch[data-theme="neon-blue"] { --swatch-a: #00d2ff; --swatch-b: #163a7a; }
.theme-swatch[data-theme="cyber-pink"] { --swatch-a: #ff4fa3; --swatch-b: #c026d3; }
.theme-swatch[data-theme="emerald-green"] { --swatch-a: #22f0b2; --swatch-b: #059669; }
.theme-swatch[data-theme="sunset-orange"] { --swatch-a: #ff8a3d; --swatch-b: #ffd76a; }
.theme-swatch[data-theme="future-cyber"] { --swatch-a: #c084fc; --swatch-b: #facc15; }

.theme-swatch.is-on {
  border-color: #fff;
  box-shadow:
    0 0 0 3px var(--theme-primary),
    0 0 18px var(--theme-glow);
}

.theme-swatch:focus-visible {
  outline: 3px solid var(--neon);
  outline-offset: 2px;
}

.pwa-install-btn,
#btn-install-pwa,
#pwa-install-btn,
#install-app-btn {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 3.2rem;
  margin-top: 12px;
  padding: 12px 16px;
  border: 1px solid var(--theme-primary, #00d2ff);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(0, 210, 255, 0.28), rgba(8, 16, 32, 0.92));
  color: #e8fbff;
  font-family: inherit;
  font-size: clamp(0.95rem, 1.6vw, 1.12rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 0 18px var(--theme-glow, rgba(0, 210, 255, 0.45)),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  text-shadow: 0 0 10px var(--theme-glow, rgba(0, 210, 255, 0.7));
}

.pwa-install-btn.hidden,
#btn-install-pwa.hidden,
#pwa-install-btn.hidden,
#install-app-btn.hidden {
  display: flex !important;
}

.pwa-install-btn:hover,
.pwa-install-btn:focus-visible,
#btn-install-pwa:hover,
#btn-install-pwa:focus-visible {
  border-color: #fff;
  background: linear-gradient(180deg, rgba(0, 210, 255, 0.48), rgba(10, 28, 48, 0.95));
  box-shadow:
    0 0 26px var(--theme-glow, rgba(0, 210, 255, 0.7)),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  outline: none;
}

.pwa-install-btn:active,
#btn-install-pwa:active {
  transform: scale(0.98);
}

.pwa-guide-modal .pwa-guide-panel {
  width: min(92vw, 420px);
  max-width: 420px;
  padding: 18px 18px 16px;
  border: 1px solid var(--theme-primary, #00d2ff);
  border-radius: 18px;
  background: rgba(8, 14, 28, 0.96);
  box-shadow: 0 0 32px var(--theme-glow, rgba(0, 210, 255, 0.4));
}

.pwa-guide-body {
  margin: 8px 0 16px;
  color: var(--ink, #f3fbff);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.55;
  text-align: center;
}

.pwa-guide-ok {
  width: 100%;
  min-height: 2.8rem;
  border: 1px solid var(--theme-primary, #00d2ff);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(0, 210, 255, 0.35), rgba(8, 16, 32, 0.9));
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 16px var(--theme-glow, rgba(0, 210, 255, 0.4));
}

.dad-duration-block {
  padding: 14px 14px 12px;
  border: 1px solid rgba(255, 214, 80, 0.38);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(42, 28, 8, 0.42), rgba(8, 16, 28, 0.72));
  box-shadow: 0 0 18px rgba(255, 214, 80, 0.16);
}

.dad-duration-block .row-title {
  color: #ffe08a;
  text-shadow: 0 0 12px rgba(255, 214, 80, 0.5);
}

.dad-duration-seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dad-duration-btn {
  min-height: 2.7rem;
  padding: 8px 6px;
  border: 1px solid rgba(255, 214, 80, 0.38);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(24, 16, 8, 0.9), rgba(8, 12, 20, 0.92));
  color: #ffe08a;
  font-family: inherit;
  font-size: clamp(0.78rem, 1.3vw, 0.92rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 214, 80, 0.12);
}

.dad-duration-btn:hover,
.dad-duration-btn:focus-visible {
  border-color: #ffe08a;
  outline: none;
  box-shadow: 0 0 16px rgba(255, 214, 80, 0.4);
}

.dad-duration-btn.is-on {
  color: #2a1804;
  background: linear-gradient(180deg, #ffe08a, #ffc24a);
  border-color: #ffe08a;
  box-shadow: 0 0 18px rgba(255, 214, 80, 0.55);
}

@media (max-width: 520px) {
  .dad-duration-btn {
    min-height: 2.45rem;
    font-size: 0.78rem;
    padding: 6px 4px;
  }
}

.row-title,
.toggle-name,
.slider-label {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.toggle-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 4rem;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #071018;
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  font-weight: 800;
  text-align: start;
  cursor: pointer;
}

.toggle-row:focus-visible {
  outline: 3px solid var(--neon);
  outline-offset: 2px;
}

.toggle-state {
  min-width: 2.8em;
  color: var(--muted);
  font-size: 0.95em;
  letter-spacing: 0.08em;
}

.toggle-row.is-on .toggle-state {
  color: var(--neon);
  text-shadow: 0 0 10px rgba(46, 230, 255, 0.6);
}

.switch {
  position: relative;
  width: 4.2rem;
  height: 2.2rem;
  border-radius: 999px;
  background: #1b2430;
  border: 2px solid var(--grid);
  flex-shrink: 0;
}

.knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.16s ease, background 0.16s ease;
}

.toggle-row.is-on .switch {
  background: var(--neon);
  border-color: #9af6ff;
  box-shadow: 0 0 14px rgba(46, 230, 255, 0.55);
}

.toggle-row.is-on .knob {
  transform: translateX(1.9rem);
  background: #071018;
}

.level-bg-auto-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 3.2rem;
  font-size: 0.88rem;
}

.level-bg-auto-toggle .toggle-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.88rem;
  line-height: 1.3;
  white-space: nowrap;
  word-break: keep-all;
}

.level-bg-auto-toggle .toggle-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.keep-default-bg-toggle .toggle-name {
  white-space: normal;
  word-break: keep-all;
  font-size: 0.86rem;
}

.keep-default-bg-toggle.is-board-hidden {
  display: none !important;
}

.bg-master-block {
  margin-bottom: 4px;
}

.master-bg-toggle {
  border: 1px solid rgba(255, 90, 110, 0.55);
  background: linear-gradient(180deg, rgba(52, 14, 22, 0.95), rgba(12, 8, 14, 0.92));
  box-shadow: 0 0 14px rgba(255, 70, 90, 0.18);
}

.master-bg-toggle .toggle-name {
  white-space: normal;
  word-break: keep-all;
  font-size: 0.88rem;
}

.master-bg-toggle.is-on {
  border-color: #ff6b7a;
  box-shadow: 0 0 18px rgba(255, 80, 100, 0.42);
}

.custom-bg-details.is-master-disabled {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.12);
}

.slider-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 12px;
  padding: 14px 14px 16px;
  border: 1px solid var(--neon-dim);
  border-radius: 14px;
  background: #071018;
}

.slider-row.is-disabled {
  opacity: 0.42;
}

.slider-label {
  font-size: clamp(1.1rem, 1.7vw, 1.3rem);
}

.slider-value {
  color: var(--accent);
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  min-width: 3.4em;
  text-align: right;
}

.slider-row.is-disabled .slider-value {
  color: var(--muted);
}

.ghost-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.ghost-preview-row .slider-row {
  flex: 1 1 auto;
  min-width: 0;
}

.ghost-preview-box {
  flex: 0 0 68px;
  width: 68px !important;
  height: 68px !important;
  padding: 4px;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
  opacity: 1 !important;
  visibility: visible !important;
  border: 1px solid rgba(0, 240, 255, 0.4) !important;
  border-radius: 8px !important;
  overflow: hidden;
  background: rgba(5, 12, 24, 0.85) !important;
  box-shadow:
    0 0 12px var(--theme-glow, rgba(0, 210, 255, 0.45)),
    inset 0 0 12px rgba(0, 20, 40, 0.45);
}

.ghost-preview-canvas,
#ghost-preview-canvas {
  display: block;
  width: 60px !important;
  height: 60px !important;
  image-rendering: auto;
  pointer-events: auto;
  opacity: 1 !important;
  visibility: visible !important;
}

.ghost-preview-row.is-disabled .ghost-preview-box,
.ghost-preview-row.is-disabled #ghost-preview-canvas,
.ghost-preview-row.is-disabled .ghost-preview-canvas {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto;
}

.profile-zoom-row .zoom-slider-wrap {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.profile-zoom-row .zoom-slider-wrap .big-slider {
  grid-column: auto;
  margin: 0;
}

.zoom-step-btn {
  width: 2.55rem;
  height: 2.55rem;
  flex-shrink: 0;
  border: 1px solid var(--neon-dim);
  border-radius: 12px;
  background: #0a1822;
  color: var(--accent);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(46, 230, 255, 0.18);
}

.zoom-step-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(46, 230, 255, 0.35);
}

.zoom-step-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.select-row {
  display: grid;
  gap: 10px;
  padding: 16px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #071018;
}

.preview-mode-row .setting-hint,
.block-skin-row .setting-hint,
.board-size-row .setting-hint {
  display: block;
  line-height: 1.45;
  white-space: normal;
}

#lang-select,
#select-language,
#start-level,
#select-preview-mode,
#select-block-skin,
#select-board-size {
  width: 100%;
  min-height: 3.6rem;
  padding: 0 14px;
  border: 2px solid var(--neon);
  border-radius: 12px;
  background: #101a28;
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 800;
  cursor: pointer;
}

.auto-record-toggle.toggle-row {
  min-height: 3.15rem;
  gap: 10px;
  padding: 8px 12px;
  font-size: 0.88rem;
}

.auto-record-toggle .toggle-name {
  white-space: nowrap;
  word-break: keep-all;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.88rem;
  line-height: 1.2;
  min-width: 0;
}

.auto-record-toggle .toggle-state {
  font-size: 0.85rem;
}

.auto-record-block .setting-hint {
  margin-top: 8px;
}

.garbage-lines-block {
  margin-top: 0;
}

.garbage-lines-block .slider-label {
  word-break: keep-all;
}

.drop-speed-block {
  margin-top: 0;
}

.handling-block {
  margin-top: 12px;
}

.handling-block .row-title {
  margin-bottom: 8px;
}

.drop-speed-block .slider-label {
  word-break: keep-all;
}

.drop-speed-row .slider-value,
#drop-speed-multiplier-value {
  min-width: 12.5em;
  white-space: nowrap;
  font-size: 0.88rem;
}

.setting-hint {
  color: var(--muted);
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  font-weight: 700;
  line-height: 1.35;
}

.asset-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.asset-badge.is-preset {
  color: #7cf0ff;
  background: rgba(46, 230, 255, 0.12);
  border: 1px solid rgba(46, 230, 255, 0.45);
}

.asset-badge.is-custom {
  color: #ffe0c2;
  background: rgba(255, 138, 61, 0.16);
  border: 1px solid rgba(255, 138, 61, 0.5);
}

.asset-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.level-bg-card .asset-actions .file-btn {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 2.4rem;
  padding: 8px 12px;
  font-size: 0.92rem;
}

.btn-delete-bg {
  appearance: none;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.4rem;
  min-height: 2.4rem;
  padding: 8px 12px;
  border: 1px solid #ff4d6d;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 62, 96, 0.48), rgba(42, 4, 12, 0.94));
  color: #ffe8ee;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(255, 48, 88, 0.42);
}

.btn-delete-bg.is-armed:not(:disabled) {
  border-color: #ff6b88;
  box-shadow: 0 0 18px rgba(255, 64, 100, 0.62);
}

.btn-delete-bg:hover:not(:disabled),
.btn-delete-bg:focus-visible:not(:disabled) {
  background: linear-gradient(180deg, rgba(255, 90, 120, 0.7), rgba(64, 6, 16, 0.96));
  box-shadow: 0 0 22px rgba(255, 70, 110, 0.78);
  outline: none;
}

.btn-delete-bg:disabled {
  opacity: 0.34;
  cursor: not-allowed;
  box-shadow: none;
  border-color: rgba(255, 77, 109, 0.28);
  color: #c9a0a8;
}


.bgm-track {
  padding: 10px 12px;
  color: var(--ink);
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  font-weight: 700;
  word-break: break-all;
  border-radius: 10px;
  background: rgba(46, 230, 255, 0.06);
}

.file-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.6rem;
  padding: 10px 14px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--neon), #7cf0ff);
  color: #071018;
  font-size: clamp(1.15rem, 1.8vw, 1.35rem);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(46, 230, 255, 0.35);
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.big-slider {
  grid-column: 1 / -1;
  width: 100%;
  height: 40px;
  margin: 4px 0 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
}

.big-slider:disabled {
  cursor: not-allowed;
}

.big-slider::-webkit-slider-runnable-track {
  height: 18px;
  border-radius: 999px;
  background: #1b2430;
  border: 2px solid var(--grid);
}

.big-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 40px;
  height: 40px;
  margin-top: -13px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff3e8;
  box-shadow: 0 0 14px rgba(255, 138, 61, 0.7);
}

.big-slider::-moz-range-track {
  height: 18px;
  border-radius: 999px;
  background: #1b2430;
  border: 2px solid var(--grid);
}

.big-slider::-moz-range-thumb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff3e8;
  box-shadow: 0 0 14px rgba(255, 138, 61, 0.7);
}

.save-btn {
  width: 100%;
  min-height: 4.2rem;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(90deg, var(--accent), #ffb068);
  color: #1a1008;
  font-family: inherit;
  font-size: clamp(1.25rem, 2.1vw, 1.55rem);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(255, 138, 61, 0.4);
}

.save-btn:hover,
.save-btn:focus-visible {
  filter: brightness(1.08);
  outline: none;
}

.settings-tabs {
  display: flex;
  flex-wrap: nowrap;
  flex-shrink: 0;
  align-items: stretch;
  gap: 6px;
  padding: 8px 16px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--neon-dim);
}

.best-card {
  cursor: pointer;
}

.best-card:focus-visible {
  outline: 3px solid var(--neon);
  outline-offset: 2px;
}

.name-input {
  width: 100%;
  min-height: 3.6rem;
  padding: 0 14px;
  border: 2px solid var(--neon);
  border-radius: 12px;
  background: #101a28;
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 800;
}

#input-player-nickname.player-nickname-input {
  max-width: 100%;
  letter-spacing: 0.02em;
}

.player-nickname-block {
  display: grid;
  gap: 8px;
}

.score-save-panel {
  width: min(560px, 92vw);
  padding: 28px 26px 24px;
  display: grid;
  gap: 14px;
  text-align: center;
}

.score-save-panel h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  text-shadow: 0 0 16px rgba(46, 230, 255, 0.45);
}

.score-save-lead {
  font-size: clamp(1.15rem, 1.8vw, 1.35rem);
  font-weight: 800;
}

.score-save-summary {
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(255, 138, 61, 0.4);
}

.ghost-btn {
  width: 100%;
  min-height: 3.4rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #071018;
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  font-weight: 800;
  cursor: pointer;
}

.ghost-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ghost-btn.danger {
  color: #ff8a8a;
  border-color: rgba(255, 90, 90, 0.45);
}

.hall-panel {
  width: min(760px, 94vw);
  max-height: min(92vh, 980px);
}

.hall-list {
  padding: 12px 22px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.hall-empty {
  padding: 28px 10px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--muted);
}

.hall-row {
  display: grid;
  grid-template-columns: 3.2rem 4.2rem 1fr auto;
  gap: 8px 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #071018;
}

.hall-sync-status {
  margin: 0 0 10px;
  padding: 0 4px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.35;
}

.hall-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 12px;
}

.hall-tab {
  min-height: 2.6rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #071018;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: box-shadow 0.28s ease, border-color 0.28s ease, color 0.28s ease, background 0.28s ease;
}

.hall-tab.is-on {
  color: #071018;
  background: linear-gradient(90deg, var(--neon), #7cf0ff);
  border-color: var(--neon);
  box-shadow: 0 0 16px var(--theme-glow, rgba(0, 210, 255, 0.45));
  animation: hall-tab-neon 0.42s ease-out;
}

@keyframes hall-tab-neon {
  0% { transform: scale(0.97); filter: brightness(1.55); }
  100% { transform: scale(1); filter: brightness(1); }
}

.hall-flag {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
  text-align: center;
}

.hall-row.rank-1 {
  border-color: #ffd400;
  box-shadow: 0 0 16px rgba(255, 212, 0, 0.28);
}

.hall-row.rank-2 {
  border-color: #cfd8e3;
  box-shadow: 0 0 14px rgba(207, 216, 227, 0.2);
}

.hall-row.rank-3 {
  border-color: #e07a3a;
  box-shadow: 0 0 14px rgba(224, 122, 58, 0.22);
}

.hall-rank {
  font-size: 1.45rem;
  font-weight: 800;
  text-align: center;
}

.hall-name {
  font-size: clamp(1.1rem, 1.7vw, 1.3rem);
  font-weight: 800;
}

.hall-meta {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.hall-score {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 800;
  color: var(--accent);
  text-align: right;
}

.hall-del {
  grid-column: 1 / -1;
  justify-self: end;
  min-height: 2.4rem;
  padding: 4px 12px;
  border: 1px solid rgba(255, 90, 90, 0.4);
  border-radius: 999px;
  background: transparent;
  color: #ff8a8a;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
}

.hall-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ranking-notice {
  margin: 8px 0 0;
  padding: 0 8px;
  font-size: 0.72rem;
  line-height: 1.45;
  letter-spacing: 0.01em;
  text-align: center;
  color: #9aa8b8;
  opacity: 0.75;
  font-weight: 600;
}

.rank-submit-box .ranking-notice {
  margin-top: 8px;
}

.rank-share-card,
#rank-share-card,
#rank-share-card[hidden],
.rank-share-card[hidden] {
  display: none !important;
  position: absolute !important;
  left: -99999px !important;
  top: auto !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

.settings-tab {
  flex: 1 0 auto;
  min-width: fit-content;
  min-height: 2.8rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #071018;
  color: var(--muted);
  font-family: inherit;
  font-size: clamp(0.8rem, 1.15vw, 0.98rem);
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.settings-tab.is-on {
  color: #071018;
  background: linear-gradient(90deg, var(--neon), #7cf0ff);
  border-color: #9af6ff;
  box-shadow: 0 0 14px rgba(46, 230, 255, 0.4);
}

.url-input {
  width: 100%;
  min-height: 3.4rem;
  padding: 0 14px;
  border: 2px solid var(--neon-dim);
  border-radius: 12px;
  background: #101a28;
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(1.05rem, 1.6vw, 1.22rem);
  font-weight: 700;
}

.url-input:focus {
  outline: 3px solid var(--neon);
  outline-offset: 2px;
}

.level-bg-hint {
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--neon-dim);
  background: rgba(46, 230, 255, 0.08);
}

.bg-scope-toggle {
  margin-bottom: 10px;
  border-color: rgba(125, 211, 252, 0.45);
}

.bg-scope-btn {
  font-size: 0.88rem;
}

.bg-target-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--neon-dim);
  border-radius: 16px;
  background: rgba(6, 12, 22, 0.88);
  box-shadow: inset 0 0 18px rgba(0, 210, 255, 0.08);
}

.bg-target-btn {
  appearance: none;
  min-height: 2.6rem;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  white-space: normal;
  line-height: 1.25;
}

.bg-target-btn.is-on {
  color: #071018;
  background: linear-gradient(90deg, var(--neon), #7cf0ff);
  box-shadow: 0 0 16px rgba(46, 230, 255, 0.4);
}

.board-bg-fx {
  display: grid;
  gap: 8px;
}

.board-bg-fx-sliders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  align-items: end;
}

.board-bg-fx.is-window-mode {
  display: none;
}

.window-bg-fx.is-board-hidden {
  display: none !important;
}


#bg-slot-status-title,
.level-bg-list {
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#bg-slot-status-title.is-switching,
.level-bg-list.is-switching {
  opacity: 0.28;
  transform: translateY(8px);
}

.level-bg-list {
  display: grid;
  gap: 12px;
}

.bulk-bg-radio.is-on,
.bulk-radio-btn.is-on {
  border-color: rgba(46, 230, 255, 0.7);
  box-shadow: 0 0 14px rgba(46, 230, 255, 0.22);
  background: rgba(12, 36, 48, 0.88);
}

@media (min-width: 900px) {
  .level-bg-list {
    grid-template-columns: 1fr 1fr;
  }
}

.level-bg-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #071018;
}

.level-bg-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 12px;
  align-items: center;
}

.level-bg-title {
  font-size: clamp(1.05rem, 1.7vw, 1.22rem);
  font-weight: 800;
}

.level-bg-file {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
  word-break: break-all;
}

.level-bg-card-default {
  border-color: rgba(46, 230, 255, 0.55);
  box-shadow: 0 0 18px rgba(46, 230, 255, 0.16);
}

.bulk-bg-card {
  margin-bottom: 14px;
  background:
    linear-gradient(180deg, rgba(10, 28, 42, 0.72), rgba(5, 12, 20, 0.88)),
    rgba(7, 16, 24, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.bulk-bg-head {
  display: grid;
  gap: 4px;
}

.bulk-bg-target,
.bulk-target-group {
  display: grid;
  gap: 8px;
}

@media (min-width: 720px) {
  .bulk-bg-target,
  .bulk-target-group {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.bulk-bg-radio,
.bulk-radio-btn,
.bulk-option-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px !important;
  padding: 6px 8px !important;
  text-align: center;
  border: 1px solid rgba(46, 230, 255, 0.28);
  border-radius: 12px;
  background: rgba(6, 14, 22, 0.72);
  color: var(--text, #e8fbff);
  font-weight: 700;
  cursor: pointer;
}

.bulk-bg-radio:has(input:checked),
.bulk-radio-btn:has(input:checked),
.bulk-option-card:has(input:checked) {
  border-color: rgba(46, 230, 255, 0.7);
  box-shadow: 0 0 14px rgba(46, 230, 255, 0.22);
  background: rgba(12, 36, 48, 0.88);
}

.bulk-bg-radio span,
.bulk-radio-btn span,
.bulk-option-card span {
  display: inline-block;
  font-size: 0.74rem !important;
  line-height: 1.25 !important;
  word-break: keep-all !important;
  white-space: normal !important;
  text-align: center;
}

.bulk-bg-radio input[type="radio"],
.bulk-radio-btn input[type="radio"],
.bulk-option-card input[type="radio"],
.bulk-bg-radio .custom-radio,
.bulk-radio-btn .custom-radio,
.bulk-option-card .custom-radio {
  margin: 0 6px 0 0;
  flex-shrink: 0;
  accent-color: #2ee6ff;
}

.bulk-bg-actions {
  flex-wrap: wrap;
}

#btn-bulk-select-files.file-btn {
  width: 100%;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}

#bulk-bg-file-input {
  display: none !important;
}

.file-btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.bulk-upload-status-box,
#bulk-upload-status-box {
  display: grid;
  gap: 4px;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 240, 255, 0.42);
  border-radius: 12px;
  background: rgba(4, 16, 28, 0.72);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.18);
}

.bulk-upload-status-box[hidden],
#bulk-upload-status-box[hidden] {
  display: none !important;
}

.bulk-progress-shell {
  height: 10px;
  padding: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(8, 18, 28, 0.92);
  border: 1px solid rgba(0, 240, 255, 0.35);
  box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.12);
}

#bulk-progress-bar {
  display: block;
  width: 0%;
  height: 6px;
  border-radius: 3px;
  background: #00f0ff;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
  transition: width 0.2s ease;
}

#bulk-status-text {
  font-size: 0.76rem;
  color: #a5f3fc;
  margin-top: 6px;
  line-height: 1.4;
  word-break: keep-all;
}

#bulk-preview-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  max-height: 80px;
  overflow-y: auto;
}

#bulk-preview-grid img,
.bulk-preview-thumb {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  border: 1px solid rgba(0, 240, 255, 0.4);
  object-fit: cover;
  background: #05070c;
  flex: 0 0 40px;
}

#bulk-preview-grid img.is-fail,
.bulk-preview-thumb.is-fail {
  border-color: rgba(255, 90, 120, 0.7);
  opacity: 0.55;
}

.bulk-bg-progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.bulk-bg-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(8, 18, 28, 0.9);
  border: 1px solid rgba(46, 230, 255, 0.28);
}

.bulk-bg-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--neon, #2ee6ff), #7cf0ff);
  box-shadow: 0 0 12px rgba(46, 230, 255, 0.45);
  transition: width 0.2s ease;
}

.bulk-bg-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bulk-bg-thumbs[hidden] {
  display: none !important;
}

.bulk-bg-thumb-item {
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(46, 230, 255, 0.22);
  border-radius: 10px;
  background: rgba(5, 10, 16, 0.72);
}

.bulk-bg-thumb-item img {
  display: block;
  width: 100%;
  height: 52px;
  object-fit: cover;
  border-radius: 7px;
  background: #05070c;
}

.bulk-bg-thumb-slot,
.bulk-bg-thumb-state {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  word-break: break-all;
}

.bulk-bg-thumb-state.is-ok {
  color: #7cffb2;
}

.bulk-bg-thumb-state.is-fail {
  color: #ff8aa0;
}

.bulk-bg-thumb-state.is-wait {
  color: var(--muted);
}

.level-bg-card-default.is-board-hidden,
[data-level-bg="default"].is-board-hidden,
.board-idle-bg-card.is-window-hidden,
#board-idle-bg-card.is-window-hidden {
  display: none !important;
}

.board-idle-bg-card,
#board-idle-bg-card {
  border-color: rgba(46, 230, 255, 0.55);
  background:
    linear-gradient(180deg, rgba(10, 28, 42, 0.72), rgba(5, 12, 20, 0.88)),
    rgba(7, 16, 24, 0.82);
  box-shadow: 0 0 18px rgba(46, 230, 255, 0.16);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

#board-idle-bg-preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#board-idle-bg-preview.hidden {
  display: none;
}

.btn-danger-subtle {
  appearance: none;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.4rem;
  min-height: 2.4rem;
  padding: 8px 12px;
  border: 1px solid #ff4d6d;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 62, 96, 0.48), rgba(42, 4, 12, 0.94));
  color: #ffe8ee;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(255, 48, 88, 0.42);
}

.btn-danger-subtle.is-armed:not(:disabled) {
  border-color: #ff6b88;
  box-shadow: 0 0 18px rgba(255, 64, 100, 0.62);
}

.btn-danger-subtle:hover:not(:disabled),
.btn-danger-subtle:focus-visible:not(:disabled) {
  filter: brightness(1.08);
}

.btn-danger-subtle:disabled {
  opacity: 0.42;
  cursor: default;
  box-shadow: none;
}

.level-bg-caption {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
}

.level-play-bg-title {
  margin: 6px 2px 0;
}

.level-bg-thumb {
  width: 112px;
  height: 63px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--neon-dim);
  background:
    radial-gradient(circle at 50% 28%, rgba(46, 230, 255, 0.16), transparent 58%),
    #05070c;
  box-shadow: inset 0 0 12px rgba(46, 230, 255, 0.12);
}

.level-bg-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.level-bg-thumb img.hidden {
  display: none;
}

.video-slot {
  display: grid;
  gap: 10px;
  padding: 16px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #071018;
}

.video-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}

.event-video-size-badge {
  display: block;
  margin: 10px 0 4px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 196, 72, 0.55);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 186, 48, 0.18), rgba(40, 22, 4, 0.72));
  color: #ffe9a8;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: -0.2px;
  text-shadow: 0 0 10px rgba(255, 210, 90, 0.35);
}

.video-slot-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.video-slot-actions .video-status {
  flex: 1 1 8rem;
  margin: 0;
  min-width: 0;
}

.video-slot-actions .preview-btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.btn-delete-video {
  appearance: none;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.4rem;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #ff4b4b;
  border-radius: 6px;
  background: rgba(255, 75, 75, 0.08);
  color: #ff4b4b;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
}

.btn-delete-video[hidden] {
  display: none !important;
}

.btn-delete-video:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-delete-video:hover:not(:disabled),
.btn-delete-video:focus-visible:not(:disabled) {
  background: rgba(255, 75, 75, 0.18);
  outline: none;
}

.video-title,
.media-card-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.3;
  white-space: nowrap;
  word-break: keep-all;
}

.video-title {
  color: #00ffff;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.95),
    0 0 15px rgba(0, 255, 255, 0.85),
    0 0 28px rgba(0, 255, 255, 0.55);
}

.video-slot-head .preview-btn {
  flex-shrink: 0;
  min-height: 2.4rem;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.preview-btn {
  flex-shrink: 0;
  min-height: 3.1rem;
  padding: 8px 14px;
  border: 1px solid #9af6ff;
  border-radius: 12px;
  background: #071018;
  color: #fff;
  font-family: inherit;
  font-size: clamp(1.02rem, 1.5vw, 1.15rem);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.28);
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.9),
    0 0 15px rgba(0, 255, 255, 0.7);
}

.preview-btn:hover,
.preview-btn:focus-visible {
  background: rgba(0, 255, 255, 0.12);
  outline: none;
}

.goal-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 12px;
  padding: 14px;
  border: 1px solid var(--neon-dim);
  border-radius: 14px;
  background: #050b14;
}

.score-input {
  width: 8.6em;
  min-height: 3.2rem;
  padding: 0 10px;
  border: 2px solid #00ffff;
  border-radius: 12px;
  background: #101a28;
  color: #fff;
  font-family: inherit;
  font-size: clamp(1.2rem, 1.9vw, 1.45rem);
  font-weight: 800;
  text-align: right;
}

.goal-row .big-slider,
.goal-row .setting-hint {
  grid-column: 1 / -1;
}

.tab-panel[data-tab-panel="videos"] .toggle-name,
.tab-panel[data-tab-panel="videos"] .slider-label,
.tab-panel[data-tab-panel="videos"] .setting-hint,
.tab-panel[data-tab-panel="videos"] .video-status {
  color: #f7fbff;
  font-weight: 800;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.9),
    0 0 15px rgba(0, 255, 255, 0.7),
    0 0 24px rgba(0, 255, 255, 0.4);
}

.tab-panel[data-tab-panel="videos"] .toggle-name,
.setting-bgm .toggle-name {
  font-size: 0.92rem;
  letter-spacing: -0.5px;
  white-space: nowrap;
  word-break: keep-all;
}

.video-status {
  font-size: clamp(1.05rem, 1.6vw, 1.22rem);
  line-height: 1.4;
  word-break: break-all;
}

.video-status.is-ready {
  color: #fff6e8;
}

.celebrate-modal {
  z-index: 60;
}

#score-save-modal,
#hall-modal {
  z-index: 70;
}

.celebrate-panel {
  width: min(920px, 94vw);
  padding: 22px 24px 24px;
  gap: 16px;
}

.celebrate-message {
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  font-weight: 800;
  text-align: center;
  line-height: 1.35;
  text-shadow: 0 0 20px rgba(46, 230, 255, 0.45);
}

.celebrate-stage {
  position: relative;
  width: 100%;
  min-height: 220px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #05080f;
  box-shadow: 0 0 28px rgba(46, 230, 255, 0.18);
}

.celebrate-video,
.celebrate-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.celebrate-fallback {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  text-align: center;
  padding: 24px;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #f3fbff;
  text-shadow: 0 0 18px rgba(46, 230, 255, 0.55);
  background:
    radial-gradient(circle at 50% 30%, rgba(46, 230, 255, 0.28), transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(255, 138, 61, 0.24), transparent 45%),
    #071018;
}

.celebrate-stage.is-fallback .celebrate-fallback {
  display: grid;
}

.celebrate-stage.is-fallback .celebrate-video,
.celebrate-stage.is-fallback .celebrate-frame {
  display: none;
}

@media (max-width: 820px) {
  .stage {
    flex-direction: column;
    align-items: center;
    height: auto;
  }

  .sidebar {
    width: min(92vw, 420px);
    height: auto;
    overflow: visible;
  }

  .sidebar-dock {
    margin-top: 4px;
  }

  .settings-modal {
    justify-content: center;
    align-items: center;
    padding: 12px;
  }

  #settings-modal .modal-panel,
  #settings-modal .modal-content,
  .settings-modal .modal-panel {
    width: 92%;
    max-width: 560px;
    height: auto;
    max-height: 88vh;
  }
}

.mobile-controls {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: calc(var(--mobile-pad-h) + env(safe-area-inset-bottom, 0px));
  min-height: calc(112px + env(safe-area-inset-bottom, 0px));
  max-height: calc(156px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background:
    linear-gradient(180deg, rgba(8, 14, 24, 0.18), rgba(6, 12, 22, 0.86));
  border-top: 1px solid rgba(46, 230, 255, 0.32);
  box-shadow:
    0 -10px 32px rgba(0, 0, 0, 0.38),
    0 0 28px rgba(46, 230, 255, 0.12);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body.is-mobile-pad .mobile-controls {
  display: flex;
}

body.is-mobile-pad .mobile-controls.hidden {
  display: none;
}

.mobile-pad {
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  gap: 10px;
  padding: 8px;
  border-radius: 20px;
  background: rgba(8, 16, 28, 0.42);
  border: 1px solid rgba(46, 230, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.mobile-pad-move {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mobile-pad-action {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.is-dad-special .mobile-pad-action {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pad-btn {
  appearance: none;
  -webkit-appearance: none;
  width: clamp(52px, 13vw, 68px);
  height: clamp(52px, 13vw, 68px);
  min-width: 48px;
  min-height: 48px;
  border-radius: 18px;
  border: 1px solid rgba(46, 230, 255, 0.48);
  background: linear-gradient(180deg, rgba(24, 42, 64, 0.82), rgba(8, 14, 24, 0.78));
  color: #e8fbff;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 0 12px rgba(46, 230, 255, 0.16);
  transition: box-shadow 0.08s ease, border-color 0.08s ease, transform 0.08s ease, background 0.08s ease;
}

.pad-btn:focus {
  outline: none;
}

.pad-btn:focus-visible {
  border-color: #7cf0ff;
}

.pad-btn.is-on,
.pad-btn:active {
  border-color: #9af6ff;
  background: linear-gradient(180deg, rgba(46, 230, 255, 0.46), rgba(10, 36, 52, 0.9));
  box-shadow:
    0 0 22px rgba(46, 230, 255, 0.72),
    inset 0 0 16px rgba(46, 230, 255, 0.28);
  transform: scale(0.96);
  color: #fff;
}

.pad-btn-drop.is-on,
.pad-btn-drop:active {
  border-color: #ffe08a;
  background: linear-gradient(180deg, rgba(255, 214, 80, 0.42), rgba(42, 28, 8, 0.9));
  box-shadow: 0 0 22px rgba(255, 214, 80, 0.65);
}

.pad-btn-hold.is-on,
.pad-btn-hold:active {
  border-color: #d4a8ff;
  background: linear-gradient(180deg, rgba(168, 85, 255, 0.4), rgba(28, 10, 42, 0.9));
  box-shadow: 0 0 22px rgba(168, 85, 255, 0.55);
}

.pad-btn-hold:disabled,
.pad-btn-hold.is-disabled,
body.preview-mode-dual .pad-btn-hold {
  opacity: 0.38;
  cursor: not-allowed;
  filter: grayscale(0.35);
  pointer-events: none;
  box-shadow: none;
}

body.preview-mode-dual #hold-card.is-locked {
  opacity: 1;
}

.pad-btn-freeze,
.btn-timestop {
  width: clamp(52px, 13vw, 68px);
  height: clamp(52px, 13vw, 68px);
  border-color: rgba(255, 214, 80, 0.72);
  color: #ffe08a;
  background: linear-gradient(180deg, rgba(64, 42, 12, 0.92), rgba(18, 12, 4, 0.9));
  box-shadow:
    0 0 16px rgba(255, 214, 80, 0.45),
    inset 0 0 10px rgba(255, 214, 80, 0.18);
}

.pad-btn-freeze.is-on,
.pad-btn-freeze:active,
.btn-timestop.is-on,
.btn-timestop:active {
  border-color: #ffe08a;
  color: #fff6c8;
  background: linear-gradient(180deg, rgba(255, 196, 72, 0.55), rgba(42, 24, 4, 0.92));
  box-shadow: 0 0 24px rgba(255, 214, 80, 0.78);
}

.btn-timestop.hidden {
  display: none;
}

body.is-mobile-pad {
  --mobile-pad-h: 124px;
  overflow: hidden;
  overscroll-behavior: none;
  height: 100dvh;
  max-height: 100dvh;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body.is-mobile-pad .app {
  height: 100%;
  max-height: 100dvh;
  padding-bottom: calc(var(--mobile-pad-h) + env(safe-area-inset-bottom, 0px) + var(--mobile-board-gap, 8px));
}


@media (max-width: 420px) {
  .pad-btn,
  .pad-btn-freeze,
  .btn-timestop {
    width: clamp(48px, 14vw, 58px);
    height: clamp(48px, 14vw, 58px);
    font-size: 1.35rem;
    border-radius: 16px;
  }

  .mobile-pad {
    gap: 8px;
    padding: 6px;
  }

  body.is-mobile-pad {
    --mobile-pad-h: 96px;
  }

  #hold,
  #next {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    margin: 0 auto !important;
  }
}

@media (min-width: 769px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
  }

  .header-full-divider,
  .brand-bar,
  .theme-separator,
  .header-divider,
  #profile-separator {
    width: 100% !important;
    margin: 0 0 6px !important;
  }

  .tagline {
    margin-bottom: 4px;
  }

  .game-actions,
  .hud-control-grid,
  #hud-control-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .hud-row-main,
  .action-row-main,
  .hud-row-utility,
  .utility-btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }

  .hud-stats-row,
  .stats-dashboard,
  .top-dashboard,
  #stats-panel,
  #top-info-bar {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    align-items: stretch !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    flex-shrink: 0;
  }

  .hold-next-container {
    display: contents;
  }

  #block-guide-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }

  #next-card,
  #hold-card,
  .preview-panel {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    padding: 8px !important;
    grid-column: auto;
    grid-row: auto;
    flex: none !important;
  }

  .hud-stats-row > .stat-grid,
  #stats-panel > .stat-grid,
  #stats-bar-row,
  #top-info-bar > .stat-grid,
  .scoreboard-2x2 {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    grid-column: auto;
    grid-row: auto;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: 1fr 1fr !important;
  }

  .hud-util-stack,
  .header-util-stack,
  .header-buttons,
  .nav-buttons {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    align-items: flex-end !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    bottom: auto !important;
    inset: auto !important;
    margin: 0 2px 0 0 !important;
    transform: none !important;
    float: none !important;
  }

  .header-top-row {
    padding: 0 6px 8px 2px !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
  }

  .dad-speed-row,
  .utility-btn-group {
    gap: 8px;
  }

  .autoplay-speed-row,
  .ai-speed-panel {
    margin: 0;
    padding: 3px 8px 4px;
  }

  .stat-grid {
    gap: 9px;
  }

  .card {
    margin: 0;
    padding: 7px 9px 8px;
  }

  .hold-next-container {
    gap: 9px;
    margin: 0;
  }

  .next-card,
  .hold-card,
  .preview-panel {
    margin: 0;
    padding: 4px !important;
  }

  #next,
  #hold {
    margin: 0 auto !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    aspect-ratio: 1 / 1 !important;
  }

  .help {
    margin: 0;
    padding: 8px 10px 8px;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .help ul {
    margin-top: 0;
    gap: 0;
    font-size: 0.8rem;
    line-height: 1.22;
  }

  .sidebar-dock {
    margin-top: 0;
    margin-bottom: 0;
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
}

@media (min-width: 769px) {
  .stage,
  .game-layout {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: stretch !important;
    height: 100% !important;
    max-height: none !important;
    gap: 16px !important;
  }

  .board-wrap,
  #board-wrap {
    order: 1;
  }

  .sidebar,
  #sidebar-container {
    order: 2;
  }

  .board-wrap,
  .sidebar {
    align-self: stretch;
    height: 100%;
    max-height: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 4px;
    justify-content: space-between;
    height: 100%;
  }

  .sidebar-dock {
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 4px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 5px;
    overflow: hidden;
  }

  .help,
  #controls-guide {
    flex: 1 1 auto !important;
    height: auto;
    min-height: 0;
    margin-bottom: 0;
    padding: 8px 12px !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    border-width: 2px;
  }
}

.guide-modal {
  z-index: 42;
}

.guide-modal:not(.hidden) .modal-backdrop {
  animation: guideFadeIn 0.28s ease-out;
}

.guide-modal:not(.hidden) .guide-panel {
  animation: guidePopIn 0.34s cubic-bezier(0.16, 0.84, 0.32, 1);
}

.guide-panel {
  width: min(860px, 96vw);
  max-height: min(92vh, 920px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(18, 30, 52, 0.72), rgba(6, 10, 20, 0.88));
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  border: 1px solid rgba(255, 214, 80, 0.38);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 36px rgba(255, 214, 80, 0.18),
    0 24px 80px rgba(0, 0, 0, 0.55);
}

.guide-lead {
  margin-top: 6px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.55;
}

.guide-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 6px;
  padding: 10px 18px 0;
  flex-shrink: 0;
}

.guide-tabs-viz {
  margin: 0 12px;
  padding: 8px 10px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(8, 16, 28, 0.38));
  border: 1px solid rgba(124, 240, 255, 0.2);
  backdrop-filter: blur(18px) saturate(1.45);
  -webkit-backdrop-filter: blur(18px) saturate(1.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.guide-tabs-viz .guide-tab {
  flex: 1 1 calc(20% - 6px);
  min-width: 5.8rem;
  gap: 2px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.guide-panel-page {
  animation: guideChapterIn 0.28s ease;
}

@keyframes guideChapterIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .guide-panel-page {
    animation: none;
  }
}

.guide-piece-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}

.guide-piece {
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-weight: 900;
  color: #071018;
  box-shadow: 0 0 12px rgba(46, 230, 255, 0.22);
}

.guide-piece[data-piece="I"] { background: #2ee6ff; }
.guide-piece[data-piece="O"] { background: #ffe08a; }
.guide-piece[data-piece="T"] { background: #c084fc; }
.guide-piece[data-piece="S"] { background: #4ade80; }
.guide-piece[data-piece="Z"] { background: #fb7185; }
.guide-piece[data-piece="J"] { background: #60a5fa; }
.guide-piece[data-piece="L"] { background: #fb923c; }

.guide-duo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.guide-duo-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 214, 80, 0.28);
  background: rgba(255, 255, 255, 0.05);
  font-weight: 800;
}

.guide-tab-ico {
  font-size: 1.05rem;
  line-height: 1;
}

.guide-tabs-viz .guide-tab.is-on {
  transform: translateY(-1px);
}

.guide-tab {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1 1 calc(14% - 6px);
  min-width: 5.4rem;
  min-height: 2.7rem;
  height: auto;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(7, 16, 24, 0.88);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  word-break: keep-all;
  box-sizing: border-box;
}

.guide-tab-sub {
  display: block;
  font-size: 0.75em;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0.85;
}

.guide-tab.is-on {
  color: #071018;
  background: linear-gradient(90deg, #2ee6ff, #7cf0ff);
  border-color: #9af6ff;
  box-shadow: 0 0 16px rgba(46, 230, 255, 0.4);
}

.guide-tab[data-guide-tab="dad"] {
  border-color: rgba(255, 214, 80, 0.42);
  color: #ffe08a;
}

.guide-tab[data-guide-tab="dad"].is-on {
  color: #2a1804;
  background: linear-gradient(90deg, #ffe08a, #ffc24a);
  border-color: #ffe08a;
  box-shadow: 0 0 16px rgba(255, 214, 80, 0.45);
}

.guide-tab[data-guide-tab="skins"] {
  border-color: rgba(46, 230, 255, 0.42);
  color: #9af6ff;
}

.guide-tab[data-guide-tab="skins"].is-on {
  color: #071018;
  background: linear-gradient(90deg, #7ef0ff, #c4b5fd);
  border-color: #9af6ff;
  box-shadow: 0 0 16px rgba(46, 230, 255, 0.4);
}

.guide-tab[data-guide-tab="board"] {
  border-color: rgba(255, 176, 80, 0.45);
  color: #ffd39a;
}

.guide-tab[data-guide-tab="board"].is-on {
  color: #2a1804;
  background: linear-gradient(90deg, #ffd39a, #ffb14a);
  border-color: #ffd39a;
  box-shadow: 0 0 16px rgba(255, 176, 80, 0.4);
}

.guide-tab[data-guide-tab="media"],
.guide-tab[data-guide-tab="custom"] {
  border-color: rgba(168, 85, 247, 0.42);
  color: #e9c6ff;
}

.guide-tab[data-guide-tab="media"].is-on,
.guide-tab[data-guide-tab="custom"].is-on {
  color: #1a0824;
  background: linear-gradient(90deg, #e9c6ff, #c084fc);
  border-color: #e9c6ff;
  box-shadow: 0 0 16px rgba(192, 132, 252, 0.4);
}

.guide-tab[data-guide-tab="bulk"] {
  border-color: rgba(255, 196, 90, 0.45);
}

.guide-tab[data-guide-tab="bulk"].is-on {
  color: #1a1206;
  background: linear-gradient(90deg, #ffc45a, #ffe39a);
}

.guide-tab[data-guide-tab="lang"] {
  border-color: rgba(130, 210, 255, 0.45);
}

.guide-tab[data-guide-tab="lang"].is-on {
  color: #071018;
  background: linear-gradient(90deg, #82d2ff, #d4f0ff);
}

.guide-tab[data-guide-tab="system"] {
  border-color: rgba(46, 230, 255, 0.42);
  color: #9af6ff;
}

.guide-tab[data-guide-tab="system"].is-on {
  color: #071018;
  background: linear-gradient(90deg, #2ee6ff, #7cf0ff);
  border-color: #9af6ff;
  box-shadow: 0 0 16px rgba(46, 230, 255, 0.4);
}

.guide-body {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 214, 80, 0.7) rgba(8, 16, 28, 0.45);
  padding: 16px 20px 28px;
  outline: none;
}

.guide-body::-webkit-scrollbar {
  width: 10px;
}

.guide-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe08a, #ffc24a);
  box-shadow: 0 0 10px rgba(255, 214, 80, 0.45);
}

.guide-body::-webkit-scrollbar-track {
  background: rgba(8, 16, 28, 0.45);
}

.guide-panel-page {
  display: grid;
  gap: 14px;
  padding-bottom: 8px;
  animation: guidePageIn 0.28s ease;
}

@keyframes guidePageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.guide-card-system .guide-diag-core-list {
  margin: 8px 0 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 6px;
}

.guide-card {
  padding: 16px 18px 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(8, 16, 28, 0.42));
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 10px 28px rgba(0, 0, 0, 0.28);
}

.guide-card h3 {
  display: block;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0 0 12px;
  padding: 8px 14px;
  border-radius: 14px;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.45;
  color: #2a1804;
  background: linear-gradient(90deg, #fff4c4, #ffe08a 40%, #ffc24a);
  border: 1px solid rgba(255, 248, 210, 0.7);
  box-shadow:
    0 0 18px rgba(255, 214, 80, 0.55),
    0 0 2px #ffe08a;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.guide-badge {
  display: inline-block;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0 0 12px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.4;
  color: #2a1804;
  background: linear-gradient(90deg, #ffe08a, #ffc24a);
  border: 1px solid rgba(255, 248, 210, 0.85);
  box-shadow:
    0 0 20px rgba(255, 214, 80, 0.7),
    0 0 4px #ffe08a;
  word-break: keep-all;
}

.guide-hero-tag {
  color: #ffe08a !important;
  font-size: 1.18rem !important;
  line-height: 1.6 !important;
  text-shadow: 0 0 14px rgba(255, 214, 80, 0.55);
}

.guide-card-dad {
  border-color: rgba(255, 214, 80, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 214, 80, 0.14), rgba(8, 16, 28, 0.5));
  box-shadow:
    0 0 0 1px rgba(255, 214, 80, 0.12) inset,
    0 0 22px rgba(255, 214, 80, 0.16);
}

.guide-card-dad .guide-copy {
  color: #fff4c4;
}

.guide-card-memory {
  border-color: rgba(192, 132, 252, 0.45);
  background:
    linear-gradient(180deg, rgba(192, 132, 252, 0.16), rgba(8, 16, 28, 0.5));
  box-shadow:
    0 0 0 1px rgba(232, 198, 255, 0.12) inset,
    0 0 22px rgba(168, 85, 247, 0.18);
}

.guide-card-memory h3 {
  color: #1a0824;
  background: linear-gradient(90deg, #e9c6ff, #c084fc);
  border: 1px solid rgba(255, 236, 255, 0.75);
}

.guide-memory-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
  color: #f4e8ff;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.7;
}

.guide-card-system {
  border-color: rgba(46, 230, 255, 0.45);
  background:
    linear-gradient(180deg, rgba(46, 230, 255, 0.14), rgba(8, 16, 28, 0.5));
  box-shadow:
    0 0 0 1px rgba(154, 246, 255, 0.12) inset,
    0 0 22px rgba(46, 230, 255, 0.18);
}

.guide-card-system h3 {
  color: #071018;
}

.guide-card-theme {
  border-color: rgba(192, 132, 252, 0.4);
  background:
    linear-gradient(180deg, rgba(0, 210, 255, 0.1), rgba(8, 16, 28, 0.5));
}

.guide-theme-dots {
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.guide-theme-dots .theme-swatch {
  width: 1.7rem;
  height: 1.7rem;
  cursor: default;
}

.guide-dad-hero h4 {
  margin: 8px 0 6px;
  font-size: 1.05rem;
  color: #ffe08a;
  letter-spacing: 0.02em;
}

.guide-dad-step .guide-copy + .guide-copy {
  margin-top: 8px;
}

.guide-dad-tip {
  margin-top: 10px !important;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(42, 24, 4, 0.45);
  border: 1px solid rgba(255, 214, 80, 0.28);
  color: #ffe08a !important;
  font-size: 1.02rem;
  line-height: 1.65;
  text-shadow: 0 0 10px rgba(255, 214, 80, 0.4);
}

.guide-copy {
  color: #d7eef6;
  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.guide-key-list {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-top: 6px;
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.55;
}

.guide-key-list li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(6, 14, 24, 0.45);
  border: 1px solid rgba(46, 230, 255, 0.12);
  word-break: keep-all;
}

.guide-key-list li.is-gold,
.guide-key-list li.is-gold span {
  color: #ffe08a;
}

.guide-key-list li.is-gold {
  border-color: rgba(255, 214, 80, 0.4);
  background: rgba(42, 24, 4, 0.42);
  box-shadow: 0 0 14px rgba(255, 214, 80, 0.18);
}

.guide-sep {
  color: var(--muted);
  font-weight: 800;
}

.guide-key-list kbd {
  min-width: 1.75em;
  padding: 5px 10px;
  font-size: 1.05em;
  border-radius: 8px;
  box-shadow:
    0 0 12px rgba(46, 230, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.guide-duration-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.guide-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2.15rem;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 80, 0.4);
  background: rgba(18, 12, 4, 0.72);
  color: #ffe08a;
  font-size: 0.92rem;
  font-weight: 800;
  box-shadow: 0 0 12px rgba(255, 214, 80, 0.22);
  word-break: keep-all;
}

.guide-pill.is-hot {
  color: #2a1804;
  background: linear-gradient(90deg, #ffe08a, #ffc24a);
  border-color: #ffe08a;
  box-shadow: 0 0 16px rgba(255, 214, 80, 0.45);
}

.guide-hands {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.guide-hand {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(6, 14, 24, 0.55));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.guide-hand.is-action {
  border-color: rgba(255, 214, 80, 0.4);
}

.guide-hand-label,
.guide-hand-desc {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.5;
  color: #c6ecf4;
  text-align: center;
  word-break: keep-all;
}

.guide-mini-pad {
  display: flex;
  gap: 6px;
}

.guide-mini-pad span {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(46, 230, 255, 0.45);
  background: linear-gradient(180deg, rgba(24, 42, 64, 0.9), rgba(8, 14, 24, 0.9));
  box-shadow: 0 0 12px rgba(46, 230, 255, 0.28);
  font-size: 1.05rem;
}

.guide-mini-pad.is-wide {
  flex-wrap: wrap;
  justify-content: center;
}

.guide-mini-pad span.is-gold {
  border-color: rgba(255, 214, 80, 0.7);
  color: #ffe08a;
  box-shadow: 0 0 12px rgba(255, 214, 80, 0.4);
}

.guide-viz-hero {
  overflow: hidden;
}

.guide-keycap-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.guide-keycap-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-height: 3rem;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(46, 230, 255, 0.2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(6, 14, 24, 0.55));
}

.guide-keycap-item.is-gold {
  border-color: rgba(255, 214, 80, 0.45);
  box-shadow: 0 0 16px rgba(255, 214, 80, 0.18);
}

.guide-keycap-item.is-diag {
  border-color: rgba(124, 240, 255, 0.45);
}

.guide-keycap-item kbd,
.guide-key-list kbd,
.guide-f9-hero kbd,
.guide-ts-card kbd {
  display: inline-grid;
  place-items: center;
  min-width: 2.1rem;
  min-height: 2.1rem;
  padding: 4px 9px;
  border-radius: 10px;
  border: 1px solid rgba(180, 230, 255, 0.55);
  background:
    linear-gradient(180deg, rgba(70, 92, 120, 0.95), rgba(18, 28, 44, 0.98));
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 12px rgba(46, 230, 255, 0.28);
  color: #e8fbff;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.guide-fold-diagram {
  margin: 12px 0 8px;
}

.guide-fold-phone {
  display: grid;
  grid-template-columns: 1fr 10px 1fr;
  gap: 8px;
  align-items: center;
  padding: 14px 10px;
  border-radius: 22px;
  border: 1px solid rgba(46, 230, 255, 0.28);
  background: linear-gradient(90deg, rgba(8, 18, 32, 0.9), rgba(18, 10, 28, 0.9));
  box-shadow: 0 0 24px rgba(46, 230, 255, 0.16);
}

.guide-fold-hinge {
  width: 8px;
  height: 72px;
  margin: 0 auto;
  border-radius: 999px;
  background: linear-gradient(180deg, #7cf0ff, #ffe08a);
  box-shadow: 0 0 16px rgba(124, 240, 255, 0.55);
}

.guide-fold-wing {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.guide-fold-pad {
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(46, 230, 255, 0.4);
  background: rgba(8, 16, 28, 0.85);
}

.guide-fold-pad.is-gold,
.guide-fold-wing.is-action .guide-fold-pad.is-gold {
  border-color: rgba(255, 214, 80, 0.7);
  color: #ffe08a;
}

.guide-flow {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
}

.guide-flow-step {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  padding: 12px 8px;
  border-radius: 16px;
  border: 1px solid rgba(255, 214, 80, 0.28);
  background: rgba(20, 12, 4, 0.4);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.4;
}

.guide-flow-num {
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffe08a, #ffc24a);
  color: #2a1804;
}

.guide-ghost-demo {
  width: 54px;
  height: 36px;
  position: relative;
  border-radius: 6px;
  background: repeating-linear-gradient(90deg, rgba(46, 230, 255, 0.15) 0 8px, transparent 8px 16px);
}

.guide-ghost-block {
  position: absolute;
  left: 14px;
  top: 6px;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(124, 240, 255, 0.35);
  box-shadow: 0 0 12px rgba(124, 240, 255, 0.8);
  animation: guideGhostPulse 1.4s ease-in-out infinite;
}

@keyframes guideGhostPulse {
  50% { opacity: 0.35; transform: translateX(8px); }
}

.guide-count-gauge {
  display: flex;
  gap: 4px;
}

.guide-count-gauge span {
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 214, 80, 0.2);
  color: #ffe08a;
}

.guide-snap-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2ee6ff, #7cf0ff);
  color: #071018;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.guide-ts-cards {
  margin-top: 12px;
}

.guide-ts-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 214, 80, 0.3);
  background: rgba(8, 16, 28, 0.45);
}

.guide-slot-map {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.guide-slot {
  min-width: 2.4rem;
  padding: 6px 8px;
  border-radius: 10px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  border: 1px solid rgba(192, 132, 252, 0.4);
  background: rgba(24, 8, 36, 0.55);
}

.guide-slot.is-idle {
  border-color: rgba(46, 230, 255, 0.45);
  color: #9af6ff;
}

.guide-slot.is-hot {
  background: linear-gradient(90deg, #ffe08a, #ffc24a);
  color: #2a1804;
  border-color: #ffe08a;
}

.guide-drop-visual {
  margin: 10px 0;
  padding: 18px 12px;
  border-radius: 16px;
  border: 1px dashed rgba(232, 198, 255, 0.55);
  background: rgba(40, 16, 56, 0.35);
  text-align: center;
  font-weight: 800;
}

.guide-theme-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.guide-theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.78rem;
  font-weight: 800;
}

.guide-theme-chip[data-theme="neon-blue"] { box-shadow: 0 0 12px rgba(46, 230, 255, 0.35); color: #9af6ff; }
.guide-theme-chip[data-theme="cyber-pink"] { box-shadow: 0 0 12px rgba(255, 110, 199, 0.35); color: #ffb6e6; }
.guide-theme-chip[data-theme="emerald-green"] { box-shadow: 0 0 12px rgba(80, 230, 160, 0.35); color: #b6ffd9; }
.guide-theme-chip[data-theme="sunset-orange"] { box-shadow: 0 0 12px rgba(255, 176, 80, 0.35); color: #ffd39a; }
.guide-theme-chip[data-theme="future-cyber"] { box-shadow: 0 0 12px rgba(180, 120, 255, 0.4); color: #e9c6ff; }

.guide-skin-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.guide-skin-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 10px 6px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 16, 28, 0.45);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.35;
}

.guide-skin-card i {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: block;
}

.guide-skin-card[data-skin="gemstone"] i {
  background: linear-gradient(135deg, #7cf0ff, #2a6cff);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}
.guide-skin-card[data-skin="glass"] i {
  background: linear-gradient(135deg, rgba(180, 240, 255, 0.5), rgba(80, 160, 255, 0.25));
  border: 1px solid rgba(180, 240, 255, 0.7);
}
.guide-skin-card[data-skin="wire"] i {
  background: transparent;
  border: 2px solid #9af6ff;
  box-shadow: 0 0 10px rgba(46, 230, 255, 0.5);
}
.guide-skin-card[data-skin="mecha"] i {
  background: linear-gradient(180deg, #6b7280, #111827);
  box-shadow: inset 0 0 0 2px #fbbf24;
}
.guide-skin-card[data-skin="candy"] i {
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #fff, #fb7185);
}

.guide-f9-hero {
  display: flex;
  gap: 14px;
  align-items: center;
}

.guide-f9-hero kbd {
  min-width: 3.4rem;
  min-height: 3.4rem;
  font-size: 1.15rem;
}

.guide-core-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.guide-core-chips span {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(46, 230, 255, 0.35);
  color: #9af6ff;
  font-size: 0.78rem;
  font-weight: 900;
}

.guide-score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.guide-score-chip {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(7, 16, 24, 0.72);
  font-weight: 800;
  font-size: 1.02rem;
}

.guide-score-chip.is-tetris {
  grid-column: 1 / -1;
  border-color: #ffe08a;
  color: #fff4c4;
  box-shadow: 0 0 16px rgba(255, 214, 80, 0.22);
}

.guide-level-track {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(46, 230, 255, 0.12), rgba(168, 85, 255, 0.22), rgba(255, 138, 61, 0.2));
  border: 1px solid rgba(46, 230, 255, 0.25);
  font-weight: 800;
  font-size: 1.05rem;
}

.guide-level-track .is-hot {
  color: #ffe08a;
  text-shadow: 0 0 10px rgba(255, 214, 80, 0.7);
}

.guide-ai-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 6px;
  font-weight: 800;
  font-size: 1.05rem;
  color: #7cf0ff;
}

.guide-ai-bar {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2ee6ff, #a855ff, #ff8a3d);
  box-shadow: 0 0 12px rgba(46, 230, 255, 0.35);
}

.guide-custom-list {
  list-style: none;
  display: grid;
  gap: 10px;
  margin: 12px 0;
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.55;
}

.guide-custom-list li {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(6, 14, 24, 0.42);
  border: 1px solid rgba(46, 230, 255, 0.14);
  word-break: keep-all;
}

.guide-master-list li {
  border-color: rgba(46, 230, 255, 0.28);
  box-shadow: inset 3px 0 0 var(--neon, #2ee6ff);
}

.guide-card-convenience .guide-custom-list li {
  border-color: rgba(255, 210, 74, 0.22);
  box-shadow: inset 3px 0 0 var(--gold, #ffd24a);
}

.guide-i18n-anchor {
  display: none !important;
}

.guide-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  flex-shrink: 0;
}

.guide-foot .save-btn {
  margin-left: auto;
}

@keyframes guideFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes guidePopIn {
  from { opacity: 0; transform: scale(0.92) translateY(14px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@media (max-width: 820px) {
  .guide-hands {
    grid-template-columns: 1fr;
  }

  .guide-modal {
    padding: 6px;
    padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
    align-items: stretch;
  }

  .guide-panel {
    width: 100%;
    max-width: 100%;
    max-height: min(96dvh, 100%);
    height: min(96dvh, 100%);
    border-radius: 18px;
  }

  .guide-tabs {
    padding: 8px 12px 0;
    gap: 5px;
  }

  .guide-tab {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1 1 calc(33.33% - 5px);
    min-height: 2.7rem;
    font-size: 0.7rem;
    padding: 5px 4px;
    line-height: 1.2;
    text-align: center;
  }

  .guide-tabs-viz .guide-tab {
    flex: 1 1 calc(33.33% - 5px);
  }

  .guide-duo-grid {
    grid-template-columns: 1fr;
  }

  .guide-piece-row {
    justify-content: center;
  }

  .guide-keycap-board,
  .guide-flow,
  .guide-skin-grid {
    grid-template-columns: 1fr 1fr;
  }

  .guide-f9-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .guide-body {
    padding: 12px 14px calc(22px + env(safe-area-inset-bottom, 0px));
  }

  .guide-card {
    padding: 14px 14px 16px;
  }

  .guide-card h3,
  .guide-badge {
    width: auto;
    max-width: 100%;
    font-size: 1.02rem;
    line-height: 1.5;
  }

  .guide-copy,
  .guide-key-list,
  .guide-custom-list,
  .guide-memory-list,
  .guide-hand-desc {
    font-size: 1.02rem;
    line-height: 1.75;
  }

  .guide-hero-tag {
    font-size: 1.08rem !important;
  }

  .guide-key-list kbd {
    padding: 4px 8px;
  }

  .guide-foot {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
}

html,
body,
.app,
.stage,
.board-wrap,
.sidebar,
.overlay,
.modal,
.modal-panel,
.settings-modal,
.settings-modal .modal-panel,
.mobile-controls,
.guide-modal,
.guide-panel {
  direction: ltr;
  unicode-bidi: isolate;
}

[data-i18n],
.bgm-track,
.video-status,
.setting-hint,
.overlay-title,
.overlay-hint,
.hall-empty,
.hall-meta,
.celebrate-message {
  unicode-bidi: isolate;
}

@media (min-width: 769px) {
  .stage,
  .game-layout,
  .app,
  .game-container {
    display: flex !important;
    justify-content: center !important;
    align-items: stretch !important;
    gap: 20px !important;
  }

  .board-wrap,
  .sidebar {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .overlay.is-start .overlay-card,
  .overlay.is-start .start-overlay-card {
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    padding: 22px 18px !important;
    border-radius: 20px !important;
    border: 1px solid rgba(0, 210, 255, 0.38) !important;
    box-shadow: 0 0 22px rgba(0, 210, 255, 0.22) !important;
  }

  .overlay.is-result .overlay-card,
  .overlay.is-conquer .overlay-card {
    min-height: 0 !important;
    width: 92% !important;
    max-width: 420px !important;
    padding: 24px 18px !important;
  }

  .overlay-card .profile-frame,
  .overlay-card .profile-avatar-container,
  .overlay:not(.is-result):not(.is-conquer) #profile-frame {
    width: min(300px, 82%) !important;
    height: auto !important;
    max-width: 300px !important;
    max-height: 300px !important;
    min-width: 0 !important;
    min-height: unset !important;
    aspect-ratio: 1 / 1 !important;
    flex: 0 0 auto !important;
    margin-bottom: 8px !important;
    box-sizing: border-box !important;
  }

  .overlay:not(.is-result):not(.is-conquer):not(.is-pause) #overlay-title,
  .overlay.is-start #overlay-title {
    display: none !important;
    font-size: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
  }

  .overlay.is-start .overlay-hint,
  .overlay.is-start #overlay-hint.guide-capsule {
    width: 260px !important;
    height: 50px !important;
    min-width: 260px !important;
    min-height: 50px !important;
    max-width: 260px !important;
    box-sizing: border-box !important;
    font-size: 0.98rem !important;
    padding: 0 16px !important;
    border-radius: 18px !important;
    white-space: nowrap !important;
  }

  .sidebar-header-custom .header-game-title,
  .sidebar-header-custom .game-main-title,
  .sidebar-header-custom h1 {
    font-size: 1.68rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    letter-spacing: 2px !important;
  }

  .sidebar-header-custom .profile-avatar-container,
  #sidebar-profile-frame {
    width: 42px !important;
    height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
  }
}

.header-divider,
.header-full-divider,
.brand-bar,
.theme-separator,
.title-line,
#profile-separator {
  display: block !important;
  width: 100% !important;
  margin: 0 0 6px !important;
}

.overlay.is-result #overlay-title,
.overlay.is-conquer #overlay-title {
  font-size: 1.1rem !important;
  white-space: nowrap !important;
  word-break: keep-all !important;
  letter-spacing: -0.5px !important;
}

.sidebar-header-custom .header-game-title,
.sidebar-header-custom .game-main-title,
.sidebar-header-custom h1 {
  font-size: 1.68rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  letter-spacing: 2px !important;
  color: #fff !important;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.95),
    0 0 16px rgba(46, 230, 255, 1),
    0 0 32px rgba(0, 210, 255, 0.85),
    0 0 48px rgba(168, 85, 255, 0.45) !important;
  margin: 0 !important;
}

@media (min-width: 769px) {
  #game-header,
  .brand.sidebar-header-custom {
    padding: 4px 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  .header-top-row {
    padding: 0 !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    box-sizing: border-box !important;
  }
}

.sidebar-header-custom .profile-avatar-container,
#sidebar-profile-frame {
  width: 42px !important;
  height: 42px !important;
  max-width: 42px !important;
  max-height: 42px !important;
  border-width: 2px !important;
  flex-shrink: 0 !important;
}


/* Foldable inner / 4:3 / square — mobile only (<=768) */


.overlay.is-pause {
  touch-action: manipulation;
}

.overlay.is-pause .overlay-hint {
  white-space: normal;
  line-height: 1.4;
}


#stats-panel,
.top-dashboard,
.hud-stats-row.stats-dashboard {
  display: flex !important;
  flex-direction: column !important;
  grid-template-columns: none !important;
  gap: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  align-items: stretch !important;
  position: static !important;
  height: 168px !important;
  min-height: 168px !important;
  max-height: 172px !important;
  flex: 0 0 168px !important;
}

#block-guide-row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
  width: 100% !important;
  height: 168px !important;
  min-height: 168px !important;
  max-height: 172px !important;
  flex: 0 0 168px !important;
  margin-bottom: 0 !important;
}

#stats-panel > .preview-panel,
#block-guide-row > #next-card,
#block-guide-row > #hold-card {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 100% !important;
  padding: 4px !important;
  box-sizing: border-box !important;
  position: static !important;
  margin: 0 !important;
}

#stats-bar-row,
#stats-panel > .stat-grid,
.scoreboard-2x2 {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 1fr 1fr !important;
  gap: 6px !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 118px !important;
  min-height: 118px !important;
  overflow: hidden !important;
  text-align: center;
}

#block-guide-row canvas,
#stats-panel #next,
#stats-panel #hold {
  width: 132px !important;
  height: 132px !important;
  max-width: 132px !important;
  max-height: 132px !important;
  aspect-ratio: 1 / 1 !important;
}

#stats-panel canvas,
#stats-panel #next,
#stats-panel #hold {
  max-width: 132px !important;
  aspect-ratio: 1 / 1 !important;
  height: 132px !important;
}


@media (min-width: 769px) {
  html,
  body {
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    box-sizing: border-box !important;
  }

  body {
    padding: 6px !important;
  }

  .app,
  .game-container,
  #game-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: stretch !important;
    gap: 16px !important;
    width: auto !important;
    max-width: 1080px !important;
    height: 100% !important;
    max-height: calc(100vh - 12px) !important;
    max-height: calc(100dvh - 12px) !important;
    min-height: 0 !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  .stage,
  .game-layout {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: stretch !important;
    gap: 16px !important;
    width: auto !important;
    height: 100% !important;
    max-height: none !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
  }

  .board-wrap,
  #board-wrap,
  .game-panel,
  .game-board-container,
  #board-wrapper {
    order: 1 !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: var(--board-aspect, 10 / 20) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    position: relative !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  #board,
  #tetris-canvas,
  .game-canvas,
  .board-canvas-stack,
  #tetris-board-wrapper {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain;
  }

  #overlay,
  .overlay,
  .game-overlay {
    width: auto !important;
    height: auto !important;
    inset: 0 !important;
  }

  .overlay.is-start .overlay-card,
  .overlay.is-start .start-overlay-card,
  .overlay.is-start #start-overlay {
    width: 100% !important;
    height: auto !important;
    max-width: none !important;
    min-height: 0 !important;
  }

  #board,
  #tetris-canvas,
  .game-canvas,
  .board-canvas-stack,
  #tetris-board-wrapper {
    aspect-ratio: var(--board-aspect, 10 / 20) !important;
  }

  .overlay.is-result .overlay-card,
  .overlay.is-conquer .overlay-card {
    min-height: 0 !important;
  }

  .overlay.is-start .overlay-card,
  .overlay.is-start .start-overlay-card {
    min-height: 0 !important;
  }

  .sidebar,
  #sidebar-container {
    order: 2 !important;
    width: 350px !important;
    min-width: 330px !important;
    flex: 0 0 350px !important;
    height: 100% !important;
    max-height: none !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    gap: 4px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  #mobile-right-tower,
  #mobile-game-controls {
    display: contents !important;
  }

  .sidebar #game-header {
    order: 0 !important;
  }

  .sidebar #stats-panel {
    order: 1 !important;
  }

  .sidebar .hud-row-main {
    order: 2 !important;
  }

  .sidebar #hud-control-grid {
    order: 3 !important;
  }

  .sidebar #stats-bar-row {
    order: 4 !important;
  }

  .sidebar .hud-row-autoplay {
    order: 5 !important;
  }

  .sidebar .dad-speed-row {
    order: 6 !important;
  }

  .sidebar .sidebar-dock {
    order: 7 !important;
  }

  .sidebar > *:not(.sidebar-dock),
  .sidebar button,
  .sidebar .stat-box,
  .sidebar .hud-row,
  .sidebar .dad-speed-row,
  .sidebar .preview-panel {
    flex-shrink: 0 !important;
  }

  #game-header,
  .brand.sidebar-header-custom {
    flex: 0 0 60px !important;
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    padding: 4px 0 0 !important;
    overflow: visible !important;
    flex-shrink: 0 !important;
  }

  .header-top-row {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    border-bottom: 1px solid rgba(0, 240, 255, 0.4) !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
  }

  .brand-heading {
    width: 92% !important;
    max-width: 100% !important;
    gap: 12px !important;
  }

  .header-full-divider,
  .header-sub-text,
  .tagline {
    display: none !important;
  }

  #game-header .profile-avatar-container,
  #sidebar-profile-frame,
  .sidebar-header-custom .profile-avatar-container {
    width: 42px !important;
    height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    flex-shrink: 0 !important;
    border-color: var(--neon, #00d2ff) !important;
    box-shadow:
      0 0 10px rgba(46, 230, 255, 0.95),
      0 0 20px rgba(0, 210, 255, 0.7),
      0 0 32px rgba(168, 85, 255, 0.35),
      inset 0 0 8px rgba(46, 230, 255, 0.28) !important;
  }

  .sidebar-header-custom .header-game-title {
    font-size: 1.68rem !important;
    line-height: 1 !important;
    font-weight: 900 !important;
    letter-spacing: 2px !important;
    white-space: nowrap !important;
    overflow: visible !important;
    flex: 1 1 auto !important;
    text-shadow:
      0 0 8px rgba(255, 255, 255, 0.95),
      0 0 16px rgba(46, 230, 255, 1),
      0 0 32px rgba(0, 210, 255, 0.85),
      0 0 48px rgba(168, 85, 255, 0.45) !important;
  }

  .hud-row-main,
  .action-row-main {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    flex: 0 0 42px !important;
    height: 42px !important;
  }

  .hud-row-diag,
  #hud-diag-guide-row,
  .hud-row-utility,
  .utility-btn-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    flex: 0 0 36px !important;
    height: 36px !important;
  }

  .btn-diagnostics,
  .btn-guide,
  #btn-diagnostics,
  #btn-guide,
  .utility-btn-group .mobile-pad-toggle,
  .utility-btn-group .settings-open-btn,
  #mobile-pad-toggle,
  #settings-open {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 8px !important;
    font-size: 0.84rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
    transform: none !important;
    flex-shrink: 0 !important;
  }

  .game-start-btn,
  .game-end-btn,
  #game-start,
  #game-end {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 8px !important;
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
    transform: none !important;
    flex-shrink: 0 !important;
  }

  .hud-row-autoplay,
  .hud-row-autoplay .autoplay-btn,
  #autoplay-toggle {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    font-size: 0.84rem !important;
    font-weight: 800 !important;
    border-radius: 8px !important;
  }

  #stats-bar-row,
  .stats-bar-row,
  .scoreboard-2x2 {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: 1fr 1fr !important;
    gap: 6px !important;
    text-align: center !important;
    flex: 0 0 118px !important;
    height: 118px !important;
    min-height: 118px !important;
  }

  #stats-bar-row .stat-box,
  .stat-grid .stat-box {
    height: 56px !important;
    min-height: 56px !important;
    padding: 8px 8px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
  }

  #stats-bar-row .label,
  .stat-grid .label {
    font-size: 0.68rem !important;
    margin-bottom: 4px !important;
    opacity: 0.8 !important;
  }

  #stats-bar-row .value,
  .stat-grid .value {
    font-size: 1.4rem !important;
    font-weight: 800 !important;
    color: #00f0ff !important;
  }

  .dad-speed-row {
    display: grid !important;
    grid-template-columns: 1fr 1.6fr !important;
    gap: 8px !important;
    align-items: center !important;
    height: 36px !important;
    min-height: 36px !important;
    flex: 0 0 36px !important;
  }

  .dad-speed-row .dad-special-btn,
  #dad-special-toggle {
    height: 100% !important;
    min-height: 36px !important;
    padding: 0 6px !important;
    font-size: 0.78rem !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .dad-speed-row .ai-speed-panel,
  .dad-speed-row .autoplay-speed-row {
    display: flex !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 2px 8px !important;
    min-width: 0 !important;
    align-items: center !important;
    border: 1px solid rgba(0, 240, 255, 0.4) !important;
    border-radius: 8px !important;
  }

  #block-guide-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    height: 168px !important;
    min-height: 168px !important;
    max-height: 172px !important;
    flex: 0 0 168px !important;
  }

  #stats-panel,
  .hud-stats-row,
  .stats-dashboard {
    flex: 0 0 168px !important;
    min-height: 168px !important;
    max-height: 172px !important;
    height: 168px !important;
  }

  #next-card,
  #hold-card,
  .preview-panel {
    height: 100% !important;
    min-height: 0 !important;
    padding: 6px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
  }

  #block-guide-row canvas,
  #next,
  #hold,
  #stats-panel canvas,
  #stats-panel #next,
  #stats-panel #hold,
  .next-canvas,
  .hold-canvas {
    width: 132px !important;
    height: 132px !important;
    max-width: 132px !important;
    max-height: 132px !important;
    aspect-ratio: 1 / 1 !important;
    margin: auto !important;
  }

  .sidebar-dock {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 5px !important;
    margin-top: 4px !important;
  }

  #dad-cheer-banner,
  .dad-cheer-banner {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    height: 160px !important;
    min-height: 160px !important;
    max-height: 160px !important;
    flex: 0 0 160px !important;
    padding: 14px 12px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    border-radius: 12px !important;
  }

  .help,
  #controls-guide {
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 8px 12px !important;
    margin: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    font-size: 0.76rem !important;
    border-radius: 10px !important;
  }

  .help ul {
    overflow: hidden !important;
    justify-content: flex-start !important;
    flex: 0 1 auto !important;
    font-size: 0.76rem !important;
    line-height: 1.2 !important;
  }

  .help li {
    margin: 2px 0 !important;
    font-size: 0.76rem !important;
    line-height: 1.2 !important;
  }
}


/* 스마트폰 전용: 768px 이하에서만 PC 160px 전광판/사이드바 스펙을 덮어씀 */


@keyframes popupFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* In-game result/action popups only — do not restyle settings, guide, sidebar, or idle start overlay */
#score-save-modal .score-save-panel,
#autoplay-end-modal .score-save-panel,
#ingame-confirm-modal .custom-modal-content,
#ingame-confirm-modal .popup-box,
#ingame-confirm-modal .alert-box,
#pwa-guide-modal .pwa-guide-panel,
.overlay.is-pause .overlay-card,
.overlay.is-result .overlay-card,
.overlay.is-conquer .overlay-card {
  max-width: 420px;
  width: 88%;
  background: linear-gradient(145deg, rgba(16, 26, 48, 0.96), rgba(8, 14, 28, 0.98)) !important;
  border: 1.5px solid rgba(0, 240, 255, 0.4) !important;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.7),
    0 0 25px rgba(0, 240, 255, 0.2) !important;
  border-radius: 16px !important;
  padding: 24px 28px !important;
  text-align: center;
  animation: popupFadeIn 0.25s ease-out;
}

#score-save-modal .popup-title,
#score-save-modal #score-save-title,
#autoplay-end-modal .popup-title,
#autoplay-end-modal #autoplay-end-title,
#ingame-confirm-modal .popup-title,
#ingame-confirm-modal .alert-title,
#ingame-confirm-modal #ingame-confirm-title,
#pwa-guide-modal #pwa-guide-title,
.overlay.is-pause #overlay-title,
.overlay.is-pause .overlay-title,
.overlay.is-result #overlay-title,
.overlay.is-result .overlay-title,
.overlay.is-conquer #overlay-title,
.overlay.is-conquer .overlay-title {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 0 0 8px !important;
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(1.25rem, 2.6vw, 1.35rem) !important;
  font-weight: 800 !important;
  letter-spacing: 0.5px;
  line-height: 1.25 !important;
  color: #ffffff !important;
  background: none !important;
  background-image: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  -webkit-text-fill-color: #ffffff !important;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.7) !important;
  filter: none !important;
}

#autoplay-end-title {
  font-size: clamp(1.08rem, 3.2vw, 1.28rem) !important;
}

#score-save-modal .popup-score,
#score-save-modal .score-save-summary,
#autoplay-end-modal .popup-score,
#autoplay-end-modal .score-save-summary {
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  color: #00f0ff !important;
  margin: 12px 0 6px !important;
  font-family: "Pretendard", "Noto Sans KR", sans-serif;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.35);
}

#score-save-modal .popup-desc,
#score-save-modal .score-save-lead,
#autoplay-end-modal .popup-desc,
#autoplay-end-modal .popup-sub,
#ingame-confirm-modal .popup-desc,
#ingame-confirm-modal .popup-sub,
.overlay.is-pause .overlay-hint,
.overlay.is-result .overlay-hint,
.overlay.is-conquer .overlay-hint {
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  color: rgba(200, 225, 255, 0.75) !important;
  margin: 0 0 18px !important;
  line-height: 1.45;
  white-space: pre-line;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

#score-save-modal .name-input {
  width: 100%;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 12px !important;
  font-size: 0.92rem !important;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 240, 255, 0.28);
  border-radius: 8px;
  box-sizing: border-box;
}

#score-save-modal .popup-btn,
#score-save-modal .save-btn,
#score-save-modal .ghost-btn,
#autoplay-end-modal .popup-btn,
#autoplay-end-modal .save-btn,
#ingame-confirm-modal .popup-btn,
#ingame-confirm-modal .save-btn,
#ingame-confirm-modal .ghost-btn,
#celebrate-modal .popup-btn,
#pwa-guide-modal .pwa-guide-ok,
.overlay.is-result .overlay-restart-btn,
.overlay.is-result .overlay-quit-btn,
.overlay.is-conquer .overlay-restart-btn,
.overlay.is-conquer .overlay-quit-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px;
  line-height: 38px;
  padding: 0 24px !important;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  box-sizing: border-box;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

#score-save-modal .btn-confirm,
#score-save-modal .save-btn,
#autoplay-end-modal .btn-confirm,
#autoplay-end-modal .save-btn,
#ingame-confirm-modal .btn-confirm,
#ingame-confirm-modal .save-btn,
#celebrate-modal .popup-btn,
#pwa-guide-modal .pwa-guide-ok,
.overlay.is-result .overlay-restart-btn,
.overlay.is-conquer .overlay-restart-btn {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.9), rgba(0, 140, 255, 0.9)) !important;
  color: #05101a !important;
  border: none !important;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4) !important;
}

#score-save-modal .btn-close.ghost-btn,
#score-save-modal #score-save-skip,
#ingame-confirm-modal .btn-close,
#ingame-confirm-modal .ghost-btn,
.overlay.is-result .overlay-quit-btn,
.overlay.is-conquer .overlay-quit-btn {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #d8e7f4 !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: none !important;
}

#score-save-modal .btn-confirm:hover,
#score-save-modal .save-btn:hover,
#autoplay-end-modal .save-btn:hover,
#ingame-confirm-modal .btn-confirm:hover,
#celebrate-modal .popup-btn:hover,
#pwa-guide-modal .pwa-guide-ok:hover,
.overlay.is-result .overlay-restart-btn:hover,
.overlay.is-conquer .overlay-restart-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.7) !important;
}

.ingame-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

#ingame-confirm-modal {
  z-index: 80;
}

#ingame-confirm-desc {
  text-align: center;
  white-space: pre-line;
}

.board-size-mobile-badge {
  display: none;
  margin: 0;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
  color: rgba(200, 225, 255, 0.88);
  text-align: center;
  border: 1px solid rgba(0, 240, 255, 0.28);
  border-radius: 8px;
  background: rgba(4, 12, 24, 0.65);
}


body.is-mobile-board-lock #board-size-setting-group select,
body.is-mobile-board-lock #board-size-setting-group #select-board-size,
body.is-mobile-board-lock #board-size-setting-group .setting-hint,
.board-size-setting-group.is-mobile-locked #select-board-size,
.board-size-setting-group.is-mobile-locked .setting-hint {
  display: none !important;
}

body.is-mobile-board-lock #board-size-mobile-badge,
body.is-mobile-board-lock .board-size-mobile-badge,
.board-size-setting-group.is-mobile-locked #board-size-mobile-badge {
  display: block !important;
}

body.is-mobile-board-lock #select-board-size option[value="24"],
body.is-mobile-board-lock #select-board-size option[value="28"],
body.is-mobile-board-lock .board-size-pc-only,
.board-size-setting-group.is-mobile-locked .board-size-pc-only {
  display: none !important;
}

body.is-mobile-board-lock .board-canvas-stack,
body.is-mobile-board-lock #tetris-board-wrapper {
  aspect-ratio: var(--board-aspect, 10 / 20) !important;
}

/* Dual-layer board: BG grid/theme + FG blocks share one stack box. */
#tetris-board-wrapper #bg-canvas,
#tetris-board-wrapper #board,
#tetris-board-wrapper #tetris-canvas,
.board-canvas-stack #bg-canvas,
.board-canvas-stack #board,
.board-canvas-stack #tetris-canvas,
.board-canvas-stack .game-canvas {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  background-image: none !important;
  display: block !important;
  box-sizing: border-box !important;
  object-fit: fill !important;
  image-rendering: pixelated;
}

#tetris-board-wrapper #bg-canvas,
.board-canvas-stack #bg-canvas {
  z-index: 1 !important;
  pointer-events: none !important;
}

#tetris-board-wrapper #board,
#tetris-board-wrapper #tetris-canvas,
.board-canvas-stack #board,
.board-canvas-stack #tetris-canvas {
  z-index: 2 !important;
  background: transparent !important;
  pointer-events: auto;
}

#tetris-board-wrapper,
.board-canvas-stack {
  position: relative !important;
  isolation: isolate;
  overflow: hidden !important;
}

.sidebar,
#sidebar-container {
  pointer-events: auto !important;
}

.sidebar button,
#hud-control-grid button,
.game-actions button,
#game-header button,
.header-util-stack button,
.brand-tools button {
  pointer-events: auto !important;
  position: relative;
  z-index: 7;
}

.game-board-container,
#board-wrap,
.board-wrap,
#board-wrapper,
#tetris-board-wrapper,
.board-canvas-stack {
  position: relative !important;
  z-index: 1;
  overflow: hidden !important;
  isolation: isolate;
  max-width: 100%;
  pointer-events: auto;
}

#bg-canvas {
  z-index: 0 !important;
  pointer-events: none !important;
}

#board,
#tetris-canvas {
  z-index: 1 !important;
  max-width: 100% !important;
  max-height: 100% !important;
}

.sidebar,
#sidebar-container,
#game-header,
.sidebar-header-box {
  position: relative;
  z-index: 5;
  pointer-events: auto !important;
}

#diag-modal:not(.hidden),
#diag-modal.active,
#diag-modal.open,
#diag-modal.show {
  justify-content: flex-end;
  background: transparent !important;
}

html.diag-ai-preview #board-wrap,
html.diag-ai-preview #tetris-board-wrapper,
body.diag-ai-preview #board-wrap {
  filter: none !important;
  opacity: 1 !important;
}

body.diag-running #overlay,
body.diag-running #start-overlay,
body.diag-running #idle-overlay,
body.diag-running #start-prompt-overlay,
body.diag-running.diag-measure-profile #overlay,
body.diag-running.diag-measure-profile #start-overlay,
body.diag-running.diag-measure-profile #profile-card,
body.diag-running.diag-measure-profile .profile-start-panel,
body.diag-running.diag-measure-profile .start-overlay-card,
body.diag-running.diag-measure-profile .board-idle-card,
body.hide-board-idle.diag-measure-profile #overlay,
body.hide-board-idle.diag-measure-profile #start-overlay,
body.hide-board-idle.diag-measure-profile #profile-card,
body.hide-board-idle.diag-measure-profile .profile-start-panel,
body.hide-board-idle.diag-measure-profile .start-overlay-card,
body.hide-board-idle.diag-measure-profile .board-idle-card {
  display: flex !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.diag-running .board-idle-card,
body.diag-running .profile-start-panel,
body.diag-running .start-overlay-card,
body.diag-running .game-overlay-card,
body.hide-board-idle #overlay,
body.hide-board-idle #start-overlay,
body.hide-board-idle #idle-overlay,
body.hide-board-idle #start-prompt-overlay,
body.hide-board-idle .board-idle-card,
body.hide-board-idle .profile-start-panel,
body.hide-board-idle .start-overlay-card,
html.diag-ai-preview #overlay,
html.diag-ai-preview #start-overlay,
html.diag-ai-preview .board-idle-card,
html.diag-ai-preview .profile-start-panel,
body.is-autoplay #overlay,
body.is-autoplay #start-overlay,
body.is-autoplay #idle-overlay,
body.is-autoplay #start-prompt-overlay,
body.is-autoplay .board-idle-card,
body.is-autoplay .profile-start-panel,
body.is-autoplay .start-overlay-card {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.is-autoplay #overlay.is-result,
body.is-autoplay #overlay.is-conquer,
body.is-autoplay #overlay.is-result #start-overlay,
body.is-autoplay #overlay.is-conquer #start-overlay,
body.is-autoplay #overlay.is-result #profile-card,
body.is-autoplay #overlay.is-conquer #profile-card,
body.is-autoplay #overlay.is-result .overlay-card,
body.is-autoplay #overlay.is-conquer .overlay-card {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

body.diag-running #bg-canvas,
body.diag-running #tetris-canvas,
body.hide-board-idle #bg-canvas,
body.hide-board-idle #tetris-canvas,
body.is-autoplay #bg-canvas,
body.is-autoplay #tetris-canvas,
html.diag-ai-preview #bg-canvas,
html.diag-ai-preview #tetris-canvas {
  opacity: 1 !important;
  visibility: visible !important;
  filter: none !important;
}

/* Click recovery: closed overlays never steal HUD clicks */
.modal,
.custom-modal,
.modal-overlay,
#settings-modal,
#guide-modal,
#diag-modal,
#celebrate-modal,
#score-save-modal,
#autoplay-end-modal,
#hall-modal,
#pwa-guide-modal,
#ingame-confirm-modal,
#game-over-modal {
  pointer-events: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  display: none !important;
  z-index: -1 !important;
}

.modal.active,
.modal.open,
.modal.show,
.modal:not(.hidden),
.custom-modal.active,
.custom-modal.open,
.custom-modal.show,
.custom-modal:not(.hidden),
#settings-modal.active,
#settings-modal.open,
#settings-modal.show,
#settings-modal:not(.hidden),
#guide-modal.active,
#guide-modal.open,
#guide-modal.show,
#guide-modal:not(.hidden),
#diag-modal.active,
#diag-modal.open,
#diag-modal.show,
#diag-modal:not(.hidden),
#celebrate-modal.active,
#celebrate-modal.open,
#celebrate-modal.show,
#celebrate-modal:not(.hidden),
#score-save-modal.active,
#score-save-modal.open,
#score-save-modal.show,
#score-save-modal:not(.hidden),
#autoplay-end-modal.active,
#autoplay-end-modal.open,
#autoplay-end-modal.show,
#autoplay-end-modal:not(.hidden),
#hall-modal.active,
#hall-modal.open,
#hall-modal.show,
#hall-modal:not(.hidden),
#pwa-guide-modal.active,
#pwa-guide-modal.open,
#pwa-guide-modal.show,
#pwa-guide-modal:not(.hidden),
#ingame-confirm-modal.active,
#ingame-confirm-modal.open,
#ingame-confirm-modal.show,
#ingame-confirm-modal:not(.hidden),
#game-over-modal.active,
#game-over-modal.open,
#game-over-modal.show,
#game-over-modal:not(.hidden) {
  pointer-events: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
  display: flex !important;
  z-index: 9999 !important;
}

.modal.hidden,
.modal[hidden],
.custom-modal.hidden,
#settings-modal.hidden,
#guide-modal.hidden,
#diag-modal.hidden,
#game-over-modal.hidden {
  pointer-events: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  display: none !important;
  z-index: -1 !important;
}

.game-board-container,
#board-wrap,
.board-wrap,
#board-wrapper,
#tetris-board-wrapper,
.board-canvas-stack,
#bg-canvas,
#tetris-canvas,
#board,
#dad-cheer-banner,
.dad-cheer-banner,
.scene-bg,
.scene-bg-image,
.scene-bg-dim {
  pointer-events: none !important;
}

.overlay,
#overlay,
.game-overlay {
  pointer-events: none !important;
}

.overlay.is-pause:not(.hidden),
.overlay.is-result:not(.hidden),
.overlay.is-conquer:not(.hidden) {
  pointer-events: auto !important;
}

.btn,
button,
input[type="button"],
input[type="submit"],
input[type="range"],
select,
.interactive,
.sidebar button,
#hud-control-grid button,
.game-actions button,
#game-header button,
.modal button,
.overlay button {
  pointer-events: auto !important;
  position: relative;
  z-index: 10;
  cursor: pointer !important;
}

.sidebar,
#sidebar-container,
#game-header {
  pointer-events: auto !important;
  z-index: 20;
}

@keyframes overlayResultCardIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.overlay.is-result .overlay-card,
.overlay.is-result .game-overlay-card,
.overlay.is-result #start-overlay,
.overlay.is-conquer .overlay-card,
.overlay.is-conquer .game-overlay-card,
.overlay.is-conquer #start-overlay {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  inset: auto !important;
  transform: none !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 20px 16px !important;
  background: linear-gradient(145deg, rgba(10, 20, 38, 0.96), rgba(6, 12, 24, 0.98)) !important;
  border: 1.5px solid rgba(0, 240, 255, 0.4) !important;
  border-radius: 16px !important;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.8),
    0 0 20px rgba(0, 240, 255, 0.25) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  box-sizing: border-box !important;
  z-index: 50;
  overflow: hidden;
  animation: overlayResultCardIn 0.25s ease-out;
}

#ai-complete-modal,
.level-clear-overlay {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 88% !important;
  max-width: 310px !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 20px 16px !important;
  background: linear-gradient(145deg, rgba(10, 20, 38, 0.96), rgba(6, 12, 24, 0.98)) !important;
  border: 1.5px solid rgba(0, 240, 255, 0.4) !important;
  border-radius: 16px !important;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.8),
    0 0 20px rgba(0, 240, 255, 0.25) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  box-sizing: border-box !important;
  z-index: 50;
  overflow: hidden;
}

.overlay.is-conquer .overlay-card,
.overlay.is-conquer .game-overlay-card,
.overlay.is-conquer #start-overlay {
  border-color: rgba(255, 214, 80, 0.55) !important;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.8),
    0 0 20px rgba(255, 214, 80, 0.28) !important;
}

.overlay.is-result .popup-avatar,
.overlay.is-result .overlay-avatar-circle,
.overlay.is-result .overlay-card .profile-frame,
.overlay.is-result .overlay-card .profile-avatar-container,
.overlay.is-result #profile-frame,
.overlay.is-conquer .popup-avatar,
.overlay.is-conquer .overlay-avatar-circle,
.overlay.is-conquer .overlay-card .profile-frame,
.overlay.is-conquer .overlay-card .profile-avatar-container,
.overlay.is-conquer #profile-frame {
  display: flex !important;
  width: 100px !important;
  height: 100px !important;
  min-width: 100px !important;
  min-height: 100px !important;
  max-width: 100px !important;
  max-height: 100px !important;
  border: 2px solid #00f0ff !important;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.5) !important;
  margin: 0 0 10px !important;
  flex-shrink: 0;
}

.overlay.is-result .profile-icon,
.overlay.is-conquer .profile-icon {
  font-size: 2.2rem !important;
}

.overlay.is-result .profile-icon-svg,
.overlay.is-conquer .profile-icon-svg {
  width: 64px !important;
  height: 64px !important;
}

.overlay.is-result .profile-caption,
.overlay.is-conquer .profile-caption {
  font-size: 0.72rem !important;
  letter-spacing: 0.04em;
}

.overlay.is-result .popup-title,
.overlay.is-result #overlay-title,
.overlay.is-result .overlay-title {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  background: none !important;
  background-image: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.45) !important;
  filter: none !important;
  margin: 0 0 6px !important;
  line-height: 1.3 !important;
  letter-spacing: 0 !important;
  white-space: normal !important;
  word-break: keep-all !important;
  overflow-wrap: break-word !important;
  overflow: visible !important;
  text-overflow: unset !important;
  text-align: center;
}

.overlay.is-conquer .popup-title,
.overlay.is-conquer #overlay-title,
.overlay.is-conquer .overlay-title {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  font-size: 0.95rem !important;
  font-weight: bold !important;
  color: #ffd700 !important;
  -webkit-text-fill-color: #ffd700 !important;
  background: none !important;
  background-image: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.4) !important;
  filter: none !important;
  margin: 0 0 12px !important;
  line-height: 1.35 !important;
  letter-spacing: 0 !important;
  white-space: normal !important;
  word-break: keep-all !important;
  overflow-wrap: break-word !important;
  overflow: visible !important;
  text-overflow: unset !important;
  text-align: center;
}

.overlay.is-result .popup-sub-guide,
.overlay.is-result .key-guide,
.overlay.is-result .overlay-hint,
.overlay.is-result #overlay-hint,
.overlay.is-conquer .popup-sub-guide,
.overlay.is-conquer .key-guide,
.overlay.is-conquer .overlay-hint,
.overlay.is-conquer #overlay-hint {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  white-space: normal !important;
  word-break: keep-all !important;
  overflow-wrap: break-word !important;
  overflow: visible !important;
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  color: rgba(200, 225, 255, 0.8) !important;
  line-height: 1.4 !important;
  text-align: center;
  margin: 10px 0 16px !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  flex-wrap: wrap !important;
}

.overlay.is-result .overlay-hint kbd,
.overlay.is-result .overlay-hint .kbd,
.overlay.is-result .key-guide kbd,
.overlay.is-conquer .overlay-hint kbd,
.overlay.is-conquer .overlay-hint .kbd,
.overlay.is-conquer .key-guide kbd {
  display: inline-block;
  font-size: 0.72rem !important;
  padding: 2px 5px !important;
  border-radius: 4px !important;
  line-height: 1.3;
  white-space: nowrap;
}

.overlay.is-result .popup-btn-group,
.overlay.is-result .overlay-btn-row,
.overlay.is-result .overlay-actions,
.overlay.is-conquer .popup-btn-group,
.overlay.is-conquer .overlay-btn-row,
.overlay.is-conquer .overlay-actions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap;
  width: 100% !important;
  max-width: 100%;
  gap: 8px !important;
  justify-content: center !important;
  align-items: stretch;
  margin: 0 !important;
  box-sizing: border-box;
}

.overlay.is-result .overlay-restart-btn,
.overlay.is-result .overlay-quit-btn,
.overlay.is-conquer .overlay-restart-btn,
.overlay.is-conquer .overlay-quit-btn {
  flex: 1 1 0 !important;
  width: auto !important;
  min-width: 0 !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  line-height: 36px !important;
  font-size: 0.82rem !important;
  font-weight: bold !important;
  border-radius: 6px !important;
  padding: 0 8px !important;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile arcade: header icons / board / slim score / 7-btn pad — 100dvh no scroll */


/* PC desktop restore: isolate arcade/mobile rules to <=768px */
@media (min-width: 769px) {
  html,
  body {
    width: auto !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: 6px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    box-sizing: border-box !important;
    background-color: var(--bg) !important;
    background-image:
      linear-gradient(var(--theme-grid) 1px, transparent 1px),
      linear-gradient(90deg, var(--theme-grid) 1px, transparent 1px),
      var(--page-bg) !important;
    background-size: 40px 40px, 40px 40px, cover !important;
    background-position: center !important;
    background-repeat: repeat, repeat, no-repeat !important;
    color: var(--ink) !important;
  }

  .app,
  .game-container,
  #game-container,
  .stage,
  .game-layout {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: stretch !important;
    width: auto !important;
    max-width: 1080px !important;
    height: 100% !important;
    max-height: calc(100dvh - 12px) !important;
    min-height: 0 !important;
    margin: 0 auto !important;
    padding: 0 !important;
    gap: 16px !important;
    overflow: visible !important;
  }

  .board-wrap,
  #board-wrap,
  .game-panel,
  .game-board-container,
  .game-main,
  .play-area,
  .canvas-area {
    order: 1 !important;
    grid-area: auto !important;
    grid-column: auto !important;
    grid-row: auto !important;
    position: relative !important;
    display: flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    aspect-ratio: var(--board-aspect, 10 / 20) !important;
  }

  #tetris-board-wrapper,
  .board-canvas-stack {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    aspect-ratio: var(--board-aspect, 10 / 20) !important;
  }

  .sidebar,
  #sidebar-container {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    order: 2 !important;
    width: 350px !important;
    min-width: 330px !important;
    max-width: 350px !important;
    flex: 0 0 350px !important;
    height: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  #stats-panel,
  .hud-stats-row,
  .stats-dashboard,
  .top-dashboard,
  .hold-next-container {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  #block-guide-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-area: auto !important;
    grid-column: auto !important;
    grid-row: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 168px !important;
    min-height: 168px !important;
    max-height: 172px !important;
    flex: 0 0 168px !important;
    padding: 0 !important;
  }

  #next-card,
  #hold-card,
  .preview-panel {
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: none !important;
    grid-area: auto !important;
    grid-column: auto !important;
    grid-row: auto !important;
  }

  #next,
  #hold,
  .next-canvas,
  .hold-canvas {
    width: 132px !important;
    height: 132px !important;
    max-width: 132px !important;
    max-height: 132px !important;
  }

  #game-header,
  .brand.sidebar-header-custom,
  .mobile-header-bar {
    display: flex !important;
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    flex: 0 0 60px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 4px 0 0 !important;
    overflow: visible !important;
  }

  .header-top-row {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  .brand-heading {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: 92% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  .header-game-title,
  .sidebar-header-custom .header-game-title,
  .brand-heading .header-game-title {
    font-size: 1.68rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    letter-spacing: 2px !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
    flex-shrink: 1 !important;
  }

  #header-mini-menu:empty {
    display: none !important;
  }

  #hud-control-grid,
  .game-actions,
  .hud-row-autoplay {
    display: flex !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    pointer-events: auto !important;
  }

  #hud-control-grid #settings-open,
  #hud-control-grid #btn-guide,
  #hud-control-grid #btn-diagnostics,
  #hud-control-grid #mobile-pad-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 8px !important;
    font-size: 0.84rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
  }

  .dad-speed-row {
    display: grid !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    pointer-events: auto !important;
  }

  #hud-diag-guide-row:empty {
    display: none !important;
  }

  #hud-diag-guide-row:not(:empty),
  #hud-control-grid .hud-row-utility {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    height: 36px !important;
    flex: 0 0 36px !important;
    pointer-events: auto !important;
  }

  #stats-bar-row,
  .stat-grid,
  .scoreboard-2x2 {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: 1fr 1fr !important;
    width: 100% !important;
    max-width: none !important;
    height: 118px !important;
    min-height: 118px !important;
    max-height: none !important;
    margin: 0 !important;
    flex: 0 0 118px !important;
    font-size: inherit !important;
    grid-area: auto !important;
    grid-column: auto !important;
    grid-row: auto !important;
  }

  #dad-cheer-banner,
  .dad-cheer-banner,
  .help,
  #controls-guide,
  .sidebar-dock {
    display: flex !important;
    height: auto !important;
  }

  #dad-cheer-banner,
  .dad-cheer-banner {
    height: 160px !important;
    min-height: 160px !important;
    max-height: 160px !important;
    flex: 0 0 160px !important;
  }

  #mobile-controls,
  #mobile-pad,
  .mobile-controls,
  .touch-controller,
  .touch-pad {
    display: none !important;
  }

  body.is-mobile-pad #mobile-controls:not(.hidden),
  body.is-mobile-pad .mobile-controls:not(.hidden) {
    display: flex !important;
  }
}

@media screen and (min-width: 769px) {
  #board-size-setting-group select,
  #board-size-setting-group #select-board-size {
    display: block !important;
  }

  #board-size-setting-group .setting-hint,
  #board-size-hint {
    display: block !important;
  }

  #board-size-mobile-badge,
  .board-size-mobile-badge {
    display: none !important;
  }

  #select-board-size option[value="24"],
  #select-board-size option[value="28"],
  .board-size-pc-only {
    display: revert !important;
  }
}

/* ==========================================================================
   📱 모바일 최종 완결 단일 미디어 쿼리 (중복 덮어쓰기 원천 차단)
   ========================================================================== */
@media screen and (max-width: 768px) {
  html,
  body {
    width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    --mobile-header-h: 48px;
    --mobile-pad-h: 48px;
  }

  body {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: center !important;
  }

  #game-container,
  .app,
  .game-container,
  .app-container,
  #app-container {
    width: 100% !important;
    height: calc(100dvh - 48px) !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-width: 480px !important;
    max-height: calc(100dvh - 48px) !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    padding: 4px 6px 0 6px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  main.stage,
  .stage,
  .game-layout,
  .game-area,
  .play-area,
  .game-main-content {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-height: 0 !important;
    height: calc(100dvh - 58px) !important;
    max-height: calc(100dvh - 58px) !important;
    display: grid !important;
    grid-template-columns: minmax(0, min(65%, calc(100% - 110px))) minmax(105px, 1fr) !important;
    grid-template-rows: auto calc(100dvh - 190px) minmax(34px, 1fr) !important;
    justify-content: start !important;
    align-items: stretch !important;
    gap: 4px !important;
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  aside.sidebar,
  .sidebar {
    display: contents !important;
  }

  header#game-header,
  #game-header {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex-shrink: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    margin: 0 0 2px 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    z-index: 20 !important;
  }

  .header-top-row {
    width: 100% !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    gap: 3px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .brand-heading {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    overflow: hidden !important;
  }

  .brand-heading .header-game-title {
    font-size: 13px !important;
    font-weight: 800 !important;
    color: #00f0ff !important;
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.6) !important;
    text-align: center !important;
    white-space: nowrap !important;
    margin: 0 !important;
  }

  #sidebar-profile-frame,
  #game-header #sidebar-profile-frame,
  #game-header .profile-avatar-container {
    display: none !important;
  }

  #header-mini-menu {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
  }

  #header-mini-menu button {
    flex: 1 !important;
    height: 22px !important;
    min-height: 22px !important;
    max-height: 22px !important;
    font-size: 8.5px !important;
    padding: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    white-space: nowrap !important;
    background: rgba(20, 25, 45, 0.75) !important;
    border-radius: 5px !important;
  }

  #header-mini-menu #settings-open {
    border: 1px solid rgba(0, 229, 255, 0.6) !important;
    color: #00e5ff !important;
  }

  #header-mini-menu #btn-guide {
    border: 1px solid rgba(138, 92, 246, 0.6) !important;
    color: #c4b5fd !important;
  }

  #header-mini-menu #btn-diagnostics {
    border: 1px solid rgba(245, 158, 11, 0.7) !important;
    color: #fbbf24 !important;
  }

  #header-mini-menu .mini-label,
  #header-mini-menu .mini-ico {
    font-size: 8.5px !important;
    color: inherit !important;
    white-space: nowrap !important;
  }

  #board-wrap,
  #board-wrap.board-wrap,
  body.is-mobile-board-lock #board-wrap,
  body.is-mobile-arcade #board-wrap {
    grid-column: 1 !important;
    grid-row: 2 !important;
    height: 100% !important;
    max-height: 100% !important;
    aspect-ratio: 10 / 20 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    justify-self: start !important;
    flex-shrink: 0 !important;
    position: relative !important;
    overflow: hidden !important;
    border: 2px solid rgba(0, 240, 255, 0.45) !important;
    border-radius: 8px !important;
    margin: 0 !important;
    display: grid !important;
    grid-template: 1fr / 1fr !important;
    place-items: stretch !important;
    box-sizing: border-box !important;
  }

  #board-bg,
  #tetris-board-wrapper,
  .board-canvas-stack,
  #overlay,
  .overlay,
  #clear-banner,
  #dad-countdown-overlay {
    grid-area: 1 / 1 !important;
  }

  #tetris-board-wrapper,
  .board-canvas-stack {
    width: 100% !important;
    height: 100% !important;
    position: relative !important;
    overflow: hidden !important;
  }

  #tetris-canvas,
  #bg-canvas,
  .game-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
  }

  #mobile-right-tower,
  #mobile-right-tower.mobile-right-tower {
    grid-column: 2 !important;
    grid-row: 2 !important;
    width: 100% !important;
    min-width: 105px !important;
    max-width: none !important;
    height: 100% !important;
    max-height: 100% !important;
    align-self: stretch !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    gap: 4px !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  #stats-panel,
  #stats-panel.hud-stats-row,
  #mobile-game-controls,
  #mobile-game-controls.control-btn-group {
    display: contents !important;
  }

  #mobile-right-tower #stats-panel,
  #mobile-right-tower #stats-panel.hud-stats-row,
  #mobile-right-tower #block-guide-row,
  #mobile-right-tower #stats-bar-row,
  #mobile-right-tower .action-row-main,
  #mobile-right-tower .hud-row-autoplay,
  #mobile-right-tower .dad-speed-row {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .action-row-main,
  #mobile-game-controls .hud-row-main {
    order: 1 !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 3px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
  }

  #mobile-game-controls #game-start,
  #mobile-game-controls #game-end,
  #game-start,
  #game-end {
    flex: 1 !important;
    width: auto !important;
    height: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    font-size: 8.5px !important;
    font-weight: bold !important;
    padding: 0 !important;
    white-space: nowrap !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: hidden !important;
  }

  #block-guide-row,
  #block-guide-row.block-guide-row {
    order: 2 !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    gap: 4px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
  }

  #next-card.card,
  #hold-card.card,
  #block-guide-row > #next-card,
  #block-guide-row > #hold-card {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 2px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    background: rgba(15, 23, 42, 0.75) !important;
    border: 1px solid rgba(0, 240, 255, 0.4) !important;
    border-radius: 8px !important;
  }

  .preview-card-head {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    height: 12px !important;
  }

  .preview-card-head .label,
  #next-card-label,
  #hold-card-label {
    font-size: 7.5px !important;
    font-weight: bold !important;
    color: #00f0ff !important;
    margin: 0 !important;
  }

  #next.next-canvas,
  #hold.hold-canvas,
  #stats-panel #next,
  #stats-panel #hold,
  #block-guide-row canvas {
    width: 36px !important;
    height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    display: block !important;
    margin: 0 auto !important;
    background: rgba(5, 10, 20, 0.6) !important;
    border-radius: 4px !important;
  }

  #hold-card #btn-toggle-guide-mode,
  #btn-toggle-guide-mode {
    width: auto !important;
    height: auto !important;
    padding: 0 2px !important;
    font-size: 8px !important;
    line-height: 1 !important;
    color: #00f0ff !important;
  }

  #stats-bar-row,
  #stats-bar-row.stats-bar-row,
  #stats-bar-row.stat-grid,
  #stats-bar-row.scoreboard-2x2 {
    order: 3 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto auto !important;
    gap: 3px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    flex: 0 0 auto !important;
  }

  #stats-bar-row .stat-box,
  #stats-bar-row.stat-grid .stat-box {
    height: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    width: auto !important;
    flex: none !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 1px 2px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    background: rgba(15, 23, 42, 0.75) !important;
    border: 1px solid rgba(0, 240, 255, 0.3) !important;
    border-radius: 6px !important;
  }

  #stats-bar-row .stat-box .label {
    font-size: 7px !important;
    color: #67e8f9 !important;
    margin: 0 !important;
    white-space: nowrap !important;
    line-height: 1 !important;
  }

  #stats-bar-row .stat-box .value {
    font-size: 9.5px !important;
    font-weight: bold !important;
    color: #ffffff !important;
    margin: 0 !important;
    white-space: nowrap !important;
    line-height: 1.1 !important;
  }

  .hud-row-autoplay {
    order: 4 !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex: 0 0 auto !important;
  }

  #autoplay-toggle {
    width: 100% !important;
    height: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    font-size: 8.5px !important;
    font-weight: bold !important;
    padding: 0 !important;
    white-space: nowrap !important;
    margin: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: hidden !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.5)) !important;
    border: 1px solid #34d399 !important;
    color: #6ee7b7 !important;
    border-radius: 6px !important;
  }

  .dad-speed-row {
    order: 5 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
  }

  .ai-speed-panel,
  .dad-speed-row .ai-speed-panel {
    order: 1 !important;
    width: 100% !important;
    font-size: 7.5px !important;
    color: #94a3b8 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 1px !important;
    margin: 0 !important;
    padding: 2px 4px !important;
    box-sizing: border-box !important;
    height: auto !important;
    flex: 0 0 auto !important;
    background: rgba(15, 23, 42, 0.75) !important;
    border: 1px solid rgba(0, 240, 255, 0.3) !important;
    border-radius: 6px !important;
  }

  .ai-speed-panel input[type="range"],
  #autoplay-speed {
    width: 100% !important;
    height: 4px !important;
    margin: 0 !important;
    max-width: none !important;
  }

  #dad-special-toggle {
    order: 2 !important;
    width: 100% !important;
    height: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    font-size: 8.5px !important;
    font-weight: bold !important;
    padding: 0 !important;
    white-space: nowrap !important;
    margin: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: hidden !important;
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.3), rgba(225, 29, 72, 0.55)) !important;
    border: 1px solid #fb7185 !important;
    color: #ffe4e6 !important;
    border-radius: 6px !important;
    flex: 0 0 auto !important;
  }

  #hud-control-grid,
  #controls-guide {
    display: none !important;
  }

  .sidebar-dock {
    display: contents !important;
  }

  #dad-cheer-banner,
  .dad-cheer-banner {
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 34px !important;
    max-height: none !important;
    flex: 1 1 auto !important;
    padding: 4px 10px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    background: linear-gradient(90deg, rgba(8, 20, 38, 0.92), rgba(16, 34, 64, 0.96), rgba(8, 20, 38, 0.92)) !important;
    border: 1px solid rgba(0, 240, 255, 0.45) !important;
    border-radius: 8px !important;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.25) !important;
    overflow: hidden !important;
    z-index: 20 !important;
    gap: 8px !important;
    align-self: stretch !important;
  }

  .cheer-header,
  .dad-cheer-head {
    width: auto !important;
    height: 22px !important;
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
  }

  .dad-cheer-badge {
    font-size: 8.5px !important;
    font-weight: 800 !important;
    padding: 2px 7px !important;
    height: 22px !important;
    line-height: 22px !important;
    border-radius: 4px !important;
    border: 1px solid rgba(0, 240, 255, 0.5) !important;
    background: rgba(0, 240, 255, 0.15) !important;
    color: #00f0ff !important;
    white-space: nowrap !important;
  }

  #dad-cheer-text,
  .cheer-main-msg,
  .dad-cheer-text,
  .cheer-text {
    flex: 1 1 auto !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    text-align: left !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.2 !important;
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.6) !important;
    margin: 0 !important;
  }

  #dad-cheer-tip,
  .cheer-sub-tip {
    display: none !important;
  }

  #dad-cheer-banner.is-tetris,
  .dad-cheer-banner.is-tetris,
  #dad-cheer-banner.is-bounce,
  .dad-cheer-banner.is-bounce {
    flex-direction: row !important;
    height: 100% !important;
    min-height: 34px !important;
    max-height: none !important;
  }

  #mobile-controls,
  #mobile-controls.mobile-controls {
    display: flex !important;
    width: 100% !important;
    max-width: 468px !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    flex: 0 0 48px !important;
    flex-shrink: 0 !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 3px !important;
    margin: 0 auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    padding: 0 2px max(4px, env(safe-area-inset-bottom, 4px)) 2px !important;
    box-sizing: border-box !important;
    z-index: 30 !important;
  }

  #mobile-controls .mobile-pad-move,
  #mobile-controls .mobile-pad-action,
  .mobile-pad-move,
  .mobile-pad-action {
    display: contents !important;
  }

  #mobile-controls .pad-btn {
    flex: 1 1 0 !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    min-width: 0 !important;
    padding: 0 !important;
    font-size: 14px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    border-radius: 6px !important;
    backdrop-filter: blur(6px) !important;
    transition: transform 0.1s ease !important;
  }

  #mobile-controls .pad-btn:active {
    transform: scale(0.92) !important;
  }

  #mobile-controls #btn-left,
  #mobile-controls #btn-down,
  #mobile-controls #btn-right {
    background: linear-gradient(180deg, rgba(0, 180, 255, 0.18) 0%, rgba(0, 100, 200, 0.35) 100%) !important;
    border: 1.5px solid #00f0ff !important;
    color: #00f0ff !important;
  }

  #mobile-controls #btn-rotate {
    background: linear-gradient(180deg, rgba(168, 85, 247, 0.2) 0%, rgba(126, 34, 206, 0.4) 100%) !important;
    border: 1.5px solid #c084fc !important;
    color: #f3e8ff !important;
  }

  #mobile-controls #btn-drop {
    background: linear-gradient(180deg, rgba(234, 179, 8, 0.25) 0%, rgba(202, 138, 4, 0.45) 100%) !important;
    border: 1.5px solid #facc15 !important;
    color: #fef08a !important;
  }

  #mobile-controls #btn-hold {
    background: linear-gradient(180deg, rgba(249, 115, 22, 0.2) 0%, rgba(194, 65, 12, 0.4) 100%) !important;
    border: 1.5px solid #fb923c !important;
    color: #ffedd5 !important;
  }

  #mobile-controls #btn-timestop,
  #mobile-controls #btn-timestop.hidden,
  #mobile-controls .pad-btn-freeze.hidden {
    display: flex !important;
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.2) 0%, rgba(14, 116, 144, 0.45) 100%) !important;
    border: 1.5px solid #67e8f9 !important;
    color: #ecfeff !important;
  }

  #board-size-setting-group select,
  #board-size-setting-group #select-board-size,
  #board-size-setting-group .setting-hint {
    display: none !important;
  }

  #board-size-mobile-badge,
  .board-size-mobile-badge {
    display: block !important;
  }

  #select-board-size option[value="24"],
  #select-board-size option[value="28"],
  .board-size-pc-only {
    display: none !important;
  }

  /* 보드 중앙 오버레이 & 시작 카드 절대 고정 (이 쿼리 최하단 — 구버전 덮어쓰기 차단) */
  #overlay.overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: auto !important;
    height: auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    background: rgba(5, 8, 18, 0.65) !important;
    backdrop-filter: blur(3px) !important;
    z-index: 50 !important;
    padding: 0 4px !important;
    box-sizing: border-box !important;
  }

  #overlay.hidden {
    display: none !important;
  }

  .overlay.is-start #start-overlay.overlay-card,
  #start-overlay.overlay-card {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 28px 22px 24px !important;
    box-sizing: border-box !important;
    text-align: center !important;
    background: rgba(10, 15, 30, 0.92) !important;
    border: 1.5px solid #00f0ff !important;
    border-radius: 16px !important;
    box-shadow: 0 0 18px rgba(0, 240, 255, 0.35) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 14px !important;
    overflow: visible !important;
  }

  .overlay.is-start #profile-frame,
  .overlay.is-start #profile-frame.profile-frame,
  #profile-frame,
  #profile-frame.profile-frame {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: min(300px, 82%) !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: unset !important;
    max-width: 300px !important;
    max-height: 300px !important;
    aspect-ratio: 1 / 1 !important;
    flex: 0 0 auto !important;
    margin: 0 auto 4px auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    border: 4px solid var(--theme-glow, #00d2ff) !important;
    box-shadow:
      0 0 22px var(--theme-glow, #00d2ff),
      0 0 48px rgba(0, 210, 255, 0.45),
      inset 0 0 16px rgba(0, 210, 255, 0.2) !important;
  }

  #profile-frame .profile-icon-svg,
  #profile-frame .dad-neon-avatar {
    width: 70% !important;
    height: 70% !important;
    max-width: none !important;
    max-height: none !important;
    filter: drop-shadow(0 0 10px #00f0ff) drop-shadow(0 0 18px rgba(168, 85, 255, 0.55)) !important;
  }

  #profile-frame .profile-icon {
    font-size: 80px !important;
    line-height: 1 !important;
  }

  #profile-frame .profile-caption {
    display: none !important;
  }

  #profile-frame .profile-image,
  #profile-image.profile-image {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    object-fit: cover !important;
  }

  .overlay:not(.is-result):not(.is-conquer):not(.is-pause) #overlay-title.overlay-title,
  .overlay.is-start #overlay-title.overlay-title {
    display: none !important;
    font-size: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
  }

  .overlay.is-start #overlay-hint.overlay-hint,
  #overlay-hint.overlay-hint {
    font-size: 0.92rem !important;
    font-weight: 700 !important;
    border-radius: 18px !important;
    padding: 0 16px !important;
    margin: 0 auto !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 260px !important;
    height: 50px !important;
    min-width: 260px !important;
    min-height: 50px !important;
    max-width: 260px !important;
    box-sizing: border-box !important;
    text-align: center !important;
    line-height: 1.2 !important;
  }

  .overlay:not(.is-result):not(.is-conquer):not(.is-pause) #overlay-actions {
    display: none !important;
  }
}

/* ==========================================================================
   📱 Foldable Unfolded (폴더블폰 펼침 화면: 좌측 이동키 안쪽 중앙 배치)
   ========================================================================== */
@media screen and (min-width: 520px) and (max-width: 900px) and (max-height: 1000px) {
  /* 1. 하단 컨트롤러 바 전체 너비 확장 및 양손 분할 레이아웃 */
  #mobile-controls:not(.hidden),
  #mobile-controls.mobile-controls:not(.hidden) {
    max-width: 100% !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0 !important;
    padding: 0 16px max(6px, env(safe-area-inset-bottom, 6px)) 16px !important;
    box-sizing: border-box !important;
  }

  /* 2. [왼손 이동키 3개]: 왼쪽 끝에서 안쪽(게임패널 중앙 방향)으로 112px 이동 */
  #mobile-controls .mobile-pad-move,
  #mobile-controls .mobile-pad-move.mobile-pad {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    width: auto !important;
    flex: 0 0 auto !important;
    margin-left: 112px !important;
  }

  /* 3. [오른손 파지 영역]: 🔄, ⚡, 📦, ⏳ 4개 액션키 묶음 (가운데 여백을 두고 우측 밀착) */
  #mobile-controls .mobile-pad-action,
  #mobile-controls .mobile-pad-action.mobile-pad {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    width: auto !important;
    flex: 0 0 auto !important;
    margin-left: auto !important;
    margin-right: 0 !important;
  }

  /* 4. 폴더블 펼침 화면에 맞는 버튼 크기 및 터치감 확장 */
  #mobile-controls .pad-btn {
    width: 56px !important;
    height: 46px !important;
    min-width: 56px !important;
    min-height: 46px !important;
    max-width: 56px !important;
    max-height: 46px !important;
    flex: 0 0 56px !important;
    font-size: 16px !important;
    border-radius: 8px !important;
  }
}

.overlay.is-start #start-overlay.start-overlay-card,
.overlay.is-start #start-overlay,
.overlay.is-pause #start-overlay,
.overlay:not(.is-result):not(.is-conquer):not(.is-pause) #start-overlay.start-overlay-card {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  padding: 22px 18px !important;
}

.overlay.is-start #profile-frame,
.overlay.is-pause #profile-frame,
.overlay:not(.is-result):not(.is-conquer):not(.is-pause) #profile-frame {
  width: min(300px, 82%) !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: unset !important;
  max-width: 300px !important;
  max-height: 300px !important;
  aspect-ratio: 1 / 1 !important;
  flex: 0 0 auto !important;
  box-sizing: border-box !important;
  border: 4px solid var(--theme-glow, #00d2ff) !important;
  box-shadow:
    0 0 22px var(--theme-glow, #00d2ff),
    0 0 48px rgba(0, 210, 255, 0.45),
    inset 0 0 16px rgba(0, 210, 255, 0.2) !important;
}

.overlay.is-start #profile-frame .dad-neon-avatar,
.overlay.is-start #profile-frame .profile-icon-svg,
.overlay:not(.is-result):not(.is-conquer):not(.is-pause) #profile-frame .dad-neon-avatar {
  width: 70% !important;
  height: 70% !important;
  max-width: none !important;
  max-height: none !important;
  filter: drop-shadow(0 0 10px #00f0ff) drop-shadow(0 0 18px rgba(168, 85, 255, 0.55)) !important;
}

.overlay.is-start #overlay-title,
.overlay:not(.is-result):not(.is-conquer):not(.is-pause) #overlay-title {
  display: none !important;
  font-size: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

.overlay.is-start #overlay-hint,
.overlay:not(.is-result):not(.is-conquer):not(.is-pause) #overlay-hint {
  width: 260px !important;
  height: 50px !important;
  min-width: 260px !important;
  min-height: 50px !important;
  max-width: 260px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
}

/* Idle profile card — original compact popup; enlarge photo circle only */
#overlay.overlay.is-start,
#overlay.overlay.is-pause {
  padding: 6px !important;
}

#overlay #profile-card,
#overlay #profile-card.profile-card-host,
#overlay.overlay.is-start #profile-card.profile-card-host,
#overlay.overlay.is-pause #profile-card.profile-card-host,
#overlay #profile-card.profile-card-host.is-active,
.profile-overlay #profile-card,
.profile-overlay-card {
  width: 92% !important;
  max-width: 420px !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto !important;
  transform: none !important;
}

#overlay.overlay.is-start #profile-card.profile-card-host > #start-overlay,
#overlay.overlay.is-pause #profile-card.profile-card-host > #start-overlay,
#overlay.overlay.is-start #start-overlay.overlay-card,
#overlay.overlay.is-pause #start-overlay.overlay-card,
#overlay #profile-card.profile-card-host > #start-overlay {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 22px 18px 20px !important;
  gap: 16px !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  transform: none !important;
  background: rgba(10, 16, 26, 0.85) !important;
  border: 2px solid rgba(0, 210, 255, 0.6) !important;
  box-shadow: 0 0 30px rgba(0, 210, 255, 0.25) !important;
  border-radius: 20px !important;
}

#overlay.overlay.is-start #profile-frame,
#overlay.overlay.is-pause #profile-frame,
#overlay.overlay.is-start #profile-card #profile-frame,
#overlay.overlay.is-pause #profile-card #profile-frame,
#overlay #profile-card #profile-frame,
#overlay #profile-card .profile-avatar-frame,
#overlay #profile-card .profile-avatar-wrap,
#overlay #profile-card .avatar-frame,
#overlay #profile-card .profile-img-container,
#overlay #profile-card #profile-avatar-canvas {
  width: min(300px, 82%) !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: unset !important;
  max-width: 300px !important;
  max-height: 300px !important;
  aspect-ratio: 1 / 1 !important;
  flex: 0 0 auto !important;
  align-self: center !important;
  box-sizing: border-box !important;
  border-radius: 50% !important;
  border: 4px solid #00d2ff !important;
  box-shadow: 0 0 20px rgba(0, 210, 255, 0.5) !important;
  margin: 0 auto 14px auto !important;
  overflow: hidden !important;
  transform: none !important;
}

#overlay #profile-card #profile-frame .dad-neon-avatar,
#overlay #profile-card #profile-frame .profile-icon-svg,
#overlay.overlay.is-start #profile-frame .dad-neon-avatar,
#overlay.overlay.is-start #profile-frame .profile-icon-svg,
#overlay.overlay.is-pause #profile-frame .dad-neon-avatar,
#overlay.overlay.is-pause #profile-frame .profile-icon-svg {
  width: 70% !important;
  height: 70% !important;
  max-width: none !important;
  max-height: none !important;
}

#overlay #profile-card img,
#overlay #profile-card .profile-image,
#overlay #profile-card canvas:not(.hidden) {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 50% !important;
}

#overlay #profile-card .profile-title,
#overlay #profile-card h1,
#overlay #profile-card h2,
#overlay #profile-card h3,
#overlay #profile-card .brand-title,
#overlay #profile-card .profile-caption,
.overlay.is-start #overlay-title,
.overlay.is-pause #overlay-title,
#overlay.overlay.is-start #overlay-title,
#overlay.overlay.is-pause #overlay-title,
#overlay.overlay.is-start #profile-card #overlay-title,
#overlay.overlay.is-pause #profile-card #overlay-title {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  font-size: 0 !important;
  line-height: 0 !important;
  opacity: 0 !important;
}

.overlay.is-result #overlay-title,
.overlay.is-conquer #overlay-title,
#overlay.overlay.is-result #overlay-title,
#overlay.overlay.is-conquer #overlay-title,
#overlay.overlay.is-result #profile-card #overlay-title,
#overlay.overlay.is-conquer #profile-card #overlay-title {
  display: block !important;
  visibility: visible !important;
  height: auto !important;
  max-height: none !important;
  font-size: 1.1rem !important;
  line-height: 1.2 !important;
  opacity: 1 !important;
}

#overlay #profile-nickname,
#profile-card .profile-nickname {
  display: block !important;
  margin: 0 0 12px !important;
  padding: 0 !important;
  color: #7cf0ff !important;
  font-size: 22px !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em !important;
  text-align: center !important;
  text-shadow: 0 0 10px rgba(0, 210, 255, 0.55) !important;
}

.overlay.is-result #profile-nickname,
.overlay.is-conquer #profile-nickname {
  display: none !important;
}

#overlay.overlay.is-start #overlay-hint,
#overlay.overlay.is-pause #overlay-hint {
  width: auto !important;
  min-width: 0 !important;
  max-width: 92% !important;
  height: auto !important;
  min-height: 52px !important;
  padding: 12px 20px !important;
  font-size: 18px !important;
}

body.diag-running.diag-measure-profile #overlay,
body.hide-board-idle.diag-measure-profile #overlay,
body.diag-running.diag-measure-profile #start-overlay,
body.hide-board-idle.diag-measure-profile #start-overlay,
body.diag-running.diag-measure-profile #profile-card.profile-card-host,
body.hide-board-idle.diag-measure-profile #profile-card.profile-card-host,
body.diag-running.diag-measure-profile #profile-frame,
body.hide-board-idle.diag-measure-profile #profile-frame {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

body.diag-running.diag-measure-profile #profile-card.profile-card-host,
body.hide-board-idle.diag-measure-profile #profile-card.profile-card-host {
  width: 92% !important;
  min-width: 0 !important;
  max-width: 420px !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}

body.diag-running.diag-measure-profile #profile-frame,
body.hide-board-idle.diag-measure-profile #profile-frame {
  width: min(300px, 82%) !important;
  height: auto !important;
  max-width: 300px !important;
  max-height: 300px !important;
  aspect-ratio: 1 / 1 !important;
  flex: 0 0 auto !important;
  box-sizing: border-box !important;
}

body.diag-running.diag-measure-profile #profile-frame .dad-neon-avatar,
body.hide-board-idle.diag-measure-profile #profile-frame .dad-neon-avatar {
  width: 70% !important;
  height: 70% !important;
  max-width: none !important;
  max-height: none !important;
}

.watermark,
.board-watermark,
.bg-watermark,
.board-level-watermark,
.level-watermark,
[class*="watermark"] {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.overlay.is-result #start-overlay,
.overlay.is-conquer #start-overlay,
.overlay.is-result #start-overlay.overlay-card,
.overlay.is-conquer #start-overlay.overlay-card {
  width: 92% !important;
  max-width: 420px !important;
  min-width: 0 !important;
}

/* Idle/pause: never show overlay title (wins leftover display:block rules) */
#overlay.overlay.is-start #overlay-title,
#overlay.overlay.is-pause #overlay-title,
#overlay.is-start .overlay-title,
#overlay.is-pause .overlay-title,
#overlay.is-start .popup-title,
#overlay #profile-card h1,
#overlay #profile-card h2,
#overlay #profile-card .overlay-title,
#overlay #profile-card .popup-title,
#overlay #profile-card .profile-title,
#overlay #profile-card .profile-caption {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  font-size: 0 !important;
  line-height: 0 !important;
  opacity: 0 !important;
}

/* Final: compact idle/result card, large photo circle */
#overlay.overlay.is-start #profile-card.profile-card-host,
#overlay.overlay.is-pause #profile-card.profile-card-host,
#overlay.overlay.is-result #profile-card.profile-card-host,
#overlay.overlay.is-conquer #profile-card.profile-card-host,
#overlay.overlay.is-start #profile-card,
#overlay.overlay.is-pause #profile-card,
#overlay.overlay.is-result #profile-card,
#overlay.overlay.is-conquer #profile-card {
  width: 92% !important;
  min-width: 0 !important;
  max-width: 420px !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  flex: 0 0 auto !important;
  box-sizing: border-box !important;
}

#overlay.overlay.is-start #profile-card > #start-overlay,
#overlay.overlay.is-pause #profile-card > #start-overlay,
#overlay.overlay.is-start #start-overlay,
#overlay.overlay.is-pause #start-overlay {
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  min-height: 0 !important;
}

#overlay.overlay.is-start #profile-card #profile-frame,
#overlay.overlay.is-pause #profile-card #profile-frame,
#overlay.overlay.is-result #profile-card #profile-frame,
#overlay.overlay.is-conquer #profile-card #profile-frame,
#overlay.overlay.is-start #profile-frame,
#overlay.overlay.is-pause #profile-frame,
#overlay.overlay.is-result #profile-frame,
#overlay.overlay.is-conquer #profile-frame {
  width: min(300px, 82%) !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: unset !important;
  max-width: 300px !important;
  max-height: 300px !important;
  aspect-ratio: 1 / 1 !important;
  flex: 0 0 auto !important;
  align-self: center !important;
  box-sizing: border-box !important;
}

#overlay.overlay.is-start #profile-frame .dad-neon-avatar,
#overlay.overlay.is-pause #profile-frame .dad-neon-avatar,
#overlay.overlay.is-result #profile-frame .dad-neon-avatar,
#overlay.overlay.is-conquer #profile-frame .dad-neon-avatar,
#overlay.overlay.is-start #profile-frame .profile-icon-svg,
#overlay.overlay.is-pause #profile-frame .profile-icon-svg,
#overlay.overlay.is-result #profile-frame .profile-icon-svg,
#overlay.overlay.is-conquer #profile-frame .profile-icon-svg {
  width: 70% !important;
  height: 70% !important;
  max-width: none !important;
  max-height: none !important;
}

/* Pin overlay to the board and flex-center the card. Never use 50%+translate. */
#board-wrap > #overlay,
#overlay.overlay,
#overlay.game-overlay {
  position: absolute !important;
  inset: 0 !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 8px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  place-items: center !important;
  box-sizing: border-box !important;
  transform: none !important;
}

#overlay.hidden {
  display: none !important;
}

#overlay > #idle-overlay,
#overlay > #start-prompt-overlay {
  display: none !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  flex: 0 0 0 !important;
}

#overlay > #profile-card,
#overlay #profile-card.profile-card-host,
#overlay.overlay.is-start #profile-card,
#overlay.overlay.is-pause #profile-card,
#overlay.overlay.is-result #profile-card,
#overlay.overlay.is-conquer #profile-card {
  position: relative !important;
  inset: auto !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  width: 92% !important;
  max-width: 420px !important;
  min-width: 0 !important;
  height: auto !important;
  margin: auto !important;
  align-self: center !important;
  justify-self: center !important;
  transform: none !important;
  flex: 0 0 auto !important;
}

#overlay #start-overlay,
#overlay #profile-card > #start-overlay,
#overlay.overlay.is-start #start-overlay,
#overlay.overlay.is-pause #start-overlay,
#overlay.overlay.is-result #start-overlay,
#overlay.overlay.is-conquer #start-overlay,
.overlay.is-result #start-overlay,
.overlay.is-conquer #start-overlay,
.overlay.is-result .overlay-card,
.overlay.is-conquer .overlay-card {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  inset: auto !important;
  transform: none !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

/* Photo window is always a circle; never follow board/panel height */
#overlay #profile-card #profile-frame,
#overlay.overlay.is-start #profile-card #profile-frame,
#overlay.overlay.is-pause #profile-card #profile-frame,
#overlay.overlay.is-result #profile-card #profile-frame,
#overlay.overlay.is-conquer #profile-card #profile-frame,
body.is-mobile-arcade #overlay #profile-card #profile-frame,
body.is-mobile-pad #overlay #profile-card #profile-frame {
  width: min(300px, 82%) !important;
  height: auto !important;
  min-height: unset !important;
  max-width: 300px !important;
  max-height: 300px !important;
  aspect-ratio: 1 / 1 !important;
  flex: 0 0 auto !important;
  align-self: center !important;
  border-radius: 50% !important;
}


