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

:root {
  --bg: #f6eadc;
  --bg2: #f3e2cf;
  --card: rgba(255, 249, 244, 0.88);
  --card-strong: rgba(255, 248, 241, 0.95);
  --brown: #7d6151;
  --soft-brown: #9b7d6b;
  --pink: #f6c9d7;
  --mint: #ccefe4;
  --sky: #d8ecff;
  --lavender: #e3d9ff;
  --yellow: #faefbe;
  --peach: #ffd9be;
  --shadow: 0 16px 30px rgba(116, 86, 68, 0.12);
  --radius-xl: 30px;
  --radius-lg: 24px;
}

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

body {
  font-family: 'Pretendard', sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  min-height: 100vh;
  color: var(--brown);
  overflow-x: hidden;
  position: relative;
}

@media (min-width: 1025px) and (pointer: fine) {
  html,
  body {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  html::-webkit-scrollbar,
  body::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

input {
  border: none;
  outline: none;
}

.app {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 28px 16px;
  position: relative;
  z-index: 2;
}

.screen {
  display: none;
  width: 100%;
  max-width: 1180px;
}

.screen.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

.card {
  background: var(--card);
  backdrop-filter: blur(9px);
  border: 3px solid rgba(255, 255, 255, 0.68);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.small-badge {
  display: inline-block;
  font-size: 0.95rem;
  padding: 10px 16px;
  margin-bottom: 16px;
  border-radius: 999px;
  background: #fff5fb;
  color: #b97e99;
  border: 2px dashed #efc2d3;
}

.sub-text {
  color: #8f7363;
  line-height: 1.65;
}

.main-card,
.menu-card {
  max-width: 680px;
  margin: 0 auto;
  padding: 52px 36px;
  text-align: center;
}

.main-card h1,
.menu-card h2,
.luck-card h2,
.game-card h2,
.popup h3 {
  font-family: 'Gaegu', cursive;
  color: var(--soft-brown);
}

.main-card h1 {
  font-size: clamp(2.3rem, 5vw, 4rem);
  margin-bottom: 14px;
}

.menu-card h2,
.luck-card h2,
.game-card h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 10px;
}

.main-btn {
  margin-top: 28px;
  background: linear-gradient(135deg, var(--pink), #ffdce7);
  color: var(--brown);
  font-family: 'Gaegu', cursive;
  font-size: 2rem;
  font-weight: 700;
  padding: 16px 42px;
  border-radius: 999px;
  box-shadow: 0 12px 22px rgba(247, 201, 216, 0.42);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.main-btn:hover,
.action-btn:hover,
.menu-btn:hover,
.game-item:hover,
.back-btn:hover,
.popup-btn:hover,
.drawer-toggle-btn:hover {
  transform: translateY(-4px);
}

.menu-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin: 34px 0 28px;
  flex-wrap: wrap;
}

.menu-btn {
  width: 220px;
  min-height: 170px;
  border-radius: 26px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--brown);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  box-shadow: var(--shadow);
}

.menu-btn .emoji {
  font-size: 2.8rem;
}

.menu-btn.physical {
  background: linear-gradient(135deg, var(--peach), #ffe8d7);
}

.menu-btn.luck {
  background: linear-gradient(135deg, var(--mint), #dbf8ee);
}

.back-btn {
  background: #fff;
  color: var(--soft-brown);
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(130, 100, 80, 0.08);
  transition: transform 0.18s ease;
}

.luck-card,
.game-card {
  padding: 28px;
}

.luck-header,
.scoreboard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.luck-header {
  margin-bottom: 24px;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  grid-auto-rows: 1fr;
}

.game-item {
  position: relative;
  width: 100%;
  min-height: 198px;
  background: #fffaf5;
  border: 2px solid #f2e5d8;
  border-radius: 24px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: 0 8px 18px rgba(130, 100, 80, 0.07);
  transition: transform 0.2s ease;
  color: var(--brown);
  appearance: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}


.game-ff-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
}

.game-ff-badge-icon {
  font-size: 0.82rem;
  line-height: 1;
}

.game-ff-badge-text {
  line-height: 1;
}

.game-ff-badge.is-supported {
  background: linear-gradient(180deg, rgba(237, 255, 247, 0.98) 0%, rgba(214, 248, 229, 0.96) 100%);
  color: #44745a;
}

.game-ff-badge.is-blocked,
.game-ff-badge.is-none {
  background: linear-gradient(180deg, rgba(255, 246, 240, 0.98) 0%, rgba(255, 231, 221, 0.96) 100%);
  color: #9a6257;
}

.game-ff-badge.is-pending {
  background: linear-gradient(180deg, rgba(245, 241, 255, 0.98) 0%, rgba(232, 225, 255, 0.96) 100%);
  color: #6b609d;
}

.game-item[data-ff-state] {
  padding-top: 58px;
}

.game-item[data-ff-state] .game-num {
  margin-top: 2px;
}

.game-item.game-launch {
  border: 2px solid #e8d8ff;
  background: linear-gradient(180deg, #fff8ff 0%, #f9f4ff 100%);
}

.game-item:nth-child(2) { background: #effaf6; }
.game-item:nth-child(3) { background: #f2f4ff; }
.game-item:nth-child(4) { background: #fff8e8; }
.game-item:nth-child(5) { background: #fff1ea; }
.game-item:nth-child(6) { background: #f4fff4; }
.game-item:nth-child(7) { background: #f9f2ff; }
.game-item:nth-child(8) { background: #eef9ff; }

.game-num {
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lavender), var(--sky));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Gaegu', cursive;
  font-size: 1.8rem;
  font-weight: 700;
}

.game-item h3 {
  font-family: 'Gaegu', cursive;
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.game-item p {
  font-size: 0.95rem;
  color: #8a7161;
  line-height: 1.5;
}

.game-item p {
  margin-bottom: 12px;
}

.game-meta {
  margin-top: auto;
  display: grid;
  gap: 10px;
  width: 100%;
  padding-top: 8px;
}

.game-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 34%),
    linear-gradient(180deg, rgba(255, 248, 252, 0.96) 0%, rgba(255, 241, 246, 0.92) 100%);
  border: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 8px 16px rgba(125, 97, 81, 0.08);
}

.game-meta-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: #9f6f87;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.game-meta-value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 900;
  color: #6d5447;
  text-align: right;
  word-break: keep-all;
  letter-spacing: 0.01em;
}

.game-meta-value:has(*) {
  gap: 4px;
}

.game-meta.is-pending .game-meta-row {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.54), transparent 34%),
    linear-gradient(180deg, rgba(255, 251, 246, 0.88) 0%, rgba(247, 241, 235, 0.84) 100%);
}
.controls-wrap,
.scoreboard-card {
  background: var(--card-strong);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
  padding: 18px;
}

.controls-wrap {
  margin-top: 18px;
}

.input-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-card label,
.scoreboard-head h3 {
  font-weight: 700;
  color: var(--soft-brown);
}

.input-card input {
  width: 100%;
  border: 2px solid #eadfd4;
  background: #fffdfa;
  border-radius: 18px;
  padding: 16px 18px;
  color: var(--brown);
}

.input-card input:focus {
  border-color: #d9c9ff;
  box-shadow: 0 0 0 5px rgba(227, 217, 255, 0.35);
}

input:disabled {
  background: #f1e7dd;
  color: #9b8577;
  cursor: not-allowed;
}

.helper-text,
.status-text,
#totalInfo {
  color: #8c7262;
  line-height: 1.5;
}

#raceStatusText {
  min-height: 56px;
  height: 56px;
  overflow-y: auto;
  padding-right: 4px;
  line-height: 1.45;
  overflow-wrap: break-word;
}

@media (max-width: 640px) {
  #raceStatusText {
    min-height: 64px;
    height: 64px;
  }
}

.button-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
  width: 100%;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 13px 14px;
  text-align: center;
  white-space: nowrap;
  word-break: keep-all;
  line-height: 1.2;
  border-radius: 999px;
  font-weight: 700;
  color: var(--brown);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.08);
  transition: transform 0.2s ease;
}

.action-btn {
  border-radius: 999px;
  padding: 13px 22px;
  font-weight: 700;
  color: var(--brown);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.08);
  transition: transform 0.2s ease;
}

.action-btn.primary {
  background: linear-gradient(135deg, var(--pink), #ffdfe8);
}

.action-btn.secondary {
  background: linear-gradient(135deg, var(--sky), #e9f5ff);
}

.action-btn.soft {
  background: linear-gradient(135deg, var(--yellow), #fff5cc);
}

.status-text {
  margin-top: 14px;
  font-size: 0.95rem;
  min-height: 24px;
}

.scoreboard-card {
  margin-top: 16px;
}

.slot-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-content: flex-start;
  margin-top: 14px;
  max-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}

.slot-legend::-webkit-scrollbar,
.race-ranking-list::-webkit-scrollbar {
  width: 8px;
}

.slot-legend::-webkit-scrollbar-thumb,
.race-ranking-list::-webkit-scrollbar-thumb {
  background: rgba(157, 125, 107, 0.35);
  border-radius: 999px;
}

.slot-legend::-webkit-scrollbar-track,
.race-ranking-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
}


.race-track-lanes::-webkit-scrollbar {
  width: 8px;
}

.race-track-lanes::-webkit-scrollbar-thumb {
  background: rgba(157, 125, 107, 0.35);
  border-radius: 999px;
}

.race-track-lanes::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 6px 14px rgba(120, 90, 70, 0.06);
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.play-area {
  margin-top: 18px;
}

.game-canvas-wrap {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.55), transparent 25%),
    linear-gradient(180deg, #fff6ef 0%, #fff2ea 30%, #ffe9da 100%);
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 16px 28px rgba(120, 90, 70, 0.08);
}

.game-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.slot-overlay {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  height: clamp(74px, 16%, 112px);
  display: flex;
  gap: 0;
  pointer-events: none;
}

.slot-box {
  min-width: 0;
  height: 100%;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  border-left: 2px solid rgba(255, 255, 255, 0.7);
  border-right: 2px solid rgba(255, 255, 255, 0.7);
  border-top: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 -10px 25px rgba(255, 255, 255, 0.18);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 8px 5px 10px;
  text-align: center;
}

.slot-name {
  width: 100%;
  font-weight: 700;
  font-size: clamp(0.62rem, 0.8vw, 0.82rem);
  color: #6f5647;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-meta {
  margin-top: 4px;
  font-size: clamp(0.52rem, 0.68vw, 0.72rem);
  color: #7d6455;
  line-height: 1.2;
}

.game-canvas-wrap,
.race-track-wrap,
.sim-arena-wrap,
.sim-arena-zoom-stage {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.race-track-wrap {
  position: relative;
}

.game-canvas-wrap.is-fast-forwarding,
.race-track-wrap.is-fast-forwarding,
.sim-arena-wrap.is-fast-forwarding,
.sim-arena-zoom-stage.is-fast-forwarding,
.game-canvas-wrap.is-fast-forward-blocked,
.race-track-wrap.is-fast-forward-blocked,
.sim-arena-wrap.is-fast-forward-blocked,
.sim-arena-zoom-stage.is-fast-forward-blocked {
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.48),
    0 0 0 4px rgba(255, 225, 149, 0.42),
    0 16px 28px rgba(120, 90, 70, 0.12);
}

.game-canvas-wrap.is-fast-forwarding::after,
.race-track-wrap.is-fast-forwarding::after,
.sim-arena-wrap.is-fast-forwarding::after,
.sim-arena-zoom-stage.is-fast-forwarding::after,
.game-canvas-wrap.is-fast-forward-blocked::after,
.race-track-wrap.is-fast-forward-blocked::after,
.sim-arena-wrap.is-fast-forward-blocked::after,
.sim-arena-zoom-stage.is-fast-forward-blocked::after {
  content: attr(data-fast-forward-label);
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 248, 222, 0.94);
  color: #8b6a37;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.14);
  pointer-events: none;
  animation: fastForwardPulse 0.9s ease-in-out infinite;
}

.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(90, 70, 60, 0.24);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 60;
  padding: 20px;
}

.popup-overlay.hidden {
  display: none;
}

.popup {
  width: 100%;
  max-width: 360px;
  background: #fffaf8;
  border-radius: 28px;
  padding: 30px 24px;
  text-align: center;
  box-shadow: 0 18px 36px rgba(90, 70, 60, 0.18);
  border: 3px solid #fff;
  animation: popUp 0.25s ease;
}

.popup-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.popup h3 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.popup-message {
  color: #8b7366;
  line-height: 1.6;
  margin-bottom: 18px;
}

.popup-btn {
  background: linear-gradient(135deg, var(--yellow), #fff2bf);
  color: var(--brown);
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
}


.popup.fast-forward-guide-popup {
  max-width: 760px;
  padding: 28px 24px;
  text-align: left;
}

.popup.fast-forward-guide-popup .popup-message {
  max-height: min(68vh, 640px);
  overflow-y: auto;
  padding-right: 6px;
  margin-bottom: 20px;
}

.ff-guide-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ff-guide-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ff-guide-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.08);
}

.ff-guide-chip.is-supported {
  background: linear-gradient(180deg, rgba(237, 255, 247, 0.98) 0%, rgba(214, 248, 229, 0.96) 100%);
  color: #44745a;
}

.ff-guide-chip.is-blocked,
.ff-guide-chip.is-none {
  background: linear-gradient(180deg, rgba(255, 246, 240, 0.98) 0%, rgba(255, 231, 221, 0.96) 100%);
  color: #9a6257;
}

.ff-guide-chip.is-pending {
  background: linear-gradient(180deg, rgba(245, 241, 255, 0.98) 0%, rgba(232, 225, 255, 0.96) 100%);
  color: #6b609d;
}

.ff-guide-chip.is-subtle {
  background: rgba(255, 255, 255, 0.78);
  color: #8d735f;
}

.ff-guide-copy {
  color: #866b5c;
  line-height: 1.7;
}

.ff-guide-demo {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 248, 241, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.84);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.05);
}

.ff-guide-screen {
  position: relative;
  overflow: hidden;
  min-height: 230px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.54), transparent 24%),
    linear-gradient(180deg, #fff6ef 0%, #fff1ea 100%);
  border: 3px solid rgba(255, 255, 255, 0.84);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4), 0 12px 22px rgba(120, 90, 70, 0.08);
}

.ff-guide-screen.is-supported::before,
.ff-guide-screen.is-blocked::before,
.ff-guide-screen.is-none::before,
.ff-guide-screen.is-pending::before {
  content: '';
  position: absolute;
  left: 26px;
  right: 26px;
  bottom: 42px;
  height: 70px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.42) 0%, rgba(255,255,255,0.18) 100%);
  border: 2px dashed rgba(255,255,255,0.75);
}

.ff-guide-overlay-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.92);
  color: #8b6a37;
  font-size: 0.86rem;
  font-weight: 900;
  opacity: 0;
  transform: translateY(-6px) scale(0.92);
  animation: ffGuideBadgePulse 2.2s ease-in-out infinite;
}

.ff-guide-overlay-badge.is-supported {
  background: rgba(255, 248, 222, 0.96);
  color: #8b6a37;
}

.ff-guide-overlay-badge.is-blocked,
.ff-guide-overlay-badge.is-none {
  background: rgba(255, 239, 233, 0.96);
  color: #995e54;
}

.ff-guide-overlay-badge.is-pending {
  background: rgba(240, 236, 255, 0.96);
  color: #6a5ca0;
}

.ff-guide-progress-row {
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 68px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.ff-guide-progress {
  display: block;
  flex: 1 1 0;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(191, 232, 216, 0.95) 0%, rgba(216, 236, 255, 0.95) 100%);
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 10px 20px rgba(120, 90, 70, 0.08);
  animation: ffGuideProgressMove 2.2s ease-in-out infinite;
}

.ff-guide-progress-a { height: 52px; animation-delay: 0s; }
.ff-guide-progress-b { height: 78px; animation-delay: 0.22s; }
.ff-guide-progress-c { height: 62px; animation-delay: 0.44s; }

.ff-guide-finger {
  position: absolute;
  left: 50%;
  bottom: 34px;
  z-index: 4;
  font-size: 3rem;
  transform: translateX(-50%);
  animation: ffGuideFingerPress 2.2s ease-in-out infinite;
  filter: drop-shadow(0 10px 16px rgba(120, 90, 70, 0.16));
}

.ff-guide-ripple {
  position: absolute;
  left: 50%;
  bottom: 78px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  transform: translateX(-50%) scale(0.4);
  opacity: 0;
  border: 3px solid rgba(255, 214, 126, 0.7);
  animation: ffGuideRipple 2.2s ease-out infinite;
}

.ff-guide-ripple-2 {
  animation-delay: 0.18s;
}

.ff-guide-demo.is-blocked .ff-guide-ripple,
.ff-guide-demo.is-none .ff-guide-ripple {
  border-color: rgba(255, 164, 140, 0.7);
}

.ff-guide-demo.is-pending .ff-guide-ripple {
  border-color: rgba(183, 161, 255, 0.72);
}

.ff-guide-hold-badge {
  position: absolute;
  left: 50%;
  bottom: 144px;
  transform: translateX(-50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.9);
  color: #8d735f;
  border: 2px solid rgba(255,255,255,0.88);
  font-size: 0.82rem;
  font-weight: 800;
  animation: ffGuideHoldPulse 2.2s ease-in-out infinite;
}

.ff-guide-caption {
  color: #8c7262;
  line-height: 1.6;
  font-size: 0.92rem;
}

.ff-guide-steps {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 251, 246, 0.84);
  border: 2px solid rgba(255, 255, 255, 0.84);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.05);
  color: #8a7161;
  line-height: 1.6;
}

.ff-guide-steps strong {
  color: var(--soft-brown);
  font-size: 1rem;
}

@keyframes ffGuideFingerPress {
  0%, 24% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
  34%, 84% {
    transform: translateX(-50%) translateY(10px) scale(0.97);
  }
  100% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes ffGuideRipple {
  0%, 24% {
    opacity: 0;
    transform: translateX(-50%) scale(0.4);
  }
  34% {
    opacity: 0.72;
    transform: translateX(-50%) scale(0.58);
  }
  48% {
    opacity: 0.28;
    transform: translateX(-50%) scale(1.32);
  }
  84%, 100% {
    opacity: 0;
    transform: translateX(-50%) scale(1.86);
  }
}

@keyframes ffGuideBadgePulse {
  0%, 26% {
    opacity: 0;
    transform: translateY(-6px) scale(0.92);
  }
  36%, 84% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-2px) scale(0.98);
  }
}

@keyframes ffGuideHoldPulse {
  0%, 24% {
    opacity: 0.78;
    transform: translateX(-50%) translateY(0);
  }
  34%, 84% {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
  }
  100% {
    opacity: 0.7;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes ffGuideProgressMove {
  0%, 20% {
    transform: translateY(0) scaleY(1);
  }
  38%, 60% {
    transform: translateY(-8px) scaleY(1.03);
  }
  100% {
    transform: translateY(0) scaleY(1);
  }
}

.popup.game-info-popup {
  max-width: 760px;
  padding: 28px 24px;
  text-align: left;
}

.popup.game-info-popup .popup-icon {
  margin-bottom: 10px;
}

.popup.game-info-popup h3 {
  margin-bottom: 14px;
}

.popup.game-info-popup .popup-message {
  max-height: min(66vh, 640px);
  overflow-y: auto;
  padding-right: 6px;
  margin-bottom: 20px;
}

.popup.game-info-popup .popup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


.popup.battle-final-popup {
  max-width: 620px;
  padding: 24px 20px;
  text-align: center;
}

.popup.battle-final-popup .popup-icon {
  margin-bottom: 8px;
}

.popup.battle-final-popup h3 {
  margin-bottom: 12px;
}

.popup.battle-final-popup .popup-message {
  max-height: min(66vh, 640px);
  overflow-y: auto;
  padding-right: 0;
  margin-bottom: 16px;
}

.battle-final-popup-list {
  width: min(100%, 500px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.battle-final-popup-item,
.battle-final-popup-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(251, 244, 238, 0.96) 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 22px rgba(120, 90, 70, 0.08);
}

.battle-final-popup-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff8df 0%, #fff0be 100%);
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.08);
  color: #8a6b41;
  font-weight: 900;
  line-height: 1;
}

.battle-final-popup-name {
  margin-top: 10px;
  font-size: 1.12rem;
  font-weight: 900;
  color: var(--soft-brown);
  line-height: 1.3;
}

.battle-final-popup-formula {
  margin-top: 6px;
  color: #8f7363;
  line-height: 1.55;
  font-weight: 600;
}

.battle-final-popup-empty {
  color: #8f7363;
}

.game-info-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-info-lead {
  color: #866b5c;
  line-height: 1.7;
}

.game-info-section {
  background: rgba(255, 248, 241, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.84);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.05);
}

.game-info-section h4 {
  margin-bottom: 8px;
  color: var(--soft-brown);
  font-size: 1.03rem;
}

.game-info-section ul {
  margin: 0;
  padding-left: 18px;
  color: #8b7366;
  line-height: 1.65;
}

.game-info-section li + li {
  margin-top: 6px;
}

.background-deco {
  position: fixed;
  border-radius: 50%;
  opacity: 0.58;
  filter: blur(2px);
  z-index: 1;
  animation: floatY 5s ease-in-out infinite;
}

.deco1 {
  width: 150px;
  height: 150px;
  background: #ffdbe8;
  top: 8%;
  left: 6%;
}

.deco2 {
  width: 110px;
  height: 110px;
  background: #d8f6ec;
  bottom: 12%;
  left: 10%;
  animation-delay: 1s;
}

.deco3 {
  width: 170px;
  height: 170px;
  background: #e8deff;
  top: 18%;
  right: 7%;
  animation-delay: 2s;
}

.deco4 {
  width: 120px;
  height: 120px;
  background: #fff0b8;
  bottom: 10%;
  right: 12%;
  animation-delay: 1.5s;
}

/* 데스크톱 game1 */
body.game1-mode {
  overflow-y: auto;
  overflow-x: hidden;
}

body.game1-mode .app {
  min-height: 100vh;
  align-items: center;
  padding: 28px 16px;
}

body.game1-mode .game-screen {
  height: auto;
}

body.game1-mode .game-card-full {
  min-height: 720px;
  height: auto;
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 16px;
  padding: 20px;
  overflow: hidden;
}

body.game1-mode .game-sidebar {
  min-width: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.34);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
}

body.game1-mode .game-sidebar-inner {
  height: 100%;
  overflow: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-title {
  font-family: 'Gaegu', cursive;
  font-size: 2rem;
  color: var(--soft-brown);
  margin-bottom: 8px;
}

body.game1-mode .controls-wrap,
body.game1-mode .scoreboard-card {
  margin-top: 0;
}

body.game1-mode .scoreboard-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.game1-mode .slot-legend {
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  max-height: 180px;
}

body.game1-mode .game-main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: clamp(8px, 1vw, 14px);
}

.game-board-card {
  background: var(--card-strong);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.game-board-head h3 {
  margin: 0;
  font-weight: 700;
  color: var(--soft-brown);
}

.game-board-head span {
  color: #8c7262;
  font-size: 0.92rem;
}

body.game1-mode .game-main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 2px 4px 0;
  flex-wrap: wrap;
}

body.game1-mode .game-main-header h2 {
  margin-bottom: 6px;
}

body.game1-mode .game-mini-badge {
  margin-bottom: 10px;
}

body.game1-mode .game-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.drawer-toggle-btn {
  display: none;
  padding: 12px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--sky), #e9f5ff);
  color: var(--brown);
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.08);
  transition: transform 0.2s ease;
}

body.game1-mode .game-play-area {
  margin-top: 0;
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

.drawer-backdrop {
  display: none;
}

/* =========================
   game2 : race
========================= */

.race-card {
  padding: 20px;
}

.race-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 16px;
  min-height: 720px;
}

.race-sidebar {
  min-width: 0;
  background: rgba(255, 255, 255, 0.34);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
}

.race-sidebar-inner {
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.race-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.race-main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.race-track-wrap {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.5), transparent 24%),
    linear-gradient(180deg, #fff8f2 0%, #fff1e6 100%);
  border: 3px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4), 0 16px 28px rgba(120, 90, 70, 0.08);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.race-track-stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.race-track-stage-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.race-track-stage-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--soft-brown);
}

.race-track-stage-desc {
  margin-top: 6px;
  color: #8c7262;
  line-height: 1.55;
  font-size: 0.9rem;
}

.race-track-stage-actions {
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.race-track-lanes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.race-track-zoom-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.race-lane {
  position: relative;
  min-height: 72px;
  border-radius: 20px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.2) 0px,
      rgba(255, 255, 255, 0.2) 28px,
      rgba(255, 255, 255, 0.08) 28px,
      rgba(255, 255, 255, 0.08) 56px
    ),
    linear-gradient(180deg, #dcb89a 0%, #cfa37d 100%);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.45);
}

.race-lane-label {
  position: absolute;
  left: 10px;
  top: 8px;
  z-index: 2;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 249, 244, 0.9);
  color: var(--brown);
  font-size: 0.82rem;
  font-weight: 700;
}

.race-start-line,
.race-finish-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  z-index: 1;
}

.race-start-line {
  left: 56px;
  background: repeating-linear-gradient(
    180deg,
    #fff 0 8px,
    #ff8f8f 8px 16px
  );
}

.race-finish-line {
  right: 18px;
  background: repeating-linear-gradient(
    180deg,
    #fff 0 8px,
    #444 8px 16px
  );
}

.race-track-inner {
  position: relative;
  min-height: 72px;
  margin-left: 62px;
  margin-right: 40px;
}

.race-horse {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 108px;
  padding: 9px 13px;
  border-radius: 999px;
  background: var(--horse-color, rgba(255, 249, 244, 0.96));
  border: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 14px rgba(120, 90, 70, 0.12);
  transition: left 0.08s linear, transform 0.18s ease, box-shadow 0.18s ease;
  z-index: 2;
  max-width: 220px;
}

.horse-emoji {
  display: inline-block;
  font-size: 1.2rem;
  line-height: 1;
  flex: 0 0 auto;
  transform: scaleX(-1);
  transform-origin: center;
}

.horse-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.horse-name {
  font-size: 0.97rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--brown);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.horse-status {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #8b7366;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.race-bottom-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.race-panel {
  background: var(--card-strong);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
  padding: 16px;
  min-height: 220px;
}

.race-ranking-panel {
  min-height: 220px;
}

.race-panel-head h3 {
  font-weight: 700;
  color: var(--soft-brown);
  margin-bottom: 12px;
}

.race-ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.race-ranking-item {
  background: #fff;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 6px 14px rgba(120, 90, 70, 0.05);
  padding: 12px 14px;
  color: var(--brown);
  line-height: 1.5;
}

.race-ranking-item strong {
  color: var(--soft-brown);
}

.race-ranking-item.top {
  background: linear-gradient(135deg, #fff5c9, #fffdf1);
}

.race-horse.horse-finished {
  animation: horseFinishPop 0.7s ease, horseFinishGlow 1.4s ease-in-out infinite alternate;
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.55),
    0 0 18px rgba(255, 223, 154, 0.85),
    0 10px 18px rgba(120, 90, 70, 0.18);
}

.race-horse.horse-finished::after {
  content: '✨';
  position: absolute;
  right: -8px;
  top: -10px;
  font-size: 1.1rem;
  animation: finishSparkle 0.9s ease-in-out infinite alternate;
}

.race-lane.lane-finished {
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.35),
    0 0 18px rgba(255, 232, 173, 0.4);
}

/* 공통 오버레이 / 애니메이션 */
.orientation-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(246, 234, 220, 0.96);
  backdrop-filter: blur(10px);
}

.orientation-lock-card {
  width: min(92vw, 420px);
  background: rgba(255, 249, 244, 0.96);
  border: 3px solid rgba(255, 255, 255, 0.86);
  border-radius: 28px;
  box-shadow: 0 16px 30px rgba(116, 86, 68, 0.14);
  padding: 28px 22px;
  text-align: center;
}

.orientation-lock-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.orientation-lock-card h3 {
  font-family: 'Gaegu', cursive;
  font-size: 2rem;
  color: var(--soft-brown);
  margin-bottom: 8px;
}

.orientation-lock-card p {
  color: #8b7366;
  line-height: 1.6;
}

body.orientation-blocked {
  overflow: hidden !important;
}

body.orientation-blocked .app {
  visibility: hidden;
  pointer-events: none;
}

body.orientation-blocked .orientation-lock-overlay {
  display: flex;
}

@keyframes fastForwardPulse {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.92;
  }
  50% {
    transform: translateY(-1px);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popUp {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes floatY {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-14px);
  }
}

@keyframes horseFinishPop {
  0% {
    transform: translateY(-50%) scale(1);
  }
  40% {
    transform: translateY(-50%) scale(1.12);
  }
  100% {
    transform: translateY(-50%) scale(1);
  }
}

@keyframes horseFinishGlow {
  from {
    filter: brightness(1);
  }
  to {
    filter: brightness(1.08);
  }
}

@keyframes finishSparkle {
  from {
    transform: translateY(0) scale(0.9) rotate(-6deg);
    opacity: 0.7;
  }
  to {
    transform: translateY(-4px) scale(1.08) rotate(8deg);
    opacity: 1;
  }
}

@media (max-width: 1024px) {
  .race-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .race-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .main-card,
  .menu-card,
  .luck-card,
  .game-card {
    padding: 24px 16px;
  }

  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .game-item {
    min-height: 180px;
  }

  .game-ff-badge {
    top: 10px;
    right: 10px;
    padding: 6px 9px;
    font-size: 0.72rem;
  }

  .menu-btn {
    width: 100%;
    max-width: 280px;
    min-height: 140px;
  }
}

@media (max-width: 640px) {
  .race-card {
    padding: 12px;
  }

  .race-sidebar-inner,
  .race-panel,
  .race-track-wrap {
    padding: 14px;
  }

  .race-horse {
    max-width: 180px;
    padding: 7px 10px;
  }

  .horse-name {
    font-size: 0.84rem;
  }

  .horse-status {
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .button-row {
    gap: 8px;
  }

  .action-btn {
    padding: 12px 8px;
    font-size: 0.92rem;
  }

  .action-btn,
  .main-btn,
  .back-btn {
    width: 100%;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .game-item[data-ff-state] {
    padding-top: 54px;
  }

  .popup.fast-forward-guide-popup,
  .popup.battle-final-popup {
    padding: 22px 16px;
  }

  .battle-final-popup-item,
  .battle-final-popup-empty {
    padding: 12px 14px;
    border-radius: 16px;
  }

  .battle-final-popup-rank-badge {
    min-width: 66px;
    min-height: 32px;
    padding: 6px 10px;
    font-size: 0.92rem;
  }

  .battle-final-popup-name {
    font-size: 1rem;
  }

  .battle-final-popup-formula {
    font-size: 0.94rem;
  }

  .ff-guide-screen {
    min-height: 210px;
  }
}


/* 모바일/태블릿: game1 이미지 같은 세로 스택 레이아웃 */
@media (max-width: 1400px) and (pointer: coarse) {
  body.game1-mode {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  body.game1-mode .app {
    min-height: 100vh;
    align-items: flex-start;
    padding: 10px 10px calc(14px + env(safe-area-inset-bottom));
  }

  body.game1-mode .game-screen {
    height: auto;
    min-height: auto;
  }

  body.game1-mode .game-card-full {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
    padding: 12px;
    gap: 14px;
  }

  body.game1-mode .game-sidebar {
    width: 100%;
    height: auto;
    min-height: 0;
    order: 2;
    border-radius: 22px;
  }

  body.game1-mode .game-sidebar-inner {
    height: auto;
    overflow: visible;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  body.game1-mode .controls-wrap,
  body.game1-mode .scoreboard-card {
    padding: 14px;
    border-radius: 20px;
  }

  body.game1-mode .game-main {
    width: 100%;
    height: auto;
    min-height: 0;
    display: block;
    order: 3;
  }

  body.game1-mode.game1-mobile-layout .game-main-header {
    width: 100%;
    order: 1;
    padding: 16px 16px 12px;
    border-radius: 22px;
    border: 2px solid rgba(255, 255, 255, 0.75);
    background: var(--card-strong);
    box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
  }

  body.game1-mode.game1-mobile-layout .game-main-header h2 {
    font-size: clamp(2rem, 6vw, 2.5rem);
    margin-bottom: 8px;
  }

  body.game1-mode.game1-mobile-layout .game-main-header .sub-text {
    font-size: 0.92rem;
    line-height: 1.5;
  }

  body.game1-mode.game1-mobile-layout .game-header-actions {
    display: none;
  }

  body.game1-mode .game-board-card {
    padding: 14px;
    gap: 10px;
  }

  body.game1-mode .game-board-head {
    align-items: flex-start;
  }

  body.game1-mode .game-play-area {
    display: block;
    margin-top: 0;
    min-height: 0;
  }

  body.game1-mode .game-canvas-wrap {
    width: 100% !important;
    max-width: 100%;
    min-height: 360px;
    border-radius: 22px;
  }

  body.game1-mode .slot-overlay {
    left: 10px;
    right: 10px;
    bottom: 10px;
    height: clamp(74px, 18%, 96px);
  }

  body.game1-mode .slot-name {
    font-size: 0.68rem;
  }

  body.game1-mode .slot-meta {
    font-size: 0.56rem;
  }

  body.game1-mode .button-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
  }

  body.game1-mode .action-btn {
    width: 100%;
    padding: 12px 8px;
    font-size: 0.94rem;
  }

  body.game1-mode .slot-legend {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  body.game1-mode.game1-mobile-layout .scoreboard-card {
    width: 100%;
    margin-top: 0;
    order: 4;
  }

  body.game1-mode.game1-mobile-layout .mobile-back-btn {
    width: 100%;
    order: 5;
    display: block;
    text-align: center;
    padding: 18px 22px;
    font-size: 1.2rem;
    border-radius: 999px;
    background: #fff;
    color: var(--soft-brown);
    box-shadow: 0 6px 16px rgba(130, 100, 80, 0.08);
  }

  .drawer-toggle-btn,
  .drawer-backdrop {
    display: none !important;
  }
}

/* 모바일/태블릿: 경마 게임을 이미지처럼 재배치 */
@media (max-width: 1024px) and (pointer: coarse) {
  body.game2-mobile-layout #game2Screen .race-card {
    padding: 12px;
  }

  body.game2-mobile-layout #game2Screen .race-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: auto;
  }

  body.game2-mobile-layout #game2Screen .race-main-header {
    order: 1;
    width: 100%;
    padding: 4px 4px 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  body.game2-mobile-layout #game2Screen .race-main-header h2 {
    font-size: clamp(2.1rem, 7vw, 2.7rem);
    margin-bottom: 10px;
  }

  body.game2-mobile-layout #game2Screen .race-main-header .sub-text {
    font-size: 0.96rem;
    line-height: 1.65;
    max-width: 360px;
  }

  body.game2-mobile-layout #game2Screen .race-main-header .game-header-actions {
    display: none;
  }

  body.game2-mobile-layout #game2Screen .race-sidebar {
    order: 2;
    width: 100%;
    min-width: 0;
    border-radius: 22px;
  }

  body.game2-mobile-layout #game2Screen .race-sidebar-inner {
    height: auto;
    overflow: visible;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  body.game2-mobile-layout #game2Screen .controls-wrap,
  body.game2-mobile-layout #game2Screen .scoreboard-card {
    padding: 14px;
    border-radius: 20px;
  }

  body.game2-mobile-layout #game2Screen .race-sidebar .scoreboard-card {
    display: none;
  }

  body.game2-mobile-layout #game2Screen .button-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 16px;
  }

  body.game2-mobile-layout #game2Screen .action-btn {
    width: 100%;
    padding: 16px 12px;
    font-size: 1.02rem;
    border-radius: 999px;
  }

  body.game2-mobile-layout #game2Screen .race-main {
    order: 3;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  body.game2-mobile-layout #game2Screen .race-track-wrap {
    width: 100%;
    padding: 14px;
    border-radius: 22px;
  }

  body.game2-mobile-layout #game2Screen .race-bottom-grid {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  body.game2-mobile-layout #game2Screen .race-panel {
    padding: 14px;
    border-radius: 22px;
  }

  body.game2-mobile-layout #game2Screen .race-ranking-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  body.game2-mobile-layout #game2Screen .race-horse {
    max-width: 185px;
    padding: 7px 10px;
  }

  body.game2-mobile-layout #game2Screen .horse-name {
    font-size: 0.88rem;
  }

  body.game2-mobile-layout #game2Screen .horse-status {
    font-size: 0.7rem;
  }

  body.game2-mobile-layout #game2Screen .mobile-race-back-btn {
    order: 4;
    width: 100%;
    display: block;
    text-align: center;
    padding: 18px 22px;
    font-size: 1.2rem;
    border-radius: 999px;
    background: #fff;
    color: var(--soft-brown);
    box-shadow: 0 6px 16px rgba(130, 100, 80, 0.08);
  }
}

@media (max-width: 820px) and (pointer: coarse) {
  body.game1-mode .game-card-full {
    padding: 10px;
    gap: 12px;
  }

  body.game1-mode.game1-mobile-layout .game-main-header {
    padding: 14px 14px 10px;
  }

  body.game1-mode.game1-mobile-layout .game-main-header h2 {
    font-size: 2rem;
  }

  body.game1-mode .small-badge {
    font-size: 0.82rem;
    padding: 8px 12px;
  }

  body.game1-mode .button-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.game1-mode .action-btn,
  body.game1-mode .back-btn {
    width: 100%;
  }

  body.game1-mode .game-board-card {
    padding: 12px;
  }

  body.game1-mode .game-board-head h3 {
    font-size: 1rem;
  }

  body.game1-mode .game-board-head span {
    font-size: 0.82rem;
  }

  body.game1-mode .game-canvas-wrap {
    min-height: 340px;
  }

  body.game1-mode.game1-mobile-layout .mobile-back-btn {
    font-size: 1.1rem;
    padding: 16px 18px;
  }
}

@media (max-width: 760px) {
  .sim-card-screen.sim-arena-zoomed .sim-arena-card {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    padding: 14px;
    gap: 12px;
  }
}

@media (max-width: 1024px) and (pointer: coarse) and (orientation: portrait) {
  body.game2-mobile-layout #game2Screen .race-horse {
    width: 52px;
    height: 52px;
    min-width: 52px;
    max-width: 52px;
    padding: 0;
    gap: 0;
    justify-content: center;
    border-radius: 50%;
  }

  body.game2-mobile-layout #game2Screen .race-horse .horse-info {
    display: none;
  }

  body.game2-mobile-layout #game2Screen .race-horse .horse-emoji {
    font-size: 1.45rem;
    line-height: 1;
  }
}

@media (max-width: 640px) and (pointer: coarse) {
  body.game2-mobile-layout #game2Screen .race-card {
    padding: 10px;
  }

  body.game2-mobile-layout #game2Screen .race-layout {
    gap: 14px;
  }

  body.game2-mobile-layout #game2Screen .race-main-header {
    padding: 2px 2px 0;
  }

  body.game2-mobile-layout #game2Screen .race-main-header h2 {
    font-size: 2rem;
  }

  body.game2-mobile-layout #game2Screen .small-badge {
    font-size: 0.82rem;
    padding: 8px 12px;
  }

  body.game2-mobile-layout #game2Screen .race-track-wrap,
  body.game2-mobile-layout #game2Screen .race-panel,
  body.game2-mobile-layout #game2Screen .race-sidebar-inner,
  body.game2-mobile-layout #game2Screen .controls-wrap {
    padding: 12px;
  }

  body.game2-mobile-layout #game2Screen .action-btn,
  body.game2-mobile-layout #game2Screen .mobile-race-back-btn {
    width: 100%;
  }

  body.game2-mobile-layout #game2Screen .race-horse {
    max-width: 168px;
  }

  body.game2-mobile-layout #game2Screen .horse-name {
    font-size: 0.82rem;
  }

  body.game2-mobile-layout #game2Screen .horse-status {
    font-size: 0.68rem;
  }
}

.action-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}
/* =========================
   game3 : card battle
========================= */

.battle-card-screen {
  padding: 20px;
}

.battle-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 16px;
  min-height: 720px;
}

.battle-sidebar {
  min-width: 0;
  background: rgba(255, 255, 255, 0.34);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
}

.battle-sidebar-inner {
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.battle-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.battle-main-header,
.battle-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.battle-table-card,
.battle-panel {
  background: rgba(255, 255, 255, 0.42);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 26px;
  box-shadow: 0 14px 28px rgba(120, 90, 70, 0.08);
}

.battle-table-card {
  padding: 18px;
}

.battle-deck-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.battle-deck-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 116px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff6df;
  color: #8d6f52;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.battle-deck {
  position: relative;
  width: 110px;
  height: 148px;
  perspective: 1000px;
}

.battle-deck-card {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.32), transparent 24%),
    linear-gradient(145deg, #b68cff 0%, #8eb8ff 45%, #9fe8da 100%);
  box-shadow: 0 10px 22px rgba(106, 84, 134, 0.16);
}

.battle-deck-card::after {
  content: '✦';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: 'Gaegu', cursive;
  font-size: 2.6rem;
  color: rgba(255, 255, 255, 0.88);
}

.battle-deck-card-1 { transform: translate(0, 0) rotate(-8deg); }
.battle-deck-card-2 { transform: translate(4px, 2px) rotate(-2deg); }
.battle-deck-card-3 { transform: translate(7px, 4px) rotate(4deg); }
.battle-deck-card-4 { transform: translate(10px, 6px) rotate(10deg); }

.battle-deck.is-shuffling .battle-deck-card-1 { animation: deckShuffle1 0.95s ease-in-out infinite; }
.battle-deck.is-shuffling .battle-deck-card-2 { animation: deckShuffle2 0.95s ease-in-out infinite; }
.battle-deck.is-shuffling .battle-deck-card-3 { animation: deckShuffle3 0.95s ease-in-out infinite; }
.battle-deck.is-shuffling .battle-deck-card-4 { animation: deckShuffle4 0.95s ease-in-out infinite; }

.battle-table {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 320px;
}

.battle-row {
  display: grid;
  grid-template-columns: minmax(110px, 170px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(255, 250, 245, 0.78);
  border: 2px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.06);
}

.battle-row-main {
  min-width: 0;
}

.battle-player-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.battle-ranking-list-hidden {
  display: none !important;
}

.battle-player-name {
  font-weight: 700;
  color: var(--soft-brown);
  word-break: break-all;
}

.battle-result-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  min-height: 82px;
  padding: 8px 9px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.42), transparent 24%),
    linear-gradient(180deg, #fffdf9 0%, #fff0e5 100%);
  border: 2px solid rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 20px rgba(114, 86, 68, 0.12);
  color: #8c6f47;
  font-family: 'Gaegu', cursive;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  flex-direction: column;
  gap: 2px;
}

.battle-result-pill strong {
  font-size: 0.8rem;
  line-height: 1;
}

.battle-result-pill span {
  font-size: 1.06rem;
  line-height: 1.05;
}

.battle-result-pill.hidden {
  display: none;
}

.battle-hand-final {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.battle-final-summary {
  display: inline-flex;
  align-items: stretch;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  width: 100%;
}

.battle-final-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  min-height: 64px;
  padding: 10px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff8df 0%, #fff0be 100%);
  border: 2px solid rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 20px rgba(114, 86, 68, 0.1);
  color: #8a6b41;
  font-family: 'Gaegu', cursive;
  text-align: center;
  flex-direction: column;
  line-height: 1.05;
  gap: 3px;
  flex: 0 0 auto;
}

.battle-final-rank strong {
  font-size: 1.12rem;
  white-space: nowrap;
}

.battle-final-rank span {
  font-size: 0.84rem;
  max-width: 110px;
  word-break: break-all;
}

.battle-final-result-box {
  min-width: 156px;
  min-height: 64px;
  padding: 10px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff9e9 0%, #fff1cb 100%);
  border: 2px solid rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 20px rgba(114, 86, 68, 0.1);
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  color: #8a6b41;
  flex: 0 1 auto;
  max-width: 100%;
}

.battle-final-result-box small {
  font-family: 'Pretendard', sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  color: #927559;
  margin-bottom: 6px;
}

.battle-final-result-box strong {
  font-family: 'Gaegu', cursive;
  font-size: 1.55rem;
  line-height: 1;
  white-space: nowrap;
}

.battle-row.is-finalized .battle-player-sub {
  display: none !important;
}

.battle-hand {
  display: grid;
  gap: 10px;
  min-width: 0;
  align-items: center;
}

.battle-hand.hand-five {
  grid-template-columns: repeat(5, minmax(0, 84px));
}

.battle-hand.hand-three {
  grid-template-columns: repeat(3, minmax(0, 84px));
}

.battle-slot {
  height: 118px;
  min-width: 0;
  border-radius: 18px;
  border: 2px dashed rgba(192, 166, 149, 0.36);
  background: rgba(255, 255, 255, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
}

.battle-slot.is-ghost::before {
  content: '🂠';
  font-size: 1.8rem;
  color: rgba(142, 118, 102, 0.24);
}

.battle-card {
  width: 84px;
  height: 118px;
  perspective: 1100px;
  opacity: 0;
  transform: translate(-92px, -120px) scale(0.72) rotate(var(--deal-rotate, 0deg));
  transition:
    transform 0.42s cubic-bezier(0.2, 0.85, 0.24, 1),
    opacity 0.22s ease,
    filter 0.24s ease;
  cursor: default;
}

.battle-card.is-dealt {
  opacity: 1;
  transform: translate(0, 0) scale(1) rotate(0deg);
}

.battle-card.is-clickable {
  cursor: pointer;
  filter: drop-shadow(0 0 12px rgba(161, 124, 255, 0.18));
}

.battle-card.is-clickable .battle-card-face {
  box-shadow: 0 0 0 4px rgba(214, 201, 255, 0.28), 0 10px 22px rgba(114, 86, 68, 0.11);
}

.battle-card.is-clickable:hover {
  transform: translate(0, -4px) scale(1.02) rotate(0deg);
}

.battle-card.is-clickable:focus-visible .battle-card-face {
  box-shadow: 0 0 0 5px rgba(178, 153, 255, 0.38), 0 10px 22px rgba(114, 86, 68, 0.11);
}

.battle-card.is-locked .battle-card-face {
  filter: saturate(0.42) brightness(1.03);
  opacity: 0.72;
}

.battle-card.is-soft-disabled {
  cursor: default;
}

.battle-card.is-locked {
  cursor: not-allowed;
}

.battle-card.is-retiring {
  opacity: 0;
  transform: translateY(-12px) scale(0.84);
}

.battle-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.58s cubic-bezier(0.22, 0.8, 0.2, 1);
}

.battle-card.is-flipped .battle-card-inner {
  transform: rotateY(180deg);
}

.battle-card-face {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  backface-visibility: hidden;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 22px rgba(114, 86, 68, 0.11);
}

.battle-card-back {
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.3), transparent 23%),
    linear-gradient(145deg, #b587ff 0%, #8caeff 48%, #96e8d3 100%);
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: 2rem;
}

.battle-card-back::before {
  content: '✦';
}

.battle-card.type-operator .battle-card-back {
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.34), transparent 23%),
    linear-gradient(145deg, #ffc68f 0%, #ff9fb2 52%, #ffdcbf 100%);
}

.battle-card.type-result .battle-card-back {
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.34), transparent 23%),
    linear-gradient(145deg, #ffe9a6 0%, #ffd8a7 52%, #ffe8c9 100%);
}

.battle-card-front {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, #fffdfa 0%, #fff3ea 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  font-family: 'Gaegu', cursive;
  font-weight: 700;
  color: var(--soft-brown);
}

.battle-card-value {
  line-height: 1;
}

.battle-card.type-number .battle-card-value {
  font-size: 2rem;
}

.battle-card.type-operator .battle-card-front {
  background: linear-gradient(180deg, #eef7ff 0%, #e4f2ff 100%);
}

.battle-card.type-operator .battle-card-value {
  font-size: 2.3rem;
}

.battle-card.type-result .battle-card-front {
  background: linear-gradient(180deg, #fff7d8 0%, #ffeec0 100%);
}

.battle-card.type-result .battle-card-value {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 1.65rem;
}

.battle-card.type-result .battle-card-value small {
  font-family: 'Pretendard', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #90724d;
}

.battle-card.is-flipped .battle-card-front {
  border-color: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 24px rgba(114, 86, 68, 0.16);
}

.battle-card.is-flipped .battle-card-value {
  color: #6f5141;
  font-weight: 700;
}

.battle-card.is-flipped.type-number .battle-card-value,
.battle-card.is-flipped.type-operator .battle-card-value {
  text-shadow: 0 0 0.01px currentColor;
}

.battle-card.is-flipped .battle-card-value small {
  color: #7e6248;
  font-weight: 800;
}

.battle-row.is-condensing {
  transform: scale(0.985);
  transition: transform 0.25s ease;
}

.battle-bottom-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.battle-panel {
  padding: 18px;
}

.battle-panel-head h3 {
  color: var(--soft-brown);
}

.battle-ranking-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.battle-ranking-empty {
  padding: 18px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: #8c7262;
  line-height: 1.55;
  text-align: center;
}

.battle-ranking-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.72);
}

.battle-ranking-item.top {
  background: linear-gradient(135deg, #fff8df, #fff1b8);
}

.battle-rank-num {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--lavender), var(--sky));
  font-family: 'Gaegu', cursive;
  font-size: 1.3rem;
  font-weight: 700;
}

.battle-rank-main {
  min-width: 0;
}

.battle-rank-name {
  font-weight: 700;
  color: var(--soft-brown);
  word-break: break-all;
}

.battle-rank-formula {
  margin-top: 4px;
  font-size: 0.82rem;
  color: #927869;
  line-height: 1.45;
  word-break: break-word;
}

.battle-rank-score {
  padding: 8px 12px;
  border-radius: 999px;
  background: #fffaf1;
  border: 2px solid rgba(232, 214, 198, 0.7);
  font-weight: 700;
  color: #8f7363;
}

@keyframes deckShuffle1 {
  0%, 100% { transform: translate(0, 0) rotate(-8deg); }
  50% { transform: translate(-22px, 4px) rotate(-20deg); }
}

@keyframes deckShuffle2 {
  0%, 100% { transform: translate(4px, 2px) rotate(-2deg); }
  50% { transform: translate(14px, -8px) rotate(10deg); }
}

@keyframes deckShuffle3 {
  0%, 100% { transform: translate(7px, 4px) rotate(4deg); }
  50% { transform: translate(-10px, -10px) rotate(-8deg); }
}

@keyframes deckShuffle4 {
  0%, 100% { transform: translate(10px, 6px) rotate(10deg); }
  50% { transform: translate(22px, 2px) rotate(18deg); }
}

@media (max-width: 1024px) {
  .battle-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

.battle-mobile-back-wrap {
  display: none;
}

@media (max-width: 760px) {
  #game3Screen .battle-card-screen {
    padding: 12px;
  }

  #game3Screen .battle-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  #game3Screen .battle-main {
    display: contents;
  }

  #game3Screen .battle-main-header {
    order: 1;
    padding: 20px 18px;
    border-radius: 28px;
    background: rgba(255, 249, 244, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
  }

  #game3Screen .battle-main-header .game-header-actions {
    display: none;
  }

  #game3Screen .battle-sidebar {
    order: 2;
    border-radius: 28px;
  }

  #game3Screen .battle-sidebar-inner {
    padding: 18px;
    gap: 14px;
  }

  #game3Screen .battle-sidebar .controls-wrap {
    margin-top: 0;
    padding: 16px;
    border-radius: 24px;
  }

  #game3Screen .battle-sidebar .scoreboard-card {
    display: none;
  }

  #game3Screen .battle-sidebar .button-row {
    gap: 10px;
    margin-top: 14px;
  }

  #game3Screen .battle-sidebar .action-btn {
    min-height: 52px;
    padding: 14px 10px;
    font-size: 0.98rem;
  }

  #game3Screen .battle-table-card {
    order: 3;
    padding: 18px 14px 16px;
    border-radius: 28px;
  }

  #game3Screen .battle-deck-stage {
    margin-bottom: 18px;
  }

  #game3Screen .battle-table {
    gap: 12px;
  }

  #game3Screen .battle-row {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
    border-radius: 24px;
  }

  #game3Screen .battle-player-head {
    align-items: center;
    gap: 8px;
  }

  #game3Screen .battle-player-sub {
    display: block;
    margin-top: 8px;
    color: #907567;
    line-height: 1.45;
    font-size: 0.96rem;
  }

  #game3Screen .battle-hand.hand-five,
  #game3Screen .battle-hand.hand-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  #game3Screen .battle-hand.battle-hand-final {
    display: flex;
    justify-content: flex-start;
  }

  #game3Screen .battle-final-summary {
    justify-content: flex-start;
    gap: 10px;
  }

  #game3Screen .battle-final-rank {
    min-width: 72px;
    min-height: 72px;
    padding: 8px 10px;
  }

  #game3Screen .battle-slot {
    height: 106px;
    border-radius: 18px;
  }

  #game3Screen .battle-card {
    width: 72px;
    height: 104px;
    margin: 0 auto;
  }

  #game3Screen .battle-card.type-number .battle-card-value,
  #game3Screen .battle-card.type-operator .battle-card-value {
    font-size: 1.8rem;
  }

  #game3Screen .battle-card.type-result .battle-card-value {
    font-size: 1.45rem;
  }

  #game3Screen .battle-ranking-list {
    display: none !important;
  }

  #game3Screen .battle-mobile-back-wrap {
    display: block;
    margin-top: 12px;
  }

  #game3Screen .battle-mobile-back-btn {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    min-height: 54px;
    border-radius: 999px;
    font-size: 1rem;
  }
}


@media (max-width: 640px) {
  .battle-final-summary {
    gap: 10px;
  }

  .battle-final-rank {
    min-width: 94px;
    min-height: 58px;
    padding: 8px 12px;
  }

  .battle-final-result-box {
    min-width: 140px;
    min-height: 58px;
    padding: 8px 14px;
  }

  .battle-final-result-box strong {
    font-size: 1.38rem;
  }
}


/* =========================
   game4 : survival ball battle
========================= */

.sim-card-screen {
  padding: 20px;
}

.sim-card-screen.sim-view-setup .sim-arena-card,
.sim-card-screen.sim-view-setup .sim-battle-summary-card {
  display: none;
}

.sim-card-screen.sim-view-battle .sim-setup-card {
  display: none;
}

.sim-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 16px;
  min-height: 720px;
}

.sim-sidebar {
  min-width: 0;
  background: rgba(255, 255, 255, 0.34);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
}

.sim-sidebar-inner {
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sim-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sim-main-header,
.sim-panel-head,
.sim-setup-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.sim-main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: nowrap;
}

.sim-main-header > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.sim-main-header .game-header-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex: 0 0 auto;
  margin-left: auto;
  align-self: flex-start;
}

.sim-header-inline-actions {
  margin-top: 12px;
}

.sim-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(180deg, rgba(255, 250, 245, 0.96) 0%, rgba(255, 243, 233, 0.96) 100%);
  color: var(--soft-brown);
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.08);
}

.sim-info-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(120, 90, 70, 0.11);
}

.sim-panel-head-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.sim-arena-zoom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(180deg, rgba(248, 255, 252, 0.98) 0%, rgba(228, 246, 255, 0.96) 100%);
  color: var(--soft-brown);
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.sim-arena-zoom-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(120, 90, 70, 0.11);
}

.sim-arena-zoom-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.sim-setup-card,
.sim-arena-card,
.sim-battle-summary-card {
  background: rgba(255, 255, 255, 0.42);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 26px;
  box-shadow: 0 14px 28px rgba(120, 90, 70, 0.08);
  padding: 18px;
}

.sim-battle-start-btn {
  width: 100%;
  margin-top: 12px;
}

.sim-phase-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 98px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff8df;
  color: #8d6f52;
  font-size: 0.82rem;
  font-weight: 700;
}

.sim-deck {
  margin: 18px auto 14px;
}

.sim-stats-board {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sim-empty-state {
  padding: 18px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: #8c7262;
  line-height: 1.55;
  text-align: center;
}

.sim-player-row {
  display: grid;
  grid-template-columns: minmax(150px, 200px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(255, 250, 245, 0.78);
  border: 2px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.06);
}

.sim-player-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sim-player-name {
  font-weight: 700;
  color: var(--soft-brown);
  word-break: break-all;
}

.sim-player-total {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff8df;
  color: #8d6f52;
  font-size: 0.82rem;
  font-weight: 700;
}

.sim-player-sub {
  margin-top: 8px;
  color: #907567;
  line-height: 1.45;
  font-size: 0.92rem;
}

.sim-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 78px));
  gap: 8px;
  justify-content: end;
}

.sim-stat-card {
  width: 78px;
  height: 118px;
  perspective: 1100px;
  opacity: 0;
  transform: translate(-54px, -30px) scale(0.72) rotate(-10deg);
  transition:
    transform 0.42s cubic-bezier(0.2, 0.85, 0.24, 1),
    opacity 0.22s ease;
}

.sim-stat-card.is-dealt {
  opacity: 1;
  transform: translate(0, 0) scale(1) rotate(0deg);
}

.sim-stat-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.58s cubic-bezier(0.22, 0.8, 0.2, 1);
}

.sim-stat-card.is-flipped .sim-stat-card-inner {
  transform: rotateY(180deg);
}

.sim-stat-card-face {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  backface-visibility: hidden;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 22px rgba(114, 86, 68, 0.11);
}

.sim-stat-card-back {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.95rem;
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.28), transparent 23%),
    linear-gradient(145deg, #b68cff 0%, #8eb8ff 48%, #9fe8da 100%);
}

.sim-stat-card-front {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, #fffdfa 0%, #fff3ea 100%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px;
  font-family: 'Gaegu', cursive;
  color: var(--soft-brown);
}

.sim-stat-card-front small {
  font-size: 0.78rem;
  line-height: 1.15;
  color: #8f7363;
}

.sim-stat-card-front strong {
  font-size: 1.68rem;
  line-height: 1;
  align-self: flex-end;
}

.sim-stat-card.type-health .sim-stat-card-front { background: linear-gradient(180deg, #fff1f5 0%, #ffdfe9 100%); }
.sim-stat-card.type-attack .sim-stat-card-front { background: linear-gradient(180deg, #fff5e9 0%, #ffe1c1 100%); }
.sim-stat-card.type-accuracy .sim-stat-card-front { background: linear-gradient(180deg, #eef7ff 0%, #dff0ff 100%); }
.sim-stat-card.type-defense .sim-stat-card-front { background: linear-gradient(180deg, #eefaf6 0%, #d6f1e8 100%); }

.sim-arena-zoom-stage {
  position: relative;
  width: 100%;
}

.sim-arena-wrap {
  position: relative;
  width: 100%;
  height: 460px;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 16%, rgba(255, 255, 255, 0.38), transparent 26%),
    linear-gradient(180deg, #fff6ef 0%, #fff1ea 100%);
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4), 0 16px 28px rgba(120, 90, 70, 0.08);
}

.sim-arena-wrap::before {
  content: '전투 시작 전';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(143, 115, 99, 0.6);
  font-family: 'Gaegu', cursive;
  font-size: 2rem;
}

.sim-arena-wrap.is-running::before {
  display: none;
}

.sim-arena-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.sim-health-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.sim-shrink-zone {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 22px;
  border: 3px solid rgba(255, 255, 255, 0);
  box-shadow: none;
  opacity: 0;
  transition:
    left 0.1s linear,
    top 0.1s linear,
    width 0.1s linear,
    height 0.1s linear,
    opacity 0.24s ease,
    border-color 0.24s ease;
  pointer-events: none;
  z-index: 2;
}

.sim-shrink-zone.is-active {
  opacity: 1;
}

.sim-shrink-zone.is-danger {
  border-color: rgba(255, 92, 92, 0.95);
  box-shadow: none;
}

.sim-arena-wrap.is-sudden-death {
  box-shadow:
    inset 0 0 0 1px rgba(255, 183, 91, 0.42),
    0 0 0 3px rgba(255, 102, 102, 0.28),
    0 16px 28px rgba(120, 90, 70, 0.1);
}

.sim-arena-wrap.is-sudden-death .sim-shrink-zone.is-danger {
  border-color: rgba(255, 72, 72, 0.98);
  box-shadow:
    inset 0 0 28px rgba(255, 96, 96, 0.12),
    0 0 18px rgba(255, 96, 96, 0.28);
}

.sim-decay-burst {
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.98) 0%, rgba(255,228,182,0.97) 36%, rgba(255,137,87,0.94) 100%);
  color: #7e351d;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.82), 0 10px 22px rgba(255, 119, 77, 0.28);
}

.sim-shrink-zone.is-frozen {
  opacity: 1;
}

.sim-ball-label {
  position: absolute;
  left: 0;
  top: 0;
  min-width: 74px;
  max-width: 92px;
  padding: 4px 6px 5px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84) 0%, rgba(255, 250, 247, 0.8) 100%);
  border: 1px solid rgba(255, 255, 255, 0.94);
  box-shadow: 0 5px 12px rgba(114, 86, 68, 0.12);
  transform: translate(-50%, -50%);
  transform-origin: center center;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  backdrop-filter: blur(5px);
  z-index: 4;
  transition: opacity 0.18s ease, transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.sim-ball-label.is-dead {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: 0 4px 10px rgba(80, 64, 58, 0.05);
  opacity: 0.32;
  filter: saturate(0.45);
  z-index: 1;
}

.sim-ball-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.sim-ball-name,
.sim-ball-hptext {
  color: #7f6555;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.sim-ball-label.is-dead .sim-ball-name,
.sim-ball-label.is-dead .sim-ball-hptext {
  color: rgba(102, 88, 82, 0.72);
}

.sim-ball-place {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(255, 239, 180, 0.96);
  color: #7b5f2b;
  font-size: 0.58rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.6);
}

.sim-ball-label.is-dead .sim-ball-place,
.sim-ball-label.is-winner .sim-ball-place {
  display: inline-flex;
}

.sim-ball-hpbar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(120, 102, 91, 0.12) 0%, rgba(120, 102, 91, 0.2) 100%);
  box-shadow: inset 0 1px 2px rgba(82, 60, 49, 0.08);
}

.sim-ball-hpbar::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  border: 1px solid rgba(255,255,255,0.35);
  pointer-events: none;
}

.sim-ball-hpbar span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff7c98 0%, #ffb86a 45%, #86e29f 100%);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.24);
  transition: width 0.16s ease;
}

.sim-ball-label.is-dead .sim-ball-hpbar {
  opacity: 0.12;
}

.sim-ball-label.is-dead .sim-ball-hpbar span {
  background: linear-gradient(90deg, rgba(151,141,137,0.22) 0%, rgba(151,141,137,0.12) 100%);
}


.sim-ball-label.is-hit {
  animation: simHitCard 0.28s ease;
  box-shadow: 0 0 0 3px rgba(255, 132, 150, 0.38), 0 0 20px rgba(255, 120, 144, 0.24), 0 10px 22px rgba(114, 86, 68, 0.2);
}

.sim-hit-burst {
  position: absolute;
  left: 0;
  top: 0;
  padding: 5px 10px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.98) 0%, rgba(255,213,213,0.97) 36%, rgba(255,126,150,0.94) 100%);
  color: #7f2842;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.82), 0 10px 22px rgba(255, 108, 142, 0.28);
  transform: translate(-50%, -50%) scale(0.45);
  opacity: 0;
  pointer-events: none;
  z-index: 4;
}


.sim-hit-burst.is-active {
  animation: simHitBurst 0.7s ease-out forwards;
}

.sim-bomb-blast-core,
.sim-bomb-blast-ring {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.22);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

.sim-bomb-blast-core {
  width: var(--blast-core-size, 88px);
  height: var(--blast-core-size, 88px);
  background:
    radial-gradient(circle, rgba(255,255,255,0.98) 0%, rgba(255,244,187,0.96) 22%, rgba(255,171,109,0.92) 52%, rgba(255,101,101,0.18) 76%, rgba(255,101,101,0) 100%);
  box-shadow: 0 0 28px rgba(255, 181, 122, 0.46);
}

.sim-bomb-blast-ring {
  width: var(--blast-ring-size, 220px);
  height: var(--blast-ring-size, 220px);
  border: 6px solid rgba(255, 241, 209, 0.95);
  box-shadow:
    0 0 0 10px rgba(255, 173, 110, 0.18),
    0 0 28px rgba(255, 132, 112, 0.22);
}

.sim-bomb-blast-core.is-active {
  animation: simBombBlastCore 0.48s ease-out forwards;
}

.sim-bomb-blast-ring.is-active {
  animation: simBombBlastRing 0.72s cubic-bezier(0.14, 0.8, 0.22, 1) forwards;
}


@keyframes simHitCard {
  0% {
    filter: brightness(1);
  }
  22% {
    filter: brightness(1.18) saturate(1.2);
  }
  48% {
    filter: brightness(0.96) saturate(1.05);
  }
  72% {
    filter: brightness(1.1) saturate(1.16);
  }
  100% {
    filter: brightness(1);
  }
}

@keyframes simHitBurst {
  0% {
    opacity: 0;
    transform: translate(-50%, -34%) scale(0.45);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -54%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -98%) scale(1.08);
  }
}

@keyframes simBombBlastCore {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.22);
  }
  24% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.26);
  }
}

@keyframes simBombBlastRing {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.18);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.56);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.08);
  }
}


.sim-card-screen.sim-arena-zoomed {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.sim-card-screen.sim-arena-zoomed .sim-arena-card {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(96vw, 1500px);
  height: min(88vh, 960px);
  margin: 0;
  z-index: 96;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  background: #fffaf6;
  box-shadow: 0 18px 38px rgba(73, 54, 45, 0.14);
}

.sim-card-screen.sim-arena-zoomed .sim-arena-zoom-stage {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 24px;
}

.sim-card-screen.sim-arena-zoomed .sim-arena-wrap {
  width: var(--sim-arena-base-width, 900px);
  height: var(--sim-arena-base-height, 460px);
  max-width: none;
  transform: scale(var(--sim-arena-zoom-scale, 1));
  transform-origin: center center;
  will-change: transform;
}

.sim-arena-zoom-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(255, 250, 244, 0.04);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 95;
}

.sim-arena-zoom-backdrop.is-active {
  opacity: 1;
  pointer-events: none;
}

body.sim-arena-zoom-lock {
  overflow: hidden;
}

.sim-battle-summary {
  overflow-x: auto;
}

.sim-summary-table {
  width: 100%;
  min-width: 520px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(255, 250, 245, 0.86);
  border: 2px solid rgba(255,255,255,0.78);
}

.sim-summary-table th,
.sim-summary-table td {
  padding: 12px 14px;
  text-align: center;
  color: #7f6657;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(157, 125, 107, 0.14);
}

.sim-summary-table th {
  background: rgba(255, 243, 228, 0.92);
  font-weight: 800;
}

.sim-summary-table tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.5);
}

.sim-summary-table tbody tr:last-child td {
  border-bottom: none;
}

.sim-summary-name {
  text-align: left !important;
  font-weight: 800;
}

@media (max-width: 1024px) {
  #game4Screen .sim-sidebar-inner,
  #game4Screen .sim-setup-card,
  #game4Screen .sim-arena-card,
  #game4Screen .sim-battle-summary-card {
    padding: 16px;
  }

  #game4Screen .sim-main {
    order: 1;
  }

  #game4Screen .sim-main-header {
    padding: 20px 18px;
    border-radius: 28px;
    background: rgba(255, 249, 244, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
  }

  #game4Screen .sim-card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #game4Screen .sim-stat-card {
    width: 100%;
    height: 102px;
  }

  #game4Screen .sim-stat-card-front strong {
    font-size: 1.46rem;
  }

  #game4Screen .sim-player-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #game4Screen .sim-arena-wrap {
    height: 360px;
  }
}

@media (max-width: 520px) {
  #game4Screen .sim-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #game4Screen .sim-stat-card {
    max-width: 92px;
    margin: 0 auto;
  }

  #game4Screen .sim-arena-wrap {
    height: 320px;
  }

  #game4Screen .sim-ball-label {
    width: 74px;
    margin-left: -37px;
  }
}


.sim-map-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.sim-map-option {
  position: relative;
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: 18px;
  border: 2px solid rgba(255,255,255,0.92);
  background: rgba(255, 250, 245, 0.92);
  box-shadow: 0 8px 18px rgba(114, 86, 68, 0.1);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, filter 0.16s ease;
}

.sim-map-option::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: 18px 0 0 18px;
  background: linear-gradient(180deg, rgba(255,189,164,0.95), rgba(175,213,255,0.95));
  opacity: 0.92;
}

.sim-map-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(114, 86, 68, 0.14);
  border-color: rgba(255, 214, 164, 0.95);
  filter: saturate(1.03);
}

.sim-map-option strong {
  display: block;
  margin-bottom: 6px;
  color: var(--soft-brown);
  font-size: 1rem;
}

.sim-map-option span {
  display: block;
  color: #8f7363;
  line-height: 1.48;
  font-size: 0.9rem;
}

.sim-map-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.sim-map-preview i {
  display: block;
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,189,164,0.9), rgba(175,213,255,0.9));
  opacity: 0.92;
}

.sim-map-option[data-sim-map-id="classic"]::before {
  background: linear-gradient(180deg, #7dc9ff, #ffd166);
}

.sim-map-option[data-sim-map-id="bomb"]::before {
  background: linear-gradient(180deg, #ffb57a, #ff6b88);
}

.sim-map-option[data-sim-map-id="bomb"] .sim-map-preview i {
  background: linear-gradient(90deg, #ffc49e, #ff7f7f);
}

.sim-map-option[data-sim-map-id="rotor"]::before {
  background: linear-gradient(180deg, #b69cff, #62e4c5);
}

.sim-map-option[data-sim-map-id="rotor"] .sim-map-preview i {
  background: linear-gradient(90deg, #d7d9ff, #b8f0d6);
}

.sim-map-option[data-sim-map-id="pinball"]::before {
  background: linear-gradient(180deg, #ffd166, #7dd3fc);
}

.sim-map-option[data-sim-map-id="pinball"] .sim-map-preview i {
  background: linear-gradient(90deg, #ffe4a8, #bce8ff);
}

.sim-map-note {
  margin-top: 4px;
  color: #8f7363;
  line-height: 1.5;
}



/* =========================
   game4 : tablet / mobile layout refinements
========================= */

.sim-mobile-back-wrap {
  display: none;
}

.sim-mobile-battle-start-slot,
.sim-mobile-reset-slot {
  display: none;
}

#game4Screen .sim-status-text,
#game4Screen #simStatusText {
  min-height: 48px;
}

@media (max-width: 1024px) and (pointer: coarse) {
  #game4Screen .sim-card-screen {
    padding: 12px;
  }

  #game4Screen .sim-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: auto;
  }

  #game4Screen .sim-main {
    display: contents;
  }

  #game4Screen .sim-main-header {
    order: 1;
    width: 100%;
    padding: 18px 16px 14px;
    border-radius: 24px;
    background: rgba(255, 249, 244, 0.92);
    border: 2px solid rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
  }

  #game4Screen .sim-main-header h2 {
    font-size: clamp(2rem, 6.8vw, 2.65rem);
    margin-bottom: 8px;
  }

  #game4Screen .sim-main-header .sub-text {
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 520px;
  }

  #game4Screen .sim-header-inline-actions {
    margin-top: 14px;
  }

  #game4Screen .sim-info-btn {
    min-height: 44px;
    padding: 11px 16px;
    font-size: 0.94rem;
  }

  #game4Screen .sim-arena-zoom-btn {
    min-height: 44px;
    padding: 11px 16px;
    font-size: 0.94rem;
  }

  #game4Screen .sim-main-header .game-header-actions {
    display: none;
  }

  #game4Screen .sim-sidebar {
    order: 2;
    width: 100%;
    border-radius: 24px;
  }

  #game4Screen .sim-sidebar-inner {
    height: auto;
    overflow: visible;
    padding: 14px;
    gap: 12px;
  }

  #game4Screen .controls-wrap,
  #game4Screen .scoreboard-card,
  #game4Screen .sim-setup-card,
  #game4Screen .sim-arena-card,
  #game4Screen .sim-battle-summary-card {
    padding: 14px;
    border-radius: 22px;
  }

  #game4Screen .sim-card-screen.sim-view-setup .sim-sidebar {
    order: 2;
  }

  #game4Screen .sim-card-screen.sim-view-setup .sim-setup-card {
    order: 3;
  }

  #game4Screen .sim-card-screen.sim-view-battle .sim-arena-card {
    order: 2;
  }

  #game4Screen .sim-card-screen.sim-view-battle .sim-battle-summary-card {
    order: 3;
  }

  #game4Screen .sim-card-screen.sim-view-battle .sim-sidebar {
    order: 4;
  }

  #game4Screen .scoreboard-card {
    display: none;
  }

  #game4Screen .sim-card-screen.sim-view-battle .sim-sidebar {
    display: none;
  }

  #game4Screen .button-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
  }

  #game4Screen .button-row .action-btn {
    min-height: 46px;
    padding: 12px 8px;
    font-size: 0.92rem;
  }

  #game4Screen .action-btn {
    width: 100%;
  }

  #game4Screen #simStatusText {
    min-height: 64px;
    line-height: 1.5;
  }

  #game4Screen .sim-player-row {
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: stretch;
  }

  #game4Screen .sim-player-sub {
    font-size: 0.9rem;
  }

  #game4Screen .sim-card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-content: stretch;
  }

  #game4Screen .sim-stat-card {
    width: 100%;
    height: 108px;
    max-width: none;
  }

  #game4Screen .sim-stat-card-front {
    padding: 10px;
  }

  #game4Screen .sim-stat-card-front small {
    font-size: 0.72rem;
  }

  #game4Screen .sim-stat-card-front strong {
    font-size: 1.38rem;
  }

  #game4Screen .sim-setup-head,
  #game4Screen .sim-panel-head {
    gap: 10px;
  }

  #game4Screen .sim-panel-head .sub-text,
  #game4Screen .sim-setup-head + .sub-text {
    font-size: 0.9rem;
  }

  #game4Screen .sim-deck {
    transform: scale(0.92);
    transform-origin: top center;
    margin: 10px auto 6px;
  }

  #game4Screen .sim-arena-wrap {
    height: clamp(320px, 56vw, 430px);
    border-radius: 22px;
  }

  #game4Screen .sim-arena-wrap::before {
    font-size: 1.7rem;
  }

  #game4Screen .sim-health-overlay {
    inset: 0;
  }

  #game4Screen .sim-ball-label {
    width: 86px;
    margin-left: -43px;
    padding: 6px 8px;
  }

  #game4Screen .sim-battle-summary {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #game4Screen .sim-summary-table {
    min-width: 500px;
  }

  #game4Screen .sim-summary-table th,
  #game4Screen .sim-summary-table td {
    padding: 11px 12px;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  #game4Screen .sim-card-screen.sim-view-setup .sim-mobile-battle-start-slot {
    display: block;
    margin-top: 16px;
  }

  #game4Screen .sim-mobile-battle-start-slot .sim-battle-start-btn {
    width: 100%;
    min-height: 56px;
    padding: 16px 18px;
    font-size: 1.02rem;
    border-radius: 999px;
  }

  #game4Screen .sim-mobile-reset-slot {
    order: 4;
    display: none;
  }

  #game4Screen .sim-card-screen.sim-view-battle .sim-mobile-reset-slot {
    display: block;
    margin-top: 2px;
  }

  #game4Screen .sim-mobile-reset-slot .action-btn.soft {
    width: 100%;
    min-height: 58px;
    padding: 16px 18px;
    font-size: 1.08rem;
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(130, 100, 80, 0.08);
  }

  #game4Screen .sim-mobile-back-wrap {
    order: 5;
    display: block;
    margin-top: 14px;
  }

  #game4Screen .sim-mobile-back-btn {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 54px;
    padding: 16px 18px;
    font-size: 1.08rem;
    border-radius: 999px;
    background: #fff;
    color: var(--soft-brown);
    box-shadow: 0 6px 16px rgba(130, 100, 80, 0.08);
  }
}

@media (max-width: 640px) and (pointer: coarse) {
  #game4Screen .sim-card-screen {
    padding: 10px;
  }

  #game4Screen .sim-layout {
    gap: 12px;
  }

  #game4Screen .sim-main-header {
    padding: 16px 14px 12px;
  }

  #game4Screen .sim-main-header h2 {
    font-size: 2rem;
  }

  #game4Screen .small-badge {
    font-size: 0.82rem;
    padding: 8px 12px;
  }

  #game4Screen .sim-info-btn {
    width: 100%;
    min-height: 46px;
    font-size: 0.95rem;
  }

  #game4Screen .sim-panel-head-actions {
    width: 100%;
    margin-left: 0;
  }

  #game4Screen .sim-arena-zoom-btn {
    width: 100%;
    min-height: 46px;
    font-size: 0.95rem;
  }

  #game4Screen .sim-sidebar-inner,
  #game4Screen .controls-wrap,
  #game4Screen .scoreboard-card,
  #game4Screen .sim-setup-card,
  #game4Screen .sim-arena-card,
  #game4Screen .sim-battle-summary-card {
    padding: 12px;
  }

  #game4Screen #simStatusText {
    min-height: 72px;
    font-size: 0.92rem;
  }

  #game4Screen .sim-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #game4Screen .sim-stat-card {
    max-width: 94px;
    height: 104px;
    margin: 0 auto;
  }

  #game4Screen .sim-player-total {
    font-size: 0.78rem;
    padding: 6px 10px;
  }

  #game4Screen .sim-player-sub {
    display: none;
  }

  #game4Screen .sim-stat-card-front strong {
    font-size: 1.5rem;
  }

  #game4Screen .sim-deck {
    transform: scale(0.82);
    margin-top: 2px;
  }

  #game4Screen .sim-arena-wrap {
    height: 300px;
  }

  #game4Screen .sim-arena-wrap::before {
    font-size: 1.45rem;
  }

  #game4Screen .sim-ball-label {
    width: 72px;
    margin-left: -36px;
    padding: 5px 7px;
    font-size: 0.66rem;
  }

  #game4Screen .sim-summary-table {
    min-width: 460px;
  }

  #game4Screen .sim-summary-table th,
  #game4Screen .sim-summary-table td {
    padding: 10px 10px;
    font-size: 0.84rem;
  }

  #game4Screen .button-row {
    gap: 7px;
  }

  #game4Screen .button-row .action-btn {
    min-height: 44px;
    padding: 11px 6px;
    font-size: 0.86rem;
  }

  #game4Screen .sim-mobile-battle-start-slot .sim-battle-start-btn,
  #game4Screen .sim-mobile-reset-slot .action-btn.soft,
  #game4Screen .sim-mobile-back-btn {
    min-height: 52px;
    padding: 15px 16px;
    font-size: 1rem;
  }
}

@media (max-width: 640px) {
  .popup.game-info-popup {
    padding: 22px 18px;
    border-radius: 24px;
  }

  .popup.game-info-popup h3 {
    font-size: 1.72rem;
  }

  .game-info-section {
    padding: 12px 13px;
  }

  .game-info-section ul {
    padding-left: 16px;
    font-size: 0.94rem;
  }
}

.game-canvas-wrap.is-fast-forward-blocked,
.race-track-wrap.is-fast-forward-blocked,
.sim-arena-wrap.is-fast-forward-blocked {
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.4),
    0 0 0 4px rgba(255, 193, 193, 0.36),
    0 16px 28px rgba(120, 90, 70, 0.1);
}

.game-canvas-wrap.is-fast-forward-blocked::after,
.race-track-wrap.is-fast-forward-blocked::after,
.sim-arena-wrap.is-fast-forward-blocked::after {
  background: rgba(255, 238, 238, 0.96);
  color: #b15f5f;
}

.sim-arena-zoom-stage.is-fast-forwarding,
.sim-arena-zoom-stage.is-fast-forward-blocked {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28);
}

/* =========================
   game5 : bombardment sea battle
========================= */

.naval-card-screen {
  padding: 20px;
}

.naval-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 16px;
  min-height: 720px;
}

.naval-sidebar {
  min-width: 0;
  background: rgba(255, 255, 255, 0.34);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
}

.naval-sidebar-inner {
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.naval-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.naval-main-header,
.naval-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.naval-board-card,
.naval-panel {
  background: rgba(255, 255, 255, 0.42);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 26px;
  box-shadow: 0 14px 28px rgba(120, 90, 70, 0.08);
}

.naval-board-card {
  padding: 18px;
}

.naval-board-meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 999px;
  background: #fff6df;
  color: #8d6f52;
  font-size: 0.84rem;
  font-weight: 700;
}

.naval-board-wrap {
  position: relative;
  margin-top: 16px;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 620px;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.46), transparent 22%),
    linear-gradient(180deg, #cfe6ff 0%, #a8d5fb 44%, #8cc4f2 100%);
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 16px 28px rgba(120, 90, 70, 0.08);
}

.naval-board {
  display: grid;
  grid-template-columns: repeat(var(--naval-board-size, 8), minmax(0, 1fr));
  grid-template-rows: repeat(var(--naval-board-size, 8), minmax(0, 1fr));
  width: 100%;
  height: 100%;
}

.naval-cell {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.52);
  background: linear-gradient(180deg, rgba(224, 243, 255, 0.42) 0%, rgba(129, 190, 237, 0.38) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4c7494;
  overflow: hidden;
}

.naval-cell-label {
  position: absolute;
  right: 6px;
  bottom: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(61, 101, 132, 0.72);
}

.naval-cell-mark {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.naval-cell.is-miss {
  background: linear-gradient(180deg, #d7dde6 0%, #b8c1cf 100%);
  color: #5b6677;
}

.naval-cell.is-hit {
  background: linear-gradient(180deg, color-mix(in srgb, var(--naval-hit-color) 72%, white 28%) 0%, var(--naval-hit-color) 100%);
  color: #fff;
}

.naval-cell.is-hit .naval-cell-label {
  color: rgba(255, 255, 255, 0.82);
}

.naval-cell.is-last-target::after {
  content: '';
  position: absolute;
  inset: 8%;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.naval-bomb-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.naval-bomb-drop,
.naval-bomb-impact {
  position: absolute;
  pointer-events: none;
}

.naval-bomb-drop {
  width: 16px;
  height: 22px;
  border-radius: 999px 999px 50% 50%;
  background: linear-gradient(180deg, #4c4c4c 0%, #1f1f1f 100%);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
}

.naval-bomb-impact {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.34);
}

.naval-bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.naval-panel {
  padding: 18px;
  min-height: 250px;
}

.naval-log-list,
.naval-ranking-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.naval-log-empty,
.naval-ranking-empty {
  padding: 18px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: #8c7262;
  line-height: 1.55;
  text-align: center;
}

.naval-log-item,
.naval-ranking-item {
  background: rgba(255, 255, 255, 0.84);
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  box-shadow: 0 6px 14px rgba(120, 90, 70, 0.05);
}

.naval-log-item {
  padding: 12px 14px;
  color: var(--brown);
  line-height: 1.5;
}

.naval-log-item.type-hit {
  background: linear-gradient(135deg, #fff3df 0%, #ffe5cd 100%);
}

.naval-log-item.type-out {
  background: linear-gradient(135deg, #ffe5ea 0%, #ffd5de 100%);
}

.naval-log-item.type-final {
  background: linear-gradient(135deg, #fff5c9 0%, #fffdf1 100%);
}

.naval-ranking-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.naval-ranking-item.top {
  background: linear-gradient(135deg, #fff5c9, #fffdf1);
}

.naval-ranking-item.is-eliminated {
  opacity: 0.82;
}

.naval-rank-num {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--lavender), var(--sky));
  font-family: 'Gaegu', cursive;
  font-size: 1.3rem;
  font-weight: 700;
}

.naval-rank-main {
  min-width: 0;
}

.naval-rank-name {
  font-weight: 700;
  color: var(--soft-brown);
  word-break: break-all;
}

.naval-rank-sub {
  margin-top: 4px;
  font-size: 0.82rem;
  color: #927869;
  line-height: 1.45;
}

.naval-rank-hull {
  padding: 8px 12px;
  border-radius: 999px;
  background: #eff8ff;
  border: 2px solid rgba(212, 230, 245, 0.84);
  font-weight: 700;
  color: #6b8ca7;
  white-space: nowrap;
}

.naval-rank-hull.is-out {
  background: #f4ece8;
  border-color: rgba(230, 217, 206, 0.84);
  color: #94796a;
}

.naval-mobile-back-wrap {
  display: none;
}

.naval-log-list::-webkit-scrollbar,
.naval-ranking-list::-webkit-scrollbar {
  width: 8px;
}

.naval-log-list::-webkit-scrollbar-thumb,
.naval-ranking-list::-webkit-scrollbar-thumb {
  background: rgba(157, 125, 107, 0.35);
  border-radius: 999px;
}

.naval-log-list::-webkit-scrollbar-track,
.naval-ranking-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
}

@media (max-width: 1024px) {
  .naval-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

@media (max-width: 760px) {
  #game5Screen .naval-card-screen {
    padding: 12px;
  }

  #game5Screen .naval-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  #game5Screen .naval-main {
    display: contents;
  }

  #game5Screen .naval-main-header {
    order: 1;
    padding: 20px 18px;
    border-radius: 28px;
    background: rgba(255, 249, 244, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
  }

  #game5Screen .naval-main-header .game-header-actions {
    display: none;
  }

  #game5Screen .naval-sidebar {
    order: 2;
    border-radius: 28px;
  }

  #game5Screen .naval-sidebar-inner {
    padding: 18px;
    gap: 14px;
  }

  #game5Screen .naval-bottom-grid {
    grid-template-columns: 1fr;
  }

  #game5Screen .naval-board-card {
    order: 3;
    padding: 18px 14px 16px;
    border-radius: 28px;
  }

  #game5Screen .naval-panel {
    padding: 16px;
    border-radius: 24px;
    min-height: 220px;
  }

  #game5Screen .naval-board-wrap {
    max-width: 100%;
  }

  #game5Screen .naval-cell-label {
    font-size: 0.58rem;
    right: 4px;
    bottom: 3px;
  }

  #game5Screen .naval-cell-mark {
    font-size: 1.05rem;
  }

  #game5Screen .naval-mobile-back-wrap {
    display: block;
    margin-top: 12px;
  }

  #game5Screen .naval-mobile-back-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 18px 22px;
    font-size: 1.2rem;
    border-radius: 999px;
    background: #fff;
    color: var(--soft-brown);
    box-shadow: 0 6px 16px rgba(130, 100, 80, 0.08);
  }
}

/* game5 polish override */
#game5Screen .naval-card-screen {
  background:
    radial-gradient(circle at top right, rgba(255, 232, 243, 0.42), transparent 24%),
    radial-gradient(circle at bottom left, rgba(219, 243, 255, 0.48), transparent 26%);
}

#game5Screen .naval-layout {
  gap: 18px;
}

#game5Screen .naval-sidebar,
#game5Screen .naval-board-card,
#game5Screen .naval-panel,
#game5Screen .naval-main-header {
  box-shadow: 0 14px 30px rgba(120, 90, 70, 0.08);
}

#game5Screen .naval-main-header {
  padding: 20px 22px;
  border-radius: 26px;
  background: rgba(255, 249, 244, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.82);
}

#game5Screen .naval-board-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 20px 18px;
}

#game5Screen .naval-panel-head {
  width: 100%;
}

#game5Screen .naval-panel-head h3 {
  font-size: 1.12rem;
  color: var(--soft-brown);
  margin-bottom: 4px;
}

#game5Screen .naval-board-wrap {
  width: min(100%, 520px);
  max-width: 520px;
  margin: 0 auto;
  padding: 0;
  border-radius: 32px;
  border: 4px solid rgba(255, 255, 255, 0.88);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.28),
    0 22px 34px rgba(120, 90, 70, 0.12);
}

#game5Screen .naval-board-wrap::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 24px;
  border: 2px dashed rgba(255, 255, 255, 0.42);
  pointer-events: none;
}

#game5Screen .naval-board {
  padding: 14px;
  gap: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(95, 165, 219, 0.12) 100%),
    linear-gradient(180deg, #cfe6ff 0%, #abd7f8 46%, #8bc2ee 100%);
}

#game5Screen .naval-cell {
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 12px;
  background:
    radial-gradient(circle at 26% 22%, rgba(255, 255, 255, 0.44), transparent 28%),
    linear-gradient(180deg, rgba(239, 250, 255, 0.92) 0%, rgba(163, 212, 249, 0.88) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.34),
    0 2px 6px rgba(90, 140, 182, 0.08);
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

#game5Screen .naval-cell-label {
  right: 5px;
  bottom: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 3px 6px rgba(90, 140, 182, 0.08);
  font-size: 0.6rem;
  line-height: 1;
}

#game5Screen .naval-cell-mark {
  font-size: 1.08rem;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.24);
}

#game5Screen .naval-cell.is-miss {
  background:
    radial-gradient(circle at 26% 22%, rgba(255, 255, 255, 0.36), transparent 28%),
    linear-gradient(180deg, #e6ebf2 0%, #bec7d3 100%);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.32),
    0 3px 8px rgba(98, 110, 126, 0.12);
}

#game5Screen .naval-cell.is-hit {
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.26),
    0 4px 10px rgba(120, 90, 70, 0.12),
    0 0 0 2px rgba(255, 255, 255, 0.22);
}

#game5Screen .naval-cell.is-hit .naval-cell-mark {
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

#game5Screen .naval-cell.is-last-target::after {
  inset: 10%;
  border-width: 3px;
  border-radius: 12px;
}

#game5Screen .naval-cell.is-impacting {
  animation: navalCellImpact 0.55s ease-out;
}

#game5Screen .naval-bottom-grid {
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr);
  gap: 16px;
  align-items: start;
}

#game5Screen .naval-panel {
  padding: 18px;
  min-height: 242px;
}

#game5Screen .naval-log-list,
#game5Screen .naval-ranking-list {
  margin-top: 14px;
}

#game5Screen .naval-log-item {
  position: relative;
  padding-left: 16px;
}

#game5Screen .naval-log-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 11px;
  width: 7px;
  height: calc(100% - 22px);
  border-radius: 999px;
  background: rgba(150, 184, 210, 0.5);
}

#game5Screen .naval-log-item.type-drop {
  background: linear-gradient(135deg, #eaf6ff 0%, #d6edff 100%);
}

#game5Screen .naval-log-item.type-hit::before {
  background: #ffb87c;
}

#game5Screen .naval-log-item.type-out::before {
  background: #ff8aa8;
}

#game5Screen .naval-log-item.type-final::before {
  background: #ffd768;
}

#game5Screen .naval-ranking-item {
  border-radius: 20px;
}

#game5Screen .naval-rank-num {
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.35);
}

#game5Screen .naval-rank-hull {
  min-width: 62px;
  text-align: center;
}

#game5Screen .naval-bomb-drop {
  width: 18px;
  height: 28px;
  border-radius: 999px 999px 52% 52%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(180deg, #575757 0%, #1f1f1f 100%);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.28);
}

#game5Screen .naval-bomb-drop::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -6px;
  width: 6px;
  height: 8px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffdf8c 0%, #ff9876 100%);
  box-shadow: 0 0 12px rgba(255, 206, 114, 0.68);
}

#game5Screen .naval-bomb-trail {
  position: absolute;
  width: 8px;
  transform-origin: top center;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.82) 0%, rgba(255,255,255,0.12) 100%);
  filter: blur(1px);
  pointer-events: none;
}

#game5Screen .naval-bomb-sfx {
  position: absolute;
  pointer-events: none;
  font-family: 'Gaegu', cursive;
  font-weight: 700;
  color: #fffdf8;
  text-shadow: 0 3px 10px rgba(95, 79, 69, 0.22);
  white-space: nowrap;
}

#game5Screen .naval-bomb-sfx.is-whoosh {
  font-size: 1.1rem;
  color: #eef9ff;
}

#game5Screen .naval-bomb-sfx.is-boom {
  font-size: 1.55rem;
  color: #fff3bf;
}

#game5Screen .naval-bomb-impact {
  width: 34px;
  height: 34px;
  border-width: 4px;
  border-color: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.4);
}

#game5Screen .naval-bomb-burst {
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 235, 164, 0.94) 0%, rgba(255, 197, 122, 0.84) 36%, rgba(255, 130, 118, 0.28) 66%, rgba(255,255,255,0) 100%);
  pointer-events: none;
}

#game5Screen .naval-bomb-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff6d8 0%, #ffb67f 100%);
  box-shadow: 0 0 10px rgba(255, 190, 125, 0.52);
  pointer-events: none;
}

@keyframes navalCellImpact {
  0% { transform: scale(1); }
  35% { transform: scale(0.94); }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@media (max-width: 960px) {
  #game5Screen .naval-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #game5Screen .naval-main-header {
    padding: 18px 16px;
  }

  #game5Screen .naval-board-card {
    padding: 16px 12px 14px;
  }

  #game5Screen .naval-board-wrap {
    width: min(100%, 430px);
  }

  #game5Screen .naval-board {
    padding: 10px;
    gap: 4px;
  }

  #game5Screen .naval-cell {
    border-radius: 10px;
  }

  #game5Screen .naval-cell-label {
    font-size: 0.54rem;
    padding: 2px 5px;
  }

  #game5Screen .naval-bomb-sfx.is-whoosh {
    font-size: 0.9rem;
  }

  #game5Screen .naval-bomb-sfx.is-boom {
    font-size: 1.25rem;
  }
}

/* game5 simplify + visibility override */
#game5Screen .naval-log-panel {
  display: none;
}

#game5Screen .naval-bottom-grid {
  width: min(100%, 520px);
  margin: 0 auto;
  grid-template-columns: 1fr;
  gap: 10px;
}

#game5Screen .naval-ranking-panel {
  min-height: 0;
  padding: 12px 12px 10px;
  border-radius: 22px;
}

#game5Screen .naval-ranking-panel .naval-panel-head h3 {
  font-size: 0.96rem;
}

#game5Screen .naval-ranking-list {
  margin-top: 8px;
  gap: 7px;
  max-height: none;
  overflow: visible;
}

#game5Screen .naval-ranking-item {
  padding: 9px 10px;
  gap: 10px;
  border-radius: 16px;
}

#game5Screen .naval-rank-num {
  width: 32px;
  height: 32px;
  font-size: 1rem;
}

#game5Screen .naval-rank-name {
  font-size: 0.92rem;
}

#game5Screen .naval-rank-sub {
  margin-top: 2px;
  font-size: 0.72rem;
  line-height: 1.35;
}

#game5Screen .naval-rank-hull {
  min-width: 52px;
  padding: 6px 9px;
  font-size: 0.78rem;
}

#game5Screen .naval-board-wrap {
  border-color: rgba(89, 137, 177, 0.95);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.3), transparent 22%),
    linear-gradient(180deg, #bfe0ff 0%, #8dc1ef 44%, #6ea9dd 100%);
}

#game5Screen .naval-board-wrap::before {
  border-color: rgba(73, 119, 159, 0.48);
}

#game5Screen .naval-board {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(33, 107, 168, 0.08) 100%),
    linear-gradient(180deg, #d7ecff 0%, #a8d3f6 46%, #82b8e8 100%);
}

#game5Screen .naval-cell {
  border-color: rgba(73, 119, 159, 0.88);
  background:
    radial-gradient(circle at 26% 22%, rgba(255, 255, 255, 0.4), transparent 28%),
    linear-gradient(180deg, rgba(231, 245, 255, 0.96) 0%, rgba(164, 208, 244, 0.96) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 1px 4px rgba(68, 108, 146, 0.08);
}

#game5Screen .naval-cell-label {
  background: rgba(240, 248, 255, 0.95);
  border-color: rgba(100, 141, 177, 0.88);
  color: rgba(52, 83, 111, 0.95);
  box-shadow: 0 3px 6px rgba(68, 108, 146, 0.12);
}

#game5Screen .naval-cell.is-miss {
  border-color: rgba(99, 113, 131, 0.84);
}

#game5Screen .naval-cell.is-last-target::after {
  border-color: rgba(37, 74, 110, 0.9);
  box-shadow: 0 0 0 2px rgba(222, 240, 255, 0.45);
}

#game5Screen .naval-hit-chip {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: calc(100% - 10px);
  padding: 4px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  border: 2px solid color-mix(in srgb, var(--naval-hit-color) 72%, #5f4a40 28%);
  box-shadow: 0 4px 10px rgba(75, 55, 43, 0.12);
  text-align: center;
}

#game5Screen .naval-hit-chip strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #5d4638;
  font-size: 0.65rem;
  line-height: 1.1;
}

#game5Screen .naval-bomb-drop {
  width: auto;
  height: auto;
  border: none;
  background: transparent;
  box-shadow: none;
  font-size: 1.65rem;
  line-height: 1;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.22));
}

#game5Screen .naval-bomb-drop::before {
  content: none;
}

#game5Screen .naval-bomb-trail {
  width: 9px;
  background: linear-gradient(180deg, rgba(35, 72, 107, 0.08) 0%, rgba(255,255,255,0.86) 26%, rgba(255,255,255,0.08) 100%);
}

#game5Screen .naval-bomb-impact {
  border-color: rgba(44, 77, 112, 0.9);
  box-shadow: 0 0 18px rgba(255, 231, 168, 0.46);
}

@media (max-width: 760px) {
  #game5Screen .naval-bottom-grid {
    width: min(100%, 430px);
  }

  #game5Screen .naval-ranking-panel {
    padding: 10px 10px 8px;
  }

  #game5Screen .naval-rank-name {
    font-size: 0.84rem;
  }

  #game5Screen .naval-rank-sub {
    font-size: 0.66rem;
  }

  #game5Screen .naval-rank-hull {
    min-width: 46px;
    font-size: 0.7rem;
  }

  #game5Screen .naval-hit-chip strong {
    font-size: 0.5rem;
  }

  #game5Screen .naval-bomb-drop {
    font-size: 1.35rem;
  }
}

/* game5 final UX override */
#game5Screen .naval-button-row {
  align-items: stretch;
}

#game5Screen .naval-button-row .action-btn:disabled {
  opacity: 0.62;
  box-shadow: inset 0 0 0 1px rgba(91, 121, 147, 0.12);
}

#game5Screen .naval-board-meta span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(244, 250, 255, 0.95);
  border: 2px solid rgba(116, 155, 189, 0.42);
  color: #4b6d8b;
  font-weight: 700;
  box-shadow: 0 8px 16px rgba(76, 111, 142, 0.1);
}

#game5Screen .naval-player-chip {
  width: 100%;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 252, 255, 0.96) 100%);
}

#game5Screen .naval-player-swatch,
#game5Screen .naval-rank-color,
#game5Screen .naval-hit-swatch {
  background: var(--naval-player-color, var(--naval-hit-color, #8fc1ea));
}

#game5Screen .naval-player-swatch {
  width: 22px;
  height: 46px;
  border-radius: 12px;
  flex: 0 0 auto;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.34),
    0 4px 10px rgba(81, 104, 126, 0.16);
  position: relative;
}

#game5Screen .naval-player-swatch::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 9px;
  border: 2px solid rgba(255,255,255,0.7);
}

#game5Screen .naval-player-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#game5Screen .naval-player-meta strong {
  color: #5e483b;
  font-size: 0.94rem;
  line-height: 1.15;
}

#game5Screen .naval-player-meta small {
  margin-top: 3px;
  color: #8f7567;
  font-size: 0.76rem;
  line-height: 1.35;
}

#game5Screen .naval-ranking-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.94) 0%, rgba(245, 251, 255, 0.95) 100%);
}

#game5Screen .naval-rank-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

#game5Screen .naval-rank-color {
  width: 12px;
  height: 32px;
  border-radius: 999px;
  flex: 0 0 auto;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.34);
}

#game5Screen .naval-cell.is-hit {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--naval-hit-color) 88%, white 12%) 0%, color-mix(in srgb, var(--naval-hit-color) 72%, #203a53 28%) 100%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.16) 0 8px, rgba(255,255,255,0.04) 8px 16px);
  border-color: color-mix(in srgb, var(--naval-hit-color) 58%, #244b6d 42%);
}

#game5Screen .naval-hit-chip {
  gap: 5px;
  padding: 3px 6px;
  background: rgba(255, 255, 255, 0.94);
  border-width: 2px;
  box-shadow: 0 6px 12px rgba(56, 43, 35, 0.14);
}

#game5Screen .naval-hit-swatch {
  width: 12px;
  height: 22px;
  border-radius: 999px;
  flex: 0 0 auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.36);
}

#game5Screen .naval-hit-chip strong {
  font-size: 0.68rem;
  color: #4f3c32;
}

#game5Screen .naval-cell.is-arming,
#game5Screen .naval-cell.is-targeting {
  z-index: 2;
  box-shadow:
    0 0 0 3px rgba(255, 247, 197, 0.42),
    0 0 18px rgba(255, 208, 112, 0.34),
    inset 0 1px 0 rgba(255,255,255,0.3);
}

#game5Screen .naval-target-warning,
#game5Screen .naval-target-pulse,
#game5Screen .naval-bomb-drop,
#game5Screen .naval-bomb-impact,
#game5Screen .naval-bomb-burst,
#game5Screen .naval-bomb-particle {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#game5Screen .naval-target-warning {
  z-index: 8;
  font-size: 1.46rem;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.18));
}

#game5Screen .naval-target-pulse {
  z-index: 7;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(255, 210, 90, 0.82);
  box-shadow: 0 0 18px rgba(255, 203, 97, 0.28);
}

#game5Screen .naval-bomb-drop {
  z-index: 9;
  width: auto;
  height: auto;
  font-size: 1.9rem;
  line-height: 1;
  border: none;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.22));
}

#game5Screen .naval-bomb-impact {
  z-index: 6;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(255, 250, 232, 0.95);
  box-shadow: 0 0 24px rgba(255, 221, 122, 0.38);
}

#game5Screen .naval-bomb-burst {
  z-index: 5;
  width: 88px;
  height: 88px;
  background: radial-gradient(circle, rgba(255, 239, 175, 0.98) 0%, rgba(255, 191, 117, 0.88) 36%, rgba(255, 122, 108, 0.34) 66%, rgba(255,255,255,0) 100%);
}

#game5Screen .naval-bomb-particle {
  z-index: 5;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff6d8 0%, #ffb67f 100%);
  box-shadow: 0 0 10px rgba(255, 190, 125, 0.52);
}

@media (max-width: 760px) {
  #game5Screen .naval-player-chip {
    padding: 8px 10px;
    gap: 10px;
  }

  #game5Screen .naval-player-swatch {
    width: 18px;
    height: 40px;
  }

  #game5Screen .naval-hit-chip {
    padding: 2px 5px;
    gap: 4px;
  }

  #game5Screen .naval-hit-swatch {
    width: 10px;
    height: 18px;
  }

  #game5Screen .naval-hit-chip strong {
    font-size: 0.54rem;
  }

  #game5Screen .naval-target-warning {
    font-size: 1.18rem;
  }

  #game5Screen .naval-bomb-drop {
    font-size: 1.48rem;
  }
}

/* game5 compact layout + standard participant list */
#game5Screen .naval-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(228px, 270px);
  grid-template-areas:
    'header header'
    'board ranking';
  align-items: start;
  gap: 14px;
}

#game5Screen .naval-main-header {
  grid-area: header;
  margin-bottom: 0;
}

#game5Screen .naval-board-card {
  grid-area: board;
  min-width: 0;
}

#game5Screen .naval-bottom-grid {
  grid-area: ranking;
  width: 100%;
  margin: 0;
  align-self: start;
}

#game5Screen .naval-board-wrap {
  width: min(100%, 470px);
}

#game5Screen .naval-sidebar .slot-legend {
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

#game5Screen .naval-sidebar .legend-chip {
  width: 100%;
  justify-content: flex-start;
}

#game5Screen .naval-ranking-panel {
  min-height: 0;
}

@media (max-width: 1120px) {
  #game5Screen .naval-main {
    grid-template-columns: minmax(0, 1fr) 238px;
  }

  #game5Screen .naval-board-wrap {
    width: min(100%, 430px);
  }
}

@media (max-width: 960px) {
  #game5Screen .naval-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  #game5Screen .naval-bottom-grid {
    width: min(100%, 430px);
    margin: 0 auto;
  }

  #game5Screen .naval-board-wrap {
    width: min(100%, 430px);
  }
}

/* game5 sidebar ranking only */
#game5Screen .naval-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#game5Screen .naval-sidebar-rank-chip {
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
}

#game5Screen .naval-sidebar-rank-chip.top {
  background: linear-gradient(135deg, #fff7d7 0%, #fff2b8 100%);
}

#game5Screen .naval-sidebar-rank-chip.is-eliminated {
  opacity: 0.7;
}

#game5Screen .naval-sidebar-rank-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--lavender), var(--sky));
  color: var(--brown);
  font-family: 'Gaegu', cursive;
  font-size: 1rem;
  font-weight: 700;
}

#game5Screen .naval-sidebar-rank-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#game5Screen .naval-sidebar-rank-meta strong {
  color: #5e483b;
  font-size: 0.92rem;
  line-height: 1.15;
}

#game5Screen .naval-sidebar-rank-meta small {
  margin-top: 2px;
  color: #8f7567;
  font-size: 0.74rem;
  line-height: 1.35;
}

#game5Screen .naval-bottom-grid,
#game5Screen .naval-ranking-panel,
#game5Screen .naval-log-panel {
  display: none !important;
}

@media (max-width: 760px) {
  #game5Screen .naval-sidebar-rank-chip {
    padding: 8px 10px;
    gap: 8px;
  }

  #game5Screen .naval-sidebar-rank-num {
    width: 24px;
    height: 24px;
    font-size: 0.92rem;
  }

  #game5Screen .naval-sidebar-rank-meta strong {
    font-size: 0.84rem;
  }

  #game5Screen .naval-sidebar-rank-meta small {
    font-size: 0.66rem;
  }
}

/* game5 header back button align fix */
#game5Screen .naval-main-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 12px;
}

#game5Screen .naval-main-header > div:first-child {
  min-width: 0;
}

#game5Screen .naval-main-header .game-header-actions {
  justify-self: end;
  align-self: start;
  margin-left: auto;
}


/* game5 hit marker color-only */
#game5Screen .naval-hit-chip {
  width: 22px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--naval-hit-color) 92%, white 8%) 0%, color-mix(in srgb, var(--naval-hit-color) 76%, #244b6d 24%) 100%);
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 6px 12px rgba(56, 43, 35, 0.14), inset 0 2px 0 rgba(255,255,255,0.3);
}

#game5Screen .naval-hit-chip::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.58);
}

#game5Screen .naval-hit-swatch,
#game5Screen .naval-hit-chip strong {
  display: none !important;
}

@media (max-width: 760px) {
  #game5Screen .naval-hit-chip {
    width: 18px;
    height: 30px;
  }
}


/* game5 player color + fill-cell hit override */
#game5Screen .naval-cell.is-hit {
  background: linear-gradient(180deg, color-mix(in srgb, var(--naval-hit-color) 94%, white 6%) 0%, color-mix(in srgb, var(--naval-hit-color) 82%, #1f3550 18%) 100%);
  border-color: color-mix(in srgb, var(--naval-hit-color) 70%, #233d58 30%);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.2),
    0 4px 10px rgba(70, 52, 43, 0.12);
}

#game5Screen .naval-cell.is-hit .naval-cell-label {
  background: rgba(255,255,255,0.92);
  color: #384a5b;
  border-color: rgba(255,255,255,0.94);
}

#game5Screen .naval-hit-chip {
  display: none !important;
}


/* game5 warm-only palette + stronger hit stroke */
#game5Screen .naval-cell.is-hit {
  border-width: 3px;
  border-color: color-mix(in srgb, var(--naval-hit-color) 38%, #4a2f22 62%);
  outline: 2px solid color-mix(in srgb, var(--naval-hit-color) 20%, #fff5ea 80%);
  outline-offset: -3px;
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,0.22),
    0 0 0 1px color-mix(in srgb, var(--naval-hit-color) 50%, #41291f 50%),
    0 6px 12px rgba(70, 52, 43, 0.18);
}


/* game5 remove remaining blue-ish accents from participant ranking */
#game5Screen .naval-sidebar-rank-num {
  background: linear-gradient(135deg, #ffe1e7 0%, #ffd59b 100%);
  color: #8b5f4e;
}

#game5Screen .naval-sidebar .legend-dot {
  box-shadow: 0 0 0 3px rgba(255, 248, 241, 0.92);
}

/* game5 stronger dark inner stroke for destroyed ship cells */
#game5Screen .naval-cell.is-hit {
  box-shadow:
    inset 0 0 0 3px rgba(58, 36, 28, 0.58),
    inset 0 0 0 6px rgba(255,255,255,0.14),
    0 0 0 1px color-mix(in srgb, var(--naval-hit-color) 50%, #41291f 50%),
    0 6px 12px rgba(70, 52, 43, 0.18);
}

/* game5 dark gray board redesign */
#game5Screen .naval-board-wrap {
  border-color: rgba(82, 88, 95, 0.96);
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.12), transparent 22%),
    linear-gradient(180deg, #7e848b 0%, #666c73 46%, #52575e 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,0.08),
    0 22px 34px rgba(56, 52, 48, 0.18);
}

#game5Screen .naval-board-wrap::before {
  border-color: rgba(225, 231, 236, 0.18);
}

#game5Screen .naval-board {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(0,0,0,0.06) 100%),
    linear-gradient(180deg, #8a9199 0%, #6b727a 46%, #565c63 100%);
}

#game5Screen .naval-cell {
  border-color: rgba(44, 49, 55, 0.88);
  background:
    radial-gradient(circle at 26% 22%, rgba(255,255,255,0.14), transparent 28%),
    linear-gradient(180deg, rgba(140, 146, 154, 0.98) 0%, rgba(100, 106, 114, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 2px 4px rgba(34, 30, 27, 0.12);
}

#game5Screen .naval-cell-label {
  background: rgba(244, 246, 248, 0.96);
  border-color: rgba(78, 84, 92, 0.92);
  color: rgba(48, 52, 58, 0.96);
}

#game5Screen .naval-cell.is-miss {
  border-color: rgba(30, 34, 39, 0.94);
  background:
    radial-gradient(circle at 26% 22%, rgba(255,255,255,0.08), transparent 28%),
    linear-gradient(180deg, #6b7077 0%, #4f555c 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 3px 8px rgba(28, 24, 21, 0.18);
}

#game5Screen .naval-cell.is-hit {
  background:
    linear-gradient(180deg, #575d65 0%, #383d44 100%);
  border-width: 3px;
  border-color: rgba(25, 28, 32, 0.96);
  outline: 2px solid rgba(235, 240, 244, 0.18);
  outline-offset: -3px;
  box-shadow:
    inset 0 0 0 3px rgba(20, 22, 25, 0.72),
    inset 0 0 0 6px rgba(255,255,255,0.08),
    0 0 0 1px rgba(18, 20, 24, 0.78),
    0 6px 12px rgba(24, 20, 18, 0.24);
}

#game5Screen .naval-cell.is-hit .naval-cell-label {
  background: rgba(250, 252, 253, 0.94);
  border-color: rgba(22, 26, 30, 0.92);
  color: #23282d;
}

#game5Screen .naval-cell.is-last-target::after {
  border-color: rgba(255, 245, 204, 0.9);
  box-shadow: 0 0 0 2px rgba(255, 244, 187, 0.18);
}

/* game5 board card width align tweak */
#game5Screen .naval-board-card {
  width: calc(100% + 8px);
  margin-right: -8px;
}

@media (max-width: 960px) {
  #game5Screen .naval-board-card {
    width: 100%;
    margin-right: 0;
  }
}

/* game5 darker miss cells */
#game5Screen .naval-cell.is-miss {
  background:
    radial-gradient(circle at 26% 22%, rgba(255,255,255,0.05), transparent 28%),
    linear-gradient(180deg, #4e535a 0%, #2f343a 100%);
  border-color: rgba(18, 20, 24, 0.96);
  box-shadow:
    inset 0 0 0 2px rgba(16, 18, 21, 0.62),
    inset 0 0 0 5px rgba(255,255,255,0.04),
    0 3px 8px rgba(20, 17, 15, 0.22);
}

#game5Screen .naval-cell.is-miss .naval-cell-label {
  border-color: rgba(18, 20, 24, 0.9);
  color: #23282d;
}

/* game5 fine width re-balance */
#game5Screen .naval-board-card {
  width: calc(100% + 2px);
  margin-right: -2px;
}

@media (max-width: 960px) {
  #game5Screen .naval-board-card {
    width: 100%;
    margin-right: 0;
  }
}

/* game5 final hit-vs-miss distinction */
#game5Screen .naval-cell.is-hit {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--naval-hit-color) 94%, white 6%) 0%, color-mix(in srgb, var(--naval-hit-color) 82%, #2a201b 18%) 100%);
  border-width: 3px;
  border-color: color-mix(in srgb, var(--naval-hit-color) 34%, #3e281f 66%);
  outline: 2px solid rgba(255, 247, 239, 0.26);
  outline-offset: -3px;
  box-shadow:
    inset 0 0 0 3px rgba(52, 32, 25, 0.62),
    inset 0 0 0 6px rgba(255,255,255,0.1),
    0 0 0 1px color-mix(in srgb, var(--naval-hit-color) 48%, #3a241c 52%),
    0 6px 12px rgba(34, 25, 21, 0.22);
}

#game5Screen .naval-cell.is-hit .naval-cell-label {
  background: rgba(255,255,255,0.94);
  border-color: rgba(52, 32, 25, 0.84);
  color: #31251f;
}


/* restore pastel participant accents for game5 */
#game5Screen .naval-sidebar-rank-num {
  background: linear-gradient(135deg, var(--lavender), var(--sky));
  color: var(--brown);
}

/* game5 fast-forward target + clean board UI */
#game5Screen #navalStatusText {
  display: none !important;
}

#game5Screen .naval-cell-label,
#game5Screen .naval-cell-mark {
  display: none !important;
}

#game5Screen .naval-board-card {
  position: relative;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#game5Screen .naval-board-card.is-fast-forwarding,
#game5Screen .naval-board-card.is-fast-forward-blocked {
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.48),
    0 0 0 4px rgba(255, 225, 149, 0.42),
    0 16px 28px rgba(120, 90, 70, 0.12);
}

#game5Screen .naval-board-card.is-fast-forwarding::after,
#game5Screen .naval-board-card.is-fast-forward-blocked::after {
  content: attr(data-fast-forward-label);
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 248, 222, 0.94);
  color: #8b6a37;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.14);
  pointer-events: none;
  animation: fastForwardPulse 0.9s ease-in-out infinite;
}

/* game5 participant list panel height tidy */
#game5Screen .naval-sidebar .scoreboard-card {
  min-height: calc(100% - 12px);
}

#game5Screen .naval-sidebar-inner {
  align-items: stretch;
}

#game5Screen .naval-sidebar .scoreboard-card {
  flex: 1 1 auto;
}

/* game5 sidebar participant card fix */
#game5Screen .naval-sidebar {
  display: flex;
}

#game5Screen .naval-sidebar-inner {
  flex: 1 1 auto;
  min-height: 0;
}

#game5Screen .naval-sidebar .scoreboard-card {
  min-height: 0 !important;
  height: auto;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

#game5Screen .naval-sidebar .slot-legend {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

/* game5 participant list internal scroll */
#game5Screen .naval-sidebar .scoreboard-card {
  overflow: hidden;
}

#game5Screen .naval-sidebar .slot-legend {
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}

/* game5 participant list fixed-height scroll */
#game5Screen .naval-sidebar .scoreboard-card {
  flex: 0 0 auto;
  height: 360px;
  max-height: 360px;
}

#game5Screen .naval-sidebar .slot-legend {
  height: 100%;
  max-height: 278px;
  overflow-y: auto;
  overflow-x: hidden;
}

@media (max-width: 960px) {
  #game5Screen .naval-sidebar .scoreboard-card {
    height: 320px;
    max-height: 320px;
  }

  #game5Screen .naval-sidebar .slot-legend {
    max-height: 238px;
  }
}


/* =========================
   utility controls : theme / fullscreen
========================= */

html {
  color-scheme: light;
}

html.theme-dark {
  color-scheme: dark;
  --bg: #161219;
  --bg2: #0f0d14;
  --card: rgba(30, 24, 34, 0.9);
  --card-strong: rgba(35, 28, 40, 0.94);
  --brown: #f3e7dc;
  --soft-brown: #f8c9d9;
  --pink: #ff9fc0;
  --mint: #66d4bb;
  --sky: #83befe;
  --lavender: #b5a2ff;
  --yellow: #f0c35a;
  --peach: #ffb893;
  --shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
  --night-surface-1: #0f1726;
  --night-surface-2: #152238;
  --night-surface-3: #21334f;
  --night-surface-4: #2c4366;
  --night-border: rgba(120, 189, 255, 0.32);
  --night-border-strong: rgba(149, 211, 255, 0.58);
  --night-text: #f4f8ff;
  --night-text-2: #d7e5fb;
  --night-text-3: #aebfdc;
  --night-muted-chip: #1d2a3d;
}

body {
  transition: background 0.25s ease, color 0.25s ease;
}

button,
input,
.card,
.controls-wrap,
.scoreboard-card,
.game-board-card,
.race-panel,
.race-track-wrap,
.battle-table-card,
.battle-panel,
.sim-setup-card,
.sim-arena-card,
.sim-battle-summary-card,
.naval-board-card,
.popup,
.orientation-lock-card {
  transition:
    background 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.utility-controls {
  position: fixed;
  top: auto;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.utility-btn {
  min-width: 132px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  border-radius: 999px;
  pointer-events: auto;
  background: rgba(255, 250, 245, 0.94);
  color: var(--soft-brown);
  border: 2px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 24px rgba(90, 70, 60, 0.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-weight: 700;
}

.utility-btn:hover {
  transform: translateY(-2px);
}

.utility-btn-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.utility-btn-label {
  font-size: 0.94rem;
  line-height: 1;
  white-space: nowrap;
}

.utility-btn.is-unsupported {
  opacity: 0.82;
}

.utility-volume-panel {
  width: 232px;
  display: grid;
  gap: 10px;
  padding: 14px 14px 12px;
  border-radius: 22px;
  pointer-events: auto;
  background: rgba(255, 250, 245, 0.94);
  color: var(--soft-brown);
  border: 2px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 24px rgba(90, 70, 60, 0.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.volume-control {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1;
}

.volume-control-text,
.volume-control-value {
  white-space: nowrap;
}

.volume-control-value {
  text-align: right;
  color: #9b7d6b;
  font-variant-numeric: tabular-nums;
}

.volume-range {
  width: 100%;
  height: 18px;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.volume-range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(246, 201, 215, 0.98) 0%, rgba(246, 201, 215, 0.98) var(--volume-progress, 50%), rgba(235, 222, 211, 0.96) var(--volume-progress, 50%), rgba(235, 222, 211, 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.72);
}

.volume-range::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(235, 222, 211, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.72);
}

.volume-range::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(246, 201, 215, 0.98);
}

.volume-range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  background: #fffaf5;
  border: 3px solid rgba(185, 126, 153, 0.86);
  box-shadow: 0 6px 12px rgba(90, 70, 60, 0.14);
}

.volume-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fffaf5;
  border: 3px solid rgba(185, 126, 153, 0.86);
  box-shadow: 0 6px 12px rgba(90, 70, 60, 0.14);
}

.volume-range:focus-visible {
  outline: 3px solid rgba(227, 217, 255, 0.75);
  outline-offset: 4px;
  border-radius: 999px;
}

.utility-audio-btn.is-audio-off {
  opacity: 0.78;
  background: rgba(245, 239, 235, 0.92);
}

.utility-desktop-only {
  display: inline-flex;
}

.utility-mobile-only {
  display: none;
}

.utility-prevstep-btn:disabled,
.utility-prevstep-btn[aria-disabled="true"] {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none !important;
}

body.orientation-blocked .utility-controls {
  opacity: 0;
  pointer-events: none;
}

html.theme-dark body {
  background:
    radial-gradient(circle at top left, rgba(255, 151, 189, 0.12), transparent 22%),
    radial-gradient(circle at bottom right, rgba(130, 190, 254, 0.14), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  color: var(--brown);
}

html.theme-dark .background-deco {
  opacity: 0.24;
  filter: blur(8px);
}

html.theme-dark .card,
html.theme-dark .controls-wrap,
html.theme-dark .scoreboard-card,
html.theme-dark .game-board-card,
html.theme-dark .race-panel,
html.theme-dark .battle-table-card,
html.theme-dark .battle-panel,
html.theme-dark .sim-setup-card,
html.theme-dark .sim-arena-card,
html.theme-dark .sim-battle-summary-card,
html.theme-dark .naval-board-card,
html.theme-dark .popup,
html.theme-dark .orientation-lock-card,
html.theme-dark .game-sidebar,
html.theme-dark .race-sidebar,
html.theme-dark .battle-sidebar,
html.theme-dark .sim-sidebar,
html.theme-dark .naval-sidebar {
  background: rgba(26, 20, 31, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html.theme-dark .small-badge,
html.theme-dark .battle-deck-label,
html.theme-dark .sim-phase-badge,
html.theme-dark .battle-result-pill,
html.theme-dark .battle-final-rank,
html.theme-dark .battle-final-result-box,
html.theme-dark .legend-chip,
html.theme-dark .race-ranking-item,
html.theme-dark .battle-ranking-item,
html.theme-dark .battle-ranking-empty,
html.theme-dark .sim-empty-state,
html.theme-dark .naval-log-item,
html.theme-dark .naval-ranking-item,
html.theme-dark .naval-player-chip,
html.theme-dark .naval-elimination-item {
  background: rgba(47, 37, 55, 0.96);
  color: #f0e7df;
  border-color: rgba(255, 255, 255, 0.07);
}

html.theme-dark .back-btn,
html.theme-dark .popup-btn,
html.theme-dark .sim-info-btn,
html.theme-dark .sim-arena-zoom-btn,
html.theme-dark .utility-btn {
  background: rgba(40, 32, 48, 0.94);
  color: #f4e9df;
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
}

html.theme-dark .utility-volume-panel {
  background: rgba(40, 32, 48, 0.94);
  color: #f4e9df;
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
}

html.theme-dark .volume-control-value {
  color: rgba(240, 231, 223, 0.72);
}

html.theme-dark .volume-range::-webkit-slider-runnable-track {
  background:
    linear-gradient(90deg, rgba(255, 159, 192, 0.94) 0%, rgba(255, 159, 192, 0.94) var(--volume-progress, 50%), rgba(255, 255, 255, 0.12) var(--volume-progress, 50%), rgba(255, 255, 255, 0.12) 100%);
  border-color: rgba(255, 255, 255, 0.08);
}

html.theme-dark .volume-range::-moz-range-track {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.08);
}

html.theme-dark .volume-range::-moz-range-progress {
  background: rgba(255, 159, 192, 0.94);
}

html.theme-dark .volume-range::-webkit-slider-thumb,
html.theme-dark .volume-range::-moz-range-thumb {
  background: #2e2537;
  border-color: rgba(255, 159, 192, 0.86);
}

html.theme-dark .main-btn {
  background: linear-gradient(135deg, #ff9fc0, #f7b0ff);
  color: #1a141e;
  box-shadow: 0 12px 24px rgba(255, 143, 184, 0.2);
}

html.theme-dark .menu-btn.physical,
html.theme-dark .menu-btn.luck,
html.theme-dark .game-item,
html.theme-dark .game-item.game-launch,
html.theme-dark .action-btn.secondary,
html.theme-dark .drawer-toggle-btn {
  background: linear-gradient(180deg, rgba(46, 37, 55, 0.96) 0%, rgba(36, 29, 44, 0.96) 100%);
  color: #f3e7dc;
  border-color: rgba(255, 255, 255, 0.07);
}

html.theme-dark .action-btn.primary {
  background: linear-gradient(135deg, #ff9fc0, #f0b8ff);
  color: #1a141e;
}

html.theme-dark .action-btn.soft {
  background: linear-gradient(135deg, #f0c35a, #ffdd8d);
  color: #241d15;
}

html.theme-dark .game-item:nth-child(2),
html.theme-dark .game-item:nth-child(3),
html.theme-dark .game-item:nth-child(4),
html.theme-dark .game-item:nth-child(5),
html.theme-dark .game-item:nth-child(6),
html.theme-dark .game-item:nth-child(7),
html.theme-dark .game-item:nth-child(8) {
  background: linear-gradient(180deg, rgba(46, 37, 55, 0.96) 0%, rgba(36, 29, 44, 0.96) 100%);
}

html.theme-dark .sub-text,
html.theme-dark .helper-text,
html.theme-dark .status-text,
html.theme-dark #totalInfo,
html.theme-dark .game-item p,
html.theme-dark .popup-message,
html.theme-dark .horse-status,
html.theme-dark .battle-rank-formula,
html.theme-dark .battle-player-sub,
html.theme-dark .sim-player-sub,
html.theme-dark .game-board-head span,
html.theme-dark .orientation-lock-card p,
html.theme-dark .race-ranking-item div {
  color: rgba(240, 231, 223, 0.72) !important;
}

html.theme-dark .game-num,
html.theme-dark .battle-rank-num {
  background: linear-gradient(135deg, rgba(131, 190, 254, 0.94), rgba(181, 162, 255, 0.94));
  color: #130f17;
}

html.theme-dark .slot-name,
html.theme-dark .slot-meta,
html.theme-dark .horse-name,
html.theme-dark .battle-player-name,
html.theme-dark .sim-player-name,
html.theme-dark .battle-rank-name,
html.theme-dark .race-lane-label {
  color: #f5ebe2;
}

html.theme-dark .input-card input,
html.theme-dark input:disabled {
  background: rgba(19, 15, 24, 0.9);
  color: #f2e7df;
  border-color: rgba(255, 255, 255, 0.09);
}

html.theme-dark .input-card input:focus {
  border-color: rgba(131, 190, 254, 0.75);
  box-shadow: 0 0 0 5px rgba(131, 190, 254, 0.14);
}

html.theme-dark .game-canvas-wrap,
html.theme-dark .race-track-wrap,
html.theme-dark .sim-arena-wrap,
html.theme-dark .sim-arena-zoom-stage,
html.theme-dark .naval-board-wrap,
html.theme-dark .battle-table-card {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.05), transparent 24%),
    linear-gradient(180deg, #261e2d 0%, #19151f 100%);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 16px 28px rgba(0, 0, 0, 0.25);
}

html.theme-dark .race-lane {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.06) 0px,
      rgba(255, 255, 255, 0.06) 28px,
      rgba(255, 255, 255, 0.02) 28px,
      rgba(255, 255, 255, 0.02) 56px
    ),
    linear-gradient(180deg, #4c3a43 0%, #362832 100%);
  border-color: rgba(255, 255, 255, 0.07);
}

html.theme-dark .race-horse,
html.theme-dark .battle-row,
html.theme-dark .sim-player-row,
html.theme-dark .battle-slot,
html.theme-dark .battle-card-front,
html.theme-dark .sim-stat-card-front {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
}

html.theme-dark .popup-overlay {
  background: rgba(5, 3, 8, 0.6);
}

html.theme-dark .popup.battle-final-popup .popup-message {
  color: var(--night-text-2) !important;
}

html.theme-dark .battle-final-popup-item,
html.theme-dark .battle-final-popup-empty {
  background:
    linear-gradient(180deg, rgba(26, 39, 63, 0.98) 0%, rgba(13, 21, 37, 1) 100%);
  border-color: rgba(125, 211, 252, 0.22);
  box-shadow:
    0 18px 28px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

html.theme-dark .battle-final-popup-rank-badge {
  background: linear-gradient(180deg, rgba(39, 61, 100, 0.98) 0%, rgba(24, 40, 72, 0.98) 100%);
  border-color: rgba(116, 172, 255, 0.18);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255,255,255,0.06);
  color: #ffd76f;
}

html.theme-dark .battle-final-popup-name {
  color: var(--night-text);
}

html.theme-dark .battle-final-popup-formula,
html.theme-dark .battle-final-popup-empty {
  color: var(--night-text-2);
}

html.theme-dark .orientation-lock-overlay {
  background: rgba(12, 9, 16, 0.9);
}

html.theme-dark .slot-box {
  box-shadow: inset 0 -10px 25px rgba(0, 0, 0, 0.16);
}

html.theme-dark .drawer-backdrop,
html.theme-dark #simArenaZoomBackdrop {
  background: rgba(7, 5, 10, 0.58);
}

@media (max-width: 1024px) {
  .utility-controls {
    top: auto;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .utility-btn {
    min-width: 124px;
    min-height: 50px;
    padding-inline: 14px;
  }
}

@media (max-width: 767px) {
  .utility-controls {
    top: auto;
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  .utility-btn {
    min-width: 52px;
    width: 52px;
    min-height: 52px;
    padding: 0;
    border-radius: 18px;
  }

  .utility-desktop-only {
    display: none;
  }

  .utility-mobile-only {
    display: inline-flex;
  }

  .utility-btn-label {
    display: none;
  }

  .utility-btn-icon {
    font-size: 1.15rem;
  }
}

@media (min-width: 768px) and (max-width: 1180px) and (pointer: coarse) {
  .utility-controls {
    top: auto;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom));
  }
}


/* =========================
   game4 : stronger night-mode contrast fixes
========================= */

html.theme-dark .popup.sim-map-popup {
  max-width: 760px;
}

html.theme-dark .sim-map-note {
  color: var(--night-text-2) !important;
}

html.theme-dark .sim-map-option {
  background:
    linear-gradient(180deg, rgba(26, 39, 63, 0.98) 0%, rgba(13, 21, 37, 1) 100%) !important;
  border-color: rgba(125, 211, 252, 0.22) !important;
  box-shadow:
    0 18px 28px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

html.theme-dark .sim-map-option:hover {
  border-color: rgba(125, 211, 252, 0.48) !important;
  box-shadow:
    0 22px 34px rgba(0, 0, 0, 0.40),
    0 0 0 1px rgba(125, 211, 252, 0.12) !important;
}

html.theme-dark .sim-map-option strong {
  color: var(--night-text) !important;
}

html.theme-dark .sim-map-option span {
  color: var(--night-text-3) !important;
}

html.theme-dark .sim-map-preview i {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 6px 12px rgba(0,0,0,0.22);
}

html.theme-dark .sim-arena-wrap {
  background:
    radial-gradient(circle at 50% 0%, rgba(125, 211, 252, 0.10), transparent 36%),
    radial-gradient(circle at 20% 18%, rgba(182, 156, 255, 0.08), transparent 28%),
    linear-gradient(180deg, #0b1322 0%, #08101c 100%) !important;
  border-color: rgba(125, 211, 252, 0.18) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.04),
    0 18px 34px rgba(0, 0, 0, 0.34) !important;
}

html.theme-dark .sim-arena-wrap::before {
  color: rgba(220, 234, 255, 0.42);
}

html.theme-dark .sim-ball-label {
  background:
    linear-gradient(180deg, rgba(19, 29, 48, 0.96) 0%, rgba(10, 17, 30, 0.98) 100%) !important;
  border-color: rgba(125, 211, 252, 0.30) !important;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255,255,255,0.08) !important;
}

html.theme-dark .sim-ball-name,
html.theme-dark .sim-ball-hptext {
  color: var(--night-text) !important;
}

html.theme-dark .sim-ball-place {
  background: linear-gradient(180deg, rgba(255, 215, 110, 0.98) 0%, rgba(255, 168, 76, 0.98) 100%) !important;
  color: #241404 !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.32), 0 3px 8px rgba(0,0,0,0.24) !important;
}

html.theme-dark .sim-ball-hpbar {
  background: linear-gradient(180deg, rgba(130, 152, 187, 0.16) 0%, rgba(48, 63, 89, 0.48) 100%) !important;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.34) !important;
}

html.theme-dark .sim-ball-hpbar::after {
  border-color: rgba(255,255,255,0.12) !important;
}

html.theme-dark .sim-ball-hpbar span {
  background: linear-gradient(90deg, #ff6b8a 0%, #ffbf69 42%, #5eead4 100%) !important;
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.20), 0 0 12px rgba(94, 234, 212, 0.18) !important;
}

html.theme-dark .sim-ball-label.is-dead {
  background: linear-gradient(180deg, rgba(24, 30, 40, 0.62) 0%, rgba(10, 14, 22, 0.72) 100%) !important;
  border-color: rgba(125, 211, 252, 0.08) !important;
  opacity: 0.4;
}

html.theme-dark .sim-ball-label.is-dead .sim-ball-name,
html.theme-dark .sim-ball-label.is-dead .sim-ball-hptext {
  color: rgba(190, 204, 224, 0.62) !important;
}

html.theme-dark .sim-ball-label.is-hit {
  box-shadow:
    0 0 0 3px rgba(255, 132, 150, 0.42),
    0 0 26px rgba(255, 120, 144, 0.26),
    0 10px 24px rgba(0, 0, 0, 0.32) !important;
}

html.theme-dark .sim-shrink-zone.is-danger {
  border-color: rgba(255, 112, 146, 0.92);
  box-shadow: 0 0 0 1px rgba(255, 112, 146, 0.12), 0 0 26px rgba(255, 112, 146, 0.16);
}

html.theme-dark .sim-summary-table {
  background:
    linear-gradient(180deg, rgba(14, 23, 40, 0.98) 0%, rgba(9, 16, 30, 1) 100%) !important;
  border-color: rgba(125, 211, 252, 0.18) !important;
}

html.theme-dark .sim-summary-table th,
html.theme-dark .sim-summary-table td {
  color: var(--night-text) !important;
  border-bottom-color: rgba(125, 211, 252, 0.10) !important;
}

html.theme-dark .sim-summary-table th {
  background:
    linear-gradient(180deg, rgba(39, 56, 86, 0.98) 0%, rgba(24, 36, 57, 0.98) 100%) !important;
  color: #f8d4e4 !important;
}

html.theme-dark .sim-summary-table tbody tr:nth-child(odd) td {
  background: rgba(12, 22, 38, 0.28) !important;
}

html.theme-dark .sim-summary-table tbody tr:nth-child(even) td {
  background: rgba(32, 45, 71, 0.42) !important;
}

html.theme-dark .sim-summary-name {
  color: var(--night-text) !important;
}

html.theme-dark .sim-stat-card.type-health .sim-stat-card-front {
  background: linear-gradient(180deg, rgba(90, 38, 66, 0.98) 0%, rgba(47, 19, 35, 0.98) 100%) !important;
}

html.theme-dark .sim-stat-card.type-attack .sim-stat-card-front {
  background: linear-gradient(180deg, rgba(105, 62, 29, 0.98) 0%, rgba(57, 31, 11, 0.98) 100%) !important;
}

html.theme-dark .sim-stat-card.type-accuracy .sim-stat-card-front {
  background: linear-gradient(180deg, rgba(33, 68, 109, 0.98) 0%, rgba(16, 35, 61, 0.98) 100%) !important;
}

html.theme-dark .sim-stat-card.type-defense .sim-stat-card-front {
  background: linear-gradient(180deg, rgba(27, 87, 76, 0.98) 0%, rgba(12, 43, 39, 0.98) 100%) !important;
}

html.theme-dark .sim-stat-card-front small,
html.theme-dark .sim-stat-card-front strong {
  color: var(--night-text) !important;
}


/* =========================
   game4 : night mode readability refresh v2
========================= */
html.theme-dark .popup.sim-map-popup {
  background:
    radial-gradient(circle at top center, rgba(139, 194, 255, 0.14), transparent 28%),
    linear-gradient(180deg, rgba(17, 28, 48, 0.98) 0%, rgba(9, 16, 30, 0.99) 100%) !important;
  border-color: rgba(122, 188, 255, 0.22) !important;
  box-shadow:
    0 24px 54px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(88, 135, 201, 0.16) !important;
}

html.theme-dark .popup.sim-map-popup h3 {
  color: #f7d7e6 !important;
}

html.theme-dark .popup.sim-map-popup .popup-message {
  color: var(--night-text-2) !important;
}

html.theme-dark .popup.sim-map-popup .popup-icon {
  filter: drop-shadow(0 8px 16px rgba(107, 163, 255, 0.22));
}

html.theme-dark .sim-map-note {
  color: var(--night-text-2) !important;
}

html.theme-dark .sim-map-picker {
  gap: 14px;
}

html.theme-dark .sim-map-option {
  background:
    linear-gradient(180deg, rgba(28, 42, 67, 0.98) 0%, rgba(15, 24, 41, 1) 100%) !important;
  border: 2px solid rgba(132, 195, 255, 0.24) !important;
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28) !important;
}

html.theme-dark .sim-map-option::before {
  opacity: 1 !important;
}

html.theme-dark .sim-map-option:hover {
  border-color: rgba(132, 195, 255, 0.52) !important;
  transform: translateY(-3px);
  box-shadow:
    0 22px 34px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(132, 195, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

html.theme-dark .sim-map-option strong {
  color: var(--night-text) !important;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.24);
}

html.theme-dark .sim-map-option span {
  color: var(--night-text-2) !important;
}

html.theme-dark .sim-map-preview i {
  opacity: 1 !important;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08),
    0 6px 12px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.14);
}

html.theme-dark #game4Screen .sim-setup-card {
  background:
    radial-gradient(circle at top center, rgba(170, 132, 255, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(21, 18, 33, 0.98) 0%, rgba(14, 12, 23, 0.99) 100%) !important;
  border-color: rgba(145, 121, 219, 0.16) !important;
}

html.theme-dark #game4Screen .sim-deck {
  filter: drop-shadow(0 14px 26px rgba(91, 74, 155, 0.24));
}

html.theme-dark #game4Screen .sim-player-row {
  background:
    linear-gradient(180deg, rgba(28, 26, 38, 0.96) 0%, rgba(19, 18, 29, 0.98) 100%) !important;
  border: 2px solid rgba(255, 255, 255, 0.06) !important;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

html.theme-dark #game4Screen .sim-player-name {
  color: #f6f2ee !important;
}

html.theme-dark #game4Screen .sim-player-sub {
  color: rgba(229, 222, 240, 0.84) !important;
}

html.theme-dark #game4Screen .sim-player-total {
  background: linear-gradient(180deg, rgba(255, 233, 178, 0.98) 0%, rgba(243, 205, 118, 0.98) 100%) !important;
  color: #3e2a07 !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.40),
    0 8px 16px rgba(0,0,0,0.22) !important;
}

html.theme-dark #game4Screen .sim-stat-card-face {
  border-color: rgba(255,255,255,0.11) !important;
}

html.theme-dark #game4Screen .sim-stat-card-back {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.22), transparent 24%),
    linear-gradient(145deg, #7759ef 0%, #5689f0 52%, #51d8c4 100%) !important;
  box-shadow:
    0 14px 28px rgba(31, 20, 64, 0.36),
    inset 0 1px 0 rgba(255,255,255,0.22) !important;
}

html.theme-dark #game4Screen .sim-stat-card.type-health .sim-stat-card-front {
  background: linear-gradient(180deg, #6e2e56 0%, #3e1931 100%) !important;
}

html.theme-dark #game4Screen .sim-stat-card.type-attack .sim-stat-card-front {
  background: linear-gradient(180deg, #7b4b1f 0%, #43250d 100%) !important;
}

html.theme-dark #game4Screen .sim-stat-card.type-accuracy .sim-stat-card-front {
  background: linear-gradient(180deg, #26598a 0%, #16304e 100%) !important;
}

html.theme-dark #game4Screen .sim-stat-card.type-defense .sim-stat-card-front {
  background: linear-gradient(180deg, #1f6b5f 0%, #12392f 100%) !important;
}

html.theme-dark #game4Screen .sim-stat-card-front small {
  color: rgba(236, 244, 255, 0.86) !important;
}

html.theme-dark #game4Screen .sim-stat-card-front strong {
  color: #ffffff !important;
  text-shadow: 0 1px 0 rgba(0,0,0,0.22);
}

html.theme-dark #game4Screen .sim-summary-table {
  background:
    linear-gradient(180deg, rgba(18, 28, 45, 0.98) 0%, rgba(10, 18, 32, 1) 100%) !important;
  border: 1px solid rgba(132, 195, 255, 0.16) !important;
}

html.theme-dark #game4Screen .sim-summary-table th {
  background:
    linear-gradient(180deg, rgba(45, 64, 96, 0.98) 0%, rgba(27, 40, 64, 0.98) 100%) !important;
  color: #ffd7e6 !important;
}

html.theme-dark #game4Screen .sim-summary-table td {
  color: var(--night-text) !important;
  border-bottom-color: rgba(132, 195, 255, 0.10) !important;
}

html.theme-dark #game4Screen .sim-summary-table tbody tr:nth-child(odd) td {
  background: rgba(12, 22, 38, 0.36) !important;
}

html.theme-dark #game4Screen .sim-summary-table tbody tr:nth-child(even) td {
  background: rgba(30, 46, 73, 0.56) !important;
}

html.theme-dark #game4Screen .sim-summary-name,
html.theme-dark #game4Screen .sim-panel-head h3,
html.theme-dark #game4Screen .sim-panel-head .sub-text,
html.theme-dark #game4Screen .sim-setup-head,
html.theme-dark #game4Screen .sim-phase-badge,
html.theme-dark #game4Screen .sim-main-header .sub-text {
  color: var(--night-text) !important;
}

/* =========================
   final night-theme palette review
   layout preserved, color system only refined
========================= */
html.theme-dark {
  --night-bg-0: #07111f;
  --night-bg-1: #0b1627;
  --night-surface-a: rgba(12, 22, 38, 0.96);
  --night-surface-b: rgba(17, 29, 48, 0.98);
  --night-surface-c: rgba(24, 39, 63, 0.98);
  --night-surface-d: rgba(32, 52, 82, 0.98);
  --night-line-soft: rgba(147, 203, 255, 0.14);
  --night-line-mid: rgba(147, 203, 255, 0.22);
  --night-line-strong: rgba(157, 213, 255, 0.38);
  --night-title: #f7d6e5;
  --night-copy: #eef5ff;
  --night-copy-soft: #cad8ea;
  --night-copy-muted: #9fb3cb;
  --night-chip: rgba(20, 33, 54, 0.95);
  --night-chip-2: rgba(31, 48, 74, 0.95);
  --night-gold-1: #ffe08a;
  --night-gold-2: #f4bf57;
  --night-pink-1: #ff8fb6;
  --night-pink-2: #ffc7db;
  --night-blue-1: #78cbff;
  --night-blue-2: #bfe6ff;
  --night-teal-1: #64e9d3;
  --night-purple-1: #c9b9ff;
}

html.theme-dark body {
  background:
    radial-gradient(circle at 0% 0%, rgba(120, 170, 255, 0.14), transparent 26%),
    radial-gradient(circle at 100% 100%, rgba(255, 133, 182, 0.12), transparent 24%),
    linear-gradient(180deg, var(--night-bg-1) 0%, var(--night-bg-0) 100%) !important;
  color: var(--night-copy) !important;
}

html.theme-dark .main-card h1,
html.theme-dark .menu-card h2,
html.theme-dark .luck-card h2,
html.theme-dark .game-card h2,
html.theme-dark .popup h3,
html.theme-dark .sidebar-title,
html.theme-dark .game-item h3,
html.theme-dark .scoreboard-head h3,
html.theme-dark .game-board-head h3,
html.theme-dark .race-panel-head h3,
html.theme-dark .battle-panel-head h3,
html.theme-dark .sim-panel-head h3,
html.theme-dark .naval-panel-head h3,
html.theme-dark .orientation-lock-card h3 {
  color: var(--night-title) !important;
}

html.theme-dark .sub-text,
html.theme-dark .helper-text,
html.theme-dark .status-text,
html.theme-dark #totalInfo,
html.theme-dark .game-item p,
html.theme-dark .popup-message,
html.theme-dark .horse-status,
html.theme-dark .battle-rank-formula,
html.theme-dark .battle-player-sub,
html.theme-dark .sim-player-sub,
html.theme-dark .game-board-head span,
html.theme-dark .orientation-lock-card p,
html.theme-dark .race-ranking-item div,
html.theme-dark .naval-board-meta,
html.theme-dark .naval-board-meta span,
html.theme-dark .battle-final-result-box small,
html.theme-dark .sim-map-note,
html.theme-dark .popup .popup-message {
  color: var(--night-copy-soft) !important;
}

html.theme-dark .card,
html.theme-dark .controls-wrap,
html.theme-dark .scoreboard-card,
html.theme-dark .game-board-card,
html.theme-dark .race-panel,
html.theme-dark .battle-table-card,
html.theme-dark .battle-panel,
html.theme-dark .sim-setup-card,
html.theme-dark .sim-arena-card,
html.theme-dark .sim-battle-summary-card,
html.theme-dark .naval-board-card,
html.theme-dark .popup,
html.theme-dark .orientation-lock-card,
html.theme-dark .game-sidebar,
html.theme-dark .race-sidebar,
html.theme-dark .battle-sidebar,
html.theme-dark .sim-sidebar,
html.theme-dark .naval-sidebar,
html.theme-dark #game3Screen .battle-main-header,
html.theme-dark #game5Screen .naval-main-header,
html.theme-dark body.game1-mode.game1-mobile-layout .game-main-header {
  background:
    radial-gradient(circle at top center, rgba(124, 186, 255, 0.08), transparent 28%),
    linear-gradient(180deg, var(--night-surface-b) 0%, var(--night-surface-a) 100%) !important;
  border-color: var(--night-line-soft) !important;
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(110, 160, 225, 0.08) !important;
}

html.theme-dark .small-badge,
html.theme-dark .battle-deck-label,
html.theme-dark .sim-phase-badge,
html.theme-dark .battle-result-pill,
html.theme-dark .battle-final-rank,
html.theme-dark .battle-final-result-box,
html.theme-dark .legend-chip,
html.theme-dark .race-ranking-item,
html.theme-dark .battle-ranking-item,
html.theme-dark .battle-ranking-empty,
html.theme-dark .sim-empty-state,
html.theme-dark .naval-log-item,
html.theme-dark .naval-ranking-item,
html.theme-dark .naval-player-chip,
html.theme-dark .naval-elimination-item,
html.theme-dark .sim-player-total,
html.theme-dark .battle-rank-score,
html.theme-dark .race-lane-label,
html.theme-dark .battle-final-result-box,
html.theme-dark .battle-final-rank {
  background: linear-gradient(180deg, var(--night-chip) 0%, rgba(14, 25, 42, 0.98) 100%) !important;
  color: var(--night-copy) !important;
  border-color: var(--night-line-soft) !important;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
}

html.theme-dark .small-badge,
html.theme-dark .sim-phase-badge,
html.theme-dark .battle-deck-label {
  color: var(--night-pink-2) !important;
}

html.theme-dark .back-btn,
html.theme-dark .popup-btn,
html.theme-dark .sim-info-btn,
html.theme-dark .sim-arena-zoom-btn,
html.theme-dark .utility-btn,
html.theme-dark .mobile-back-btn,
html.theme-dark .mobile-race-back-btn,
html.theme-dark .battle-mobile-back-btn,
html.theme-dark .sim-mobile-back-btn,
html.theme-dark .naval-mobile-back-btn {
  background: linear-gradient(180deg, rgba(26, 42, 66, 0.98) 0%, rgba(16, 28, 46, 0.98) 100%) !important;
  color: var(--night-copy) !important;
  border: 2px solid var(--night-line-soft) !important;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

html.theme-dark .back-btn:hover,
html.theme-dark .popup-btn:hover,
html.theme-dark .sim-info-btn:hover,
html.theme-dark .sim-arena-zoom-btn:hover,
html.theme-dark .utility-btn:hover,
html.theme-dark .drawer-toggle-btn:hover {
  border-color: var(--night-line-mid) !important;
}

html.theme-dark .main-btn,
html.theme-dark .action-btn.primary {
  background: linear-gradient(135deg, var(--night-pink-1), #d7a9ff 100%) !important;
  color: #140d18 !important;
  border: none !important;
  box-shadow: 0 14px 28px rgba(255, 125, 182, 0.24) !important;
}

html.theme-dark .action-btn.secondary,
html.theme-dark .menu-btn.physical,
html.theme-dark .menu-btn.luck,
html.theme-dark .game-item,
html.theme-dark .game-item.game-launch,
html.theme-dark .drawer-toggle-btn {
  background: linear-gradient(180deg, var(--night-surface-c) 0%, var(--night-surface-b) 100%) !important;
  color: var(--night-copy) !important;
  border: 2px solid var(--night-line-soft) !important;
}

html.theme-dark .action-btn.soft {
  background: linear-gradient(135deg, var(--night-gold-1), var(--night-gold-2)) !important;
  color: #23170a !important;
  border: none !important;
}

html.theme-dark .menu-btn .emoji,
html.theme-dark .popup-icon,
html.theme-dark .orientation-lock-icon {
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.25));
}

html.theme-dark .game-num,
html.theme-dark .battle-rank-num {
  background: linear-gradient(135deg, var(--night-blue-1), var(--night-purple-1)) !important;
  color: #0d1018 !important;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.26) !important;
}

html.theme-dark .input-card label,
html.theme-dark .scoreboard-head h3,
html.theme-dark .scoreboard-head span,
html.theme-dark .slot-name,
html.theme-dark .slot-meta,
html.theme-dark .horse-name,
html.theme-dark .battle-player-name,
html.theme-dark .sim-player-name,
html.theme-dark .battle-rank-name,
html.theme-dark .naval-cell-label,
html.theme-dark .naval-cell-mark,
html.theme-dark .popup h3,
html.theme-dark .popup strong {
  color: var(--night-copy) !important;
}

html.theme-dark .input-card input,
html.theme-dark input:disabled {
  background: linear-gradient(180deg, rgba(7, 14, 26, 0.98) 0%, rgba(12, 20, 35, 0.98) 100%) !important;
  color: var(--night-copy) !important;
  border: 2px solid var(--night-line-soft) !important;
}

html.theme-dark .input-card input::placeholder {
  color: rgba(191, 208, 229, 0.56);
}

html.theme-dark .input-card input:focus {
  border-color: var(--night-line-strong) !important;
  box-shadow: 0 0 0 5px rgba(120, 203, 255, 0.12) !important;
}

html.theme-dark .game-canvas-wrap,
html.theme-dark .race-track-wrap,
html.theme-dark .sim-arena-wrap,
html.theme-dark .sim-arena-zoom-stage,
html.theme-dark .naval-board-wrap,
html.theme-dark .battle-table-card,
html.theme-dark .battle-table-card,
html.theme-dark .battle-panel,
html.theme-dark .game-board-card,
html.theme-dark .race-panel,
html.theme-dark .sim-arena-card,
html.theme-dark .naval-board-card {
  background:
    radial-gradient(circle at top center, rgba(124, 186, 255, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(10, 18, 33, 0.98) 0%, rgba(7, 13, 24, 1) 100%) !important;
  border-color: var(--night-line-soft) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 18px 34px rgba(0, 0, 0, 0.32) !important;
}

html.theme-dark .slot-box {
  border-color: rgba(241, 248, 255, 0.10) !important;
  box-shadow: inset 0 -12px 22px rgba(0, 0, 0, 0.22) !important;
}

html.theme-dark .race-lane {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.05) 0px,
      rgba(255, 255, 255, 0.05) 28px,
      rgba(255, 255, 255, 0.015) 28px,
      rgba(255, 255, 255, 0.015) 56px
    ),
    linear-gradient(180deg, rgba(37, 54, 84, 0.98) 0%, rgba(21, 33, 54, 0.98) 100%) !important;
  border-color: var(--night-line-soft) !important;
}

html.theme-dark .race-start-line {
  background: repeating-linear-gradient(180deg, #f8fbff 0 8px, #84c7ff 8px 16px) !important;
}

html.theme-dark .race-finish-line {
  background: repeating-linear-gradient(180deg, #f8fbff 0 8px, #19263b 8px 16px) !important;
}

html.theme-dark .race-horse {
  border-color: rgba(255, 255, 255, 0.72) !important;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -10px 16px rgba(8, 16, 31, 0.08) !important;
}

html.theme-dark .race-horse .horse-info {
  padding: 2px 8px 2px 2px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

html.theme-dark .race-horse .horse-name {
  color: #0f1b34 !important;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
}

html.theme-dark .race-horse .horse-status {
  color: rgba(15, 27, 52, 0.72) !important;
  font-weight: 800;
}

html.theme-dark .horse-emoji {
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.24));
}

html.theme-dark .race-horse,
html.theme-dark .battle-row,
html.theme-dark .battle-slot,
html.theme-dark .battle-card-front,
html.theme-dark .sim-player-row,
html.theme-dark .sim-stat-card-front,
html.theme-dark .naval-cell,
html.theme-dark .naval-log-item,
html.theme-dark .naval-ranking-item,
html.theme-dark .naval-player-chip {
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
}

html.theme-dark .battle-row,
html.theme-dark .sim-player-row,
html.theme-dark .battle-slot,
html.theme-dark .naval-cell,
html.theme-dark .naval-player-chip,
html.theme-dark .naval-log-item,
html.theme-dark .naval-ranking-item {
  background: linear-gradient(180deg, rgba(21, 32, 52, 0.98) 0%, rgba(13, 22, 37, 0.98) 100%) !important;
  border-color: var(--night-line-soft) !important;
}

html.theme-dark .battle-card-front {
  background: linear-gradient(180deg, rgba(16, 28, 47, 0.98) 0%, rgba(11, 20, 34, 0.98) 100%) !important;
  border-color: var(--night-line-soft) !important;
  color: var(--night-copy) !important;
}

html.theme-dark .battle-card.type-operator .battle-card-front {
  background: linear-gradient(180deg, rgba(33, 66, 112, 0.98) 0%, rgba(20, 37, 68, 0.98) 100%) !important;
}

html.theme-dark .battle-card.type-result .battle-card-front {
  background: linear-gradient(180deg, rgba(101, 76, 23, 0.98) 0%, rgba(57, 39, 10, 0.98) 100%) !important;
}

html.theme-dark .battle-card-back {
  border-color: rgba(255, 255, 255, 0.12) !important;
}

html.theme-dark .battle-card.type-number .battle-card-back {
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.24), transparent 23%),
    linear-gradient(145deg, #8161ff 0%, #5d8ef7 48%, #5ae0cc 100%) !important;
}

html.theme-dark .battle-card.type-operator .battle-card-back {
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.24), transparent 23%),
    linear-gradient(145deg, #ffbf78 0%, #ff8fb1 52%, #ffd3b8 100%) !important;
}

html.theme-dark .battle-card.type-result .battle-card-back {
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.24), transparent 23%),
    linear-gradient(145deg, #ffe08a 0%, #ffc86a 52%, #ffe6b5 100%) !important;
}

html.theme-dark .battle-card.is-locked.type-number .battle-card-back {
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.16), transparent 23%),
    linear-gradient(145deg, rgba(129, 97, 255, 0.78) 0%, rgba(93, 142, 247, 0.74) 48%, rgba(90, 224, 204, 0.74) 100%) !important;
}

html.theme-dark .battle-card.is-locked.type-operator .battle-card-back {
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.16), transparent 23%),
    linear-gradient(145deg, rgba(255, 191, 120, 0.82) 0%, rgba(255, 143, 177, 0.76) 52%, rgba(255, 211, 184, 0.72) 100%) !important;
}

html.theme-dark .battle-card.is-locked.type-result .battle-card-back {
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.16), transparent 23%),
    linear-gradient(145deg, rgba(255, 224, 138, 0.84) 0%, rgba(255, 200, 106, 0.78) 52%, rgba(255, 230, 181, 0.74) 100%) !important;
}

html.theme-dark .battle-result-pill,
html.theme-dark .battle-final-rank {
  background: linear-gradient(180deg, rgba(41, 56, 88, 0.98) 0%, rgba(23, 37, 61, 0.98) 100%) !important;
}

html.theme-dark .battle-final-result-box,
html.theme-dark .battle-rank-score,
html.theme-dark .sim-player-total,
html.theme-dark .battle-result-pill,
html.theme-dark .battle-final-rank {
  border-color: rgba(255, 221, 150, 0.24) !important;
}

html.theme-dark .battle-final-result-box strong,
html.theme-dark .battle-result-pill span,
html.theme-dark .battle-result-pill strong,
html.theme-dark .battle-final-rank strong,
html.theme-dark .battle-rank-score {
  color: var(--night-gold-1) !important;
}

html.theme-dark .sim-panel-head h3,
html.theme-dark .sim-panel-head .sub-text,
html.theme-dark .sim-main-header .sub-text,
html.theme-dark .sim-summary-name,
html.theme-dark .sim-setup-head,
html.theme-dark .sim-player-name,
html.theme-dark .sim-player-sub,
html.theme-dark .sim-stat-card-front small,
html.theme-dark .sim-stat-card-front strong,
html.theme-dark .sim-summary-table th,
html.theme-dark .sim-summary-table td,
html.theme-dark .sim-map-option strong,
html.theme-dark .sim-map-option span,
html.theme-dark .sim-ball-name,
html.theme-dark .sim-ball-hptext {
  color: var(--night-copy) !important;
}

html.theme-dark .popup.sim-map-popup {
  background:
    radial-gradient(circle at top center, rgba(124, 186, 255, 0.15), transparent 26%),
    linear-gradient(180deg, rgba(14, 24, 41, 0.99) 0%, rgba(8, 14, 25, 1) 100%) !important;
  border-color: var(--night-line-mid) !important;
}

html.theme-dark .sim-map-picker {
  gap: 14px;
}

html.theme-dark .sim-map-option {
  background: linear-gradient(180deg, rgba(24, 39, 63, 0.98) 0%, rgba(14, 24, 41, 1) 100%) !important;
  border: 2px solid var(--night-line-soft) !important;
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

html.theme-dark .sim-map-option:hover {
  border-color: var(--night-line-strong) !important;
  box-shadow:
    0 20px 34px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(124, 186, 255, 0.12) !important;
}

html.theme-dark .sim-map-option strong {
  color: var(--night-title) !important;
}

html.theme-dark .sim-map-option span {
  color: var(--night-copy-soft) !important;
}

html.theme-dark .sim-map-preview i {
  opacity: 1 !important;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 6px 12px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.14) !important;
}

html.theme-dark #game4Screen .sim-setup-card {
  background:
    radial-gradient(circle at top center, rgba(201, 185, 255, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(15, 20, 35, 0.99) 0%, rgba(9, 12, 24, 1) 100%) !important;
  border-color: var(--night-line-soft) !important;
}

html.theme-dark #game4Screen .sim-player-row {
  background: linear-gradient(180deg, rgba(18, 29, 48, 0.98) 0%, rgba(12, 20, 34, 1) 100%) !important;
  border: 2px solid var(--night-line-soft) !important;
}

html.theme-dark #game4Screen .sim-player-total {
  background: linear-gradient(180deg, rgba(255, 229, 164, 0.98) 0%, rgba(246, 193, 88, 0.98) 100%) !important;
  color: #352309 !important;
}

html.theme-dark #game4Screen .sim-stat-card-face {
  border-color: rgba(255, 255, 255, 0.11) !important;
}

html.theme-dark #game4Screen .sim-stat-card-back {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.22), transparent 24%),
    linear-gradient(145deg, #7f60ff 0%, #5e93fb 52%, #5ce3ce 100%) !important;
}

html.theme-dark #game4Screen .sim-stat-card.type-health .sim-stat-card-front {
  background: linear-gradient(180deg, #6b2f57 0%, #381628 100%) !important;
}

html.theme-dark #game4Screen .sim-stat-card.type-attack .sim-stat-card-front {
  background: linear-gradient(180deg, #7b4e22 0%, #42240b 100%) !important;
}

html.theme-dark #game4Screen .sim-stat-card.type-accuracy .sim-stat-card-front {
  background: linear-gradient(180deg, #285e91 0%, #16324d 100%) !important;
}

html.theme-dark #game4Screen .sim-stat-card.type-defense .sim-stat-card-front {
  background: linear-gradient(180deg, #1f6e64 0%, #103a33 100%) !important;
}

html.theme-dark .sim-ball-label {
  background: linear-gradient(180deg, rgba(18, 30, 49, 0.97) 0%, rgba(10, 18, 31, 0.99) 100%) !important;
  border-color: var(--night-line-mid) !important;
}

html.theme-dark .sim-ball-place {
  background: linear-gradient(180deg, #ffe08a 0%, #f4bf57 100%) !important;
  color: #281804 !important;
}

html.theme-dark .sim-ball-hpbar {
  background: linear-gradient(180deg, rgba(92, 111, 145, 0.22) 0%, rgba(37, 52, 78, 0.48) 100%) !important;
}

html.theme-dark .sim-ball-hpbar span {
  background: linear-gradient(90deg, #ff7092 0%, #ffc56e 42%, #5de6d3 100%) !important;
}

html.theme-dark .sim-summary-table {
  background: linear-gradient(180deg, rgba(15, 26, 43, 0.98) 0%, rgba(8, 15, 27, 1) 100%) !important;
  border: 1px solid var(--night-line-soft) !important;
}

html.theme-dark .sim-summary-table th {
  background: linear-gradient(180deg, rgba(38, 56, 87, 0.98) 0%, rgba(22, 35, 58, 0.98) 100%) !important;
  color: var(--night-title) !important;
}

html.theme-dark .sim-summary-table tbody tr:nth-child(odd) td {
  background: rgba(10, 20, 35, 0.42) !important;
}

html.theme-dark .sim-summary-table tbody tr:nth-child(even) td {
  background: rgba(26, 41, 67, 0.56) !important;
}

html.theme-dark .naval-board-wrap {
  background:
    radial-gradient(circle at top center, rgba(123, 203, 255, 0.09), transparent 28%),
    linear-gradient(180deg, rgba(7, 17, 31, 0.99) 0%, rgba(6, 12, 23, 1) 100%) !important;
}

html.theme-dark .naval-cell {
  background: linear-gradient(180deg, rgba(17, 34, 58, 0.98) 0%, rgba(10, 23, 42, 0.98) 100%) !important;
  border-color: rgba(142, 203, 255, 0.14) !important;
}

html.theme-dark .naval-cell.is-miss {
  background: linear-gradient(180deg, rgba(44, 57, 78, 0.98) 0%, rgba(29, 39, 55, 0.98) 100%) !important;
}

html.theme-dark .naval-cell.is-hit {
  background: linear-gradient(180deg, rgba(102, 49, 58, 0.98) 0%, rgba(64, 27, 36, 0.98) 100%) !important;
  border-color: rgba(255, 153, 176, 0.36) !important;
}

html.theme-dark .naval-cell.is-hit .naval-cell-label,
html.theme-dark .naval-cell.is-hit .naval-cell-mark {
  color: #ffeaf1 !important;
}

html.theme-dark .naval-log-item.type-hit,
html.theme-dark .naval-log-item.type-out,
html.theme-dark .naval-log-item.type-final,
html.theme-dark .naval-ranking-item.top {
  border-color: var(--night-line-mid) !important;
}

html.theme-dark .popup-overlay {
  background: rgba(3, 8, 16, 0.72) !important;
}

html.theme-dark .orientation-lock-overlay,
html.theme-dark .drawer-backdrop,
html.theme-dark #simArenaZoomBackdrop {
  background: rgba(3, 8, 16, 0.78) !important;
}

html.theme-dark .utility-btn,
html.theme-dark .utility-btn-label,
html.theme-dark .utility-btn-icon {
  color: var(--night-copy) !important;
}

html.theme-dark .action-btn:disabled,
html.theme-dark .utility-btn.is-unsupported,
html.theme-dark button:disabled {
  opacity: 0.58;
}


/* =========================
   game4 : popup / arena polish patch
========================= */
.popup.sim-map-popup {
  width: min(92vw, 860px);
  max-width: 860px;
  padding: 30px 26px 24px;
}

.popup.sim-map-popup .popup-message {
  max-height: min(70vh, 720px);
}

.sim-map-note {
  margin: 2px 0 16px;
  font-size: 0.96rem;
  line-height: 1.6;
}

.sim-map-picker {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.sim-map-option {
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  gap: 0;
  min-height: 156px;
  padding: 18px 18px 16px 20px;
}

.sim-map-option strong {
  margin-bottom: 8px;
  padding-right: 10px;
}

.sim-map-option span {
  padding-right: 6px;
}

.sim-map-preview {
  margin-top: 14px;
}

#game4Screen .sim-arena-zoom-stage {
  border-radius: 28px;
  overflow: hidden;
  isolation: isolate;
  background: transparent !important;
  box-shadow: none !important;
}

#game4Screen .sim-arena-wrap {
  isolation: isolate;
  transform: translateZ(0);
}

#game4Screen .sim-arena-wrap,
#game4Screen .sim-arena-wrap canvas,
#game4Screen .sim-health-overlay {
  border-radius: inherit;
}

.sim-card-screen.sim-arena-zoomed .sim-arena-card {
  overflow: hidden;
}

.sim-card-screen.sim-arena-zoomed .sim-arena-zoom-stage {
  background: transparent !important;
  box-shadow: none !important;
}

.sim-arena-zoom-backdrop {
  background: rgba(6, 14, 28, 0.08);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.sim-arena-zoom-backdrop.is-active {
  pointer-events: auto;
}

html.theme-dark .popup.sim-map-popup {
  width: min(92vw, 880px) !important;
  max-width: 880px !important;
  background:
    radial-gradient(circle at top center, rgba(124, 186, 255, 0.14), transparent 26%),
    linear-gradient(180deg, rgba(15, 24, 41, 0.99) 0%, rgba(8, 14, 25, 1) 100%) !important;
  border-color: rgba(124, 186, 255, 0.24) !important;
  box-shadow:
    0 26px 58px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(88, 135, 201, 0.16) !important;
}

html.theme-dark .popup.sim-map-popup .popup-message {
  color: var(--night-copy) !important;
}

html.theme-dark .sim-map-note {
  color: var(--night-copy-soft) !important;
}

html.theme-dark .sim-map-picker {
  gap: 14px;
}

html.theme-dark .sim-map-option {
  background:
    linear-gradient(180deg, rgba(24, 39, 63, 0.98) 0%, rgba(14, 24, 41, 1) 100%) !important;
  border: 2px solid rgba(124, 186, 255, 0.18) !important;
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

html.theme-dark .sim-map-option:hover {
  border-color: rgba(124, 186, 255, 0.42) !important;
  box-shadow:
    0 20px 34px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(124, 186, 255, 0.12) !important;
}

html.theme-dark #game4Screen .sim-arena-zoom-stage,
html.theme-dark .sim-card-screen.sim-arena-zoomed .sim-arena-zoom-stage {
  background: transparent !important;
  box-shadow: none !important;
}

html.theme-dark .sim-card-screen.sim-arena-zoomed .sim-arena-card {
  background:
    radial-gradient(circle at top center, rgba(124, 186, 255, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(16, 30, 54, 0.995) 0%, rgba(9, 17, 31, 1) 100%) !important;
  border-color: rgba(124, 186, 255, 0.24) !important;
  box-shadow:
    0 28px 58px rgba(0, 0, 0, 0.40),
    inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

html.theme-dark .sim-card-screen.sim-arena-zoomed .sim-arena-wrap,
html.theme-dark #game4Screen .sim-arena-wrap {
  background:
    radial-gradient(circle at 50% 0%, rgba(125, 211, 252, 0.11), transparent 36%),
    radial-gradient(circle at 20% 18%, rgba(182, 156, 255, 0.08), transparent 28%),
    linear-gradient(180deg, #0b1833 0%, #091221 100%) !important;
  border-color: rgba(125, 211, 252, 0.20) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 18px 30px rgba(0, 0, 0, 0.22) !important;
}

html.theme-dark .sim-arena-zoom-backdrop {
  background: rgba(2, 8, 18, 0.16);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

html.theme-dark #simArenaZoomBackdrop {
  background: rgba(3, 8, 16, 0.48) !important;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

@media (max-width: 760px) {
  .popup.sim-map-popup {
    width: min(94vw, 640px);
    padding: 24px 18px 20px;
  }

  .sim-map-picker {
    grid-template-columns: 1fr;
  }

  .sim-map-option {
    min-height: auto;
  }
}


/* ===== game4 zoom size fix ===== */
.sim-card-screen.sim-arena-zoomed .sim-arena-card {
  width: min(96vw, 1520px) !important;
  height: min(92vh, 980px) !important;
  padding: 18px 18px 16px !important;
  gap: 16px !important;
}

.sim-card-screen.sim-arena-zoomed .sim-panel-head {
  margin-bottom: 0 !important;
}

.sim-card-screen.sim-arena-zoomed .sim-arena-zoom-stage {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
}

.sim-card-screen.sim-arena-zoomed .sim-arena-wrap {
  flex: 0 0 auto !important;
  width: var(--sim-arena-base-width, 900px) !important;
  height: var(--sim-arena-base-height, 460px) !important;
  max-width: none !important;
  max-height: none !important;
  transform: scale(var(--sim-arena-zoom-scale, 1.45)) !important;
  transform-origin: center center !important;
}

@media (max-width: 900px) {
  .sim-card-screen.sim-arena-zoomed .sim-arena-card {
    width: calc(100vw - 14px) !important;
    height: calc(100vh - 14px) !important;
    padding: 14px !important;
  }
}

html.theme-dark .sim-card-screen.sim-arena-zoomed .sim-arena-card {
  width: min(96vw, 1520px) !important;
  height: min(92vh, 980px) !important;
}

/* =========================
   game1 dark mode visibility tuning
========================= */
html.theme-dark body.game1-mode .game-board-card {
  background:
    radial-gradient(circle at top center, rgba(124, 186, 255, 0.1), transparent 30%),
    linear-gradient(180deg, rgba(15, 28, 48, 0.98) 0%, rgba(8, 16, 30, 1) 100%) !important;
  border-color: rgba(111, 172, 235, 0.26) !important;
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(90, 156, 226, 0.08) !important;
}

html.theme-dark body.game1-mode .game-board-head h3 {
  color: #f4f8ff !important;
}

html.theme-dark body.game1-mode .game-board-head span {
  color: rgba(214, 229, 248, 0.82) !important;
}

html.theme-dark body.game1-mode .game-canvas-wrap {
  background:
    radial-gradient(circle at 50% 0%, rgba(122, 190, 255, 0.1), transparent 32%),
    radial-gradient(circle at 50% 100%, rgba(106, 149, 220, 0.08), transparent 26%),
    linear-gradient(180deg, #071120 0%, #030a16 100%) !important;
  border: 2px solid rgba(118, 179, 239, 0.34) !important;
  box-shadow:
    inset 0 0 0 1px rgba(214, 236, 255, 0.06),
    inset 0 16px 28px rgba(88, 151, 219, 0.06),
    0 14px 30px rgba(0, 0, 0, 0.34) !important;
}

html.theme-dark body.game1-mode .slot-overlay {
  bottom: 14px;
}

html.theme-dark body.game1-mode .slot-box {
  border-left: 1px solid rgba(214, 236, 255, 0.14) !important;
  border-right: 1px solid rgba(214, 236, 255, 0.14) !important;
  border-top: 1px solid rgba(214, 236, 255, 0.18) !important;
  box-shadow:
    inset 0 -20px 28px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

html.theme-dark body.game1-mode .slot-name {
  color: #f4f8ff !important;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.34);
}

html.theme-dark body.game1-mode .slot-meta {
  color: rgba(224, 236, 249, 0.88) !important;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}


/* =========================
   game4 mobile / tablet night-mode visibility fix
========================= */
html.theme-dark #game4Screen .sim-card-screen {
  background: transparent;
}

html.theme-dark #game4Screen .sim-main-header {
  background:
    radial-gradient(circle at top center, rgba(124, 186, 255, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(18, 30, 50, 0.98) 0%, rgba(10, 18, 32, 0.99) 100%) !important;
  border: 1px solid rgba(124, 186, 255, 0.22) !important;
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(88, 135, 201, 0.08) !important;
}

html.theme-dark #game4Screen .sim-main-header h2 {
  color: var(--night-title) !important;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
}

html.theme-dark #game4Screen .sim-main-header .sub-text {
  color: var(--night-copy-soft) !important;
}

html.theme-dark #game4Screen .sim-main-header .small-badge {
  background: linear-gradient(180deg, rgba(28, 45, 71, 0.96) 0%, rgba(16, 28, 48, 0.96) 100%) !important;
  color: #ffd8e6 !important;
  border-color: rgba(124, 186, 255, 0.18) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 20px rgba(0, 0, 0, 0.22) !important;
}

html.theme-dark #game4Screen .sim-header-inline-actions {
  margin-top: 14px;
}

html.theme-dark #game4Screen .sim-main-header .sim-info-btn {
  background: linear-gradient(180deg, rgba(24, 39, 63, 0.98) 0%, rgba(14, 24, 41, 1) 100%) !important;
  color: var(--night-copy) !important;
  border-color: rgba(124, 186, 255, 0.22) !important;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

html.theme-dark #game4Screen .sim-main-header .sim-info-btn:hover {
  border-color: rgba(124, 186, 255, 0.40) !important;
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(124, 186, 255, 0.10) !important;
}

@media (max-width: 1024px) and (pointer: coarse) {
  html.theme-dark #game4Screen .sim-main-header {
    background:
      radial-gradient(circle at top center, rgba(122, 188, 255, 0.18), transparent 34%),
      linear-gradient(180deg, rgba(16, 28, 47, 0.99) 0%, rgba(8, 15, 28, 1) 100%) !important;
    border: 1px solid rgba(122, 188, 255, 0.22) !important;
    box-shadow:
      0 18px 36px rgba(0, 0, 0, 0.36),
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      0 0 0 1px rgba(88, 135, 201, 0.10) !important;
  }

  html.theme-dark #game4Screen .sim-main-header .sub-text {
    color: var(--night-copy-soft) !important;
  }
}

@media (max-width: 640px) and (pointer: coarse) {
  html.theme-dark #game4Screen .sim-main-header {
    padding: 16px 14px 14px !important;
    border-radius: 22px;
  }

  html.theme-dark #game4Screen .sim-main-header .small-badge {
    margin-bottom: 12px;
  }

  html.theme-dark #game4Screen .sim-main-header .sim-info-btn {
    width: 100%;
  }
}


html.theme-dark .game-meta-row {
  background:
    radial-gradient(circle at top left, rgba(99, 135, 214, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(18, 31, 55, 0.92) 0%, rgba(11, 22, 42, 0.94) 100%) !important;
  border-color: rgba(153, 191, 255, 0.18) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 18px rgba(0, 0, 0, 0.22) !important;
}

html.theme-dark .game-meta-label {
  color: #b7c9e6 !important;
}

html.theme-dark .game-meta-value {
  color: #fff4d6 !important;
  text-shadow: 0 0 10px rgba(255, 215, 130, 0.14);
}

html.theme-dark .game-meta.is-pending .game-meta-row {
  background:
    radial-gradient(circle at top left, rgba(88, 112, 153, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(24, 35, 58, 0.86) 0%, rgba(16, 25, 42, 0.88) 100%) !important;
}

@media (max-width: 720px) {
  .game-meta {
    gap: 8px;
    padding-top: 6px;
  }

  .game-meta-row {
    min-height: 40px;
    padding: 9px 12px;
  }

  .game-meta-label {
    font-size: 0.74rem;
  }

  .game-meta-value {
    font-size: 0.82rem;
  }
}

/* =========================
   game3 night mode card readability fix
========================= */
html.theme-dark .battle-card-front {
  border-color: rgba(228, 239, 255, 0.72) !important;
  color: #f8fbff !important;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 0 0 1px rgba(124, 186, 255, 0.08) !important;
}

html.theme-dark .battle-card.type-number .battle-card-front {
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.22), transparent 26%),
    linear-gradient(180deg, #edf5ff 0%, #dfeeff 100%) !important;
  color: #536684 !important;
}

html.theme-dark .battle-card.type-operator .battle-card-front {
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.24), transparent 26%),
    linear-gradient(180deg, #fff0df 0%, #ffdfe8 100%) !important;
  color: #775564 !important;
}

html.theme-dark .battle-card.type-result .battle-card-front {
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.26), transparent 28%),
    linear-gradient(180deg, #fff4ca 0%, #ffe7a6 100%) !important;
  color: #6f5533 !important;
}

html.theme-dark .battle-card.is-flipped .battle-card-front {
  border-color: rgba(245, 249, 255, 0.9) !important;
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.08) !important;
}

html.theme-dark .battle-card.is-flipped .battle-card-value {
  color: inherit !important;
  text-shadow: none !important;
}

html.theme-dark .battle-card.type-number .battle-card-value,
html.theme-dark .battle-card.type-operator .battle-card-value,
html.theme-dark .battle-card.type-result .battle-card-value {
  color: inherit !important;
}

html.theme-dark .battle-card.type-result .battle-card-value small,
html.theme-dark .battle-card.is-flipped .battle-card-value small {
  color: rgba(111, 85, 51, 0.88) !important;
}

/* game4 모바일 게임 설명 버튼 진짜 중앙 정렬 보정 */
@media (max-width: 1024px) and (pointer: coarse) {
  #game4Screen .sim-main-header {
    grid-template-columns: minmax(0, 1fr) !important;
    column-gap: 0 !important;
  }

  #game4Screen .sim-main-header > div:first-child {
    width: 100%;
  }

  #game4Screen .sim-header-inline-actions {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  #game4Screen .sim-info-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-inline: auto;
  }
}

@media (max-width: 640px) and (pointer: coarse) {
  #game4Screen .sim-main-header {
    grid-template-columns: minmax(0, 1fr) !important;
    column-gap: 0 !important;
  }

  #game4Screen .sim-main-header > div:first-child {
    width: 100%;
  }

  #game4Screen .sim-header-inline-actions {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  #game4Screen .sim-info-btn {
    width: min(100%, 290px) !important;
    margin-inline: auto !important;
  }
}

html.theme-dark #game4Screen .sim-main-header {
  grid-template-columns: minmax(0, 1fr);
}

/* =========================
   game4 : game info popup dark mode fix
========================= */
html.theme-dark .popup.game-info-popup {
  background:
    radial-gradient(circle at top center, rgba(124, 186, 255, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(16, 24, 40, 0.98) 0%, rgba(8, 14, 25, 1) 100%) !important;
  border-color: rgba(124, 186, 255, 0.22) !important;
  box-shadow:
    0 26px 58px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(88, 135, 201, 0.14) !important;
}

html.theme-dark .popup.game-info-popup h3,
html.theme-dark .popup.game-info-popup .popup-icon {
  color: #eef6ff !important;
}

html.theme-dark .popup.game-info-popup .popup-message,
html.theme-dark .popup.game-info-popup .game-info-lead {
  color: #d7e5f5 !important;
}

html.theme-dark .popup.game-info-popup .game-info-section {
  background: linear-gradient(180deg, rgba(31, 43, 66, 0.92) 0%, rgba(20, 30, 46, 0.94) 100%) !important;
  border: 1px solid rgba(132, 184, 255, 0.18) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 22px rgba(0, 0, 0, 0.22) !important;
}

html.theme-dark .popup.game-info-popup .game-info-section h4 {
  color: #ffbfd6 !important;
}

html.theme-dark .popup.game-info-popup .game-info-section ul,
html.theme-dark .popup.game-info-popup .game-info-section li,
html.theme-dark .popup.game-info-popup .game-info-section p {
  color: #d6e2ee !important;
}

html.theme-dark .popup.game-info-popup strong {
  color: #ffffff !important;
}

html.theme-dark .popup.game-info-popup .popup-btn {
  background: linear-gradient(180deg, rgba(43, 57, 84, 0.98) 0%, rgba(30, 41, 62, 0.98) 100%) !important;
  color: #eef6ff !important;
  border: 1px solid rgba(132, 184, 255, 0.2);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28) !important;
}

html.theme-dark .popup.game-info-popup .popup-message::-webkit-scrollbar {
  width: 10px;
}

html.theme-dark .popup.game-info-popup .popup-message::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
}

html.theme-dark .popup.game-info-popup .popup-message::-webkit-scrollbar-thumb {
  background: rgba(132, 184, 255, 0.26);
  border-radius: 999px;
}


/* =========================
   desktop: game3 / game4 header stroke remove
========================= */
@media (min-width: 761px) {
  html.theme-dark #game3Screen .battle-main-header,
  html.theme-dark #game4Screen .sim-main-header {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
  }
}

/* =========================
   remove all in-game "목록으로" buttons
========================= */
#game1Screen .game-header-actions .back-btn,
#game1Screen .mobile-back-btn,
#game2Screen .game-header-actions .back-btn,
#game2Screen .mobile-race-back-btn,
#game3Screen .game-header-actions .back-btn,
#game3Screen .battle-mobile-back-wrap,
#game3Screen .battle-mobile-back-btn,
#game4Screen .game-header-actions .back-btn,
#game4Screen .sim-mobile-back-wrap,
#game4Screen .sim-mobile-back-btn,
#game5Screen .game-header-actions .back-btn,
#game5Screen .naval-mobile-back-wrap,
#game5Screen .naval-mobile-back-btn {
  display: none !important;
}


/* =========================
   luck screen : mobile swipe carousel
========================= */

.luck-carousel-shell {
  width: 100%;
  min-width: 0;
}

#luckScreen .game-item[data-clone] {
  display: none;
}

.luck-carousel-hud {
  display: none;
}

.luck-carousel-hint {
  color: #8f7363;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.luck-carousel-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.luck-carousel-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  border: none;
  padding: 0;
  background: rgba(125, 97, 81, 0.24);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
  transition: transform 0.18s ease, width 0.18s ease, opacity 0.18s ease, background 0.18s ease;
  opacity: 0.7;
}

.luck-carousel-dot.is-active {
  width: 24px;
  background: linear-gradient(135deg, #f6c9d7, #d8ecff);
  opacity: 1;
}

@media (max-width: 820px) and (pointer: coarse) {
  body.luck-carousel-mode #luckScreen .luck-card {
    padding: 22px 12px 18px;
  }

  body.luck-carousel-mode #luckScreen .luck-header {
    margin-bottom: 16px;
  }

  body.luck-carousel-mode #luckScreen .luck-carousel-shell {
    position: relative;
    overflow: hidden;
    --luck-carousel-peek: 30px;
  }

  body.luck-carousel-mode #luckScreen .game-grid {
    display: flex;
    grid-template-columns: none;
    grid-auto-rows: auto;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding: 4px var(--luck-carousel-peek) 14px;
    scroll-padding-inline: var(--luck-carousel-peek);
    align-items: stretch;
  }

  body.luck-carousel-mode #luckScreen .game-grid::-webkit-scrollbar {
    display: none;
  }

  body.luck-carousel-mode #luckScreen .game-grid.is-loop-resetting {
    scroll-behavior: auto;
    scroll-snap-type: none;
  }

  body.luck-carousel-mode #luckScreen .game-grid.is-loop-resetting .game-item {
    transition: none;
  }

  body.luck-carousel-mode #luckScreen .game-item[data-clone] {
    display: flex;
  }

  body.luck-carousel-mode #luckScreen .game-item {
    position: relative;
    flex: 0 0 calc(100% - 76px);
    max-width: calc(100% - 76px);
    min-height: 214px;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    opacity: 0.58;
    transform: scale(0.94);
    filter: saturate(0.78) brightness(0.82);
    transition: transform 0.22s ease, opacity 0.22s ease, filter 0.22s ease, box-shadow 0.22s ease;
  }

  body.luck-carousel-mode #luckScreen .game-item.is-carousel-neighbor {
    opacity: 0.78;
    transform: scale(0.965);
    filter: saturate(0.92) brightness(0.92);
  }

  body.luck-carousel-mode #luckScreen .game-item.is-carousel-active {
    opacity: 1;
    transform: scale(1);
    filter: none;
    box-shadow: 0 12px 28px rgba(130, 100, 80, 0.12);
  }

  body.luck-carousel-mode #luckScreen .luck-carousel-hud {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
    padding-bottom: 2px;
  }
}

html.theme-dark .luck-carousel-hint {
  color: rgba(240, 231, 223, 0.72);
}

html.theme-dark .luck-carousel-dot {
  background: rgba(240, 231, 223, 0.18);
  box-shadow: inset 0 0 0 1px rgba(240, 231, 223, 0.12);
}

html.theme-dark .luck-carousel-dot.is-active {
  background: linear-gradient(135deg, rgba(255, 159, 192, 0.95), rgba(131, 190, 254, 0.95));
}

/* =========================
   fast-forward guide : real race demo + dark mode refinements
========================= */
.ff-guide-screen-race {
  min-height: 286px;
  padding: 14px;
  background:
    radial-gradient(circle at 18% 10%, rgba(111, 171, 255, 0.18), transparent 22%),
    radial-gradient(circle at 85% 18%, rgba(255, 167, 205, 0.14), transparent 20%),
    linear-gradient(180deg, #081224 0%, #0b1830 52%, #091120 100%);
  border-color: rgba(139, 196, 255, 0.22);
  box-shadow:
    inset 0 0 0 1px rgba(149, 214, 255, 0.08),
    0 18px 32px rgba(5, 11, 24, 0.34);
}

.ff-race-demo-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ff-race-demo-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ff-race-demo-chip,
.ff-race-demo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  border: 1px solid rgba(173, 223, 255, 0.16);
  box-shadow: 0 10px 18px rgba(3, 8, 19, 0.24);
  backdrop-filter: blur(10px);
}

.ff-race-demo-chip {
  background: rgba(14, 34, 60, 0.88);
  color: #d9ebff;
}

.ff-race-demo-badge {
  background: rgba(255, 235, 157, 0.14);
  color: #fff0ad;
  opacity: 0;
  transform: translateY(-6px) scale(0.94);
  animation: ffRaceBadgeReveal 4.8s ease-in-out infinite;
}

.ff-race-demo-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0 44px;
}

.ff-race-demo-stage::after {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 10px;
  height: 50px;
  border-radius: 20px;
  border: 1px dashed rgba(151, 205, 255, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(117, 162, 228, 0.03) 100%);
}

.ff-race-lane {
  position: relative;
  min-height: 58px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(149, 211, 255, 0.18);
  background: linear-gradient(180deg, rgba(18, 34, 61, 0.95) 0%, rgba(12, 25, 45, 0.95) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 18px rgba(4, 10, 22, 0.22);
}

.ff-race-lane-track {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.03) 0 5%, transparent 5% 10%, rgba(255,255,255,0.05) 10% 15%, transparent 15% 20%),
    linear-gradient(180deg, rgba(124, 172, 255, 0.08), rgba(255,255,255,0));
  background-size: 120px 100%, 100% 100%;
  animation: ffRaceTrackShift 2.3s linear infinite;
}

.ff-race-lane-label {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(10, 23, 43, 0.86);
  border: 1px solid rgba(163, 219, 255, 0.16);
  color: #ecf6ff;
  font-size: 0.78rem;
  font-weight: 800;
}

.ff-race-start-line,
.ff-race-finish-line {
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: 9px;
  z-index: 2;
  border-radius: 4px;
}

.ff-race-start-line {
  left: 62px;
  background: repeating-linear-gradient(180deg, #fefefe 0 6px, #9bc9ff 6px 12px);
  box-shadow: 0 0 12px rgba(130, 190, 254, 0.28);
}

.ff-race-finish-line {
  right: 14px;
  background: repeating-linear-gradient(180deg, #ffffff 0 6px, #23324b 6px 12px);
}

.ff-race-runner {
  position: absolute;
  left: 76px;
  top: 50%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 116px;
  min-height: 44px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.74);
  box-shadow: 0 8px 18px rgba(8, 14, 28, 0.24);
  transform: translate(0, -50%);
}

.ff-race-runner.is-pink {
  background: linear-gradient(135deg, #ff93b5 0%, #ef7fb0 100%);
  color: #21121e;
}

.ff-race-runner.is-mint {
  background: linear-gradient(135deg, #8eead8 0%, #5fddca 100%);
  color: #112328;
}

.ff-race-runner.is-sky {
  background: linear-gradient(135deg, #9bd9ff 0%, #7dcfff 100%);
  color: #102036;
}

.ff-race-runner-emoji {
  font-size: 1rem;
  line-height: 1;
  flex: 0 0 auto;
}

.ff-race-runner-info {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.ff-race-runner-info strong {
  font-size: 0.88rem;
  font-weight: 900;
}

.ff-race-runner-info span {
  margin-top: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.88;
}

.ff-race-runner.is-runner-1 {
  animation: ffRaceRunner1 4.8s linear infinite;
}

.ff-race-runner.is-runner-2 {
  animation: ffRaceRunner2 4.8s linear infinite;
}

.ff-race-runner.is-runner-3 {
  animation: ffRaceRunner3 4.8s linear infinite;
}

.ff-race-touch-area {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: 160px;
  height: 42px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(123,173,255,0.08) 100%);
  border: 1px solid rgba(173, 223, 255, 0.14);
}

.ff-guide-ripple-race {
  left: 50%;
  bottom: 6px;
  border-color: rgba(135, 196, 255, 0.52);
}

.ff-guide-finger-race {
  bottom: -10px;
  font-size: 2.9rem;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.28));
}

.ff-guide-hold-badge-race {
  bottom: 52px;
  background: rgba(13, 29, 52, 0.92);
  color: #dcecff;
  border-color: rgba(173, 223, 255, 0.16);
}


html.theme-dark .game-ff-badge {
  background: linear-gradient(180deg, rgba(17, 29, 48, 0.92) 0%, rgba(12, 22, 38, 0.94) 100%) !important;
  color: var(--night-copy-soft) !important;
  border: 1.5px solid var(--night-line-soft) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 14px rgba(0, 0, 0, 0.22) !important;
  backdrop-filter: blur(10px);
}

html.theme-dark .game-ff-badge.is-supported {
  background: linear-gradient(180deg, rgba(20, 47, 44, 0.92) 0%, rgba(14, 33, 31, 0.94) 100%) !important;
  color: #b6eadb !important;
  border-color: rgba(116, 219, 186, 0.18) !important;
}

html.theme-dark .game-ff-badge.is-blocked,
html.theme-dark .game-ff-badge.is-none {
  background: linear-gradient(180deg, rgba(58, 33, 36, 0.92) 0%, rgba(36, 23, 26, 0.94) 100%) !important;
  color: #e9bbb3 !important;
  border-color: rgba(255, 165, 153, 0.14) !important;
}

html.theme-dark .game-ff-badge.is-pending {
  background: linear-gradient(180deg, rgba(38, 33, 64, 0.92) 0%, rgba(25, 22, 44, 0.94) 100%) !important;
  color: #d8cdfd !important;
  border-color: rgba(186, 171, 255, 0.16) !important;
}

html.theme-dark .game-ff-badge-icon {
  opacity: 0.82;
}

html.theme-dark .ff-guide-copy {
  color: #b9cdea;
}

html.theme-dark .ff-guide-chip {
  border-color: rgba(173, 223, 255, 0.14);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.24);
}

html.theme-dark .ff-guide-chip.is-supported {
  background: linear-gradient(180deg, rgba(16, 57, 47, 0.96) 0%, rgba(14, 43, 37, 0.96) 100%);
  color: #9ff0da;
}

html.theme-dark .ff-guide-chip.is-blocked,
html.theme-dark .ff-guide-chip.is-none {
  background: linear-gradient(180deg, rgba(67, 31, 34, 0.96) 0%, rgba(51, 23, 25, 0.96) 100%);
  color: #ffb7b2;
}

html.theme-dark .ff-guide-chip.is-pending {
  background: linear-gradient(180deg, rgba(44, 35, 74, 0.96) 0%, rgba(33, 26, 57, 0.96) 100%);
  color: #cec4ff;
}

html.theme-dark .ff-guide-chip.is-subtle {
  background: rgba(18, 31, 50, 0.9);
  color: #d8e7fb;
}

html.theme-dark .ff-guide-demo {
  background: linear-gradient(180deg, rgba(14, 20, 34, 0.94) 0%, rgba(12, 18, 30, 0.94) 100%);
  border-color: rgba(149, 211, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 14px 24px rgba(0,0,0,0.24);
}

html.theme-dark .ff-guide-screen:not(.ff-guide-screen-race) {
  background:
    radial-gradient(circle at top left, rgba(125, 180, 255, 0.14), transparent 26%),
    linear-gradient(180deg, #0d1729 0%, #101a2f 100%);
  border-color: rgba(149, 211, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03), 0 12px 22px rgba(0,0,0,0.24);
}

html.theme-dark .ff-guide-screen.is-supported::before,
html.theme-dark .ff-guide-screen.is-blocked::before,
html.theme-dark .ff-guide-screen.is-none::before,
html.theme-dark .ff-guide-screen.is-pending::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(125,180,255,0.02) 100%);
  border-color: rgba(149, 211, 255, 0.12);
}

html.theme-dark .ff-guide-overlay-badge {
  border-color: rgba(173, 223, 255, 0.14);
  background: rgba(18, 31, 50, 0.94);
  color: #e4f1ff;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.24);
}

html.theme-dark .ff-guide-overlay-badge.is-supported {
  background: rgba(58, 48, 12, 0.9);
  color: #ffe689;
}

html.theme-dark .ff-guide-overlay-badge.is-blocked,
html.theme-dark .ff-guide-overlay-badge.is-none {
  background: rgba(59, 24, 28, 0.9);
  color: #ffb4aa;
}

html.theme-dark .ff-guide-overlay-badge.is-pending {
  background: rgba(40, 31, 70, 0.9);
  color: #cfc4ff;
}

html.theme-dark .ff-guide-progress {
  background: linear-gradient(180deg, rgba(68, 117, 171, 0.94) 0%, rgba(95, 213, 195, 0.88) 100%);
  border-color: rgba(173, 223, 255, 0.16);
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

html.theme-dark .ff-guide-hold-badge {
  background: rgba(18, 31, 50, 0.94);
  color: #dbeaff;
  border-color: rgba(173, 223, 255, 0.14);
}

html.theme-dark .ff-guide-caption {
  color: #aabedc;
}

html.theme-dark .ff-guide-steps {
  background: linear-gradient(180deg, rgba(15, 22, 37, 0.94) 0%, rgba(13, 19, 31, 0.94) 100%);
  border-color: rgba(149, 211, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 12px 20px rgba(0,0,0,0.2);
  color: #b8cde9;
}

html.theme-dark .ff-guide-steps strong {
  color: #f3e9ff;
}

@keyframes ffRaceTrackShift {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: -120px 0, 0 0;
  }
}

@keyframes ffRaceBadgeReveal {
  0%, 24% {
    opacity: 0;
    transform: translateY(-6px) scale(0.94);
  }
  36%, 84% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-2px) scale(0.98);
  }
}

@keyframes ffRaceRunner1 {
  0% { transform: translate(0, -50%); }
  24% { transform: translate(30px, -50%); }
  34% { transform: translate(54px, -50%); }
  42% { transform: translate(142px, -50%); }
  56% { transform: translate(250px, -50%); }
  70% { transform: translate(390px, -50%); }
  84% { transform: translate(490px, -50%); }
  100% { transform: translate(0, -50%); }
}

@keyframes ffRaceRunner2 {
  0% { transform: translate(0, -50%); }
  24% { transform: translate(24px, -50%); }
  34% { transform: translate(48px, -50%); }
  42% { transform: translate(130px, -50%); }
  56% { transform: translate(228px, -50%); }
  70% { transform: translate(338px, -50%); }
  84% { transform: translate(438px, -50%); }
  100% { transform: translate(0, -50%); }
}

@keyframes ffRaceRunner3 {
  0% { transform: translate(0, -50%); }
  24% { transform: translate(18px, -50%); }
  34% { transform: translate(42px, -50%); }
  42% { transform: translate(118px, -50%); }
  56% { transform: translate(212px, -50%); }
  70% { transform: translate(308px, -50%); }
  84% { transform: translate(404px, -50%); }
  100% { transform: translate(0, -50%); }
}

@media (max-width: 640px) {
  .ff-guide-screen-race {
    min-height: 270px;
    padding: 12px;
  }

  .ff-race-demo-stage {
    padding-bottom: 48px;
  }

  .ff-race-lane {
    min-height: 54px;
  }

  .ff-race-runner {
    min-width: 96px;
    padding: 6px 10px;
  }

  .ff-race-runner-info strong {
    font-size: 0.8rem;
  }

  .ff-race-runner-info span {
    font-size: 0.68rem;
  }

  .ff-race-lane-label {
    min-width: 46px;
    font-size: 0.72rem;
  }

  @keyframes ffRaceRunner1 {
    0% { transform: translate(0, -50%); }
    24% { transform: translate(20px, -50%); }
    34% { transform: translate(36px, -50%); }
    42% { transform: translate(98px, -50%); }
    56% { transform: translate(176px, -50%); }
    70% { transform: translate(250px, -50%); }
    84% { transform: translate(322px, -50%); }
    100% { transform: translate(0, -50%); }
  }

  @keyframes ffRaceRunner2 {
    0% { transform: translate(0, -50%); }
    24% { transform: translate(16px, -50%); }
    34% { transform: translate(30px, -50%); }
    42% { transform: translate(86px, -50%); }
    56% { transform: translate(154px, -50%); }
    70% { transform: translate(220px, -50%); }
    84% { transform: translate(286px, -50%); }
    100% { transform: translate(0, -50%); }
  }

  @keyframes ffRaceRunner3 {
    0% { transform: translate(0, -50%); }
    24% { transform: translate(12px, -50%); }
    34% { transform: translate(26px, -50%); }
    42% { transform: translate(74px, -50%); }
    56% { transform: translate(138px, -50%); }
    70% { transform: translate(196px, -50%); }
    84% { transform: translate(252px, -50%); }
    100% { transform: translate(0, -50%); }
  }
}


.ff-guide-screen-sim {
  min-height: 300px;
  padding: 14px;
  background:
    radial-gradient(circle at 18% 14%, rgba(110, 163, 255, 0.18), transparent 26%),
    radial-gradient(circle at 82% 18%, rgba(115, 255, 219, 0.12), transparent 24%),
    linear-gradient(180deg, #081427 0%, #09182d 48%, #07111f 100%);
  border-color: rgba(140, 202, 255, 0.18);
  box-shadow:
    inset 0 0 0 1px rgba(149, 214, 255, 0.07),
    0 18px 34px rgba(4, 9, 19, 0.36);
}

.ff-sim-demo-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ff-sim-demo-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ff-sim-demo-stage {
  position: relative;
  min-height: 230px;
  border-radius: 24px;
  overflow: hidden;
  border: 2px solid rgba(129, 197, 255, 0.28);
  background:
    radial-gradient(circle at 50% 0%, rgba(120, 165, 255, 0.14), transparent 32%),
    linear-gradient(180deg, #071631 0%, #06132a 42%, #051024 100%);
  box-shadow:
    inset 0 0 0 1px rgba(179, 222, 255, 0.08),
    0 16px 26px rgba(3, 8, 18, 0.26);
}

.ff-sim-arena-grid,
.ff-sim-arena-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ff-sim-arena-grid {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.04) 0 4%, transparent 4% 8%),
    linear-gradient(180deg, rgba(125, 177, 255, 0.08), rgba(255,255,255,0));
  background-size: 128px 100%, 100% 100%;
  animation: ffSimArenaShift 2.8s linear infinite;
  opacity: 0.55;
}

.ff-sim-arena-glow {
  border-radius: 24px;
  box-shadow: inset 0 -18px 26px rgba(104, 176, 255, 0.12);
}

.ff-sim-fighter {
  position: absolute;
  width: 100px;
  height: 100px;
  animation-duration: 4.8s;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}

.ff-sim-ball {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 16px rgba(4, 8, 18, 0.3);
  transform: translate(-50%, -50%);
}

.ff-sim-ball.is-pink {
  background: linear-gradient(180deg, #ff98bc 0%, #ef779f 100%);
}

.ff-sim-ball.is-mint {
  background: linear-gradient(180deg, #8bead8 0%, #67d8c9 100%);
}

.ff-sim-ball.is-sky {
  background: linear-gradient(180deg, #98d9ff 0%, #73c6fb 100%);
}

.ff-sim-ball.is-gold {
  background: linear-gradient(180deg, #f6d36f 0%, #e4b54a 100%);
}

.ff-sim-label {
  position: absolute;
  min-width: 74px;
  padding: 8px 10px 9px;
  border-radius: 14px;
  background: rgba(9, 24, 45, 0.92);
  border: 1px solid rgba(145, 206, 255, 0.18);
  box-shadow: 0 10px 20px rgba(3, 8, 18, 0.26);
  color: #ebf5ff;
}

.ff-sim-label strong,
.ff-sim-label span {
  display: block;
  line-height: 1.05;
}

.ff-sim-label strong {
  font-size: 0.72rem;
  font-weight: 900;
}

.ff-sim-label span {
  margin-top: 6px;
  font-size: 0.88rem;
  font-weight: 900;
}

.ff-sim-health-bar {
  display: block;
  width: 50px;
  height: 5px;
  margin-top: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8eead7 0%, #fae890 100%);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}

.ff-sim-label.is-hong {
  left: 56px;
  top: 44px;
}

.ff-sim-label.is-kim {
  right: -4px;
  top: -6px;
}

.ff-sim-label.is-park {
  left: -8px;
  top: -2px;
}

.ff-sim-label.is-choi {
  right: 0;
  top: 2px;
}

.ff-sim-fighter.is-ball-1 {
  left: 46%;
  top: 64%;
  animation-name: ffSimBall1;
}

.ff-sim-fighter.is-ball-2 {
  left: 75%;
  top: 28%;
  animation-name: ffSimBall2;
}

.ff-sim-fighter.is-ball-3 {
  left: 12%;
  top: 52%;
  animation-name: ffSimBall3;
}

.ff-sim-fighter.is-ball-4 {
  left: 35%;
  top: 8%;
  animation-name: ffSimBall4;
}

.ff-sim-touch-area {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: 170px;
  height: 46px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(104,176,255,0.08) 100%);
  border: 1px solid rgba(165, 217, 255, 0.14);
}

.ff-guide-ripple-sim {
  left: 50%;
  bottom: 8px;
  border-color: rgba(135, 196, 255, 0.5);
}

.ff-guide-finger-sim {
  bottom: -10px;
  font-size: 2.9rem;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.32));
}

.ff-guide-hold-badge-sim {
  bottom: 54px;
  background: rgba(10, 27, 50, 0.94);
  color: #dbecff;
  border-color: rgba(173, 223, 255, 0.16);
}

@keyframes ffSimArenaShift {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: -128px 0, 0 0;
  }
}

@keyframes ffSimBall1 {
  0% { transform: translate(0, 0); }
  24% { transform: translate(-6px, -8px); }
  34% { transform: translate(10px, -18px); }
  42% { transform: translate(32px, -44px); }
  56% { transform: translate(-24px, -92px); }
  70% { transform: translate(44px, -126px); }
  84% { transform: translate(-12px, -58px); }
  100% { transform: translate(0, 0); }
}

@keyframes ffSimBall2 {
  0% { transform: translate(0, 0); }
  24% { transform: translate(-10px, 10px); }
  34% { transform: translate(-22px, 18px); }
  42% { transform: translate(-74px, 68px); }
  56% { transform: translate(-134px, 98px); }
  70% { transform: translate(-182px, 16px); }
  84% { transform: translate(-92px, 44px); }
  100% { transform: translate(0, 0); }
}

@keyframes ffSimBall3 {
  0% { transform: translate(0, 0); }
  24% { transform: translate(12px, -8px); }
  34% { transform: translate(20px, -16px); }
  42% { transform: translate(54px, 4px); }
  56% { transform: translate(126px, 34px); }
  70% { transform: translate(152px, -48px); }
  84% { transform: translate(74px, 12px); }
  100% { transform: translate(0, 0); }
}

@keyframes ffSimBall4 {
  0% { transform: translate(0, 0); }
  24% { transform: translate(8px, 8px); }
  34% { transform: translate(16px, 20px); }
  42% { transform: translate(38px, 72px); }
  56% { transform: translate(92px, 132px); }
  70% { transform: translate(148px, 84px); }
  84% { transform: translate(54px, 36px); }
  100% { transform: translate(0, 0); }
}

@media (max-width: 640px) {
  .ff-guide-screen-sim {
    min-height: 286px;
    padding: 12px;
  }

  .ff-sim-demo-stage {
    min-height: 214px;
  }

  .ff-sim-fighter {
    width: 86px;
    height: 86px;
  }

  .ff-sim-ball {
    width: 32px;
    height: 32px;
  }

  .ff-sim-label {
    min-width: 66px;
    padding: 7px 8px 8px;
  }

  .ff-sim-label strong {
    font-size: 0.66rem;
  }

  .ff-sim-label span {
    font-size: 0.8rem;
  }

  .ff-sim-health-bar {
    width: 44px;
  }
}

/* =========================
   fast-forward guide sync refinement
   손가락 꾹 누름 / 해제 타이밍과 예시 속도 싱크 맞춤
========================= */
.ff-race-demo-badge,
.ff-sim-demo-badge {
  animation: ffGuideBadgeHoldSync 4.8s linear infinite;
}

.ff-guide-ripple-race,
.ff-guide-ripple-sim {
  animation: ffGuideRippleHoldSync 4.8s linear infinite;
}

.ff-guide-ripple-race.ff-guide-ripple-2,
.ff-guide-ripple-sim.ff-guide-ripple-2 {
  animation-delay: 0.16s;
}

.ff-guide-finger-race,
.ff-guide-finger-sim {
  animation: ffGuideFingerHoldSync 4.8s linear infinite;
}

.ff-guide-hold-badge-race,
.ff-guide-hold-badge-sim {
  animation: ffGuideHoldLabelSync 4.8s linear infinite;
}

.ff-race-lane-track {
  animation: ffRaceTrackShiftSync 4.8s linear infinite;
}

.ff-race-runner.is-runner-1 {
  animation: ffRaceRunner1Sync 4.8s linear infinite;
}

.ff-race-runner.is-runner-2 {
  animation: ffRaceRunner2Sync 4.8s linear infinite;
}

.ff-race-runner.is-runner-3 {
  animation: ffRaceRunner3Sync 4.8s linear infinite;
}

.ff-sim-fighter.is-ball-1 {
  animation-name: ffSimBall1Sync;
}

.ff-sim-fighter.is-ball-2 {
  animation-name: ffSimBall2Sync;
}

.ff-sim-fighter.is-ball-3 {
  animation-name: ffSimBall3Sync;
}

.ff-sim-fighter.is-ball-4 {
  animation-name: ffSimBall4Sync;
}

@keyframes ffGuideFingerHoldSync {
  0%, 16% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
  24%, 30% {
    transform: translateX(-50%) translateY(10px) scale(0.97);
  }
  30%, 68% {
    transform: translateX(-50%) translateY(12px) scale(0.95);
  }
  76%, 100% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes ffGuideBadgeHoldSync {
  0%, 24% {
    opacity: 0;
    transform: translateY(-6px) scale(0.94);
  }
  30%, 68% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  76%, 100% {
    opacity: 0;
    transform: translateY(-4px) scale(0.96);
  }
}

@keyframes ffGuideHoldLabelSync {
  0%, 20% {
    opacity: 0.72;
    transform: translateX(-50%) translateY(0);
  }
  30%, 68% {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
  }
  76%, 100% {
    opacity: 0.76;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes ffGuideRippleHoldSync {
  0%, 24% {
    opacity: 0;
    transform: translateX(-50%) scale(0.35);
  }
  30% {
    opacity: 0.72;
    transform: translateX(-50%) scale(0.52);
  }
  42% {
    opacity: 0;
    transform: translateX(-50%) scale(1.8);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(1.8);
  }
}

@keyframes ffRaceTrackShiftSync {
  0% {
    background-position: 0 0, 0 0;
  }
  24% {
    background-position: -34px 0, 0 0;
  }
  30% {
    background-position: -42px 0, 0 0;
  }
  68% {
    background-position: -268px 0, 0 0;
  }
  76% {
    background-position: -282px 0, 0 0;
  }
  100% {
    background-position: -332px 0, 0 0;
  }
}

@keyframes ffRaceRunner1Sync {
  0% { transform: translate(0, -50%); }
  24% { transform: translate(26px, -50%); }
  30% { transform: translate(34px, -50%); }
  40% { transform: translate(132px, -50%); }
  52% { transform: translate(268px, -50%); }
  68% { transform: translate(486px, -50%); }
  76% { transform: translate(502px, -50%); }
  100% { transform: translate(546px, -50%); }
}

@keyframes ffRaceRunner2Sync {
  0% { transform: translate(0, -50%); }
  24% { transform: translate(22px, -50%); }
  30% { transform: translate(30px, -50%); }
  40% { transform: translate(116px, -50%); }
  52% { transform: translate(236px, -50%); }
  68% { transform: translate(430px, -50%); }
  76% { transform: translate(444px, -50%); }
  100% { transform: translate(484px, -50%); }
}

@keyframes ffRaceRunner3Sync {
  0% { transform: translate(0, -50%); }
  24% { transform: translate(18px, -50%); }
  30% { transform: translate(24px, -50%); }
  40% { transform: translate(104px, -50%); }
  52% { transform: translate(212px, -50%); }
  68% { transform: translate(394px, -50%); }
  76% { transform: translate(406px, -50%); }
  100% { transform: translate(440px, -50%); }
}

@keyframes ffSimBall1Sync {
  0% { transform: translate(0, 0); }
  24% { transform: translate(-8px, -10px); }
  30% { transform: translate(4px, -16px); }
  42% { transform: translate(42px, -52px); }
  54% { transform: translate(-28px, -104px); }
  68% { transform: translate(54px, -138px); }
  76% { transform: translate(44px, -130px); }
  100% { transform: translate(18px, -118px); }
}

@keyframes ffSimBall2Sync {
  0% { transform: translate(0, 0); }
  24% { transform: translate(-12px, 12px); }
  30% { transform: translate(-18px, 20px); }
  42% { transform: translate(-82px, 76px); }
  54% { transform: translate(-148px, 104px); }
  68% { transform: translate(-198px, 18px); }
  76% { transform: translate(-184px, 22px); }
  100% { transform: translate(-150px, 40px); }
}

@keyframes ffSimBall3Sync {
  0% { transform: translate(0, 0); }
  24% { transform: translate(14px, -10px); }
  30% { transform: translate(18px, -14px); }
  42% { transform: translate(60px, 8px); }
  54% { transform: translate(136px, 40px); }
  68% { transform: translate(164px, -52px); }
  76% { transform: translate(154px, -46px); }
  100% { transform: translate(130px, -30px); }
}

@keyframes ffSimBall4Sync {
  0% { transform: translate(0, 0); }
  24% { transform: translate(10px, 10px); }
  30% { transform: translate(16px, 18px); }
  42% { transform: translate(44px, 78px); }
  54% { transform: translate(102px, 142px); }
  68% { transform: translate(156px, 88px); }
  76% { transform: translate(146px, 84px); }
  100% { transform: translate(122px, 68px); }
}

@media (max-width: 640px) {
  .ff-race-runner.is-runner-1 {
    animation: ffRaceRunner1SyncMobile 4.8s linear infinite;
  }

  .ff-race-runner.is-runner-2 {
    animation: ffRaceRunner2SyncMobile 4.8s linear infinite;
  }

  .ff-race-runner.is-runner-3 {
    animation: ffRaceRunner3SyncMobile 4.8s linear infinite;
  }

  @keyframes ffRaceRunner1SyncMobile {
    0% { transform: translate(0, -50%); }
    24% { transform: translate(16px, -50%); }
    30% { transform: translate(22px, -50%); }
    42% { transform: translate(82px, -50%); }
    54% { transform: translate(176px, -50%); }
    68% { transform: translate(326px, -50%); }
    76% { transform: translate(336px, -50%); }
    100% { transform: translate(366px, -50%); }
  }

  @keyframes ffRaceRunner2SyncMobile {
    0% { transform: translate(0, -50%); }
    24% { transform: translate(14px, -50%); }
    30% { transform: translate(20px, -50%); }
    42% { transform: translate(74px, -50%); }
    54% { transform: translate(156px, -50%); }
    68% { transform: translate(292px, -50%); }
    76% { transform: translate(300px, -50%); }
    100% { transform: translate(326px, -50%); }
  }

  @keyframes ffRaceRunner3SyncMobile {
    0% { transform: translate(0, -50%); }
    24% { transform: translate(12px, -50%); }
    30% { transform: translate(16px, -50%); }
    42% { transform: translate(64px, -50%); }
    54% { transform: translate(138px, -50%); }
    68% { transform: translate(258px, -50%); }
    76% { transform: translate(266px, -50%); }
    100% { transform: translate(288px, -50%); }
  }
}

/* =========================
   game4 : ball battle info popup
========================= */
.popup.game-info-popup.game-info-popup-sim {
  max-width: 860px;
}

.game-info-content-sim {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.game-info-content-sim .game-info-lead {
  color: #7f6556;
  line-height: 1.75;
}

.game-info-tabbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.game-info-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.96);
  color: #8b6f60;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.game-info-tab-btn:hover {
  transform: translateY(-1px);
}

.game-info-tab-btn.is-active {
  background: linear-gradient(180deg, #fff2e8 0%, #ffe4cf 100%);
  color: #7c5540;
  box-shadow: 0 10px 20px rgba(120, 90, 70, 0.12);
}

.game-info-panels {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-info-panel {
  display: none;
}

.game-info-panel.is-active {
  display: block;
}

.sim-info-visual-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sim-info-hero-note,
.sim-info-visual-card,
.game-info-content-sim .game-info-section {
  background: rgba(255, 248, 241, 0.84);
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 20px;
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.05);
}

.sim-info-hero-note {
  padding: 16px 18px;
}

.sim-info-hero-note p {
  color: #866b5c;
  line-height: 1.7;
}

.sim-info-hero-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff6dd 0%, #ffeac0 100%);
  color: #8b6a37;
  font-size: 0.84rem;
  font-weight: 900;
  margin-bottom: 10px;
}

.sim-info-visual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.sim-info-visual-card {
  padding: 16px;
}

.sim-info-visual-card.is-wide {
  grid-column: span 2;
}

.sim-info-card-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.sim-info-step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffd7c2, #ffeabf);
  color: #815942;
  font-family: 'Gaegu', cursive;
  font-size: 1.1rem;
  font-weight: 700;
}

.sim-info-card-head h4 {
  margin: 0 0 6px;
  color: var(--soft-brown);
  font-size: 1.05rem;
}

.sim-info-card-head p {
  color: #8c7262;
  line-height: 1.6;
}

.sim-info-scene {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.56), transparent 24%),
    linear-gradient(180deg, #fff6ef 0%, #fff1ea 100%);
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.32);
}

.sim-info-scene-cards {
  min-height: 200px;
  padding: 16px;
}

.sim-info-player-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  color: #815942;
  font-weight: 800;
  box-shadow: 0 8px 14px rgba(120, 90, 70, 0.08);
}

.sim-info-player-chip.is-pink {
  background: linear-gradient(180deg, #fff5f8 0%, #ffe5ec 100%);
}

.sim-info-card-deck-mini {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.sim-info-stat-card-mini {
  min-height: 118px;
  border-radius: 18px;
  border: 2px solid rgba(255,255,255,0.94);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  color: #765848;
  box-shadow: 0 10px 18px rgba(114, 86, 68, 0.1);
  animation: simInfoCardFloat 2.8s ease-in-out infinite;
}

.sim-info-stat-card-mini.delay-1 { animation-delay: 0.12s; }
.sim-info-stat-card-mini.delay-2 { animation-delay: 0.24s; }
.sim-info-stat-card-mini.delay-3 { animation-delay: 0.36s; }

.sim-info-stat-card-mini strong {
  font-size: 0.9rem;
}

.sim-info-stat-card-mini span:last-child {
  align-self: flex-end;
  font-family: 'Gaegu', cursive;
  font-size: 1.5rem;
  font-weight: 700;
}

.sim-info-stat-card-icon {
  font-size: 1.2rem;
}

.sim-info-stat-card-mini.is-health { background: linear-gradient(180deg, #fff1f5 0%, #ffdfe9 100%); }
.sim-info-stat-card-mini.is-attack { background: linear-gradient(180deg, #fff5e9 0%, #ffe1c1 100%); }
.sim-info-stat-card-mini.is-accuracy { background: linear-gradient(180deg, #eef7ff 0%, #dff0ff 100%); }
.sim-info-stat-card-mini.is-defense { background: linear-gradient(180deg, #eefaf6 0%, #d6f1e8 100%); }

.sim-info-ready-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe5ef 0%, #ffd6e6 100%);
  color: #946378;
  font-weight: 900;
}

.sim-info-scene-duel,
.sim-info-scene-finale {
  min-height: 228px;
  padding: 16px;
}

.sim-info-arena-shell {
  position: relative;
  min-height: 194px;
  border-radius: 18px;
  background: rgba(255,255,255,0.22);
  overflow: hidden;
}

.sim-info-arena-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.45) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.6;
}

.sim-info-demo-ball {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.94);
  box-shadow: 0 8px 14px rgba(120, 90, 70, 0.14);
}

.sim-info-demo-ball.is-pink { background: #f8b8c9; }
.sim-info-demo-ball.is-mint { background: #bfe8d8; }
.sim-info-demo-ball.is-sky { background: #c6def8; }

.sim-info-demo-ball.duel-left {
  left: 30%;
  top: 46%;
  animation: simInfoBallLeft 1.8s ease-in-out infinite;
}

.sim-info-demo-ball.duel-right {
  left: 62%;
  top: 46%;
  animation: simInfoBallRight 1.8s ease-in-out infinite;
}

.sim-info-hit-spark {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(255,214,138,0.92) 42%, rgba(255,142,123,0) 100%);
  animation: simInfoSpark 1.8s ease-in-out infinite;
}

.sim-info-hit-badge {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translateX(-50%);
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  color: #8d5a4b;
  font-weight: 900;
  animation: simInfoSparkBadge 1.8s ease-in-out infinite;
}

.sim-info-health-label {
  position: absolute;
  min-width: 112px;
  max-width: 130px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.94);
  box-shadow: 0 6px 14px rgba(114, 86, 68, 0.1);
}

.duel-label-left {
  left: 12px;
  top: 12px;
}

.duel-label-right {
  right: 12px;
  top: 12px;
}

.sim-info-health-label strong,
.sim-info-health-label span,
.sim-info-health-label em {
  display: block;
  font-style: normal;
}

.sim-info-health-label strong {
  color: #795f50;
  font-size: 0.84rem;
  margin-bottom: 4px;
}

.sim-info-health-values {
  color: #8d7466;
  font-size: 0.78rem;
  line-height: 1.3;
}

.sim-info-health-values .hp-before {
  opacity: 0.5;
  text-decoration: line-through;
}

.sim-info-health-values .hp-after {
  color: #c35e72;
  font-weight: 800;
}

.sim-info-health-track {
  position: relative;
  display: block;
  height: 6px;
  margin-top: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(119, 95, 81, 0.16);
}

.sim-info-health-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff7c98 0%, #ffb86a 45%, #86e29f 100%);
}

.sim-info-health-fill.is-full { width: 100%; }
.sim-info-health-fill.is-drop { width: 78%; animation: simInfoHpDrop 1.8s ease-in-out infinite; }
.sim-info-health-fill.is-winner { width: 42%; }

.sim-info-scene-stats {
  min-height: 252px;
  padding: 14px;
}

.sim-info-stat-meaning-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.sim-info-stat-meaning-card {
  min-height: 104px;
  border-radius: 18px;
  border: 2px solid rgba(255,255,255,0.92);
  padding: 12px;
  box-shadow: 0 8px 16px rgba(114, 86, 68, 0.08);
}

.sim-info-stat-meaning-card header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #755949;
  margin-bottom: 8px;
}

.sim-info-stat-meaning-card header span {
  font-size: 1.1rem;
}

.sim-info-stat-meaning-card.is-health { background: linear-gradient(180deg, #fff1f5 0%, #ffdfe9 100%); }
.sim-info-stat-meaning-card.is-attack { background: linear-gradient(180deg, #fff5e9 0%, #ffe1c1 100%); }
.sim-info-stat-meaning-card.is-accuracy { background: linear-gradient(180deg, #eef7ff 0%, #dff0ff 100%); }
.sim-info-stat-meaning-card.is-defense { background: linear-gradient(180deg, #eefaf6 0%, #d6f1e8 100%); }

.sim-info-mini-note,
.sim-info-mini-formula {
  color: #8b7061;
  font-size: 0.84rem;
  line-height: 1.45;
}

.sim-info-mini-formula {
  margin-top: 8px;
  font-weight: 800;
}

.sim-info-big-hp-track {
  position: relative;
  height: 10px;
  margin-top: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(119, 95, 81, 0.16);
}

.sim-info-big-hp-base,
.sim-info-big-hp-bonus {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
}

.sim-info-big-hp-base {
  width: 54%;
  background: rgba(255, 145, 170, 0.55);
}

.sim-info-big-hp-bonus {
  width: 100%;
  background: linear-gradient(90deg, #ff7c98 0%, #ffb86a 45%, #86e29f 100%);
  clip-path: inset(0 0 0 54%);
}

.sim-info-attack-demo {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.sim-info-attack-hit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 32px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  color: #c15e4f;
  font-weight: 900;
  animation: simInfoDamagePulse 1.6s ease-in-out infinite;
}

.sim-info-accuracy-demo {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sim-info-accuracy-demo span,
.sim-info-defense-formula {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  font-weight: 900;
}

.sim-info-accuracy-demo .is-hit {
  color: #4e8d68;
}

.sim-info-accuracy-demo .is-miss {
  color: #8c7183;
}

.sim-info-defense-formula {
  margin-top: 10px;
  color: #4d896f;
}

.sim-info-arena-shell.is-finale {
  min-height: 194px;
}

.finale-ball-1 {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
}

.finale-ball-2 {
  left: 24%;
  top: 66%;
}

.finale-ball-3 {
  right: 18%;
  top: 62%;
}

.sim-info-demo-ball.is-faded {
  opacity: 0.28;
  filter: grayscale(0.4);
}

.finale-label {
  left: 16px;
  top: 16px;
}

.finale-label.is-eliminated {
  left: auto;
  right: 16px;
  top: auto;
  bottom: 16px;
  min-width: 96px;
  text-align: center;
  color: #8f7667;
}

.finale-label.is-winner {
  max-width: 120px;
}

.sim-info-winner-crown {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff6dd 0%, #ffe6aa 100%);
  color: #8a6a30;
  font-weight: 900;
  box-shadow: 0 8px 14px rgba(120, 90, 70, 0.1);
}

@keyframes simInfoCardFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes simInfoBallLeft {
  0%, 100% { transform: translate(0, 0); }
  42%, 58% { transform: translate(52px, 0); }
}

@keyframes simInfoBallRight {
  0%, 100% { transform: translate(0, 0); }
  42%, 58% { transform: translate(-52px, 0); }
}

@keyframes simInfoSpark {
  0%, 28%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  45%, 58% { opacity: 1; transform: translate(-50%, -50%) scale(1.25); }
}

@keyframes simInfoSparkBadge {
  0%, 28%, 100% { opacity: 0; transform: translateX(-50%) translateY(6px); }
  45%, 58% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes simInfoHpDrop {
  0%, 25% { width: 100%; }
  45%, 100% { width: 78%; }
}

@keyframes simInfoDamagePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

.theme-dark .popup.game-info-popup.game-info-popup-sim {
  background: #241c1d;
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 20px 44px rgba(0,0,0,0.42);
}

.theme-dark .game-info-content-sim .game-info-lead,
.theme-dark .sim-info-hero-note p,
.theme-dark .sim-info-card-head p,
.theme-dark .sim-info-mini-note,
.theme-dark .sim-info-mini-formula,
.theme-dark .game-info-content-sim .game-info-section ul {
  color: #d4c0b8;
}

.theme-dark .game-info-tab-btn,
.theme-dark .sim-info-hero-note,
.theme-dark .sim-info-visual-card,
.theme-dark .game-info-content-sim .game-info-section,
.theme-dark .sim-info-health-label,
.theme-dark .sim-info-player-chip,
.theme-dark .sim-info-ready-pill,
.theme-dark .sim-info-attack-hit,
.theme-dark .sim-info-accuracy-demo span,
.theme-dark .sim-info-defense-formula,
.theme-dark .sim-info-winner-crown {
  border-color: rgba(255,255,255,0.08);
}

.theme-dark .game-info-tab-btn,
.theme-dark .sim-info-hero-note,
.theme-dark .sim-info-visual-card,
.theme-dark .game-info-content-sim .game-info-section {
  background: rgba(255,255,255,0.04);
}

.theme-dark .game-info-tab-btn {
  color: #ead6cd;
}

.theme-dark .game-info-tab-btn.is-active {
  background: linear-gradient(180deg, rgba(255,197,164,0.24) 0%, rgba(255,154,140,0.18) 100%);
  color: #fff0e8;
}

.theme-dark .sim-info-scene,
.theme-dark .sim-info-arena-shell {
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.06), transparent 24%),
    linear-gradient(180deg, #2a2224 0%, #221b1d 100%);
  border-color: rgba(255,255,255,0.08);
}

.theme-dark .sim-info-health-track,
.theme-dark .sim-info-big-hp-track {
  background: rgba(255,255,255,0.12);
}

.theme-dark .sim-info-card-head h4,
.theme-dark .game-info-content-sim .game-info-section h4,
.theme-dark .sim-info-stat-meaning-card header,
.theme-dark .sim-info-health-label strong {
  color: #fff0e8;
}

.theme-dark .sim-info-health-values,
.theme-dark .sim-info-player-chip,
.theme-dark .sim-info-ready-pill,
.theme-dark .sim-info-attack-hit,
.theme-dark .sim-info-accuracy-demo span,
.theme-dark .sim-info-defense-formula,
.theme-dark .finale-label.is-eliminated {
  color: #f0dbd1;
}

@media (max-width: 760px) {
  .popup.game-info-popup.game-info-popup-sim {
    padding: 22px 16px;
  }

  .sim-info-visual-grid,
  .sim-info-stat-meaning-grid {
    grid-template-columns: 1fr;
  }

  .sim-info-visual-card.is-wide {
    grid-column: span 1;
  }

  .sim-info-card-deck-mini {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .game-info-tabbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .game-info-tab-btn {
    width: 100%;
    min-height: 42px;
  }

  .sim-info-card-head {
    grid-template-columns: 1fr;
  }

  .sim-info-scene-cards,
  .sim-info-scene-duel,
  .sim-info-scene-finale,
  .sim-info-scene-stats {
    padding: 12px;
  }

  .sim-info-health-label {
    min-width: 96px;
    max-width: 108px;
    padding: 7px 8px;
  }

  .sim-info-health-label strong {
    font-size: 0.76rem;
  }

  .sim-info-health-values {
    font-size: 0.7rem;
  }

  .sim-info-demo-ball.duel-left {
    left: 24%;
  }

  .sim-info-demo-ball.duel-right {
    left: 64%;
  }
}


/* =========================
   game4 : info popup refinements
========================= */
.sim-info-visual-grid {
  align-items: stretch;
}

.sim-info-visual-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.sim-info-visual-card-step1 {
  grid-column: auto;
}

.sim-info-scene-cards {
  min-height: 228px;
}

.sim-info-card-deck-mini {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.sim-info-stat-card-mini {
  min-height: 92px;
  padding: 10px 10px;
}

.sim-info-stat-card-mini strong {
  font-size: 0.82rem;
}

.sim-info-stat-card-mini span:last-child {
  font-size: 1.28rem;
}

.sim-info-ready-pill {
  margin-top: 12px;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim {
  background:
    radial-gradient(circle at top center, rgba(75, 124, 214, 0.18) 0%, transparent 28%),
    linear-gradient(180deg, rgba(10, 19, 36, 0.985) 0%, rgba(4, 11, 24, 1) 100%);
  border-color: rgba(92, 143, 231, 0.34);
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.54),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .popup-icon {
  filter: drop-shadow(0 6px 14px rgba(90, 160, 255, 0.22));
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim h3 {
  color: #f2f7ff;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .popup-message,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-lead,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-section ul,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-section li,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-hero-note p,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-card-head p,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-mini-note,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-mini-formula,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-health-values,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .finale-label.is-eliminated {
  color: #c9d9ee !important;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-tabbar {
  display: flex;
  width: fit-content;
  max-width: 100%;
  padding: 6px;
  border-radius: 999px;
  background: rgba(10, 19, 36, 0.7);
  border: 1px solid rgba(92, 143, 231, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-tab-btn {
  background: transparent;
  border-color: transparent;
  color: #90abcb;
  box-shadow: none;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-tab-btn.is-active {
  background: linear-gradient(180deg, rgba(39, 61, 100, 0.98) 0%, rgba(24, 40, 72, 0.98) 100%);
  border-color: rgba(116, 172, 255, 0.18);
  color: #eef6ff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255,255,255,0.06);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-hero-note,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-visual-card,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-content-sim .game-info-section {
  background:
    radial-gradient(circle at top left, rgba(88, 146, 240, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(15, 27, 47, 0.96) 0%, rgba(10, 18, 33, 0.98) 100%) !important;
  border-color: rgba(92, 143, 231, 0.18) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 16px 28px rgba(0, 0, 0, 0.22) !important;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-card-head h4,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-section h4,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-health-label strong,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-stat-meaning-card header {
  color: #f2f7ff !important;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-step {
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.22), rgba(196, 181, 253, 0.32));
  color: #eef6ff;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-hero-badge {
  background: linear-gradient(180deg, rgba(42, 70, 114, 0.98) 0%, rgba(29, 50, 88, 0.98) 100%);
  color: #dff0ff;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-scene,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-arena-shell {
  background:
    radial-gradient(circle at top center, rgba(106, 164, 255, 0.14), transparent 30%),
    linear-gradient(180deg, rgba(17, 30, 53, 0.98) 0%, rgba(7, 15, 30, 1) 100%);
  border-color: rgba(112, 167, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-arena-grid {
  background-image:
    linear-gradient(rgba(157, 197, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(157, 197, 255, 0.16) 1px, transparent 1px);
  opacity: 0.58;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-player-chip,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-ready-pill,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-hit-badge,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-health-label,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-attack-hit,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-accuracy-demo span,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-defense-formula,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-winner-crown {
  background: linear-gradient(180deg, rgba(29, 44, 72, 0.96) 0%, rgba(18, 30, 52, 0.98) 100%);
  border-color: rgba(112, 167, 255, 0.16);
  color: #eef6ff;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-player-chip.is-pink {
  background: linear-gradient(180deg, rgba(57, 71, 113, 0.96) 0%, rgba(37, 51, 85, 0.98) 100%);
  color: #f4f7ff;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-stat-card-mini {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.22);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-stat-card-mini.is-health {
  background: linear-gradient(180deg, rgba(118, 72, 104, 0.9) 0%, rgba(85, 48, 75, 0.96) 100%);
  color: #ffe8f3;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-stat-card-mini.is-attack {
  background: linear-gradient(180deg, rgba(124, 92, 58, 0.92) 0%, rgba(92, 64, 39, 0.98) 100%);
  color: #fff0dd;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-stat-card-mini.is-accuracy {
  background: linear-gradient(180deg, rgba(69, 93, 129, 0.92) 0%, rgba(48, 68, 99, 0.98) 100%);
  color: #e5f2ff;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-stat-card-mini.is-defense {
  background: linear-gradient(180deg, rgba(55, 102, 95, 0.92) 0%, rgba(35, 73, 66, 0.98) 100%);
  color: #e4fff7;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-stat-meaning-card {
  border-color: rgba(112, 167, 255, 0.12);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.2);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-stat-meaning-card.is-health {
  background: linear-gradient(180deg, rgba(66, 45, 68, 0.94) 0%, rgba(44, 29, 48, 0.98) 100%);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-stat-meaning-card.is-attack {
  background: linear-gradient(180deg, rgba(75, 55, 38, 0.94) 0%, rgba(53, 37, 24, 0.98) 100%);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-stat-meaning-card.is-accuracy {
  background: linear-gradient(180deg, rgba(38, 53, 76, 0.94) 0%, rgba(24, 35, 53, 0.98) 100%);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-stat-meaning-card.is-defense {
  background: linear-gradient(180deg, rgba(33, 63, 59, 0.94) 0%, rgba(21, 43, 40, 0.98) 100%);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-health-track,
html.theme-dark .popup.game-info-popup.game-info-popup-sim .sim-info-big-hp-track {
  background: rgba(255,255,255,0.14);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .popup-message::-webkit-scrollbar {
  width: 10px;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .popup-message::-webkit-scrollbar-thumb {
  background: rgba(103, 148, 224, 0.5);
  border-radius: 999px;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .popup-message::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
}

@media (max-width: 760px) {
  .sim-info-visual-grid {
    grid-template-columns: 1fr;
  }

  .sim-info-visual-card-step1,
  .sim-info-visual-card.is-wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .sim-info-card-deck-mini {
    grid-template-columns: 1fr;
  }

  .sim-info-scene-cards {
    min-height: 380px;
  }
}


/* =========================
   global scrollbars + minimal cursor
========================= */

:root {
  --scrollbar-size: 12px;
  --scrollbar-track: rgba(255, 250, 244, 0.86);
  --scrollbar-track-edge: rgba(235, 220, 207, 0.88);
  --scrollbar-thumb: rgba(212, 168, 186, 0.92);
  --scrollbar-thumb-strong: rgba(182, 130, 155, 0.98);
  --scrollbar-thumb-shadow: rgba(136, 103, 83, 0.12);
  --cursor-ring: rgba(255, 255, 255, 0.78);
  --cursor-fill: rgba(255, 230, 239, 0.22);
  --cursor-core: rgba(176, 126, 151, 0.88);
  --cursor-glow: rgba(246, 201, 215, 0.34);
}

html.theme-dark {
  --scrollbar-track: rgba(15, 24, 40, 0.88);
  --scrollbar-track-edge: rgba(58, 83, 121, 0.62);
  --scrollbar-thumb: rgba(111, 173, 255, 0.72);
  --scrollbar-thumb-strong: rgba(146, 206, 255, 0.92);
  --scrollbar-thumb-shadow: rgba(0, 0, 0, 0.24);
  --cursor-ring: rgba(213, 235, 255, 0.84);
  --cursor-fill: rgba(69, 118, 201, 0.14);
  --cursor-core: rgba(147, 207, 255, 0.96);
  --cursor-glow: rgba(95, 167, 255, 0.22);
}

html,
body,
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: var(--scrollbar-size) !important;
  height: var(--scrollbar-size) !important;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--scrollbar-thumb) 0%, var(--scrollbar-thumb-strong) 100%) !important;
  border-radius: 999px !important;
  border: 2px solid var(--scrollbar-track) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.36), 0 2px 6px var(--scrollbar-thumb-shadow) !important;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--scrollbar-thumb-strong) 0%, var(--scrollbar-thumb-strong) 100%) !important;
}

*::-webkit-scrollbar-track {
  background: linear-gradient(180deg, var(--scrollbar-track) 0%, color-mix(in srgb, var(--scrollbar-track-edge) 62%, var(--scrollbar-track) 38%) 100%) !important;
  border-radius: 999px !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16) !important;
}

*::-webkit-scrollbar-corner {
  background: transparent !important;
}

@media (min-width: 1025px) and (pointer: fine) {
  html,
  body {
    scrollbar-width: thin;
    -ms-overflow-style: auto;
  }

  html::-webkit-scrollbar,
  body::-webkit-scrollbar {
    display: block !important;
    width: 14px !important;
    height: 14px !important;
  }
}

@media (pointer: fine) {
  html,
  body,
  body *,
  button,
  a,
  input,
  textarea,
  select,
  summary,
  label {
    cursor: none !important;
  }

  .app-cursor {
    --cursor-x: 0px;
    --cursor-y: 0px;
    --cursor-scale: 0.8;
    position: fixed;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transform: translate3d(var(--cursor-x), var(--cursor-y), 0) translate3d(-50%, -50%, 0) scale(var(--cursor-scale));
    transition: opacity 0.1s ease, transform 0.03s linear, width 0.12s ease, height 0.12s ease;
    will-change: transform, opacity;
    mix-blend-mode: normal;
  }

  .app-cursor::before,
  .app-cursor::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    transition: inherit;
  }

  .app-cursor::before {
    border: 1.5px solid var(--cursor-ring);
    background: color-mix(in srgb, var(--cursor-fill) 88%, transparent 12%);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.1), 0 0 10px var(--cursor-glow);
  }

  .app-cursor::after {
    inset: 50%;
    width: 6px;
    height: 6px;
    margin-left: -3px;
    margin-top: -3px;
    border-radius: 999px;
    background: var(--cursor-core);
    box-shadow: 0 0 10px color-mix(in srgb, var(--cursor-core) 35%, transparent 65%);
  }

  .app-cursor.is-visible {
    opacity: 1;
  }

  .app-cursor.is-hover {
    --cursor-scale: 1.12;
  }

  .app-cursor.is-hover::before {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.18), 0 0 22px var(--cursor-glow);
  }

  .app-cursor.is-press {
    --cursor-scale: 0.92;
  }

  .app-cursor.is-text {
    width: 20px;
    height: 30px;
  }

  .app-cursor.is-text::after {
    width: 2.5px;
    height: 15px;
    margin-left: -1.25px;
    margin-top: -7.5px;
    border-radius: 3px;
  }
}

/* =========================
   game4 : ball battle info popup responsive cleanup
========================= */
.popup.game-info-popup.game-info-popup-sim {
  width: min(96vw, 1020px);
  max-width: 1020px;
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  padding: 30px 28px;
}

.popup.game-info-popup.game-info-popup-sim h3 {
  line-height: 1.06;
}

.popup.game-info-popup.game-info-popup-sim .popup-message {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px;
  margin-bottom: 18px;
}

.game-info-content-sim {
  min-width: 0;
  gap: 18px;
}

.game-info-content-sim .game-info-lead {
  font-size: 1rem;
  line-height: 1.78;
}

.game-info-tabbar {
  position: sticky;
  top: 0;
  z-index: 4;
  align-self: flex-start;
}

.game-info-content-sim .game-info-panel[data-info-panel="visual"].is-active {
  display: block;
}

.game-info-content-sim .game-info-panel[data-info-panel="text"].is-active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.game-info-content-sim .game-info-panel[data-info-panel="text"].is-active .game-info-section {
  height: 100%;
}

.sim-info-hero-note {
  padding: 18px 20px;
}

.sim-info-visual-grid {
  align-items: stretch;
  gap: 16px;
}

.sim-info-visual-card {
  min-width: 0;
  padding: 18px;
}

.sim-info-card-head {
  gap: 14px;
}

.sim-info-card-head p {
  font-size: 0.95rem;
}

.sim-info-scene-cards,
.sim-info-scene-duel,
.sim-info-scene-finale,
.sim-info-scene-stats {
  min-width: 0;
}

.sim-info-stat-meaning-card,
.sim-info-stat-card-mini,
.sim-info-health-label,
.sim-info-defense-formula,
.sim-info-mini-formula {
  word-break: keep-all;
}

@media (min-width: 1025px) {
  .popup.game-info-popup.game-info-popup-sim {
    width: min(95vw, 1040px);
    max-width: 1040px;
    padding: 32px 30px;
  }

  .popup.game-info-popup.game-info-popup-sim .popup-message {
    padding-right: 12px;
  }

  .game-info-tabbar {
    gap: 10px;
  }

  .game-info-tab-btn {
    min-height: 42px;
    padding: 10px 16px;
  }

  .sim-info-visual-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .sim-info-card-deck-mini {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 761px) and (max-width: 1024px) {
  .popup-overlay:has(.popup.game-info-popup.game-info-popup-sim) {
    padding: 18px;
  }

  .popup.game-info-popup.game-info-popup-sim {
    width: min(94vw, 860px);
    max-width: 860px;
    max-height: min(90vh, 920px);
    padding: 24px 22px;
    border-radius: 26px;
  }

  .popup.game-info-popup.game-info-popup-sim .popup-message {
    padding-right: 8px;
  }

  .game-info-content-sim {
    gap: 16px;
  }

  .game-info-content-sim .game-info-lead {
    font-size: 0.96rem;
    line-height: 1.72;
  }

  .game-info-tabbar {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .game-info-tab-btn {
    width: 100%;
    min-height: 44px;
  }

  .game-info-content-sim .game-info-panel[data-info-panel="text"].is-active {
    grid-template-columns: 1fr;
  }

  .sim-info-visual-grid,
  .sim-info-stat-meaning-grid {
    grid-template-columns: 1fr;
  }

  .sim-info-visual-card,
  .sim-info-visual-card.is-wide,
  .sim-info-visual-card-step1 {
    grid-column: 1 / -1;
  }

  .sim-info-card-deck-mini {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .sim-info-scene-cards {
    min-height: 246px;
  }

  .sim-info-scene-duel,
  .sim-info-scene-finale {
    min-height: 238px;
  }

  .sim-info-scene-stats {
    min-height: 272px;
  }
}

@media (max-width: 760px) {
  .popup-overlay:has(.popup.game-info-popup.game-info-popup-sim) {
    align-items: flex-start;
    padding: 10px;
    overflow-y: auto;
  }

  .popup.game-info-popup.game-info-popup-sim {
    width: 100%;
    max-width: none;
    max-height: none;
    min-height: calc(100vh - 20px);
    padding: 20px 16px 18px;
    border-radius: 24px;
  }

  .popup.game-info-popup.game-info-popup-sim .popup-icon {
    font-size: 2.5rem;
    margin-bottom: 6px;
  }

  .popup.game-info-popup.game-info-popup-sim h3 {
    font-size: clamp(1.7rem, 7vw, 2.1rem);
    margin-bottom: 12px;
  }

  .popup.game-info-popup.game-info-popup-sim .popup-message {
    padding-right: 4px;
    margin-bottom: 16px;
  }

  .game-info-content-sim {
    gap: 14px;
  }

  .game-info-content-sim .game-info-lead {
    font-size: 0.93rem;
    line-height: 1.68;
  }

  .game-info-tabbar {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .game-info-tab-btn {
    width: 100%;
    min-height: 42px;
    padding: 10px 10px;
    font-size: 0.9rem;
  }

  .game-info-content-sim .game-info-panel[data-info-panel="text"].is-active {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .sim-info-hero-note,
  .sim-info-visual-card,
  .game-info-content-sim .game-info-section {
    border-radius: 18px;
  }

  .sim-info-hero-note {
    padding: 14px 14px;
  }

  .sim-info-hero-badge {
    width: 100%;
    text-align: center;
    line-height: 1.35;
  }

  .sim-info-visual-grid,
  .sim-info-stat-meaning-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .sim-info-visual-card,
  .sim-info-visual-card.is-wide,
  .sim-info-visual-card-step1 {
    grid-column: 1 / -1;
    padding: 14px;
  }

  .sim-info-card-head {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }

  .sim-info-step {
    width: 30px;
    height: 30px;
  }

  .sim-info-card-head h4 {
    font-size: 1rem;
    line-height: 1.4;
  }

  .sim-info-card-head p,
  .sim-info-mini-note,
  .sim-info-mini-formula {
    font-size: 0.87rem;
    line-height: 1.55;
  }

  .sim-info-card-deck-mini {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .sim-info-stat-card-mini {
    min-height: 100px;
    padding: 10px;
  }

  .sim-info-stat-card-mini strong {
    font-size: 0.8rem;
  }

  .sim-info-stat-card-mini span:last-child {
    font-size: 1.24rem;
  }

  .sim-info-scene-cards {
    min-height: 238px;
    padding: 14px;
  }

  .sim-info-scene-duel,
  .sim-info-scene-finale,
  .sim-info-scene-stats {
    padding: 12px;
  }

  .sim-info-scene-duel,
  .sim-info-scene-finale {
    min-height: 220px;
  }

  .sim-info-scene-stats {
    min-height: 252px;
  }

  .sim-info-health-label {
    min-width: 96px;
    max-width: 108px;
    padding: 7px 8px;
  }

  .sim-info-health-label strong {
    font-size: 0.74rem;
  }

  .sim-info-health-values {
    font-size: 0.69rem;
  }

  .sim-info-demo-ball.duel-left {
    left: 24%;
  }

  .sim-info-demo-ball.duel-right {
    left: 64%;
  }
}

@media (max-width: 430px) {
  .popup-overlay:has(.popup.game-info-popup.game-info-popup-sim) {
    padding: 8px;
  }

  .popup.game-info-popup.game-info-popup-sim {
    min-height: calc(100vh - 16px);
    padding: 18px 13px 16px;
    border-radius: 22px;
  }

  .popup.game-info-popup.game-info-popup-sim .popup-message {
    padding-right: 2px;
  }

  .game-info-content-sim .game-info-lead {
    font-size: 0.9rem;
  }

  .game-info-tab-btn {
    min-height: 40px;
    font-size: 0.86rem;
    padding: 9px 8px;
  }

  .sim-info-card-deck-mini {
    grid-template-columns: 1fr;
  }

  .sim-info-scene-cards {
    min-height: 356px;
  }

  .sim-info-stat-card-mini {
    min-height: 88px;
  }
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-tabbar {
  background: transparent;
  border: 0;
  box-shadow: none;
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-tab-btn {
  border: 1px solid rgba(96, 143, 219, 0.22);
  background: rgba(15, 24, 40, 0.6);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-tab-btn.is-active {
  background: linear-gradient(180deg, rgba(39, 61, 100, 0.98) 0%, rgba(24, 40, 72, 0.98) 100%);
}

/* ===== game4 info popup mobile tab layout hotfix ===== */
@media (max-width: 760px) and (pointer: coarse) {
  .popup.game-info-popup.game-info-popup-sim .game-info-tabbar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  .popup.game-info-popup.game-info-popup-sim .game-info-tab-btn {
    flex: 1 1 0;
    min-width: 0;
    width: calc(50% - 4px);
    white-space: nowrap;
  }
}

/* ===== game4 info popup tab pressed / raised state refinement ===== */
.popup.game-info-popup.game-info-popup-sim .game-info-tabbar {
  align-items: stretch;
}

.popup.game-info-popup.game-info-popup-sim .game-info-tab-btn {
  position: relative;
  transform: translateY(-2px);
  background:
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.62), transparent 46%),
    linear-gradient(180deg, rgba(255, 251, 247, 0.98) 0%, rgba(255, 241, 229, 0.98) 100%);
  border: 1px solid rgba(255, 220, 201, 0.92);
  color: #8c6650;
  box-shadow:
    0 12px 18px rgba(111, 83, 67, 0.14),
    0 4px 0 rgba(228, 191, 165, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease;
}

.popup.game-info-popup.game-info-popup-sim .game-info-tab-btn:hover:not(.is-active) {
  transform: translateY(-3px);
  box-shadow:
    0 14px 20px rgba(111, 83, 67, 0.16),
    0 5px 0 rgba(228, 191, 165, 0.96),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.popup.game-info-popup.game-info-popup-sim .game-info-tab-btn.is-active {
  transform: translateY(1px);
  background:
    linear-gradient(180deg, rgba(255, 229, 209, 0.98) 0%, rgba(255, 214, 185, 0.98) 100%);
  border-color: rgba(232, 178, 145, 0.98);
  color: #734b37;
  box-shadow:
    inset 0 3px 10px rgba(201, 140, 108, 0.22),
    inset 0 1px 0 rgba(255, 247, 241, 0.9),
    0 3px 6px rgba(111, 83, 67, 0.1);
}

.popup.game-info-popup.game-info-popup-sim .game-info-tab-btn.is-active:hover {
  transform: translateY(1px);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-tab-btn {
  transform: translateY(-2px);
  border: 1px solid rgba(111, 166, 255, 0.26);
  background:
    radial-gradient(circle at top center, rgba(153, 208, 255, 0.14), transparent 44%),
    linear-gradient(180deg, rgba(24, 39, 67, 0.96) 0%, rgba(14, 25, 46, 0.98) 100%);
  color: #d8e9ff;
  box-shadow:
    0 14px 22px rgba(0, 0, 0, 0.28),
    0 4px 0 rgba(17, 33, 61, 0.92),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-tab-btn:hover:not(.is-active) {
  transform: translateY(-3px);
  box-shadow:
    0 16px 24px rgba(0, 0, 0, 0.32),
    0 5px 0 rgba(18, 36, 66, 0.98),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-tab-btn.is-active {
  transform: translateY(1px);
  border-color: rgba(122, 180, 255, 0.24);
  background:
    radial-gradient(circle at top center, rgba(126, 190, 255, 0.1), transparent 44%),
    linear-gradient(180deg, rgba(18, 31, 57, 0.98) 0%, rgba(11, 20, 39, 1) 100%);
  color: #f4f9ff;
  box-shadow:
    inset 0 3px 12px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 3px 7px rgba(0, 0, 0, 0.18);
}

html.theme-dark .popup.game-info-popup.game-info-popup-sim .game-info-tab-btn.is-active:hover {
  transform: translateY(1px);
}


/* =========================
   game6 : stock game
========================= */

.stock-card-screen {
  padding: 20px;
}

.stock-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 16px;
  min-height: 720px;
}

.stock-sidebar {
  min-width: 0;
  background: rgba(255, 255, 255, 0.34);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
}

.stock-sidebar-inner {
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stock-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stock-main-header,
.stock-panel-head,
.stock-setup-head,
.stock-live-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.stock-setup-card,
.stock-live-card,
.stock-panel,
.stock-market-preview-card,
.stock-allocation-card {
  background: rgba(255, 255, 255, 0.42);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 26px;
  box-shadow: 0 14px 28px rgba(120, 90, 70, 0.08);
}

.stock-setup-card,
.stock-live-card,
.stock-panel {
  padding: 18px;
}

.stock-duration-card {
  margin-top: 14px;
}

.stock-duration-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stock-duration-row input[type="range"] {
  flex: 1 1 auto;
  accent-color: #f7b9c8;
}

.stock-duration-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--soft-brown);
  font-weight: 800;
}

.stock-player-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.stock-player-summary-item {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  border: 2px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.05);
}

.stock-player-summary-item.is-active {
  border-color: rgba(242, 136, 75, 0.34);
  box-shadow: 0 10px 22px rgba(242, 136, 75, 0.15);
}

.stock-player-summary-item.is-ready {
  background: linear-gradient(180deg, rgba(244, 255, 248, 0.94) 0%, rgba(232, 251, 239, 0.96) 100%);
}

.stock-player-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stock-player-summary-sub {
  margin-top: 6px;
  color: #8b7366;
  line-height: 1.5;
  font-size: 0.92rem;
}

.stock-player-summary-badge,
.stock-ready-badge,
.stock-timer-badge,
.stock-roster-badge,
.stock-sector-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  border: 2px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.07);
}

.stock-player-summary-badge.is-ready,
.stock-ready-badge.is-ready,
.stock-allocation-total.is-ready {
  background: linear-gradient(180deg, rgba(237, 255, 247, 0.98) 0%, rgba(214, 248, 229, 0.96) 100%);
  color: #44745a;
}

.stock-player-summary-badge.is-pending,
.stock-ready-badge,
.stock-timer-badge,
.stock-allocation-total {
  background: linear-gradient(180deg, rgba(255, 250, 245, 0.98) 0%, rgba(255, 241, 233, 0.96) 100%);
  color: #8d6f52;
}

.stock-timer-badge.is-live {
  background: linear-gradient(180deg, rgba(232, 246, 255, 0.98) 0%, rgba(214, 236, 255, 0.96) 100%);
  color: #4c6d8f;
}

.stock-setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.stock-market-preview-card,
.stock-allocation-card {
  padding: 16px;
}

.stock-player-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.stock-player-tab {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-width: 128px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.05);
  color: var(--brown);
}

.stock-player-tab strong {
  font-size: 0.98rem;
}

.stock-player-tab span {
  font-size: 0.82rem;
  color: #8b7366;
}

.stock-player-tab.is-active {
  border-color: rgba(242, 136, 75, 0.38);
  transform: translateY(-1px);
}

.stock-player-tab.is-ready {
  background: linear-gradient(180deg, rgba(244, 255, 248, 0.94) 0%, rgba(232, 251, 239, 0.96) 100%);
}

.stock-roster {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.stock-roster-card,
.stock-chart-card,
.stock-portfolio-card,
.stock-ranking-item {
  background: rgba(255, 255, 255, 0.84);
  border: 2px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.05);
}

.stock-roster-card {
  padding: 14px;
  border-radius: 20px;
}

.stock-roster-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.stock-roster-head strong {
  font-size: 1.03rem;
  color: var(--soft-brown);
}

.stock-roster-price {
  font-family: 'Gaegu', cursive;
  font-size: 1.7rem;
  color: var(--soft-brown);
}

.stock-roster-trait {
  margin-top: 6px;
  font-weight: 700;
  color: #8b7366;
}

.stock-roster-desc {
  margin-top: 6px;
  color: #8b7366;
  line-height: 1.55;
  font-size: 0.9rem;
}

.stock-allocation-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.stock-active-player-title {
  font-family: 'Gaegu', cursive;
  font-size: 1.9rem;
  color: var(--soft-brown);
}

.stock-allocation-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 250, 245, 0.84);
  border: 2px solid rgba(255, 255, 255, 0.78);
}

.stock-allocation-row.is-filled {
  box-shadow: inset 0 0 0 1px rgba(242, 136, 75, 0.12);
}

.stock-allocation-slot-label {
  font-weight: 800;
  color: #9b7d6b;
}

.stock-allocation-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 170px);
  gap: 10px;
  align-items: center;
}

.stock-select,
.stock-amount-input {
  width: 100%;
  min-width: 0;
  border: 2px solid #eadfd4;
  background: #fffdfa;
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--brown);
}

.stock-select {
  min-height: 52px;
}

.stock-amount-input {
  text-align: right;
  font-weight: 700;
}

.stock-amount-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.stock-allocation-summary {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.stock-allocation-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.78);
}

.stock-allocation-total strong {
  font-weight: 800;
}

.stock-allocation-total.is-remaining {
  background: linear-gradient(180deg, rgba(255, 248, 230, 0.96) 0%, rgba(255, 239, 199, 0.92) 100%);
  color: #7c5c2d;
}

.stock-allocation-total.is-danger {
  background: linear-gradient(180deg, rgba(255, 245, 241, 0.98) 0%, rgba(255, 231, 221, 0.96) 100%);
  color: #995e54;
}

.stock-allocation-note {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  color: #8b7366;
  line-height: 1.55;
}

.stock-allocation-note.is-ready {
  background: linear-gradient(180deg, rgba(244, 255, 248, 0.94) 0%, rgba(232, 251, 239, 0.96) 100%);
  color: #44745a;
}

.stock-turn-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stock-turn-btn,
.stock-sell-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  color: var(--brown);
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(180deg, rgba(248, 255, 252, 0.98) 0%, rgba(228, 246, 255, 0.96) 100%);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.08);
}

.stock-turn-btn:disabled,
.stock-sell-btn:disabled,
.stock-setup-locked .stock-player-tab,
.stock-setup-locked .stock-select,
.stock-setup-locked .stock-amount-input {
  opacity: 0.55;
  cursor: not-allowed;
}


@media (max-width: 1180px) {
  .stock-allocation-controls {
    grid-template-columns: 1fr;
  }

  .stock-amount-wrap {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

.stock-live-card {
  position: relative;
}

.stock-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.stock-chart-card {
  padding: 14px;
  border-radius: 22px;
}

.stock-chart-head,
.stock-portfolio-head,
.stock-ranking-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.stock-chart-head h4,
.stock-portfolio-head h4 {
  font-size: 1.1rem;
  color: var(--soft-brown);
}

.stock-chart-price-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
}

.stock-chart-price-block strong {
  font-family: 'Gaegu', cursive;
  font-size: 1.4rem;
  color: var(--soft-brown);
}

.stock-chart-price-block span,
.stock-portfolio-head p,
.stock-portfolio-cash,
.stock-chart-note,
.stock-holder-row small,
.stock-ranking-main span {
  color: #8b7366;
  line-height: 1.45;
}

.stock-chart-price-block.is-up span,
.stock-holder-row.is-profit em,
.stock-portfolio-profit.is-profit,
.stock-ranking-profit.is-profit,
.stock-results-popup-item em.is-profit {
  color: #2f8c63;
}

.stock-chart-price-block.is-down span,
.stock-holder-row.is-loss em,
.stock-portfolio-profit.is-loss,
.stock-ranking-profit.is-loss,
.stock-results-popup-item em.is-loss {
  color: #c55555;
}

.stock-chart-shell {
  margin-top: 12px;
  height: 156px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.12) 100%),
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.34) 0px,
      rgba(255,255,255,0.34) 1px,
      transparent 1px,
      transparent 24px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255,255,255,0.24) 0px,
      rgba(255,255,255,0.24) 1px,
      transparent 1px,
      transparent 26px
    );
  overflow: hidden;
}

.stock-chart-shell svg {
  width: 100%;
  height: 100%;
}

.stock-chart-line {
  fill: none;
  stroke: rgba(140, 88, 69, 0.95);
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stock-chart-holders,
.stock-holdings-list,
.stock-ranking-list,
.stock-portfolio-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stock-chart-holders {
  margin-top: 12px;
}

.stock-holder-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.stock-holder-row strong,
.stock-ranking-main strong {
  color: var(--soft-brown);
}

.stock-holder-row em {
  font-style: normal;
  font-weight: 800;
  justify-self: end;
}

.stock-holder-row.is-sold {
  opacity: 0.8;
}

.stock-holder-empty,
.stock-empty-state {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  color: #8b7366;
  line-height: 1.55;
}

.stock-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 14px;
}

.stock-portfolio-card {
  padding: 14px;
  border-radius: 20px;
}

.stock-portfolio-profit {
  font-weight: 900;
}

.stock-holding-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
}

.stock-holding-chip.is-sold {
  background: rgba(246, 241, 235, 0.9);
}

.stock-holding-meta {
  display: grid;
  gap: 3px;
}

.stock-holding-meta strong {
  color: var(--soft-brown);
}

.stock-holding-meta span {
  color: #8b7366;
  font-size: 0.9rem;
}

.stock-holding-meta em {
  font-style: normal;
  font-weight: 800;
}

.stock-ranking-item {
  padding: 12px 14px;
  border-radius: 18px;
  align-items: center;
}

.stock-ranking-item.top {
  background: linear-gradient(180deg, rgba(255, 248, 223, 0.98) 0%, rgba(255, 241, 190, 0.96) 100%);
}

.stock-ranking-num {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--lavender), var(--sky));
  font-family: 'Gaegu', cursive;
  font-size: 1.3rem;
  font-weight: 700;
}

.stock-ranking-main {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 4px;
}

.stock-ranking-profit {
  font-weight: 900;
}

.stock-results-popup .popup-message {
  max-height: min(66vh, 640px);
  overflow-y: auto;
}

.stock-results-popup-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stock-results-popup-item {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 22px rgba(120, 90, 70, 0.08);
}

.stock-results-popup-item strong {
  color: var(--soft-brown);
  font-size: 1.06rem;
}

.stock-results-popup-item span {
  color: #8b7366;
}

.stock-results-popup-item em {
  font-style: normal;
  font-weight: 900;
}

.stock-results-popup-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff8df 0%, #fff0be 100%);
  color: #8a6b41;
  font-weight: 900;
}

.stock-chart-card.sector-medical,
.stock-roster-card.sector-medical { background: linear-gradient(180deg, rgba(245,255,249,0.94) 0%, rgba(233,249,240,0.96) 100%); }
.stock-chart-card.sector-tech,
.stock-roster-card.sector-tech { background: linear-gradient(180deg, rgba(245,249,255,0.94) 0%, rgba(231,240,255,0.96) 100%); }
.stock-chart-card.sector-food,
.stock-roster-card.sector-food { background: linear-gradient(180deg, rgba(255,252,242,0.94) 0%, rgba(255,247,225,0.96) 100%); }
.stock-chart-card.sector-beauty,
.stock-roster-card.sector-beauty { background: linear-gradient(180deg, rgba(255,245,249,0.94) 0%, rgba(255,234,243,0.96) 100%); }
.stock-chart-card.sector-leisure,
.stock-roster-card.sector-leisure { background: linear-gradient(180deg, rgba(255,246,240,0.94) 0%, rgba(255,236,226,0.96) 100%); }
.stock-chart-card.sector-coin,
.stock-roster-card.sector-coin { background: linear-gradient(180deg, rgba(247,244,255,0.94) 0%, rgba(236,231,255,0.96) 100%); }

.stock-mobile-back-wrap {
  display: none;
}

@media (max-width: 1180px) {
  .stock-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .stock-setup-grid,
  .stock-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #game6Screen .stock-card-screen {
    padding: 12px;
  }

  #game6Screen .stock-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  #game6Screen .stock-main {
    display: contents;
  }

  #game6Screen .stock-main-header {
    order: 1;
    padding: 20px 18px;
    border-radius: 28px;
    background: rgba(255, 249, 244, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
  }

  #game6Screen .stock-main-header .game-header-actions {
    display: none;
  }

  #game6Screen .stock-sidebar {
    order: 2;
    border-radius: 28px;
  }

  #game6Screen .stock-sidebar-inner,
  #game6Screen .stock-setup-card,
  #game6Screen .stock-live-card,
  #game6Screen .stock-panel,
  #game6Screen .stock-market-preview-card,
  #game6Screen .stock-allocation-card {
    padding: 16px;
  }

  #game6Screen .stock-roster {
    grid-template-columns: 1fr;
  }

  #game6Screen .stock-allocation-row {
    grid-template-columns: 1fr;
  }

  #game6Screen .stock-board {
    grid-template-columns: 1fr;
  }

  #game6Screen .stock-holder-row {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  #game6Screen .stock-holding-chip {
    grid-template-columns: 1fr;
  }

  #game6Screen .stock-turn-actions {
    grid-template-columns: 1fr;
  }

  #game6Screen .stock-mobile-back-wrap {
    display: block;
    margin-top: 12px;
  }

  #game6Screen .stock-mobile-back-btn {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    min-height: 54px;
    border-radius: 999px;
    font-size: 1rem;
  }
}

html.theme-dark .stock-sidebar,
html.theme-dark .stock-setup-card,
html.theme-dark .stock-live-card,
html.theme-dark .stock-panel,
html.theme-dark .stock-market-preview-card,
html.theme-dark .stock-allocation-card,
html.theme-dark .stock-roster-card,
html.theme-dark .stock-chart-card,
html.theme-dark .stock-portfolio-card,
html.theme-dark .stock-ranking-item,
html.theme-dark .stock-player-summary-item,
html.theme-dark .stock-allocation-row,
html.theme-dark .stock-holder-row,
html.theme-dark .stock-holding-chip,
html.theme-dark .stock-results-popup-item,
html.theme-dark #game6Screen .stock-main-header {
  background: rgba(32, 35, 46, 0.92);
  border-color: rgba(118, 130, 161, 0.3);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

html.theme-dark .stock-player-tab,
html.theme-dark .stock-ready-badge,
html.theme-dark .stock-timer-badge,
html.theme-dark .stock-roster-badge,
html.theme-dark .stock-sector-chip,
html.theme-dark .stock-allocation-total,
html.theme-dark .stock-turn-btn,
html.theme-dark .stock-sell-btn,
html.theme-dark .stock-player-summary-badge,
html.theme-dark .stock-duration-value,
html.theme-dark .stock-results-popup-rank {
  background: rgba(48, 55, 75, 0.92);
  border-color: rgba(118, 130, 161, 0.34);
  color: #f2eee7;
}

html.theme-dark .stock-select,
html.theme-dark .stock-amount-input {
  background: rgba(19, 22, 31, 0.94);
  border-color: rgba(118, 130, 161, 0.36);
  color: #f2eee7;
}

html.theme-dark .stock-allocation-controls {
  gap: 10px;
}

html.theme-dark .stock-allocation-total.is-total {
  background: linear-gradient(180deg, rgba(43, 49, 68, 0.96) 0%, rgba(34, 39, 58, 0.94) 100%);
  border-color: rgba(118, 130, 161, 0.28);
  color: #eef2ff;
}

html.theme-dark .stock-allocation-total.is-remaining {
  background: linear-gradient(180deg, rgba(70, 58, 28, 0.98) 0%, rgba(55, 43, 20, 0.96) 100%);
  border-color: rgba(226, 190, 95, 0.34);
  color: #fff3c4;
}

html.theme-dark .stock-allocation-total.is-remaining strong {
  color: #fff8de;
}

html.theme-dark .stock-main-header h2,
html.theme-dark .stock-panel-head h3,
html.theme-dark .stock-live-head h3,
html.theme-dark .stock-setup-head h3,
html.theme-dark .stock-active-player-title,
html.theme-dark .stock-roster-head strong,
html.theme-dark .stock-chart-head h4,
html.theme-dark .stock-portfolio-head h4,
html.theme-dark .stock-ranking-main strong,
html.theme-dark .stock-results-popup-item strong {
  color: #f6efe6;
}

html.theme-dark .stock-player-summary-sub,
html.theme-dark .stock-roster-desc,
html.theme-dark .stock-roster-trait,
html.theme-dark .stock-chart-note,
html.theme-dark .stock-chart-price-block span,
html.theme-dark .stock-portfolio-head p,
html.theme-dark .stock-portfolio-cash,
html.theme-dark .stock-holding-meta span,
html.theme-dark .stock-holder-row small,
html.theme-dark .stock-empty-state,
html.theme-dark .stock-holder-empty,
html.theme-dark .stock-ranking-main span,
html.theme-dark .stock-results-popup-item span,
html.theme-dark .stock-player-tab span,
html.theme-dark .stock-allocation-note {
  color: #c8cde2;
}

html.theme-dark .stock-chart-shell {
  background:
    linear-gradient(180deg, rgba(8, 11, 18, 0.88) 0%, rgba(17, 22, 32, 0.94) 100%),
    repeating-linear-gradient(
      0deg,
      rgba(106, 121, 154, 0.18) 0px,
      rgba(106, 121, 154, 0.18) 1px,
      transparent 1px,
      transparent 24px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(106, 121, 154, 0.16) 0px,
      rgba(106, 121, 154, 0.16) 1px,
      transparent 1px,
      transparent 26px
    );
}

html.theme-dark .stock-chart-line {
  stroke: #f2c978;
}

html.theme-dark .stock-player-tab.is-ready,
html.theme-dark .stock-player-summary-item.is-ready,
html.theme-dark .stock-ready-badge.is-ready,
html.theme-dark .stock-allocation-total.is-ready,
html.theme-dark .stock-allocation-note.is-ready {
  background: rgba(29, 72, 56, 0.9);
  color: #ddf5ea;
}

html.theme-dark .stock-allocation-total.is-danger,
html.theme-dark .stock-player-summary-badge.is-pending {
  background: rgba(86, 44, 49, 0.92);
  color: #ffe3e0;
}

html.theme-dark .stock-chart-price-block.is-up span,
html.theme-dark .stock-holder-row.is-profit em,
html.theme-dark .stock-portfolio-profit.is-profit,
html.theme-dark .stock-ranking-profit.is-profit,
html.theme-dark .stock-results-popup-item em.is-profit {
  color: #7de4b7;
}

html.theme-dark .stock-chart-price-block.is-down span,
html.theme-dark .stock-holder-row.is-loss em,
html.theme-dark .stock-portfolio-profit.is-loss,
html.theme-dark .stock-ranking-profit.is-loss,
html.theme-dark .stock-results-popup-item em.is-loss {
  color: #ff9a9a;
}


/* =========================
   performance tuning
========================= */
body.app-active-game .background-deco {
  animation: none;
  filter: none;
  opacity: 0.24;
}

body.app-active-game .card,
body.app-active-game .popup,
body.app-active-game .game-ff-badge,
body.app-active-game .orientation-lock-overlay {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.race-ranking-list,
.battle-table,
.sim-health-overlay,
#stockBoard,
#stockPortfolioList,
#stockRankingList,
#navalBoardWrap {
  contain: layout paint;
}

.sim-ball-label,
.race-horse,
.app-cursor {
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .background-deco,
  .race-horse.horse-finished,
  .race-horse.horse-finished::after,
  .game-canvas-wrap.is-fast-forwarding::after,
  .race-track-wrap.is-fast-forwarding::after,
  .sim-arena-wrap.is-fast-forwarding::after,
  .sim-arena-zoom-stage.is-fast-forwarding::after,
  .game-canvas-wrap.is-fast-forward-blocked::after,
  .race-track-wrap.is-fast-forward-blocked::after,
  .sim-arena-wrap.is-fast-forward-blocked::after,
  .sim-arena-zoom-stage.is-fast-forward-blocked::after {
    animation: none !important;
  }
}


/* =========================
   stock game overhaul
========================= */
.stock-card-screen.stock-view-setup .stock-live-card,
.stock-card-screen.stock-view-setup .stock-bottom-grid {
  display: none;
}

.stock-card-screen.stock-view-live .stock-setup-card {
  display: none;
}

.stock-roster {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stock-roster-card-btn {
  appearance: none;
  width: 100%;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.stock-roster-card-btn:hover {
  transform: translateY(-2px);
}

.stock-roster-card-btn.is-selected {
  border-color: rgba(242, 136, 75, 0.42);
  box-shadow: 0 12px 24px rgba(242, 136, 75, 0.12);
}

.stock-roster-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.stock-roster-select-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.78);
  color: var(--soft-brown);
  font-size: 0.78rem;
  font-weight: 900;
  border: 1px solid rgba(255,255,255,0.8);
}

.stock-roster-card-btn.is-selected .stock-roster-select-state {
  background: linear-gradient(180deg, rgba(255, 243, 233, 0.98) 0%, rgba(255, 232, 215, 0.96) 100%);
  color: #8d5a42;
}

.stock-roster-card .stock-roster-head {
  margin-bottom: 10px;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stock-roster-card .stock-roster-price {
  font-family: 'Pretendard', sans-serif;
  font-size: 0.98rem;
  font-weight: 900;
}

.stock-roster-desc {
  min-height: 2.9em;
}

.stock-allocation-editor {
  gap: 14px;
}

.stock-empty-state-setup strong {
  color: var(--soft-brown);
}

.stock-picked-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 22px rgba(120, 90, 70, 0.06);
}

.stock-picked-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stock-picked-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.78);
  color: #8a6b52;
  font-size: 0.78rem;
  font-weight: 900;
}

.stock-picked-name {
  margin-top: 8px;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--soft-brown);
}

.stock-picked-trait {
  margin-top: 4px;
  color: #8b7366;
  font-size: 0.9rem;
}

.stock-picked-remove-btn,
.stock-fill-btn,
.stock-chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.88);
  background: rgba(255,255,255,0.82);
  color: var(--brown);
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.06);
}

.stock-picked-remove-btn {
  min-width: 64px;
  background: linear-gradient(180deg, rgba(255,245,241,0.98) 0%, rgba(255,231,221,0.96) 100%);
  color: #995e54;
}

.stock-picked-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.72);
}

.stock-picked-price-row span {
  color: #8b7366;
}

.stock-picked-price-row strong {
  color: var(--soft-brown);
  font-size: 1.02rem;
}

.stock-quick-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.stock-chip-btn {
  min-height: 40px;
  padding: 8px 6px;
}

.stock-manwon-input-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.stock-manwon-label {
  font-weight: 900;
  color: #9b7d6b;
}

.stock-manwon-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.stock-amount-input-manwon {
  text-align: right;
  font-size: 1rem;
  font-weight: 900;
}

.stock-picked-meta {
  color: #8b7366;
  font-size: 0.9rem;
  line-height: 1.5;
}

.stock-allocation-chip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stock-helper-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stock-live-head .sub-text,
.stock-panel-head .sub-text,
.stock-setup-head .sub-text {
  max-width: 560px;
}

@media (max-width: 1180px) {
  .stock-roster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-allocation-chip-grid,
  .stock-helper-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .stock-card-screen.stock-view-live .stock-setup-card {
    display: none;
  }

  #game6Screen .stock-roster {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stock-roster-card .stock-roster-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .stock-quick-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stock-manwon-input-row {
    grid-template-columns: 1fr;
  }

  .stock-manwon-control {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 560px) {
  #game6Screen .stock-roster {
    grid-template-columns: 1fr;
  }
}

html.theme-dark .stock-roster-card-btn.is-selected {
  border-color: rgba(242, 136, 75, 0.44);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(242, 136, 75, 0.18) inset;
}

html.theme-dark .stock-roster-select-state,
html.theme-dark .stock-picked-badge,
html.theme-dark .stock-picked-price-row,
html.theme-dark .stock-chip-btn,
html.theme-dark .stock-picked-remove-btn,
html.theme-dark .stock-fill-btn,
html.theme-dark .stock-picked-card {
  background: rgba(33, 39, 56, 0.94);
  border-color: rgba(118, 130, 161, 0.34);
  color: #eef2ff;
}

html.theme-dark .stock-picked-card,
html.theme-dark .stock-roster-card-btn {
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
}

html.theme-dark .stock-picked-name,
html.theme-dark .stock-picked-price-row strong {
  color: #f6efe6;
}

html.theme-dark .stock-picked-trait,
html.theme-dark .stock-picked-meta,
html.theme-dark .stock-picked-price-row span,
html.theme-dark .stock-empty-state-setup strong,
html.theme-dark .stock-manwon-label {
  color: #c8cde2;
}

html.theme-dark .stock-roster-card-btn.is-selected .stock-roster-select-state {
  background: rgba(95, 64, 39, 0.96);
  color: #ffe8cb;
  border-color: rgba(226, 190, 95, 0.28);
}

.stock-picked-card.sector-medical,
.stock-roster-card-btn.sector-medical {
  background: linear-gradient(180deg, rgba(242,255,248,0.96) 0%, rgba(227,247,237,0.98) 100%);
}
.stock-picked-card.sector-tech,
.stock-roster-card-btn.sector-tech {
  background: linear-gradient(180deg, rgba(244,248,255,0.96) 0%, rgba(228,239,255,0.98) 100%);
}
.stock-picked-card.sector-food,
.stock-roster-card-btn.sector-food {
  background: linear-gradient(180deg, rgba(255,251,240,0.96) 0%, rgba(255,246,224,0.98) 100%);
}
.stock-picked-card.sector-beauty,
.stock-roster-card-btn.sector-beauty {
  background: linear-gradient(180deg, rgba(255,244,249,0.96) 0%, rgba(255,231,241,0.98) 100%);
}
.stock-picked-card.sector-leisure,
.stock-roster-card-btn.sector-leisure {
  background: linear-gradient(180deg, rgba(255,245,239,0.96) 0%, rgba(255,234,224,0.98) 100%);
}
.stock-picked-card.sector-coin,
.stock-roster-card-btn.sector-coin {
  background: linear-gradient(180deg, rgba(246,243,255,0.96) 0%, rgba(234,229,255,0.98) 100%);
}

html.theme-dark .stock-picked-card.sector-medical,
html.theme-dark .stock-roster-card-btn.sector-medical {
  background: linear-gradient(180deg, rgba(23,58,49,0.94) 0%, rgba(20,44,40,0.96) 100%);
}
html.theme-dark .stock-picked-card.sector-tech,
html.theme-dark .stock-roster-card-btn.sector-tech {
  background: linear-gradient(180deg, rgba(24,39,67,0.94) 0%, rgba(18,29,51,0.96) 100%);
}
html.theme-dark .stock-picked-card.sector-food,
html.theme-dark .stock-roster-card-btn.sector-food {
  background: linear-gradient(180deg, rgba(63,56,28,0.94) 0%, rgba(48,42,21,0.96) 100%);
}
html.theme-dark .stock-picked-card.sector-beauty,
html.theme-dark .stock-roster-card-btn.sector-beauty {
  background: linear-gradient(180deg, rgba(69,34,53,0.94) 0%, rgba(52,25,40,0.96) 100%);
}
html.theme-dark .stock-picked-card.sector-leisure,
html.theme-dark .stock-roster-card-btn.sector-leisure {
  background: linear-gradient(180deg, rgba(73,42,29,0.94) 0%, rgba(56,31,21,0.96) 100%);
}
html.theme-dark .stock-picked-card.sector-coin,
html.theme-dark .stock-roster-card-btn.sector-coin {
  background: linear-gradient(180deg, rgba(50,38,73,0.94) 0%, rgba(38,29,56,0.96) 100%);
}


/* =========================
   stock game cleanup 2
========================= */
.stock-layout {
  grid-template-columns: minmax(272px, 300px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.stock-main-header {
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 24px;
  background: rgba(255, 250, 246, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 22px rgba(120, 90, 70, 0.06);
}

.stock-main-header > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.stock-main-header h2 {
  margin-bottom: 6px;
}

.stock-main-header .sub-text {
  max-width: 760px;
}

.stock-setup-grid {
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  align-items: start;
}

.stock-market-preview-card,
.stock-allocation-card,
.stock-live-card,
.stock-panel,
.stock-setup-card,
.stock-sidebar,
.stock-main-header {
  backdrop-filter: blur(12px);
}

.stock-sidebar-inner,
.stock-setup-card,
.stock-live-card,
.stock-panel,
.stock-market-preview-card,
.stock-allocation-card {
  overflow: hidden;
}

.stock-player-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stock-player-tab {
  min-width: 0;
  min-height: 72px;
  align-items: flex-start;
  justify-content: center;
  border-radius: 20px;
}

.stock-player-tab strong,
.stock-player-summary-top strong,
.stock-chart-head h4,
.stock-portfolio-head h4,
.stock-ranking-main strong,
.stock-picked-name,
.stock-roster-head strong {
  word-break: keep-all;
}

.stock-roster {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stock-roster-card {
  padding: 14px 14px 13px;
  border-radius: 22px;
}

.stock-roster-card-btn {
  min-height: 154px;
}

.stock-roster-head {
  gap: 8px;
}

.stock-roster-card .stock-roster-head {
  align-items: flex-start;
}

.stock-roster-head strong {
  flex: 1 1 auto;
  font-size: 1.02rem;
  line-height: 1.28;
  letter-spacing: -0.02em;
}

.stock-roster-card .stock-roster-price {
  flex: 0 0 auto;
  font-size: 1rem;
  line-height: 1.1;
}

.stock-roster-trait {
  font-size: 0.9rem;
  line-height: 1.4;
}

.stock-roster-desc {
  min-height: 0;
  margin-top: 4px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.stock-roster-select-state {
  min-width: 56px;
}

.stock-allocation-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stock-active-player-title {
  font-size: 1.8rem;
  line-height: 1.1;
}

.stock-allocation-editor {
  margin-top: 0;
}

.stock-picked-card {
  gap: 10px;
  padding: 14px;
  border-radius: 20px;
}

.stock-picked-head {
  align-items: center;
}

.stock-picked-name {
  font-size: 1.04rem;
  line-height: 1.28;
}

.stock-picked-trait,
.stock-picked-meta {
  font-size: 0.86rem;
}

.stock-picked-price-row {
  padding: 10px 12px;
}

.stock-quick-row {
  gap: 6px;
}

.stock-chip-btn,
.stock-fill-btn,
.stock-picked-remove-btn,
.stock-turn-btn {
  min-height: 40px;
}

.stock-chip-btn {
  font-size: 0.84rem;
}

.stock-manwon-input-row {
  grid-template-columns: 46px minmax(0, 1fr) auto;
}

.stock-manwon-control {
  min-width: 0;
}

.stock-allocation-summary {
  margin-top: 4px;
}

.stock-allocation-chip-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stock-allocation-total {
  min-height: 72px;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  padding: 12px 14px;
  gap: 6px;
}

.stock-allocation-total span {
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.2;
}

.stock-allocation-total strong {
  font-size: 1.02rem;
  line-height: 1.15;
}

.stock-allocation-note {
  padding: 14px 15px;
  font-size: 0.92rem;
}

.stock-helper-actions,
.stock-turn-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stock-live-head {
  align-items: center;
}

.stock-board {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stock-chart-card {
  padding: 16px;
}

.stock-chart-head h4,
.stock-portfolio-head h4 {
  font-size: 1.02rem;
  line-height: 1.25;
}

.stock-chart-shell {
  height: 138px;
}

.stock-holder-row {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name state"
    "value value"
    "profit profit";
  gap: 4px 10px;
  align-items: start;
}

.stock-holder-row strong { grid-area: name; }
.stock-holder-row > span { grid-area: state; justify-self: end; }
.stock-holder-row small { grid-area: value; }
.stock-holder-row em { grid-area: profit; justify-self: start; }

.stock-bottom-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.86fr);
}

.stock-portfolio-card,
.stock-ranking-item {
  padding: 14px;
}

.stock-holding-chip {
  grid-template-columns: 1fr;
  gap: 8px;
}

.stock-holding-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stock-holding-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.66);
  color: #7d6151;
  font-size: 0.76rem;
  font-weight: 900;
}

.stock-ranking-item {
  min-height: 74px;
}

.stock-empty-state,
.stock-holder-empty {
  border: 2px dashed rgba(255,255,255,0.72);
}

@media (max-width: 1180px) {
  .stock-layout {
    grid-template-columns: 1fr;
  }

  .stock-setup-grid,
  .stock-bottom-grid {
    grid-template-columns: 1fr;
  }

  .stock-player-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .stock-roster {
    grid-template-columns: 1fr;
  }

  .stock-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #game6Screen .stock-main-header {
    padding: 18px 16px;
  }

  #game6Screen .stock-player-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #game6Screen .stock-roster {
    grid-template-columns: 1fr;
  }

  #game6Screen .stock-roster-card-btn {
    min-height: 132px;
  }

  #game6Screen .stock-allocation-chip-grid,
  #game6Screen .stock-helper-actions,
  #game6Screen .stock-turn-actions {
    grid-template-columns: 1fr;
  }

  #game6Screen .stock-manwon-input-row {
    grid-template-columns: 1fr;
  }

  #game6Screen .stock-live-head {
    align-items: flex-start;
  }
}

html.theme-dark .stock-main-header,
html.theme-dark .stock-sidebar,
html.theme-dark .stock-setup-card,
html.theme-dark .stock-live-card,
html.theme-dark .stock-panel,
html.theme-dark .stock-market-preview-card,
html.theme-dark .stock-allocation-card,
html.theme-dark .stock-roster-card,
html.theme-dark .stock-chart-card,
html.theme-dark .stock-portfolio-card,
html.theme-dark .stock-ranking-item,
html.theme-dark .stock-player-summary-item,
html.theme-dark .stock-picked-card,
html.theme-dark .stock-holder-row,
html.theme-dark .stock-holding-chip,
html.theme-dark .stock-empty-state,
html.theme-dark .stock-holder-empty {
  background: linear-gradient(180deg, rgba(24, 29, 42, 0.96) 0%, rgba(20, 24, 36, 0.96) 100%);
  border-color: rgba(103, 120, 164, 0.24);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

html.theme-dark .stock-player-tab,
html.theme-dark .stock-ready-badge,
html.theme-dark .stock-timer-badge,
html.theme-dark .stock-roster-badge,
html.theme-dark .stock-sector-chip,
html.theme-dark .stock-duration-value,
html.theme-dark .stock-results-popup-rank,
html.theme-dark .stock-roster-select-state,
html.theme-dark .stock-chip-btn,
html.theme-dark .stock-fill-btn,
html.theme-dark .stock-picked-remove-btn,
html.theme-dark .stock-holding-state {
  background: rgba(44, 52, 74, 0.96);
  border-color: rgba(118, 130, 161, 0.28);
  color: #f3f6ff;
}

html.theme-dark .stock-turn-btn {
  background: linear-gradient(180deg, rgba(54, 66, 97, 0.98) 0%, rgba(44, 55, 84, 0.98) 100%);
  border-color: rgba(123, 144, 191, 0.32);
  color: #f5f7ff;
}

html.theme-dark .stock-turn-btn:hover,
html.theme-dark .stock-chip-btn:hover,
html.theme-dark .stock-fill-btn:hover,
html.theme-dark .stock-picked-remove-btn:hover {
  box-shadow: 0 10px 20px rgba(0,0,0,0.26), 0 0 0 1px rgba(140, 164, 216, 0.18) inset;
}

html.theme-dark .stock-select,
html.theme-dark .stock-amount-input {
  background: rgba(10, 14, 22, 0.98);
  border-color: rgba(95, 111, 151, 0.36);
  color: #f5f7ff;
}

html.theme-dark .stock-allocation-total {
  background: linear-gradient(180deg, rgba(35, 42, 61, 0.98) 0%, rgba(28, 35, 52, 0.98) 100%);
  border-color: rgba(103, 120, 164, 0.24);
  color: #eef2ff;
}

html.theme-dark .stock-allocation-total.is-remaining {
  background: linear-gradient(180deg, rgba(89, 71, 28, 0.98) 0%, rgba(67, 53, 21, 0.98) 100%);
  border-color: rgba(226, 190, 95, 0.32);
  color: #fff3c4;
}

html.theme-dark .stock-allocation-total.is-danger {
  background: linear-gradient(180deg, rgba(95, 44, 51, 0.98) 0%, rgba(72, 33, 39, 0.98) 100%);
  border-color: rgba(210, 100, 107, 0.24);
  color: #ffe4e1;
}

html.theme-dark .stock-allocation-note {
  background: linear-gradient(180deg, rgba(27, 34, 51, 0.98) 0%, rgba(22, 28, 42, 0.98) 100%);
  border: 2px solid rgba(103, 120, 164, 0.24);
  color: #dce4ff;
}

html.theme-dark .stock-allocation-note.is-ready {
  background: linear-gradient(180deg, rgba(28, 77, 59, 0.96) 0%, rgba(22, 59, 46, 0.96) 100%);
  border-color: rgba(74, 170, 126, 0.26);
  color: #e6fff1;
}

html.theme-dark .stock-main-header h2,
html.theme-dark .stock-panel-head h3,
html.theme-dark .stock-live-head h3,
html.theme-dark .stock-setup-head h3,
html.theme-dark .stock-active-player-title,
html.theme-dark .stock-roster-head strong,
html.theme-dark .stock-chart-head h4,
html.theme-dark .stock-portfolio-head h4,
html.theme-dark .stock-ranking-main strong,
html.theme-dark .stock-results-popup-item strong,
html.theme-dark .stock-picked-name,
html.theme-dark .stock-picked-price-row strong {
  color: #f7f1ea;
}

html.theme-dark .stock-player-summary-sub,
html.theme-dark .stock-roster-desc,
html.theme-dark .stock-roster-trait,
html.theme-dark .stock-chart-note,
html.theme-dark .stock-chart-price-block span,
html.theme-dark .stock-portfolio-head p,
html.theme-dark .stock-portfolio-cash,
html.theme-dark .stock-holding-meta span,
html.theme-dark .stock-holder-row small,
html.theme-dark .stock-empty-state,
html.theme-dark .stock-holder-empty,
html.theme-dark .stock-ranking-main span,
html.theme-dark .stock-results-popup-item span,
html.theme-dark .stock-player-tab span,
html.theme-dark .stock-picked-trait,
html.theme-dark .stock-picked-meta,
html.theme-dark .stock-picked-price-row span,
html.theme-dark .stock-holding-state,
html.theme-dark .stock-main-header .sub-text,
html.theme-dark .stock-panel .sub-text,
html.theme-dark .stock-setup-card .sub-text,
html.theme-dark .stock-live-card .sub-text {
  color: #cfd7f1;
}

html.theme-dark .stock-main-header .back-btn {
  background: linear-gradient(180deg, rgba(20, 48, 88, 0.98) 0%, rgba(17, 40, 74, 0.98) 100%);
  border: 1px solid rgba(89, 121, 174, 0.24);
  color: #eef4ff;
}

html.theme-dark .stock-chart-shell {
  background:
    linear-gradient(180deg, rgba(8, 11, 18, 0.88) 0%, rgba(15, 20, 31, 0.96) 100%),
    repeating-linear-gradient(
      0deg,
      rgba(106, 121, 154, 0.18) 0px,
      rgba(106, 121, 154, 0.18) 1px,
      transparent 1px,
      transparent 24px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(106, 121, 154, 0.16) 0px,
      rgba(106, 121, 154, 0.16) 1px,
      transparent 1px,
      transparent 26px
    );
}

html.theme-dark .stock-chart-line {
  stroke: #ffcf76;
}

html.theme-dark .stock-player-tab.is-active,
html.theme-dark .stock-player-summary-item.is-active,
html.theme-dark .stock-roster-card-btn.is-selected {
  border-color: rgba(255, 165, 112, 0.46);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.26), 0 0 0 1px rgba(255, 165, 112, 0.18) inset;
}

html.theme-dark .stock-player-tab.is-ready,
html.theme-dark .stock-player-summary-item.is-ready,
html.theme-dark .stock-ready-badge.is-ready,
html.theme-dark .stock-allocation-total.is-ready {
  background: linear-gradient(180deg, rgba(28, 77, 59, 0.96) 0%, rgba(22, 59, 46, 0.96) 100%);
  color: #e8fff2;
}

html.theme-dark .stock-chart-price-block.is-up span,
html.theme-dark .stock-holder-row.is-profit em,
html.theme-dark .stock-portfolio-profit.is-profit,
html.theme-dark .stock-ranking-profit.is-profit,
html.theme-dark .stock-results-popup-item em.is-profit {
  color: #78efb8;
}

html.theme-dark .stock-chart-price-block.is-down span,
html.theme-dark .stock-holder-row.is-loss em,
html.theme-dark .stock-portfolio-profit.is-loss,
html.theme-dark .stock-ranking-profit.is-loss,
html.theme-dark .stock-results-popup-item em.is-loss {
  color: #ff999d;
}

html.theme-dark .stock-picked-card.sector-medical,
html.theme-dark .stock-roster-card-btn.sector-medical {
  background: linear-gradient(180deg, rgba(17, 63, 52, 0.96) 0%, rgba(14, 49, 41, 0.98) 100%);
}

html.theme-dark .stock-picked-card.sector-tech,
html.theme-dark .stock-roster-card-btn.sector-tech {
  background: linear-gradient(180deg, rgba(20, 43, 81, 0.96) 0%, rgba(16, 34, 63, 0.98) 100%);
}

html.theme-dark .stock-picked-card.sector-food,
html.theme-dark .stock-roster-card-btn.sector-food {
  background: linear-gradient(180deg, rgba(84, 73, 25, 0.96) 0%, rgba(64, 54, 18, 0.98) 100%);
}

html.theme-dark .stock-picked-card.sector-beauty,
html.theme-dark .stock-roster-card-btn.sector-beauty {
  background: linear-gradient(180deg, rgba(83, 32, 57, 0.96) 0%, rgba(64, 24, 43, 0.98) 100%);
}

html.theme-dark .stock-picked-card.sector-leisure,
html.theme-dark .stock-roster-card-btn.sector-leisure {
  background: linear-gradient(180deg, rgba(87, 45, 26, 0.96) 0%, rgba(66, 33, 18, 0.98) 100%);
}

html.theme-dark .stock-picked-card.sector-coin,
html.theme-dark .stock-roster-card-btn.sector-coin {
  background: linear-gradient(180deg, rgba(59, 40, 87, 0.96) 0%, rgba(44, 30, 65, 0.98) 100%);
}

/* =========================
   stock duration slider + compact chart tweak
========================= */
.stock-duration-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.stock-duration-row input[type="range"] {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  flex: initial;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  height: 28px;
  --stock-duration-progress: 50%;
}

.stock-duration-row input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #f4b6c8 0%,
    #f4b6c8 var(--stock-duration-progress),
    rgba(125, 97, 81, 0.22) var(--stock-duration-progress),
    rgba(125, 97, 81, 0.22) 100%
  );
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.stock-duration-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: linear-gradient(180deg, #f8cddd 0%, #f2a9c4 100%);
  box-shadow: 0 6px 14px rgba(120, 90, 70, 0.22);
}

.stock-duration-row input[type="range"]::-moz-range-track {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(125, 97, 81, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.stock-duration-row input[type="range"]::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: #f4b6c8;
}

.stock-duration-row input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  background: linear-gradient(180deg, #f8cddd 0%, #f2a9c4 100%);
  box-shadow: 0 6px 14px rgba(120, 90, 70, 0.22);
}

.stock-duration-row input[type="range"]:focus-visible {
  outline: none;
}

.stock-duration-row input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(244, 182, 200, 0.24), 0 6px 14px rgba(120, 90, 70, 0.22);
}

.stock-duration-row input[type="range"]:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 4px rgba(244, 182, 200, 0.24), 0 6px 14px rgba(120, 90, 70, 0.22);
}

.stock-chart-card {
  padding: 13px;
}

.stock-chart-shell {
  height: 116px;
}

@media (max-width: 760px) {
  .stock-chart-shell {
    height: 108px;
  }
}

html.theme-dark .stock-duration-row input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(
    90deg,
    #f2c978 0%,
    #f2c978 var(--stock-duration-progress),
    rgba(116, 131, 171, 0.32) var(--stock-duration-progress),
    rgba(116, 131, 171, 0.32) 100%
  );
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

html.theme-dark .stock-duration-row input[type="range"]::-webkit-slider-thumb {
  border-color: rgba(255, 255, 255, 0.22);
  background: linear-gradient(180deg, #35456a 0%, #29344f 100%);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
}

html.theme-dark .stock-duration-row input[type="range"]::-moz-range-track {
  background: rgba(116, 131, 171, 0.32);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

html.theme-dark .stock-duration-row input[type="range"]::-moz-range-progress {
  background: #f2c978;
}

html.theme-dark .stock-duration-row input[type="range"]::-moz-range-thumb {
  border-color: rgba(255, 255, 255, 0.22);
  background: linear-gradient(180deg, #35456a 0%, #29344f 100%);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
}


/* =========================
   stock game fine-tune : cursor / compact board / red-blue trend
========================= */
@media (pointer: fine) {
  .app-cursor {
    --cursor-scale: 0.8;
    width: 24px;
    height: 24px;
    transition: opacity 0.1s ease, transform 0.03s linear, width 0.12s ease, height 0.12s ease;
  }

  .app-cursor.is-hover {
    --cursor-scale: 1.02;
  }

  .app-cursor.is-press {
    --cursor-scale: 0.9;
  }
}

.stock-live-card {
  padding: 14px;
}

.stock-live-head {
  gap: 12px;
  margin-bottom: 2px;
}

.stock-live-head h3 {
  font-size: 1.08rem;
}

.stock-live-head .sub-text {
  font-size: 0.9rem;
  line-height: 1.5;
}

.stock-board {
  gap: 10px;
  margin-top: 10px;
}

.stock-chart-card {
  padding: 11px;
  border-radius: 18px;
}

.stock-chart-head,
.stock-portfolio-head,
.stock-ranking-item {
  gap: 8px;
}

.stock-chart-head h4,
.stock-portfolio-head h4 {
  font-size: 0.98rem;
  line-height: 1.2;
}

.stock-chart-price-block strong {
  font-size: 1.18rem;
}

.stock-chart-price-block span,
.stock-chart-note,
.stock-holder-row small,
.stock-ranking-main span,
.stock-portfolio-head p,
.stock-portfolio-cash {
  font-size: 0.84rem;
  line-height: 1.4;
}

.stock-chart-shell {
  margin-top: 10px;
  height: 96px;
  border-radius: 14px;
}

.stock-chart-line {
  stroke-width: 2.5;
}

.stock-chart-line.is-up {
  stroke: #dd4b4b;
}

.stock-chart-line.is-down {
  stroke: #3d78e0;
}

.stock-chart-price-block.is-up span,
.stock-holder-row.is-profit em,
.stock-portfolio-profit.is-profit,
.stock-ranking-profit.is-profit,
.stock-results-popup-item em.is-profit {
  color: #dd4b4b;
}

.stock-chart-price-block.is-down span,
.stock-holder-row.is-loss em,
.stock-portfolio-profit.is-loss,
.stock-ranking-profit.is-loss,
.stock-results-popup-item em.is-loss {
  color: #3d78e0;
}

.stock-chart-holders,
.stock-holdings-list,
.stock-ranking-list,
.stock-portfolio-list {
  gap: 8px;
}

.stock-holder-row {
  padding: 8px 10px;
  gap: 4px 8px;
  border-radius: 12px;
}

.stock-panel {
  padding: 14px;
}

.stock-bottom-grid {
  gap: 10px;
}

.stock-ranking-item {
  min-height: 66px;
  padding: 12px;
}

.stock-portfolio-card {
  padding: 12px;
}

.stock-holding-chip {
  gap: 6px;
  padding: 10px 12px;
}

html.theme-dark .stock-chart-line.is-up {
  stroke: #ff6b6b;
}

html.theme-dark .stock-chart-line.is-down {
  stroke: #6aa8ff;
}

html.theme-dark .stock-chart-price-block.is-up span,
html.theme-dark .stock-holder-row.is-profit em,
html.theme-dark .stock-portfolio-profit.is-profit,
html.theme-dark .stock-ranking-profit.is-profit,
html.theme-dark .stock-results-popup-item em.is-profit {
  color: #ff7b7b;
}

html.theme-dark .stock-chart-price-block.is-down span,
html.theme-dark .stock-holder-row.is-loss em,
html.theme-dark .stock-portfolio-profit.is-loss,
html.theme-dark .stock-ranking-profit.is-loss,
html.theme-dark .stock-results-popup-item em.is-loss {
  color: #76adff;
}

@media (max-width: 760px) {
  .stock-chart-shell {
    height: 92px;
  }

  #game6Screen .stock-live-card,
  #game6Screen .stock-panel,
  #game6Screen .stock-market-preview-card,
  #game6Screen .stock-allocation-card {
    padding: 14px;
  }
}

/* =========================
   stock game compact roster + horizontal picked slider
========================= */
.stock-layout {
  grid-template-columns: minmax(268px, 292px) minmax(0, 1fr);
  gap: 14px;
}

.stock-main {
  gap: 12px;
}

.stock-main-header {
  padding: 12px 14px;
}

.stock-main-header .sub-text {
  font-size: 0.93rem;
  line-height: 1.55;
}

.stock-setup-card,
.stock-market-preview-card,
.stock-allocation-card,
.stock-live-card,
.stock-panel {
  padding: 14px;
}

.stock-setup-grid {
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 12px;
  margin-top: 12px;
}

.stock-player-tabs {
  margin-top: 12px;
  gap: 8px;
}

.stock-player-tab {
  min-height: 64px;
  padding: 10px 12px;
}

.stock-player-tab strong {
  font-size: 0.92rem;
}

.stock-player-tab span {
  font-size: 0.76rem;
}

.stock-market-preview-card .stock-panel-head .sub-text,
.stock-setup-head .sub-text {
  font-size: 0.88rem;
  line-height: 1.5;
}

.stock-roster {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.stock-roster-card,
.stock-roster-card-btn {
  min-height: 118px;
  padding: 10px 10px 9px;
  border-radius: 18px;
}

.stock-roster-topline {
  margin-bottom: 6px;
  align-items: flex-start;
}

.stock-roster-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 3px;
  min-height: auto;
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

.stock-roster-emoji {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.stock-roster-badge-text {
  font-size: 0.64rem;
  font-weight: 900;
  color: #8d735f;
  letter-spacing: 0.02em;
}

.stock-roster-select-state {
  min-width: 44px;
  min-height: 26px;
  padding: 4px 8px;
  font-size: 0.7rem;
}

.stock-roster-card .stock-roster-head {
  margin-bottom: 4px;
  gap: 6px;
}

.stock-roster-head strong {
  font-size: 0.88rem;
  line-height: 1.18;
}

.stock-roster-card .stock-roster-price {
  font-size: 0.82rem;
  line-height: 1.05;
}

.stock-roster-trait {
  margin-top: 2px;
  font-size: 0.72rem;
  line-height: 1.3;
}

.stock-roster-desc {
  margin-top: 3px;
  min-height: 0;
  font-size: 0.68rem;
  line-height: 1.3;
}

.stock-active-player-title {
  font-size: 1.5rem;
}

.stock-allocation-editor {
  margin-top: 0;
  gap: 10px;
  overflow: hidden;
}

.stock-picked-carousel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.stock-picked-carousel-hint,
.stock-picked-carousel-count {
  color: #8b7366;
  font-size: 0.8rem;
  line-height: 1.35;
  font-weight: 800;
}

.stock-picked-carousel-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stock-carousel-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  padding: 6px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.86);
  background: rgba(255,255,255,0.86);
  color: var(--brown);
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.06);
}

.stock-picked-carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 100%);
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 2px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.stock-picked-carousel::-webkit-scrollbar {
  display: none;
}

.stock-picked-slide {
  scroll-snap-align: start;
}

.stock-picked-card {
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
}

.stock-picked-badge {
  font-size: 0.72rem;
}

.stock-picked-name {
  margin-top: 6px;
  font-size: 0.98rem;
  line-height: 1.2;
}

.stock-picked-trait,
.stock-picked-meta {
  font-size: 0.8rem;
  line-height: 1.38;
}

.stock-picked-remove-btn,
.stock-fill-btn,
.stock-chip-btn,
.stock-turn-btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.8rem;
}

.stock-picked-price-row {
  padding: 10px 12px;
}

.stock-picked-price-row strong {
  font-size: 0.92rem;
}

.stock-quick-row {
  gap: 6px;
}

.stock-chip-btn {
  min-height: 36px;
  padding: 7px 4px;
}

.stock-manwon-input-row {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px;
}

.stock-manwon-label {
  font-size: 0.8rem;
}

.stock-manwon-control {
  gap: 6px;
}

.stock-amount-input-manwon {
  padding: 10px 12px;
  font-size: 0.92rem;
}

.stock-allocation-summary {
  margin-top: 8px;
}

.stock-allocation-chip-grid {
  gap: 8px;
}

.stock-allocation-total {
  min-height: 64px;
  padding: 10px 12px;
}

.stock-allocation-total span {
  font-size: 0.76rem;
}

.stock-allocation-total strong {
  font-size: 0.94rem;
}

.stock-helper-actions,
.stock-turn-actions {
  gap: 8px;
}

@media (max-width: 1180px) {
  .stock-layout {
    grid-template-columns: 1fr;
  }

  .stock-setup-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .stock-roster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  #game6Screen .stock-sidebar-inner,
  #game6Screen .stock-setup-card,
  #game6Screen .stock-market-preview-card,
  #game6Screen .stock-allocation-card,
  #game6Screen .stock-live-card,
  #game6Screen .stock-panel {
    padding: 12px;
  }

  #game6Screen .stock-main-header {
    padding: 16px 14px;
  }

  #game6Screen .stock-roster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #game6Screen .stock-roster-card,
  #game6Screen .stock-roster-card-btn {
    min-height: 112px;
  }

  #game6Screen .stock-allocation-chip-grid,
  #game6Screen .stock-helper-actions,
  #game6Screen .stock-turn-actions {
    grid-template-columns: 1fr;
  }

  #game6Screen .stock-manwon-input-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  #game6Screen .stock-roster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #game6Screen .stock-roster-emoji {
    font-size: 1.8rem;
  }

  #game6Screen .stock-roster-head strong {
    font-size: 0.82rem;
  }
}

html.theme-dark .stock-roster-badge {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

html.theme-dark .stock-roster-badge-text,
html.theme-dark .stock-picked-carousel-hint,
html.theme-dark .stock-picked-carousel-count {
  color: #c8cde2;
}

html.theme-dark .stock-carousel-nav-btn {
  background: rgba(33, 39, 56, 0.94);
  border-color: rgba(118, 130, 161, 0.34);
  color: #eef2ff;
}


/* stock game tuning: prevent text overflow and keep one picked stock visible at a time */
.stock-roster-card,
.stock-roster-card-btn,
.stock-picked-card {
  min-width: 0;
  overflow: hidden;
}

.stock-roster-topline,
.stock-roster-head,
.stock-picked-head,
.stock-picked-head-main,
.stock-picked-price-row,
.stock-manwon-control {
  min-width: 0;
}

.stock-roster-card .stock-roster-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.stock-roster-head strong,
.stock-picked-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.stock-roster-trait,
.stock-roster-desc,
.stock-picked-trait,
.stock-picked-meta {
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.stock-roster-trait {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.stock-roster-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.stock-roster-card .stock-roster-price {
  white-space: nowrap;
  margin-left: 8px;
}

.stock-picked-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.stock-picked-head-main {
  display: grid;
  gap: 4px;
}

.stock-picked-carousel {
  display: block;
  overflow: hidden;
}

.stock-picked-carousel.is-single-view .stock-picked-slide {
  width: 100%;
}

.stock-picked-card {
  width: 100%;
}

.stock-picked-carousel-toolbar {
  align-items: flex-start;
}

.stock-picked-carousel-count {
  min-width: 64px;
  text-align: center;
}

.stock-picked-price-row strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* stock roster layout refinement: 2 columns x 3 rows, fixed text order */
.stock-roster {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

.stock-roster-card,
.stock-roster-card-btn {
  min-height: 168px !important;
  padding: 12px !important;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 6px;
}

.stock-roster-topline {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px !important;
}

.stock-roster-badge,
.stock-roster-badge-text {
  display: none !important;
}

.stock-roster-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem !important;
  line-height: 1;
  flex: 0 0 auto;
}

.stock-roster-select-state {
  min-width: 50px !important;
  min-height: 28px !important;
  padding: 4px 9px !important;
  font-size: 0.72rem !important;
  flex: 0 0 auto;
}

.stock-roster-head {
  display: none !important;
}

.stock-roster-name {
  width: 100%;
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--soft-brown);
  line-height: 1.24;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.stock-roster-info-line {
  width: 100%;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.stock-roster-info-line > span {
  font-size: 0.72rem;
  font-weight: 800;
  color: #8d735f;
  line-height: 1.35;
}

.stock-roster-info-line > strong {
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--brown);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.stock-roster-price-line > strong {
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stock-roster-trait,
.stock-roster-price {
  display: none !important;
}

.stock-roster-desc {
  width: 100%;
  margin-top: auto !important;
  padding-top: 2px;
  font-size: 0.73rem !important;
  font-weight: 900;
  line-height: 1.3 !important;
  color: #7d6151;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-picked-carousel {
  display: block !important;
  overflow: hidden !important;
}

.stock-picked-carousel.is-single-view .stock-picked-slide {
  width: 100%;
}

.stock-picked-card {
  width: 100%;
}

@media (max-width: 760px) {
  #game6Screen .stock-roster {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #game6Screen .stock-roster-card,
  #game6Screen .stock-roster-card-btn {
    min-height: 160px !important;
  }
}

html.theme-dark .stock-roster-name,
html.theme-dark .stock-roster-info-line > strong,
html.theme-dark .stock-roster-desc {
  color: #eef2ff;
}

html.theme-dark .stock-roster-info-line > span {
  color: #c8cde2;
}

/* stock game final sizing tune: cleaner 2x3 roster + tighter single allocation card */
.stock-setup-grid {
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr) !important;
  align-items: start;
}

.stock-market-preview-card,
.stock-allocation-card {
  padding: 14px !important;
}

.stock-roster {
  gap: 8px !important;
  margin-top: 12px !important;
}

.stock-roster-card,
.stock-roster-card-btn {
  min-height: 154px !important;
  padding: 11px !important;
  gap: 5px !important;
}

.stock-roster-emoji {
  font-size: 2.08rem !important;
}

.stock-roster-name {
  font-size: 1rem !important;
  line-height: 1.2 !important;
  -webkit-line-clamp: 1 !important;
}

.stock-roster-info-line {
  grid-template-columns: 52px minmax(0, 1fr) !important;
  gap: 6px !important;
}

.stock-roster-info-line > span {
  font-size: 0.74rem !important;
  line-height: 1.28 !important;
}

.stock-roster-info-line > strong {
  font-size: 0.82rem !important;
  line-height: 1.28 !important;
  -webkit-line-clamp: 2 !important;
}

.stock-roster-price-line > strong {
  font-size: 0.9rem !important;
}

.stock-roster-desc {
  margin-top: auto !important;
  padding-top: 0 !important;
  font-size: 0.78rem !important;
  line-height: 1.28 !important;
}

.stock-allocation-editor {
  gap: 8px !important;
}

.stock-active-player-title {
  font-size: 1.42rem !important;
  line-height: 1.1 !important;
}

.stock-picked-carousel-toolbar {
  gap: 6px !important;
  margin-bottom: 2px;
}

.stock-picked-carousel-hint,
.stock-picked-carousel-count {
  font-size: 0.76rem !important;
  line-height: 1.25 !important;
}

.stock-carousel-nav-btn {
  min-width: 32px !important;
  min-height: 32px !important;
}

.stock-picked-card {
  padding: 12px !important;
  gap: 7px !important;
  border-radius: 18px !important;
}

.stock-picked-head {
  gap: 8px !important;
}

.stock-picked-badge {
  font-size: 0.7rem !important;
  padding: 6px 10px !important;
}

.stock-picked-name {
  margin-top: 4px !important;
  font-size: 0.96rem !important;
  line-height: 1.18 !important;
  -webkit-line-clamp: 1 !important;
}

.stock-picked-trait,
.stock-picked-meta {
  font-size: 0.76rem !important;
  line-height: 1.28 !important;
}

.stock-picked-price-row {
  padding: 8px 10px !important;
}

.stock-picked-price-row span {
  font-size: 0.74rem !important;
}

.stock-picked-price-row strong {
  font-size: 0.88rem !important;
}

.stock-quick-row {
  gap: 5px !important;
}

.stock-chip-btn,
.stock-fill-btn,
.stock-turn-btn,
.stock-picked-remove-btn {
  min-height: 32px !important;
  padding: 6px 9px !important;
  font-size: 0.78rem !important;
}

.stock-manwon-input-row {
  grid-template-columns: 38px minmax(0, 1fr) auto !important;
  gap: 6px !important;
}

.stock-manwon-label {
  font-size: 0.76rem !important;
}

.stock-manwon-control {
  gap: 5px !important;
}

.stock-amount-input-manwon {
  padding: 9px 10px !important;
  font-size: 0.88rem !important;
}

.stock-allocation-summary {
  margin-top: 6px !important;
  gap: 8px !important;
}

.stock-allocation-chip-grid {
  gap: 7px !important;
}

.stock-allocation-total {
  min-height: 58px !important;
  padding: 9px 11px !important;
}

.stock-allocation-total span {
  font-size: 0.74rem !important;
}

.stock-allocation-total strong {
  font-size: 0.9rem !important;
}

.stock-allocation-note {
  min-height: 50px;
  padding: 11px 12px !important;
  font-size: 0.84rem !important;
  line-height: 1.34 !important;
}

.stock-helper-actions,
.stock-turn-actions {
  gap: 7px !important;
}

@media (max-width: 1280px) {
  .stock-roster-card,
  .stock-roster-card-btn {
    min-height: 148px !important;
  }

  .stock-picked-card {
    padding: 11px !important;
  }
}


/* stock ranking multiline cleanup */
.stock-ranking-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.stock-ranking-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.stock-ranking-main strong,
.stock-ranking-asset,
.stock-ranking-profit {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-ranking-main strong {
  font-size: 1.02rem;
  line-height: 1.1;
}

.stock-ranking-asset {
  white-space: nowrap;
  font-size: 0.94rem;
  font-weight: 800;
  color: #d8e1ff;
  line-height: 1.15;
}

.stock-ranking-profit {
  white-space: nowrap;
  font-style: normal;
  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1.1;
}

html.theme-dark .stock-ranking-asset {
  color: #d6def8;
}


/* =========================
   stock game live ranking + header cleanup
========================= */
.stock-layout {
  min-height: auto !important;
}

.stock-card-screen {
  padding-bottom: 16px !important;
}

.stock-main-header {
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  align-items: flex-start !important;
}

.stock-main {
  gap: 14px !important;
}

.stock-ranking-item {
  padding: 12px 14px !important;
}

.stock-player-summary .stock-ranking-item {
  grid-template-columns: 42px minmax(0, 1fr) !important;
  align-items: start !important;
}

.stock-player-summary .stock-ranking-main,
.stock-ranking-list .stock-ranking-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.stock-player-summary .stock-ranking-main strong,
.stock-ranking-list .stock-ranking-main strong {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-player-summary .stock-ranking-asset,
.stock-ranking-list .stock-ranking-asset,
.stock-player-summary .stock-ranking-profit,
.stock-ranking-list .stock-ranking-profit {
  display: block;
  max-width: 100%;
  line-height: 1.2;
}

.stock-player-summary .stock-ranking-asset,
.stock-ranking-list .stock-ranking-asset {
  white-space: normal;
  overflow-wrap: anywhere;
}

.stock-player-summary .stock-ranking-profit,
.stock-ranking-list .stock-ranking-profit {
  white-space: normal;
  overflow-wrap: anywhere;
  font-style: normal;
}

html.theme-dark .stock-main-header {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}


/* =========================
   stock game desktop fit + bottom alignment cleanup
========================= */
@media (min-width: 1181px) {
  #game6Screen .stock-card-screen {
    padding: 14px 14px 12px !important;
  }

  #game6Screen .stock-layout {
    grid-template-columns: minmax(248px, 274px) minmax(0, 1fr);
    gap: 12px;
    min-height: auto !important;
  }

  #game6Screen .stock-sidebar-inner {
    padding: 14px !important;
    gap: 10px !important;
  }

  #game6Screen .stock-sidebar .sidebar-head .sub-text,
  #game6Screen .stock-sidebar .helper-text,
  #game6Screen #stockStatusText,
  #game6Screen .stock-duration-card .helper-text {
    font-size: 0.82rem;
    line-height: 1.42;
  }

  #game6Screen .stock-sidebar .controls-wrap,
  #game6Screen .stock-sidebar .scoreboard-card {
    padding: 14px;
    border-radius: 20px;
  }

  #game6Screen .stock-sidebar .input-card input {
    padding: 13px 14px;
    font-size: 0.95rem;
  }

  #game6Screen .stock-sidebar .button-row {
    gap: 8px;
    margin-top: 12px;
  }

  #game6Screen .stock-sidebar .action-btn {
    min-height: 42px;
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  #game6Screen .stock-duration-row {
    gap: 10px;
  }

  #game6Screen .stock-duration-value {
    min-width: 64px;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 0.92rem;
  }

  #game6Screen .stock-main {
    gap: 10px !important;
  }

  #game6Screen .stock-main-header .sub-text,
  #game6Screen .stock-setup-head .sub-text,
  #game6Screen .stock-panel-head .sub-text {
    font-size: 0.84rem;
    line-height: 1.42;
  }

  #game6Screen .stock-player-tabs {
    margin-top: 10px;
    gap: 6px;
  }

  #game6Screen .stock-player-tab {
    min-height: 56px;
    padding: 8px 10px;
    border-radius: 16px;
  }

  #game6Screen .stock-player-tab strong {
    font-size: 0.88rem;
    line-height: 1.15;
  }

  #game6Screen .stock-player-tab span {
    font-size: 0.72rem;
    line-height: 1.2;
  }

  #game6Screen .stock-setup-card,
  #game6Screen .stock-market-preview-card,
  #game6Screen .stock-allocation-card,
  #game6Screen .stock-live-card,
  #game6Screen .stock-panel {
    padding: 12px !important;
  }

  #game6Screen .stock-setup-grid {
    grid-template-columns: minmax(0, 1.08fr) minmax(292px, 0.9fr);
    gap: 10px;
    margin-top: 10px;
  }

  #game6Screen .stock-player-summary {
    gap: 6px !important;
    margin-top: 10px !important;
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
  }

  #game6Screen .stock-player-summary-item,
  #game6Screen .stock-player-summary .stock-ranking-item {
    padding: 8px 10px !important;
    border-radius: 14px !important;
  }

  #game6Screen .stock-player-summary-top {
    gap: 6px;
  }

  #game6Screen .stock-player-summary-top strong,
  #game6Screen .stock-player-summary .stock-ranking-main strong {
    font-size: 0.88rem;
    line-height: 1.16;
  }

  #game6Screen .stock-player-summary-sub,
  #game6Screen .stock-player-summary .stock-ranking-asset,
  #game6Screen .stock-player-summary .stock-ranking-profit {
    margin-top: 3px;
    font-size: 0.74rem;
    line-height: 1.26;
  }

  #game6Screen .stock-player-summary-sub {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  #game6Screen .stock-player-summary-badge {
    min-height: 24px;
    padding: 2px 8px;
    font-size: 0.68rem;
  }

  #game6Screen .stock-player-summary .stock-ranking-item {
    grid-template-columns: 30px minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  #game6Screen .stock-player-summary .stock-ranking-num {
    width: 30px;
    height: 30px;
    font-size: 0.92rem;
  }

  #game6Screen .stock-roster {
    gap: 8px;
    margin-top: 8px;
  }

  #game6Screen .stock-roster-card,
  #game6Screen .stock-roster-card-btn {
    min-height: 106px;
    padding: 9px 9px 8px;
    border-radius: 16px;
  }

  #game6Screen .stock-roster-topline {
    margin-bottom: 4px;
  }

  #game6Screen .stock-roster-emoji {
    font-size: 1.72rem;
  }

  #game6Screen .stock-roster-select-state {
    min-width: 40px;
    min-height: 24px;
    padding: 3px 7px;
    font-size: 0.66rem;
  }

  #game6Screen .stock-roster-head strong,
  #game6Screen .stock-roster-name {
    font-size: 0.84rem;
    line-height: 1.14;
  }

  #game6Screen .stock-roster-card .stock-roster-price,
  #game6Screen .stock-roster-info-line,
  #game6Screen .stock-roster-trait {
    font-size: 0.7rem;
    line-height: 1.24;
  }

  #game6Screen .stock-roster-desc {
    margin-top: 2px;
    font-size: 0.64rem;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  #game6Screen .stock-active-player-title {
    font-size: 1.34rem;
    line-height: 1.08;
  }

  #game6Screen .stock-picked-card {
    padding: 10px;
    gap: 7px;
    border-radius: 16px;
  }

  #game6Screen .stock-picked-name {
    margin-top: 4px;
    font-size: 0.92rem;
  }

  #game6Screen .stock-picked-trait,
  #game6Screen .stock-picked-meta,
  #game6Screen .stock-picked-carousel-hint,
  #game6Screen .stock-picked-carousel-count {
    font-size: 0.76rem;
    line-height: 1.32;
  }

  #game6Screen .stock-picked-remove-btn,
  #game6Screen .stock-fill-btn,
  #game6Screen .stock-chip-btn,
  #game6Screen .stock-turn-btn {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 0.76rem;
  }

  #game6Screen .stock-picked-price-row,
  #game6Screen .stock-allocation-note {
    padding: 9px 10px;
  }

  #game6Screen .stock-allocation-note {
    font-size: 0.78rem;
    line-height: 1.36;
  }

  #game6Screen .stock-allocation-chip-grid,
  #game6Screen .stock-helper-actions,
  #game6Screen .stock-turn-actions {
    gap: 7px;
  }

  #game6Screen .stock-allocation-total {
    min-height: 54px;
    padding: 8px 10px;
    border-radius: 14px;
  }

  #game6Screen .stock-allocation-total span {
    font-size: 0.72rem;
    line-height: 1.15;
  }

  #game6Screen .stock-allocation-total strong {
    font-size: 0.88rem;
    line-height: 1.14;
  }
}

@media (min-width: 1181px) and (max-height: 980px) {
  #game6Screen .stock-card-screen {
    padding: 12px 12px 10px !important;
  }

  #game6Screen .stock-layout {
    grid-template-columns: minmax(242px, 266px) minmax(0, 1fr);
    gap: 10px;
  }

  #game6Screen .stock-sidebar-inner,
  #game6Screen .stock-sidebar .controls-wrap,
  #game6Screen .stock-sidebar .scoreboard-card,
  #game6Screen .stock-setup-card,
  #game6Screen .stock-market-preview-card,
  #game6Screen .stock-allocation-card {
    padding: 11px !important;
  }

  #game6Screen .stock-player-tab {
    min-height: 52px;
  }

  #game6Screen .stock-roster-card,
  #game6Screen .stock-roster-card-btn {
    min-height: 100px;
  }

  #game6Screen .stock-player-summary-item,
  #game6Screen .stock-player-summary .stock-ranking-item {
    padding: 7px 9px !important;
  }
}

/* =========================
   game5 : russian roulette
========================= */

#game5Screen .game-header-actions,
#game5Screen .roulette-mobile-back-wrap {
  display: none !important;
}

#game5Screen .roulette-card-screen {
  padding: 20px;
}

#game5Screen .roulette-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 16px;
  min-height: 720px;
}

#game5Screen .roulette-sidebar {
  min-width: 0;
  background: rgba(255, 255, 255, 0.34);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
}

#game5Screen .roulette-sidebar-inner {
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#game5Screen .roulette-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#game5Screen .roulette-main-header,
#game5Screen .roulette-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

#game5Screen .roulette-panel-head.compact {
  align-items: center;
  margin-bottom: 12px;
}

#game5Screen .roulette-stage-card,
#game5Screen .roulette-panel {
  background: rgba(255, 255, 255, 0.42);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 26px;
  box-shadow: 0 14px 28px rgba(120, 90, 70, 0.08);
}

#game5Screen .roulette-stage-card {
  padding: 18px;
}

#game5Screen .roulette-panel {
  padding: 16px;
  min-height: 210px;
}

#game5Screen .roulette-board-meta span,
#game5Screen .roulette-chamber-panel strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff8df 0%, #fff0be 100%);
  border: 2px solid rgba(255, 255, 255, 0.92);
  color: #8a6b41;
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.08);
}

#game5Screen .roulette-map-wrap {
  position: relative;
  min-height: 500px;
  margin-top: 14px;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.18) 34%, transparent 62%),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.48), transparent 24%),
    linear-gradient(180deg, #fff8f2 0%, #fff0e4 100%);
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.46), 0 16px 28px rgba(120, 90, 70, 0.08);
}

#game5Screen .roulette-map {
  --roulette-radius: clamp(150px, 23vw, 218px);
  position: absolute;
  inset: 0;
}

#game5Screen .roulette-map::before,
#game5Screen .roulette-map::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
}

#game5Screen .roulette-map::before {
  width: calc(var(--roulette-radius) * 2 + 64px);
  height: calc(var(--roulette-radius) * 2 + 64px);
  border: 2px dashed rgba(157, 125, 107, 0.28);
}

#game5Screen .roulette-map::after {
  width: calc(var(--roulette-radius) * 2 - 38px);
  height: calc(var(--roulette-radius) * 2 - 38px);
  border: 1px solid rgba(255, 255, 255, 0.72);
}

#game5Screen .roulette-gun-core {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: 138px;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 30px;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.52), transparent 28%),
    linear-gradient(180deg, #fffdf8 0%, #fff1e1 100%);
  border: 3px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 34px rgba(120, 90, 70, 0.16);
  transform: translate(-50%, -50%) rotate(var(--gun-angle, 0deg));
  transition: transform 0.34s ease, box-shadow 0.24s ease;
}

#game5Screen .roulette-gun-core.is-live {
  box-shadow:
    0 0 0 6px rgba(255, 241, 184, 0.3),
    0 18px 34px rgba(120, 90, 70, 0.18);
}

#game5Screen .roulette-gun-core.is-firing {
  animation: rouletteGunFire 0.42s ease;
}

#game5Screen .roulette-gun-emoji {
  font-size: 3.3rem;
  line-height: 1;
  filter: drop-shadow(0 8px 12px rgba(110, 82, 68, 0.14));
}

#game5Screen .roulette-gun-label,
#game5Screen .roulette-gun-sub {
  display: block;
  transform: rotate(calc(-1 * var(--gun-angle, 0deg)));
  text-align: center;
  line-height: 1.1;
}

#game5Screen .roulette-gun-label {
  color: #8a6b41;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

#game5Screen .roulette-gun-sub {
  color: #927559;
  font-size: 0.75rem;
  font-weight: 800;
}

#game5Screen .roulette-player-node {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: var(--roulette-node-width, 118px);
  min-height: var(--roulette-node-min-height, 102px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.52), transparent 30%),
    linear-gradient(180deg, color-mix(in srgb, var(--player-color) 42%, white 58%) 0%, var(--player-color) 100%);
  border: 3px solid rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 20px rgba(120, 90, 70, 0.13);
  color: #6f5141;
  text-align: center;
  transform:
    translate(-50%, -50%)
    rotate(var(--player-angle))
    translate(0, calc(-1 * var(--roulette-radius)))
    rotate(calc(-1 * var(--player-angle)));
  transition: opacity 0.28s ease, filter 0.28s ease, box-shadow 0.24s ease;
}

#game5Screen .roulette-player-node.is-active {
  box-shadow:
    0 0 0 5px rgba(255, 217, 118, 0.42),
    0 14px 26px rgba(120, 90, 70, 0.18);
  animation: rouletteTargetPulse 0.9s ease-in-out infinite;
}

#game5Screen .roulette-player-node.is-targeted {
  box-shadow:
    0 0 0 7px rgba(255, 186, 102, 0.44),
    0 18px 30px rgba(120, 90, 70, 0.2);
}

#game5Screen .roulette-player-node.is-hit {
  animation: rouletteHit 0.58s ease both;
}

#game5Screen .roulette-player-node.is-blank {
  animation: rouletteBlank 0.5s ease both;
}

#game5Screen .roulette-player-node.is-firework {
  animation: rouletteFireworkJolt 0.58s ease both;
}

#game5Screen .roulette-player-node.is-dead {
  filter: grayscale(0.88) saturate(0.55);
  opacity: 0.54;
  background: linear-gradient(180deg, rgba(225, 221, 218, 0.92) 0%, rgba(176, 168, 161, 0.92) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34), 0 8px 14px rgba(120, 90, 70, 0.08);
}

#game5Screen .roulette-player-avatar {
  font-size: var(--roulette-avatar-size, 1.9rem);
  line-height: 1;
}

#game5Screen .roulette-player-name {
  width: 100%;
  color: #5f493e;
  font-weight: 900;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#game5Screen .roulette-player-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #806355;
  font-size: 0.74rem;
  font-weight: 800;
}

#game5Screen .roulette-map.is-compact .roulette-player-node {
  border-width: 2px;
  border-radius: 20px;
  padding: 8px 6px;
  gap: 3px;
}

#game5Screen .roulette-map.is-compact .roulette-player-name {
  font-size: 0.76rem;
}

#game5Screen .roulette-map.is-compact .roulette-player-state {
  min-height: 19px;
  padding: 2px 6px;
  font-size: 0.62rem;
}

#game5Screen .roulette-map.is-tiny .roulette-player-node {
  border-radius: 18px;
  padding: 7px 5px;
}

#game5Screen .roulette-map.is-tiny .roulette-player-name {
  font-size: 0.68rem;
}

#game5Screen .roulette-map.is-tiny .roulette-player-state {
  display: none;
}

#game5Screen .roulette-effect-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

#game5Screen .roulette-muzzle-flash,
#game5Screen .roulette-hit-burst {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#game5Screen .roulette-shot-beam {
  position: absolute;
  height: 8px;
  border-radius: 999px;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 241, 158, 0.96) 16%, rgba(255, 116, 96, 0.94) 62%, rgba(255, 255, 255, 0) 100%);
  box-shadow: 0 0 18px rgba(255, 199, 100, 0.72), 0 0 32px rgba(255, 98, 86, 0.32);
  animation: rouletteBeamShoot 0.34s ease-out forwards;
  pointer-events: none;
}

#game5Screen .roulette-shot-beam.is-firework {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 241, 158, 0.96) 16%, rgba(255, 116, 96, 0.94) 62%, rgba(255, 255, 255, 0) 100%);
  box-shadow: 0 0 18px rgba(255, 199, 100, 0.72), 0 0 32px rgba(255, 98, 86, 0.32);
}

#game5Screen .roulette-shot-beam.is-blank {
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(236, 247, 255, 0.72) 20%, rgba(183, 205, 228, 0.66) 58%, rgba(255,255,255,0) 100%);
  box-shadow: 0 0 14px rgba(183, 205, 228, 0.42);
}

#game5Screen .roulette-shot-bolt {
  position: absolute;
  width: 26px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.98) 0%, rgba(255, 232, 112, 0.98) 42%, rgba(255, 104, 88, 0.98) 100%);
  box-shadow: 0 0 16px rgba(255, 218, 104, 0.76);
  transform-origin: center;
  pointer-events: none;
}

#game5Screen .roulette-shot-bolt.is-firework {
  background: linear-gradient(90deg, rgba(255,255,255,0.98) 0%, rgba(255, 232, 112, 0.98) 42%, rgba(255, 104, 88, 0.98) 100%);
  box-shadow: 0 0 16px rgba(255, 218, 104, 0.76);
}

#game5Screen .roulette-shot-bolt.is-blank {
  background: linear-gradient(90deg, rgba(255,255,255,0.88) 0%, rgba(205, 222, 238, 0.86) 100%);
  box-shadow: 0 0 12px rgba(205, 222, 238, 0.46);
}

#game5Screen .roulette-firework-burst,
#game5Screen .roulette-blank-spark {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#game5Screen .roulette-firework-burst {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  font-size: 2.4rem;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.88) 0%, rgba(134, 221, 255, 0.5) 28%, rgba(255, 117, 217, 0.24) 52%, transparent 74%);
  animation: rouletteFireworkBurst 0.72s ease-out forwards;
}

#game5Screen .roulette-firework-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff6a8 0%, #ff78d6 100%);
  transform: translate(-50%, -50%);
  animation: rouletteFireworkParticle 0.7s ease-out forwards;
  pointer-events: none;
}

#game5Screen .roulette-blank-spark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  font-size: 1.35rem;
  background: radial-gradient(circle, rgba(236, 247, 255, 0.72) 0%, rgba(176, 197, 220, 0.24) 48%, transparent 72%);
  animation: rouletteBlankSpark 0.56s ease-out forwards;
}

#game5Screen .roulette-muzzle-flash {
  width: 76px;
  height: 76px;
  background: radial-gradient(circle, rgba(255, 241, 158, 0.95) 0%, rgba(255, 173, 91, 0.62) 42%, transparent 70%);
  animation: rouletteFlash 0.45s ease-out forwards;
}

#game5Screen .roulette-hit-burst {
  width: 240px;
  height: 240px;
  border: 4px solid rgba(255, 116, 96, 0.42);
  box-shadow: 0 0 34px rgba(255, 126, 104, 0.28);
  animation: rouletteBurst 0.62s ease-out forwards;
}

#game5Screen .roulette-chamber-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(255, 250, 245, 0.78);
  border: 2px solid rgba(255, 255, 255, 0.78);
}

#game5Screen .roulette-chamber-label {
  display: block;
  margin-bottom: 6px;
  color: #8f7363;
  font-size: 0.82rem;
  font-weight: 800;
}

#game5Screen .roulette-bullet-track {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(30, minmax(5px, 1fr));
  gap: 4px;
  min-width: 0;
}

#game5Screen .roulette-bullet-dot {
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff4b2 0%, #efbe5d 100%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
  opacity: 0.95;
}

#game5Screen .roulette-bullet-dot.is-spent {
  background: rgba(139, 115, 102, 0.18);
  border-color: rgba(255, 255, 255, 0.48);
  opacity: 0.46;
}

#game5Screen .roulette-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

#game5Screen .roulette-ranking-list,
#game5Screen .roulette-log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 5px;
}

#game5Screen .roulette-ranking-empty,
#game5Screen .roulette-log-empty {
  padding: 18px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: #8c7262;
  line-height: 1.55;
  text-align: center;
}

#game5Screen .roulette-ranking-item,
#game5Screen .roulette-log-item {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.06);
  color: var(--brown);
}

#game5Screen .roulette-ranking-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

#game5Screen .roulette-ranking-item.top {
  background: linear-gradient(135deg, #fff8df, #fff1b8);
}

#game5Screen .roulette-ranking-item.is-eliminated {
  opacity: 0.68;
}

#game5Screen .roulette-rank-num {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--lavender), var(--sky));
  font-family: 'Gaegu', cursive;
  font-size: 1.3rem;
  font-weight: 700;
}

#game5Screen .roulette-rank-main {
  min-width: 0;
}

#game5Screen .roulette-rank-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--soft-brown);
  font-weight: 900;
  word-break: break-all;
}

#game5Screen .roulette-rank-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--roulette-player-color);
}

#game5Screen .roulette-rank-sub {
  margin-top: 4px;
  color: #927869;
  font-size: 0.82rem;
  line-height: 1.45;
}

#game5Screen .roulette-rank-state {
  padding: 8px 12px;
  border-radius: 999px;
  background: #fffaf1;
  border: 2px solid rgba(232, 214, 198, 0.7);
  color: #8f7363;
  font-weight: 800;
  white-space: nowrap;
}

#game5Screen .roulette-rank-state.is-out {
  background: rgba(139, 115, 102, 0.14);
  color: #8a7161;
}

#game5Screen .roulette-log-item {
  padding: 12px 14px;
  line-height: 1.5;
  font-weight: 700;
}

#game5Screen .roulette-log-item.type-hit {
  background: linear-gradient(180deg, rgba(255, 239, 233, 0.94) 0%, rgba(255, 222, 217, 0.9) 100%);
}

#game5Screen .roulette-log-item.type-blank {
  background: linear-gradient(180deg, rgba(240, 255, 249, 0.94) 0%, rgba(218, 246, 235, 0.9) 100%);
}

#game5Screen .roulette-log-item.type-reload {
  background: linear-gradient(180deg, rgba(245, 241, 255, 0.96) 0%, rgba(232, 225, 255, 0.9) 100%);
}

#game5Screen .roulette-log-item.type-final {
  background: linear-gradient(180deg, rgba(255, 248, 222, 0.98) 0%, rgba(255, 236, 181, 0.94) 100%);
}

#game5Screen .roulette-sidebar-rank-chip {
  display: grid;
  grid-template-columns: auto auto 1fr;
  width: 100%;
  border-radius: 18px;
}

#game5Screen .roulette-sidebar-rank-chip.is-eliminated {
  opacity: 0.62;
}

#game5Screen .roulette-sidebar-rank-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 900;
  color: #8a6b41;
}

#game5Screen .roulette-sidebar-rank-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#game5Screen .roulette-sidebar-rank-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#game5Screen .roulette-sidebar-rank-meta small {
  color: #927869;
  font-size: 0.76rem;
  font-weight: 800;
}

.popup.roulette-final-popup {
  max-width: 560px;
}

.roulette-final-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(100%, 460px);
  margin: 0 auto;
}

.roulette-final-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  align-items: center;
  padding: 13px 15px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  border: 2px solid rgba(255, 255, 255, 0.82);
  text-align: left;
}

.roulette-final-item.top {
  background: linear-gradient(135deg, #fff8df, #fff1b8);
}

.roulette-final-rank {
  grid-row: span 2;
  display: inline-grid;
  place-items: center;
  min-width: 58px;
  min-height: 38px;
  padding: 7px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--lavender), var(--sky));
  font-weight: 900;
  color: #6f5141;
}

.roulette-final-item strong {
  color: var(--soft-brown);
  font-size: 1.05rem;
}

.roulette-final-item small {
  color: #8c7262;
  font-weight: 700;
}

@keyframes rouletteGunFire {
  0%, 100% { transform: translate(-50%, -50%) rotate(var(--gun-angle, 0deg)) scale(1); }
  38% { transform: translate(-50%, -50%) rotate(var(--gun-angle, 0deg)) translateY(8px) scale(0.96); }
  62% { transform: translate(-50%, -50%) rotate(var(--gun-angle, 0deg)) translateY(-5px) scale(1.03); }
}

@keyframes rouletteTargetPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

@keyframes rouletteHit {
  0% { filter: brightness(1); }
  30% { filter: brightness(1.35) saturate(1.2); transform: translate(-50%, -50%) rotate(var(--player-angle)) translate(0, calc(-1 * var(--roulette-radius))) rotate(calc(-1 * var(--player-angle))) scale(1.08); }
  58% { transform: translate(-50%, -50%) rotate(var(--player-angle)) translate(0, calc(-1 * var(--roulette-radius))) rotate(calc(-1 * var(--player-angle))) translateX(-8px) scale(0.96); }
  100% { filter: brightness(0.86) grayscale(0.6); transform: translate(-50%, -50%) rotate(var(--player-angle)) translate(0, calc(-1 * var(--roulette-radius))) rotate(calc(-1 * var(--player-angle))) scale(1); }
}

@keyframes rouletteBlank {
  0%, 100% { transform: translate(-50%, -50%) rotate(var(--player-angle)) translate(0, calc(-1 * var(--roulette-radius))) rotate(calc(-1 * var(--player-angle))) scale(1); }
  45% { transform: translate(-50%, -50%) rotate(var(--player-angle)) translate(0, calc(-1 * var(--roulette-radius))) rotate(calc(-1 * var(--player-angle))) scale(1.04); }
}

@keyframes rouletteFlash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  36% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.8); }
}

@keyframes rouletteBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.24); }
  35% { opacity: 0.88; transform: translate(-50%, -50%) scale(0.7); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.48); }
}

@keyframes rouletteBeamShoot {
  0% { clip-path: inset(0 100% 0 0); opacity: 0; }
  16% { opacity: 1; }
  76% { clip-path: inset(0 0 0 0); opacity: 1; }
  100% { clip-path: inset(0 0 0 100%); opacity: 0; }
}

@keyframes rouletteFireworkJolt {
  0%, 100% { transform: translate(-50%, -50%) rotate(var(--player-angle)) translate(0, calc(-1 * var(--roulette-radius))) rotate(calc(-1 * var(--player-angle))) scale(1); }
  42% { transform: translate(-50%, -50%) rotate(var(--player-angle)) translate(0, calc(-1 * var(--roulette-radius))) rotate(calc(-1 * var(--player-angle))) scale(1.07) rotate(1deg); filter: brightness(1.22); }
}

@keyframes rouletteFireworkBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.28) rotate(-8deg); }
  34% { opacity: 1; transform: translate(-50%, -50%) scale(0.9) rotate(4deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.7) rotate(10deg); }
}

@keyframes rouletteFireworkParticle {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  34% { opacity: 1; transform: translate(calc(-50% + var(--fx)), calc(-50% + var(--fy))) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--fx2)), calc(-50% + var(--fy2))) scale(0.26); }
}

@keyframes rouletteBlankSpark {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.34); }
  42% { opacity: 0.86; transform: translate(-50%, -50%) scale(0.96); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.42); }
}

@media (max-width: 1024px) {
  #game5Screen .roulette-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  #game5Screen .roulette-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #game5Screen .roulette-card-screen {
    padding: 12px;
  }

  #game5Screen .roulette-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  #game5Screen .roulette-main {
    display: contents;
  }

  #game5Screen .roulette-main-header {
    order: 1;
    padding: 20px 18px;
    border-radius: 28px;
    background: rgba(255, 249, 244, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
  }

  #game5Screen .roulette-main-header .game-header-actions {
    display: none;
  }

  #game5Screen .roulette-sidebar {
    order: 2;
  }

  #game5Screen .roulette-stage-card {
    order: 3;
  }

  #game5Screen .roulette-sidebar,
  #game5Screen .roulette-stage-card,
  #game5Screen .roulette-panel {
    border-radius: 24px;
  }

  #game5Screen .roulette-sidebar-inner,
  #game5Screen .roulette-stage-card,
  #game5Screen .roulette-panel {
    padding: 14px;
  }

  #game5Screen .roulette-map-wrap {
    min-height: 420px;
    border-radius: 24px;
  }

  #game5Screen .roulette-map {
    --roulette-radius: clamp(128px, 37vw, 160px);
  }

  #game5Screen .roulette-gun-core {
    width: 84px;
    min-height: 78px;
    border-radius: 22px;
  }

  #game5Screen .roulette-gun-emoji {
    font-size: 2rem;
  }

  #game5Screen .roulette-player-node {
    width: var(--roulette-node-width, 74px);
    min-height: var(--roulette-node-min-height, 72px);
    border-radius: 18px;
    padding: 7px 5px;
  }

  #game5Screen .roulette-player-avatar {
    font-size: var(--roulette-avatar-size, 1.25rem);
  }

  #game5Screen .roulette-player-name {
    font-size: 0.72rem;
  }

  #game5Screen .roulette-player-state {
    min-height: 18px;
    padding: 2px 6px;
    font-size: 0.6rem;
  }

  #game5Screen .roulette-chamber-panel {
    flex-direction: column;
    align-items: stretch;
  }

  #game5Screen .roulette-bullet-track {
    grid-template-columns: repeat(15, minmax(6px, 1fr));
  }

  #game5Screen .roulette-mobile-back-wrap {
    display: block;
    margin-top: 12px;
  }

  #game5Screen .roulette-mobile-back-btn {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    min-height: 54px;
    border-radius: 999px;
    font-size: 1rem;
  }
}

html.theme-dark #game5Screen .roulette-sidebar,
html.theme-dark #game5Screen .roulette-stage-card,
html.theme-dark #game5Screen .roulette-panel,
html.theme-dark #game5Screen .roulette-main-header {
  background: rgba(24, 31, 42, 0.82);
  border-color: rgba(176, 197, 220, 0.22);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.26);
}

html.theme-dark #game5Screen .roulette-map-wrap {
  background:
    radial-gradient(circle at center, rgba(128, 148, 171, 0.34), rgba(40, 51, 66, 0.26) 36%, transparent 64%),
    radial-gradient(circle at top left, rgba(183, 205, 228, 0.16), transparent 28%),
    linear-gradient(180deg, #182130 0%, #101722 100%);
  border-color: rgba(176, 197, 220, 0.24);
  box-shadow: inset 0 0 0 1px rgba(176, 197, 220, 0.12), 0 16px 28px rgba(0, 0, 0, 0.25);
}

html.theme-dark #game5Screen .roulette-map::before {
  border-color: rgba(176, 197, 220, 0.24);
}

html.theme-dark #game5Screen .roulette-map::after {
  border-color: rgba(176, 197, 220, 0.15);
}

html.theme-dark #game5Screen .roulette-gun-core,
html.theme-dark #game5Screen .roulette-chamber-panel,
html.theme-dark #game5Screen .roulette-ranking-item,
html.theme-dark #game5Screen .roulette-log-item,
html.theme-dark #game5Screen .roulette-ranking-empty,
html.theme-dark #game5Screen .roulette-log-empty,
html.theme-dark .roulette-final-item {
  background: linear-gradient(180deg, rgba(35, 46, 60, 0.96) 0%, rgba(22, 30, 42, 0.96) 100%);
  border-color: rgba(176, 197, 220, 0.2);
  color: #d9e5f0;
}

html.theme-dark #game5Screen .roulette-gun-core.is-live {
  box-shadow:
    0 0 0 6px rgba(255, 213, 111, 0.18),
    0 18px 34px rgba(0, 0, 0, 0.32);
}

html.theme-dark #game5Screen .roulette-player-node {
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.2), transparent 30%),
    linear-gradient(180deg, color-mix(in srgb, var(--player-color) 70%, #182130 30%) 0%, color-mix(in srgb, var(--player-color) 58%, #0f1722 42%) 100%);
  border-color: rgba(236, 247, 255, 0.48);
  color: #ecf7ff;
}

html.theme-dark #game5Screen .roulette-player-name,
html.theme-dark #game5Screen .roulette-rank-name,
html.theme-dark .roulette-final-item strong {
  color: #f3f8ff;
}

html.theme-dark #game5Screen .roulette-player-state,
html.theme-dark #game5Screen .roulette-rank-state,
html.theme-dark #game5Screen .roulette-sidebar-rank-num {
  background: rgba(236, 247, 255, 0.12);
  border-color: rgba(236, 247, 255, 0.14);
  color: #d9e5f0;
}

html.theme-dark #game5Screen .roulette-player-node.is-dead {
  background: linear-gradient(180deg, rgba(71, 78, 90, 0.82) 0%, rgba(34, 40, 49, 0.9) 100%);
  opacity: 0.48;
}

html.theme-dark #game5Screen .roulette-board-meta span,
html.theme-dark #game5Screen .roulette-chamber-panel strong,
html.theme-dark .roulette-final-rank,
html.theme-dark #game5Screen .roulette-rank-num {
  background: linear-gradient(180deg, rgba(255, 213, 111, 0.22) 0%, rgba(255, 181, 96, 0.16) 100%);
  border-color: rgba(255, 213, 111, 0.22);
  color: #ffe6a6;
}

html.theme-dark #game5Screen .roulette-bullet-dot {
  background: linear-gradient(180deg, #ffd56f 0%, #bb8842 100%);
  border-color: rgba(255, 242, 202, 0.3);
}

html.theme-dark #game5Screen .roulette-bullet-dot.is-spent {
  background: rgba(176, 197, 220, 0.13);
  border-color: rgba(176, 197, 220, 0.1);
}

html.theme-dark #game5Screen .roulette-ranking-item.top,
html.theme-dark .roulette-final-item.top {
  background: linear-gradient(180deg, rgba(82, 62, 34, 0.96) 0%, rgba(48, 39, 27, 0.96) 100%);
}

html.theme-dark #game5Screen .roulette-log-item.type-hit {
  background: linear-gradient(180deg, rgba(92, 42, 45, 0.96) 0%, rgba(56, 28, 35, 0.96) 100%);
}

html.theme-dark #game5Screen .roulette-log-item.type-blank {
  background: linear-gradient(180deg, rgba(34, 76, 72, 0.96) 0%, rgba(20, 46, 49, 0.96) 100%);
}

html.theme-dark #game5Screen .roulette-log-item.type-reload {
  background: linear-gradient(180deg, rgba(54, 46, 86, 0.96) 0%, rgba(31, 29, 54, 0.96) 100%);
}

html.theme-dark #game5Screen .roulette-log-item.type-final {
  background: linear-gradient(180deg, rgba(82, 62, 34, 0.96) 0%, rgba(48, 39, 27, 0.96) 100%);
}


/* game5 header: 경마처럼 상자 외곽 없이 텍스트만 보이도록 정리 */
#game5Screen .roulette-main-header {
  padding: 4px 4px 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

html.theme-dark #game5Screen .roulette-main-header {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

@media (max-width: 760px) {
  #game5Screen .roulette-main-header {
    padding: 4px 4px 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
}

/* =========================
   stock game mobile layout final fix
   - game title/settings at top
   - investment prep becomes one-column flow
   - mobile controls stay readable
========================= */
@media (max-width: 760px) {
  body.app-active-game #game6Screen.screen.active {
    max-width: none;
  }

  body.app-active-game #game6Screen .stock-card-screen {
    padding: 10px !important;
    border-radius: 24px !important;
    overflow: visible !important;
  }

  body.app-active-game #game6Screen .stock-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    min-height: 0 !important;
    align-items: stretch !important;
  }

  body.app-active-game #game6Screen .stock-main {
    display: contents !important;
  }

  body.app-active-game #game6Screen .stock-main-header {
    order: 1 !important;
    width: 100% !important;
    padding: 4px 4px 2px !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  body.app-active-game #game6Screen .stock-main-header .small-badge {
    margin-bottom: 10px !important;
    padding: 8px 13px !important;
    font-size: 0.82rem !important;
  }

  body.app-active-game #game6Screen .stock-main-header h2 {
    margin-bottom: 8px !important;
    font-size: clamp(2.15rem, 12vw, 3rem) !important;
    line-height: 0.95 !important;
  }

  body.app-active-game #game6Screen .stock-main-header .sub-text {
    max-width: 100% !important;
    font-size: 0.95rem !important;
    line-height: 1.62 !important;
  }

  body.app-active-game #game6Screen .stock-sidebar {
    order: 2 !important;
    width: 100% !important;
    border-radius: 24px !important;
  }

  body.app-active-game #game6Screen .stock-setup-card {
    order: 3 !important;
    width: 100% !important;
    border-radius: 24px !important;
  }

  body.app-active-game #game6Screen .stock-live-card {
    order: 4 !important;
    width: 100% !important;
    border-radius: 24px !important;
  }

  body.app-active-game #game6Screen .stock-sidebar-inner,
  body.app-active-game #game6Screen .stock-sidebar .controls-wrap,
  body.app-active-game #game6Screen .stock-sidebar .scoreboard-card,
  body.app-active-game #game6Screen .stock-setup-card,
  body.app-active-game #game6Screen .stock-market-preview-card,
  body.app-active-game #game6Screen .stock-allocation-card,
  body.app-active-game #game6Screen .stock-live-card,
  body.app-active-game #game6Screen .stock-panel {
    padding: 12px !important;
  }

  body.app-active-game #game6Screen .stock-sidebar-inner {
    height: auto !important;
    overflow: visible !important;
    gap: 12px !important;
  }

  body.app-active-game #game6Screen .stock-sidebar .controls-wrap {
    margin-top: 12px !important;
  }

  body.app-active-game #game6Screen .stock-sidebar .scoreboard-card {
    margin-top: 0 !important;
  }

  body.app-active-game #game6Screen .stock-sidebar .sidebar-title {
    font-size: 1.8rem !important;
    line-height: 1.05 !important;
  }

  body.app-active-game #game6Screen .stock-sidebar .sidebar-head .sub-text,
  body.app-active-game #game6Screen .stock-sidebar .helper-text,
  body.app-active-game #game6Screen #stockStatusText,
  body.app-active-game #game6Screen .stock-duration-card .helper-text {
    font-size: 0.86rem !important;
    line-height: 1.5 !important;
  }

  body.app-active-game #game6Screen .stock-duration-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 10px !important;
  }

  body.app-active-game #game6Screen .stock-duration-value {
    min-width: 64px !important;
    min-height: 36px !important;
    padding: 7px 10px !important;
    font-size: 0.9rem !important;
  }

  body.app-active-game #game6Screen .stock-sidebar .button-row {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-top: 14px !important;
  }

  body.app-active-game #game6Screen .stock-sidebar .action-btn {
    width: 100% !important;
    min-height: 46px !important;
    padding: 11px 8px !important;
    font-size: 0.9rem !important;
  }

  body.app-active-game #game6Screen .stock-player-summary {
    max-height: 188px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 4px !important;
    gap: 8px !important;
  }

  body.app-active-game #game6Screen .stock-player-summary-item,
  body.app-active-game #game6Screen .stock-player-summary .stock-ranking-item {
    padding: 9px 10px !important;
    border-radius: 14px !important;
  }

  body.app-active-game #game6Screen .stock-setup-head,
  body.app-active-game #game6Screen .stock-panel-head,
  body.app-active-game #game6Screen .stock-live-head {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  body.app-active-game #game6Screen .stock-setup-head h3,
  body.app-active-game #game6Screen .stock-panel-head h3,
  body.app-active-game #game6Screen .stock-live-head h3 {
    font-size: 1.05rem !important;
    line-height: 1.2 !important;
  }

  body.app-active-game #game6Screen .stock-setup-head .sub-text,
  body.app-active-game #game6Screen .stock-panel-head .sub-text,
  body.app-active-game #game6Screen .stock-live-head .sub-text {
    max-width: 100% !important;
    font-size: 0.84rem !important;
    line-height: 1.46 !important;
  }

  body.app-active-game #game6Screen .stock-ready-badge,
  body.app-active-game #game6Screen .stock-timer-badge {
    width: fit-content !important;
    min-height: 30px !important;
    padding: 5px 10px !important;
    font-size: 0.76rem !important;
  }

  body.app-active-game #game6Screen .stock-player-tabs {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 2px 2px 6px !important;
    margin-top: 12px !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
  }

  body.app-active-game #game6Screen .stock-player-tab {
    flex: 0 0 min(42vw, 150px) !important;
    min-height: 56px !important;
    padding: 9px 10px !important;
    border-radius: 16px !important;
    scroll-snap-align: start !important;
  }

  body.app-active-game #game6Screen .stock-player-tab strong {
    font-size: 0.86rem !important;
    line-height: 1.15 !important;
  }

  body.app-active-game #game6Screen .stock-player-tab span {
    font-size: 0.72rem !important;
    line-height: 1.22 !important;
  }

  body.app-active-game #game6Screen .stock-setup-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    margin-top: 10px !important;
  }

  body.app-active-game #game6Screen .stock-market-preview-card,
  body.app-active-game #game6Screen .stock-allocation-card {
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  body.app-active-game #game6Screen .stock-roster {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-top: 10px !important;
  }

  body.app-active-game #game6Screen .stock-roster-card,
  body.app-active-game #game6Screen .stock-roster-card-btn {
    min-height: 132px !important;
    padding: 10px !important;
    border-radius: 16px !important;
    gap: 5px !important;
  }

  body.app-active-game #game6Screen .stock-roster-emoji {
    font-size: 1.72rem !important;
  }

  body.app-active-game #game6Screen .stock-roster-select-state {
    min-width: 40px !important;
    min-height: 24px !important;
    padding: 3px 7px !important;
    font-size: 0.64rem !important;
  }

  body.app-active-game #game6Screen .stock-roster-name {
    font-size: 0.86rem !important;
    line-height: 1.16 !important;
    -webkit-line-clamp: 1 !important;
  }

  body.app-active-game #game6Screen .stock-roster-info-line {
    grid-template-columns: 44px minmax(0, 1fr) !important;
    gap: 5px !important;
  }

  body.app-active-game #game6Screen .stock-roster-info-line > span {
    font-size: 0.64rem !important;
    line-height: 1.22 !important;
  }

  body.app-active-game #game6Screen .stock-roster-info-line > strong {
    font-size: 0.68rem !important;
    line-height: 1.22 !important;
    -webkit-line-clamp: 2 !important;
  }

  body.app-active-game #game6Screen .stock-roster-desc {
    font-size: 0.66rem !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
  }

  body.app-active-game #game6Screen .stock-active-player-title {
    font-size: 1.32rem !important;
    line-height: 1.1 !important;
  }

  body.app-active-game #game6Screen .stock-picked-carousel-toolbar {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 8px !important;
    align-items: center !important;
  }

  body.app-active-game #game6Screen .stock-picked-carousel-hint,
  body.app-active-game #game6Screen .stock-picked-carousel-count {
    font-size: 0.74rem !important;
    line-height: 1.25 !important;
  }

  body.app-active-game #game6Screen .stock-picked-card {
    padding: 10px !important;
    gap: 7px !important;
    border-radius: 16px !important;
  }

  body.app-active-game #game6Screen .stock-picked-head {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 8px !important;
  }

  body.app-active-game #game6Screen .stock-picked-name {
    font-size: 0.9rem !important;
    line-height: 1.18 !important;
    -webkit-line-clamp: 1 !important;
  }

  body.app-active-game #game6Screen .stock-picked-trait,
  body.app-active-game #game6Screen .stock-picked-meta {
    font-size: 0.74rem !important;
    line-height: 1.3 !important;
  }

  body.app-active-game #game6Screen .stock-picked-price-row {
    padding: 8px 10px !important;
    border-radius: 13px !important;
  }

  body.app-active-game #game6Screen .stock-picked-price-row span,
  body.app-active-game #game6Screen .stock-manwon-label,
  body.app-active-game #game6Screen .stock-allocation-total span {
    font-size: 0.72rem !important;
  }

  body.app-active-game #game6Screen .stock-picked-price-row strong,
  body.app-active-game #game6Screen .stock-allocation-total strong {
    font-size: 0.86rem !important;
  }

  body.app-active-game #game6Screen .stock-quick-row {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  body.app-active-game #game6Screen .stock-chip-btn,
  body.app-active-game #game6Screen .stock-fill-btn,
  body.app-active-game #game6Screen .stock-turn-btn,
  body.app-active-game #game6Screen .stock-picked-remove-btn {
    min-height: 34px !important;
    padding: 6px 8px !important;
    font-size: 0.76rem !important;
  }

  body.app-active-game #game6Screen .stock-manwon-input-row,
  body.app-active-game #game6Screen .stock-manwon-control {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 7px !important;
  }

  body.app-active-game #game6Screen .stock-amount-input-manwon {
    width: 100% !important;
    padding: 10px 12px !important;
    font-size: 0.9rem !important;
    text-align: right !important;
  }

  body.app-active-game #game6Screen .stock-allocation-chip-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 7px !important;
  }

  body.app-active-game #game6Screen .stock-allocation-total {
    min-height: 54px !important;
    padding: 8px 9px !important;
    border-radius: 14px !important;
  }

  body.app-active-game #game6Screen .stock-allocation-note {
    min-height: auto !important;
    padding: 10px 11px !important;
    font-size: 0.78rem !important;
    line-height: 1.38 !important;
  }

  body.app-active-game #game6Screen .stock-helper-actions,
  body.app-active-game #game6Screen .stock-turn-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 7px !important;
  }

  body.app-active-game #game6Screen .stock-board,
  body.app-active-game #game6Screen .stock-bottom-grid,
  body.app-active-game #game6Screen .stock-holder-row,
  body.app-active-game #game6Screen .stock-holding-chip {
    grid-template-columns: 1fr !important;
  }

  body.app-active-game #game6Screen .stock-chart-shell {
    height: 92px !important;
  }
}

@media (max-width: 370px) {
  body.app-active-game #game6Screen .stock-roster {
    grid-template-columns: 1fr !important;
  }

  body.app-active-game #game6Screen .stock-allocation-chip-grid {
    grid-template-columns: 1fr !important;
  }
}

/* =========================
   game7 : transparent ladder
========================= */
#game7Screen .ladder-card-screen {
  padding: 20px;
  display: flex;
}

#game7Screen .ladder-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 16px;
  width: 100%;
  min-height: auto;
  align-items: stretch;
}

#game7Screen .ladder-sidebar {
  min-width: 0;
  background: rgba(255, 255, 255, 0.34);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
}

#game7Screen .ladder-sidebar-inner {
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#game7Screen .ladder-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#game7Screen .ladder-main-header,
#game7Screen .ladder-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

#game7Screen .ladder-main-header {
  padding: 4px 4px 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

#game7Screen .ladder-stage-card {
  background: rgba(255, 255, 255, 0.42);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 26px;
  box-shadow: 0 14px 28px rgba(120, 90, 70, 0.08);
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

#game7Screen .ladder-button-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#game7Screen .ladder-reveal-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff6ee 0%, #ffe8dd 100%);
  color: #9a6257;
  border: 2px solid rgba(255, 255, 255, 0.92);
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.08);
}

#game7Screen .ladder-reveal-badge.is-revealed {
  background: linear-gradient(180deg, #edfff7 0%, #d6f8e5 100%);
  color: #44745a;
}

#game7Screen .ladder-board {
  position: relative;
  margin-top: 16px;
  min-height: 520px;
  flex: 1;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.18) 36%, transparent 68%),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.48), transparent 24%),
    linear-gradient(180deg, #fff8f2 0%, #fff0e4 100%);
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.46), 0 16px 28px rgba(120, 90, 70, 0.08);
}

#game7Screen .ladder-empty-state {
  min-height: 520px;
  display: grid;
  place-items: center;
  color: #8c7262;
  font-weight: 800;
  line-height: 1.6;
  text-align: center;
  padding: 24px;
}

#game7Screen .ladder-svg {
  display: block;
  width: 100%;
  min-height: 520px;
}

#game7Screen .ladder-vertical-line {
  stroke: rgba(150, 124, 109, 0.58);
  stroke-width: 7;
  stroke-linecap: round;
  filter: drop-shadow(0 4px 8px rgba(120, 90, 70, 0.1));
}

#game7Screen .ladder-horizontal-line {
  stroke: rgba(255, 128, 160, 0.9);
  stroke-width: 8;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.45s ease, stroke-dashoffset 0.45s ease;
}

#game7Screen .ladder-board.is-revealed .ladder-horizontal-line {
  opacity: 1;
  animation: ladderLineReveal 0.8s ease both;
}

#game7Screen .ladder-player-label text,
#game7Screen .ladder-rank-label text {
  font-family: 'Pretendard', sans-serif;
  text-anchor: middle;
  font-size: 23px;
  font-weight: 900;
  fill: #6f5141;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.8);
  stroke-width: 4px;
}

#game7Screen .ladder-player-label circle {
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 5px;
  filter: drop-shadow(0 5px 8px rgba(120, 90, 70, 0.14));
}

#game7Screen .ladder-rank-label rect {
  fill: rgba(255, 248, 223, 0.96);
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 4px;
  filter: drop-shadow(0 6px 10px rgba(120, 90, 70, 0.12));
  transition: fill 0.35s ease, stroke 0.35s ease, filter 0.35s ease;
}

#game7Screen .ladder-rank-label text {
  font-size: 22px;
  fill: #8a6b41;
  stroke-width: 3px;
  transition: fill 0.35s ease;
}

#game7Screen .ladder-rank-label.is-filled rect {
  fill: var(--ladder-rank-color, #ffd56f);
  stroke: rgba(255, 255, 255, 0.95);
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--ladder-rank-color, #ffd56f) 42%, transparent));
}

#game7Screen .ladder-rank-label.is-filled text {
  fill: #ffffff;
}

#game7Screen .ladder-board-caption {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 34px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: #8c7262;
  font-weight: 900;
  font-size: 0.86rem;
  text-align: center;
  backdrop-filter: blur(8px);
}

#game7Screen .ladder-check-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#game7Screen .ladder-check-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

#game7Screen .ladder-check-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 2px solid rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.06);
}

#game7Screen .ladder-check-item.is-checked {
  background: linear-gradient(180deg, rgba(237, 255, 247, 0.88) 0%, rgba(225, 248, 239, 0.92) 100%);
}

#game7Screen .ladder-check-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ladder-player-color, #ffd56f);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.55);
}

#game7Screen .ladder-check-name {
  min-width: 0;
  color: var(--soft-brown);
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#game7Screen .ladder-check-result {
  grid-column: 2 / 4;
  color: #8f7363;
  font-size: 0.82rem;
  font-weight: 800;
}

#game7Screen .ladder-check-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pink), #ffdfe8);
  color: var(--brown);
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.08);
}

#game7Screen .ladder-check-btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  box-shadow: none;
}

#game7Screen .ladder-check-empty {
  padding: 18px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: #8c7262;
  text-align: center;
  line-height: 1.55;
}

#game7Screen .ladder-final-ranking {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 248, 223, 0.9) 0%, rgba(255, 240, 190, 0.92) 100%);
  border: 2px solid rgba(255, 255, 255, 0.86);
  color: #8a6b41;
  font-weight: 800;
}

#game7Screen .ladder-final-ranking span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  line-height: 1.45;
}

@keyframes ladderLineReveal {
  from {
    opacity: 0;
    stroke-dasharray: 18 12;
  }
  to {
    opacity: 1;
    stroke-dasharray: 0 0;
  }
}

@media (max-width: 1024px) {
  #game7Screen .ladder-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

@media (max-width: 760px) {
  #game7Screen .ladder-sidebar .ladder-check-card {
    display: none;
  }

  #game7Screen .ladder-card-screen {
    padding: 12px;
  }

  #game7Screen .ladder-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  #game7Screen .ladder-main {
    display: contents;
  }

  #game7Screen .ladder-main-header {
    order: 1;
    padding: 4px 4px 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  #game7Screen .ladder-sidebar {
    order: 2;
    border-radius: 24px;
  }

  #game7Screen .ladder-stage-card {
    order: 3;
    padding: 14px;
    border-radius: 24px;
  }

  #game7Screen .ladder-sidebar-inner {
    padding: 14px;
  }

  #game7Screen .ladder-board,
  #game7Screen .ladder-empty-state,
  #game7Screen .ladder-svg {
    min-height: 430px;
  }

  #game7Screen .ladder-player-label text {
    font-size: 18px;
    stroke-width: 3px;
  }

  #game7Screen .ladder-rank-label text {
    font-size: 18px;
  }

  #game7Screen .ladder-rank-label rect {
    width: 58px;
    x: -29px;
  }

  #game7Screen .ladder-check-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  #game7Screen .ladder-check-btn {
    grid-column: 1 / 3;
    width: 100%;
  }

  #game7Screen .ladder-check-result {
    grid-column: 2 / 3;
  }

  #game7Screen .ladder-button-row {
    grid-template-columns: 1fr;
  }
}

html.theme-dark #game7Screen .ladder-sidebar,
html.theme-dark #game7Screen .ladder-stage-card,
html.theme-dark #game7Screen .ladder-check-item,
html.theme-dark #game7Screen .ladder-check-empty {
  background: rgba(24, 31, 42, 0.82);
  border-color: rgba(176, 197, 220, 0.22);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.26);
}

html.theme-dark #game7Screen .ladder-board {
  background:
    radial-gradient(circle at center, rgba(128, 148, 171, 0.34), rgba(40, 51, 66, 0.26) 36%, transparent 64%),
    radial-gradient(circle at top left, rgba(183, 205, 228, 0.16), transparent 28%),
    linear-gradient(180deg, #182130 0%, #101722 100%);
  border-color: rgba(176, 197, 220, 0.24);
  box-shadow: inset 0 0 0 1px rgba(176, 197, 220, 0.12), 0 16px 28px rgba(0, 0, 0, 0.25);
}

html.theme-dark #game7Screen .ladder-vertical-line {
  stroke: rgba(176, 197, 220, 0.48);
}

html.theme-dark #game7Screen .ladder-horizontal-line {
  stroke: rgba(255, 130, 173, 0.9);
}

html.theme-dark #game7Screen .ladder-player-label text,
html.theme-dark #game7Screen .ladder-check-name {
  fill: #f3f8ff;
  color: #f3f8ff;
  stroke: rgba(16, 23, 34, 0.84);
}

html.theme-dark #game7Screen .ladder-rank-label rect,
html.theme-dark #game7Screen .ladder-reveal-badge,
html.theme-dark #game7Screen .ladder-final-ranking {
  background: linear-gradient(180deg, rgba(255, 213, 111, 0.22) 0%, rgba(255, 181, 96, 0.16) 100%);
  border-color: rgba(255, 213, 111, 0.22);
  color: #ffe6a6;
}

html.theme-dark #game7Screen .ladder-rank-label rect {
  fill: rgba(82, 62, 34, 0.96);
  stroke: rgba(255, 213, 111, 0.28);
}

html.theme-dark #game7Screen .ladder-rank-label text {
  fill: #ffe6a6;
  stroke: rgba(16, 23, 34, 0.84);
}

html.theme-dark #game7Screen .ladder-board-caption {
  background: rgba(24, 31, 42, 0.74);
  color: #d9e5f0;
}

html.theme-dark #game7Screen .ladder-check-result,
html.theme-dark #game7Screen .ladder-empty-state {
  color: #b7c5d5;
}

html.theme-dark #game7Screen .ladder-check-item.is-checked {
  background: linear-gradient(180deg, rgba(34, 76, 72, 0.78) 0%, rgba(20, 46, 49, 0.92) 100%);
}


/* game7 requested flow: selected ladder numbers + automatic result popups */
#game7Screen .ladder-button-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#game7Screen .ladder-check-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

#game7Screen .ladder-check-item.is-active {
  box-shadow:
    0 0 0 4px rgba(255, 213, 111, 0.28),
    0 10px 22px rgba(120, 90, 70, 0.12);
}

#game7Screen .ladder-check-lane {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 248, 223, 0.86);
  color: #8a6b41;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

#game7Screen .ladder-active-path {
  fill: none;
  stroke: color-mix(in srgb, var(--ladder-player-color, #ffd56f) 72%, white 28%);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.38;
  filter: drop-shadow(0 0 10px rgba(255, 213, 111, 0.26));
  stroke-dasharray: 1500;
  stroke-dashoffset: 1500;
  animation: none;
}

#game7Screen .ladder-active-runner {
  pointer-events: none;
}

#game7Screen .ladder-active-runner-body {
  fill: var(--ladder-player-color, #ffd56f);
  stroke: rgba(255, 255, 255, 0.96);
  stroke-width: 5;
  filter: drop-shadow(0 0 16px rgba(255, 213, 111, 0.45));
}

#game7Screen .ladder-active-runner-text {
  font-family: 'Pretendard', sans-serif;
  font-size: 17px;
  font-weight: 900;
  text-anchor: middle;
  fill: #ffffff;
  paint-order: stroke;
  stroke: rgba(91, 62, 41, 0.35);
  stroke-width: 2px;
}

#game7Screen .ladder-player-label.is-active circle {
  filter: drop-shadow(0 0 12px rgba(255, 213, 111, 0.78));
}

#game7Screen .ladder-player-label.is-done {
  opacity: 0.72;
}

#game7Screen .ladder-player-label .ladder-lane-num {
  font-size: 15px;
  font-weight: 900;
  fill: #8a6b41;
  stroke-width: 3px;
}

@keyframes ladderPathTrace {
  to { stroke-dashoffset: 0; }
}



html.theme-dark #game7Screen .ladder-check-lane {
  background: rgba(255, 213, 111, 0.16);
  color: #ffe6a6;
}

html.theme-dark #game7Screen .ladder-active-path {
  filter: drop-shadow(0 0 14px rgba(255, 213, 111, 0.32));
}

html.theme-dark #game7Screen .ladder-active-runner-body {
  stroke: rgba(16, 23, 34, 0.82);
}

html.theme-dark #game7Screen .ladder-player-label .ladder-lane-num {
  fill: #ffe6a6;
  stroke: rgba(16, 23, 34, 0.84);
}

html.theme-dark #game7Screen .ladder-rank-label.is-filled rect {
  stroke: rgba(255, 255, 255, 0.16);
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--ladder-rank-color, #ffd56f) 46%, transparent));
}

html.theme-dark #game7Screen .ladder-rank-label.is-filled text,
html.theme-dark #game7Screen .ladder-active-runner-text {
  fill: #f8fbff;
  stroke: rgba(16, 23, 34, 0.52);
}

@media (max-width: 760px) {
  #game7Screen .ladder-button-row {
    grid-template-columns: 1fr 1fr;
  }

  #game7Screen .ladder-check-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  #game7Screen .ladder-check-result {
    grid-column: 2 / 4;
  }

  #game7Screen .ladder-player-label .ladder-lane-num {
    font-size: 12px;
  }
}


/* game7 final summary popup */
.popup.ladder-final-popup {
  max-width: 620px;
  padding: 24px 20px;
  text-align: center;
}

.popup.ladder-final-popup .popup-message {
  max-height: min(66vh, 640px);
  overflow-y: auto;
  padding-right: 4px;
}

.ladder-final-popup-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(100%, 500px);
  margin: 0 auto;
}

.ladder-final-popup-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  align-items: center;
  padding: 13px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(251, 244, 238, 0.96) 100%);
  border: 2px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 22px rgba(120, 90, 70, 0.08);
  text-align: left;
}

.ladder-final-popup-item.top {
  background: linear-gradient(180deg, #fff8df 0%, #fff0be 100%);
}

.ladder-final-popup-rank {
  grid-row: 1 / 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 248, 223, 0.96);
  color: #8a6b41;
  font-weight: 900;
}

.ladder-final-popup-item strong {
  color: var(--soft-brown);
  font-size: 1.05rem;
  line-height: 1.25;
}

.ladder-final-popup-item small {
  color: #8f7363;
  font-weight: 700;
  line-height: 1.35;
}

html.theme-dark .ladder-final-popup-item {
  background: linear-gradient(180deg, rgba(35, 46, 60, 0.96) 0%, rgba(22, 30, 42, 0.96) 100%);
  border-color: rgba(176, 197, 220, 0.2);
}

html.theme-dark .ladder-final-popup-item.top {
  background: linear-gradient(180deg, rgba(82, 62, 34, 0.96) 0%, rgba(48, 39, 27, 0.96) 100%);
}

html.theme-dark .ladder-final-popup-rank {
  background: rgba(255, 213, 111, 0.16);
  color: #ffe6a6;
}

html.theme-dark .ladder-final-popup-item strong {
  color: #f3f8ff;
}

html.theme-dark .ladder-final-popup-item small {
  color: #b7c5d5;
}

/* Patch: runner is JS-positioned; no trailing path line should be visible. */
#game7Screen .ladder-active-path { display: none !important; }

.desktop-only-inline { display: inline; }
.mobile-only-inline { display: none; }
@media (max-width: 760px) { .desktop-only-inline { display: none; } .mobile-only-inline { display: inline; } }

/* Patch: game7 mobile portrait readability upgrade */
@media (max-width: 820px) and (pointer: coarse) and (orientation: portrait) {
  #game7Screen .ladder-sidebar .ladder-check-card {
    display: none;
  }

  #game7Screen.ladder-mobile-priority,
  #game7Screen {
    max-width: 100%;
  }

  body.app-active-game #game7Screen .ladder-card-screen {
    width: 100%;
    padding: 10px;
    border-radius: 24px;
  }

  body.app-active-game #game7Screen .ladder-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  body.app-active-game #game7Screen .ladder-main {
    display: contents;
  }

  body.app-active-game #game7Screen .ladder-main-header {
    order: 1;
    padding: 4px 4px 0;
    border-radius: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  body.app-active-game #game7Screen .ladder-main-header .small-badge {
    margin-bottom: 8px;
    padding: 7px 11px;
    font-size: 0.78rem;
  }

  body.app-active-game #game7Screen .ladder-main-header h2 {
    margin-bottom: 6px;
    font-size: clamp(1.72rem, 7.2vw, 2.18rem);
    line-height: 1.05;
  }

  body.app-active-game #game7Screen .ladder-main-header .sub-text {
    font-size: 0.86rem;
    line-height: 1.45;
  }

  body.app-active-game #game7Screen .ladder-stage-card {
    order: 3;
    padding: 12px;
    border-radius: 24px;
  }

  body.app-active-game #game7Screen .ladder-panel-head {
    gap: 10px;
  }

  body.app-active-game #game7Screen .ladder-panel-head h3 {
    font-size: 1.12rem;
    line-height: 1.18;
  }

  body.app-active-game #game7Screen .ladder-panel-head .sub-text {
    font-size: 0.84rem;
    line-height: 1.42;
  }

  body.app-active-game #game7Screen .ladder-reveal-badge {
    min-height: 34px;
    padding: 7px 12px;
    font-size: 0.82rem;
  }

  body.app-active-game #game7Screen .ladder-sidebar {
    order: 2;
    border-radius: 22px;
  }

  body.app-active-game #game7Screen .ladder-sidebar-inner {
    padding: 12px;
  }

  body.app-active-game #game7Screen .ladder-board,
  body.app-active-game #game7Screen .ladder-empty-state,
  body.app-active-game #game7Screen .ladder-svg {
    min-height: clamp(560px, 72vh, 660px);
    min-height: clamp(560px, 72svh, 660px);
  }

  body.app-active-game #game7Screen .ladder-board {
    height: clamp(560px, 72vh, 660px);
    height: clamp(560px, 72svh, 660px);
    margin-top: 12px;
    border-radius: 24px;
  }

  body.app-active-game #game7Screen .ladder-svg {
    width: 100%;
    height: 100%;
  }

  body.app-active-game #game7Screen .ladder-vertical-line {
    stroke-width: 6;
    opacity: 0.96;
  }

  body.app-active-game #game7Screen .ladder-horizontal-line {
    stroke-width: 7;
  }

  body.app-active-game #game7Screen .ladder-player-label text,
  body.app-active-game #game7Screen .ladder-rank-label text {
    font-size: 24px;
    stroke-width: 4px;
    letter-spacing: -0.02em;
  }

  body.app-active-game #game7Screen .ladder-player-label .ladder-lane-num {
    font-size: 16px;
    stroke-width: 3px;
  }

  body.app-active-game #game7Screen .ladder-rank-label text {
    font-size: 25px;
  }

  body.app-active-game #game7Screen .ladder-player-label circle,
  body.app-active-game #game7Screen .ladder-active-runner-body {
    stroke-width: 5px;
  }

  body.app-active-game #game7Screen .ladder-board-caption {
    left: 12px;
    right: 12px;
    bottom: 12px;
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.98rem;
    line-height: 1.25;
    border: 1px solid rgba(255,255,255,0.14);
  }

  body.app-active-game #game7Screen .ladder-button-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  body.app-active-game #game7Screen .ladder-check-list {
    max-height: 220px;
    overflow-y: auto;
  }

  body.app-active-game #game7Screen .ladder-check-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 11px 12px;
    border-radius: 18px;
  }

  body.app-active-game #game7Screen .ladder-check-name {
    font-size: 0.98rem;
  }

  body.app-active-game #game7Screen .ladder-check-result {
    grid-column: 2 / 4;
    font-size: 0.78rem;
  }
}

@media (max-width: 380px) and (pointer: coarse) and (orientation: portrait) {
  body.app-active-game #game7Screen .ladder-card-screen {
    padding: 8px;
  }

  body.app-active-game #game7Screen .ladder-stage-card {
    padding: 10px;
  }

  body.app-active-game #game7Screen .ladder-board,
  body.app-active-game #game7Screen .ladder-empty-state,
  body.app-active-game #game7Screen .ladder-svg {
    min-height: 540px;
  }

  body.app-active-game #game7Screen .ladder-board {
    height: 540px;
  }
}

/* =========================
   game2 / game5 zoom view
   - matches game4 large view behavior without blur
   - keeps original game DOM alive during play
========================= */
.race-panel-head-actions,
#game5Screen .roulette-panel-head-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}

#game5Screen .roulette-panel-head-actions .roulette-board-meta {
  display: inline-flex;
  align-items: center;
}

body.race-track-zoom-lock,
body.roulette-stage-zoom-lock {
  overflow: hidden !important;
}

.race-track-zoom-backdrop,
.roulette-stage-zoom-backdrop {
  background: rgba(255, 250, 244, 0.04) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.race-track-zoom-backdrop.is-active,
.roulette-stage-zoom-backdrop.is-active {
  opacity: 1 !important;
  pointer-events: auto !important;
}

#game2Screen .race-card.race-track-zoomed {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

#game2Screen .race-card.race-track-zoomed .race-track-wrap {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  z-index: 96 !important;
  width: min(97vw, 1720px) !important;
  height: min(94vh, 1040px) !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 16px 18px 18px !important;
  transform: translate(-50%, -50%) !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  gap: 14px !important;
  overflow: hidden !important;
  border-radius: 28px !important;
  border-width: 4px !important;
  box-shadow: 0 18px 38px rgba(73, 54, 45, 0.14) !important;
}

#game2Screen .race-card.race-track-zoomed .race-track-stage-head {
  align-items: flex-start !important;
  gap: 18px !important;
}

#game2Screen .race-card.race-track-zoomed .race-track-stage-title {
  font-size: 1.95rem !important;
}

#game2Screen .race-card.race-track-zoomed .race-track-stage-desc {
  margin-top: 8px !important;
  font-size: 1.02rem !important;
}

#game2Screen .race-card.race-track-zoomed .race-track-lanes {
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-right: 4px !important;
}

#game2Screen .race-card.race-track-zoomed .race-lane {
  flex: 0 0 72px !important;
  min-height: 72px !important;
}

#game2Screen .race-card.race-track-zoomed .race-track-zoom-btn {
  position: static !important;
  z-index: auto !important;
}

#game5Screen .roulette-card-screen.roulette-stage-zoomed {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

#game5Screen .roulette-card-screen.roulette-stage-zoomed .roulette-stage-card {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  z-index: 96 !important;
  width: min(96vw, 1520px) !important;
  height: min(92vh, 980px) !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 18px 18px 16px !important;
  transform: translate(-50%, -50%) !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  gap: 14px !important;
  overflow: hidden !important;
  background: #fffaf6 !important;
  border-radius: 28px !important;
  box-shadow: 0 18px 38px rgba(73, 54, 45, 0.14) !important;
}

#game5Screen .roulette-card-screen.roulette-stage-zoomed .roulette-panel-head {
  margin: 0 !important;
}

#game5Screen .roulette-card-screen.roulette-stage-zoomed .roulette-map-wrap {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  margin-top: 0 !important;
  border-radius: 24px !important;
}

#game5Screen .roulette-card-screen.roulette-stage-zoomed .roulette-chamber-panel {
  margin-top: 0 !important;
}

html.theme-dark .race-track-zoom-backdrop,
html.theme-dark .roulette-stage-zoom-backdrop {
  background: rgba(7, 12, 22, 0.04) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

html.theme-dark #game2Screen .race-card.race-track-zoomed .race-track-wrap,
html.theme-dark #game5Screen .roulette-card-screen.roulette-stage-zoomed .roulette-stage-card {
  background:
    radial-gradient(circle at top left, rgba(99, 153, 202, 0.18), transparent 32%),
    linear-gradient(180deg, rgba(24, 35, 50, 0.98) 0%, rgba(16, 24, 36, 0.98) 100%) !important;
  border-color: rgba(160, 190, 220, 0.32) !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42) !important;
}

@media (max-width: 900px) {
  #game2Screen .race-card.race-track-zoomed .race-track-wrap,
  #game5Screen .roulette-card-screen.roulette-stage-zoomed .roulette-stage-card {
    width: calc(100vw - 14px) !important;
    height: calc(100vh - 14px) !important;
    padding: 14px !important;
    border-radius: 24px !important;
  }

  #game2Screen .race-card.race-track-zoomed .race-track-stage-title {
    font-size: 1.4rem !important;
  }

  #game2Screen .race-card.race-track-zoomed .race-track-stage-desc {
    font-size: 0.92rem !important;
  }

  #game2Screen .race-card.race-track-zoomed .race-lane {
    flex-basis: 64px !important;
    min-height: 64px !important;
  }

  #game5Screen .roulette-card-screen.roulette-stage-zoomed .roulette-panel-head {
    gap: 10px !important;
  }
}


/* 클릭 우선순위 보정: 게임 진행 중 빨리감기/맵 이벤트가 확대 버튼을 가로채지 않도록 고정 */
.race-track-stage-actions,
#game5Screen .roulette-panel-head-actions,
.race-track-zoom-btn,
.roulette-stage-zoom-btn {
  position: relative;
  z-index: 120;
  pointer-events: auto;
}

#game2Screen .race-card.race-track-zoomed .race-track-stage-actions,
#game5Screen .roulette-card-screen.roulette-stage-zoomed .roulette-panel-head-actions {
  z-index: 130 !important;
}

#game2Screen .race-track-wrap > .race-track-stage-head,
#game5Screen .roulette-stage-card > .roulette-panel-head {
  position: relative;
  z-index: 3;
}

/* =========================
   physical menu + game M1 : balloon blow
========================= */

.physical-card {
  padding: 28px;
}

.physical-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.physical-header h2,
.balloon-card-screen h2,
.bomb-pass-card-screen h2,
.circle-tap-card-screen h2,
.key-react-card-screen h2 {
  font-family: 'Gaegu', cursive;
  color: var(--soft-brown);
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 10px;
}

.physical-game-shell {
  width: 100%;
}

.physical-carousel-hud {
  display: none;
}

#physicalScreen .physical-game-item[data-clone] {
  display: none;
}

.physical-game-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.physical-game-item {
  overflow: hidden;
}

.physical-compat-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(237, 255, 247, 0.98) 0%, rgba(214, 248, 229, 0.96) 100%);
  color: #44745a;
  font-size: 0.76rem;
  font-weight: 900;
  border: 2px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.12);
}

.physical-game-item[data-physical-compat="mobile-compatible"],
.physical-game-item[data-physical-compat="desktop-only"] {
  padding-top: 58px;
}

.physical-game-item[data-physical-compat="mobile-only"] {
  display: none;
  padding-top: 58px;
}

.physical-compat-badge.is-mobile-only {
  background: linear-gradient(180deg, rgba(255, 246, 240, 0.98) 0%, rgba(255, 231, 221, 0.96) 100%);
  color: #9a6257;
}

.physical-compat-badge.is-desktop-only {
  background: linear-gradient(180deg, rgba(238, 247, 255, 0.98) 0%, rgba(219, 236, 255, 0.96) 100%);
  color: #50719d;
}

@media (max-width: 980px) {
  .physical-game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) and (pointer: coarse) {
  .physical-game-item[data-physical-compat="desktop-only"] {
    display: none !important;
  }

  .physical-game-item[data-physical-compat="mobile-only"] {
    display: flex;
  }
}

@media (max-width: 820px) and (pointer: coarse) {
  .physical-card {
    padding: 24px 16px;
    overflow: hidden;
  }

  .physical-game-shell {
    width: 100%;
    overflow: visible;
  }

  .physical-game-grid {
    display: flex;
    grid-template-columns: none;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 13%;
    padding: 4px 13% 10px;
    margin-inline: -16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .physical-game-grid::-webkit-scrollbar {
    display: none;
  }

  body.physical-carousel-mode #physicalScreen .physical-game-grid.is-loop-resetting {
    scroll-behavior: auto;
    scroll-snap-type: none;
  }

  body.physical-carousel-mode #physicalScreen .physical-game-grid.is-loop-resetting .physical-game-item {
    transition: none;
  }

  body.physical-carousel-mode #physicalScreen .physical-game-item[data-clone] {
    display: flex;
  }

  .physical-game-item {
    flex: 0 0 74%;
    min-width: 0;
    min-height: 330px;
    scroll-snap-align: center;
    transform: scale(0.92);
    opacity: 0.58;
    transition: transform 0.22s ease, opacity 0.22s ease, box-shadow 0.22s ease;
  }

  .physical-game-item.is-carousel-active {
    transform: scale(1);
    opacity: 1;
  }

  .physical-game-item.is-carousel-neighbor {
    opacity: 0.74;
  }

  .physical-carousel-hud {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
  }

  .physical-carousel-hud[aria-hidden="true"] {
    display: none;
  }

  .physical-carousel-hint {
    color: #8f7363;
    font-size: 0.9rem;
    font-weight: 800;
    text-align: center;
  }

  .physical-carousel-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  .physical-carousel-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: rgba(157, 125, 107, 0.28);
    transition: width 0.2s ease, background 0.2s ease, transform 0.2s ease;
  }

  .physical-carousel-dot.is-active {
    width: 26px;
    background: linear-gradient(135deg, var(--pink), var(--lavender));
    transform: translateY(-1px);
  }
}

@media (max-width: 560px) and (pointer: coarse) {
  .physical-game-item {
    flex-basis: 78%;
    min-height: 320px;
  }
}

.balloon-card-screen {
  padding: 20px;
}

.balloon-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 16px;
  min-height: 720px;
}

.balloon-sidebar {
  min-width: 0;
  background: rgba(255, 255, 255, 0.34);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
}

.balloon-sidebar-inner {
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.balloon-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.balloon-main-header,
.balloon-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.balloon-stage-card {
  min-height: 590px;
  padding: 18px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.54), transparent 24%),
    linear-gradient(180deg, rgba(255, 248, 244, 0.92) 0%, rgba(255, 239, 231, 0.94) 100%);
  border: 3px solid rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42), 0 16px 28px rgba(120, 90, 70, 0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.balloon-panel-head h3 {
  font-weight: 800;
  color: var(--soft-brown);
  margin-bottom: 6px;
}

.balloon-turn-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #9f6f87;
  border: 2px solid rgba(255, 255, 255, 0.9);
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.08);
}

.balloon-press-area {
  position: relative;
  flex: 1 1 auto;
  min-height: 330px;
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.88), transparent 18%),
    radial-gradient(circle at 15% 25%, rgba(255, 219, 232, 0.55), transparent 26%),
    radial-gradient(circle at 84% 78%, rgba(216, 236, 255, 0.55), transparent 28%),
    linear-gradient(180deg, rgba(255, 250, 246, 0.92) 0%, rgba(255, 233, 224, 0.94) 100%);
  border: 3px dashed rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.34), 0 12px 24px rgba(120, 90, 70, 0.08);
  display: grid;
  place-items: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.balloon-press-area:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.34), 0 0 0 5px rgba(227, 217, 255, 0.42), 0 12px 24px rgba(120, 90, 70, 0.08);
}

.balloon-press-area.is-disabled {
  cursor: pointer;
}

.balloon-press-area.is-holding {
  border-color: rgba(255, 203, 132, 0.94);
  animation: balloonAreaPulse 0.75s ease-in-out infinite;
}

.balloon-press-area.is-popped {
  border-color: rgba(255, 134, 134, 0.85);
}

.balloon-visual {
  --balloon-scale: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(8px) scale(var(--balloon-scale));
  transform-origin: 50% 72%;
  transition: transform 0.12s ease-out, filter 0.18s ease;
  filter: drop-shadow(0 20px 22px rgba(173, 87, 116, 0.16));
}

.balloon-body {
  position: relative;
  width: 132px;
  height: 158px;
  border-radius: 58% 58% 54% 54% / 62% 62% 48% 48%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.82) 0 12%, transparent 13%),
    radial-gradient(circle at 62% 76%, rgba(0, 0, 0, 0.14), transparent 28%),
    linear-gradient(
      145deg,
      color-mix(in srgb, var(--balloon-current-color, #ff6f9f) 58%, #ffffff) 0%,
      var(--balloon-current-color, #ff6f9f) 52%,
      color-mix(in srgb, var(--balloon-current-color, #ff6f9f) 82%, #000000) 100%
    );
  border: 3px solid rgba(255, 255, 255, 0.86);
  box-shadow:
    inset -14px -16px 24px rgba(185, 39, 88, 0.18),
    inset 9px 9px 18px rgba(255, 255, 255, 0.28),
    0 16px 24px rgba(161, 74, 104, 0.14);
  display: grid;
  place-items: center;
}

.balloon-visual.is-popped {
  opacity: 0;
  transform: translateY(8px) scale(0.35) rotate(6deg);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.balloon-pressure-number {
  font-family: 'Gaegu', cursive;
  font-size: 2.75rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 3px 10px rgba(124, 35, 68, 0.22);
  line-height: 1;
}

.balloon-knot {
  width: 28px;
  height: 24px;
  margin-top: -3px;
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  background: linear-gradient(180deg, var(--balloon-current-color, #ff6f9f) 0%, color-mix(in srgb, var(--balloon-current-color, #ff6f9f) 78%, #000000) 100%);
  border: 2px solid rgba(255, 255, 255, 0.72);
}

.balloon-string {
  width: 2px;
  height: 60px;
  background: linear-gradient(180deg, rgba(125, 97, 81, 0.32), rgba(125, 97, 81, 0.04));
  border-radius: 999px;
}

.balloon-pop-effect {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(5rem, 18vw, 10rem);
  opacity: 0;
  transform: scale(0.4) rotate(-8deg);
  pointer-events: none;
  filter: drop-shadow(0 14px 18px rgba(130, 60, 60, 0.18));
}

.balloon-pop-effect.is-active {
  animation: balloonPopBang 0.72s ease-out both;
}

.balloon-pressure-card {
  display: none !important;
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.05);
}

.balloon-pressure-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #8f7363;
  font-weight: 800;
  margin-bottom: 10px;
}

.balloon-pressure-topline strong {
  font-family: 'Gaegu', cursive;
  color: var(--soft-brown);
  font-size: 1.5rem;
  line-height: 1;
}

.balloon-pressure-track {
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 241, 232, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.84);
}

.balloon-pressure-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #bfe8d8 0%, #ffd56f 58%, #ff6f9f 100%);
  transition: width 0.12s linear;
}

.balloon-stage-hint {
  min-height: 48px;
  padding: 13px 16px;
  border-radius: 20px;
  background: rgba(255, 250, 245, 0.76);
  color: #8a7161;
  line-height: 1.6;
  text-align: center;
  font-weight: 700;
}

.balloon-button-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.balloon-player-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.balloon-player-item,
.balloon-player-empty {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 2px solid rgba(255, 255, 255, 0.74);
  color: var(--brown);
  box-shadow: 0 6px 14px rgba(120, 90, 70, 0.05);
}

.balloon-player-empty {
  display: block;
  text-align: center;
  color: #8c7262;
  line-height: 1.5;
}

.balloon-player-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--soft-brown);
}

.balloon-player-item span:last-child {
  font-size: 0.84rem;
  font-weight: 800;
  color: #8f7363;
  white-space: nowrap;
}

.balloon-player-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--balloon-player-color, var(--pink));
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.72);
}

.balloon-player-item.is-current {
  background: linear-gradient(180deg, rgba(255, 251, 240, 0.94) 0%, rgba(255, 241, 211, 0.94) 100%);
  border-color: rgba(255, 228, 150, 0.84);
}

.balloon-player-item.is-loser {
  background: linear-gradient(180deg, rgba(255, 243, 243, 0.96) 0%, rgba(255, 224, 224, 0.94) 100%);
  border-color: rgba(255, 152, 152, 0.78);
}

.balloon-back-btn {
  width: max-content;
  align-self: flex-end;
}

.popup.balloon-result-popup {
  max-width: 420px;
}

@keyframes balloonAreaPulse {
  0%, 100% {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.34), 0 12px 24px rgba(120, 90, 70, 0.08);
  }
  50% {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.34), 0 0 0 5px rgba(255, 214, 126, 0.32), 0 12px 24px rgba(120, 90, 70, 0.1);
  }
}

@keyframes balloonDangerShake {
  0%, 100% { transform: translateY(8px) scale(var(--balloon-scale)) rotate(0deg); }
  25% { transform: translateY(7px) scale(var(--balloon-scale)) rotate(-1.5deg); }
  75% { transform: translateY(9px) scale(var(--balloon-scale)) rotate(1.5deg); }
}

@keyframes balloonPopBang {
  0% {
    opacity: 0;
    transform: scale(0.4) rotate(-8deg);
  }
  28% {
    opacity: 1;
    transform: scale(1.08) rotate(5deg);
  }
  100% {
    opacity: 0;
    transform: scale(1.55) rotate(12deg);
  }
}

@media (max-width: 1024px) {
  .balloon-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .balloon-stage-card {
    min-height: 560px;
  }
}

@media (max-width: 720px) {
  .balloon-card-screen {
    padding: 12px;
  }

  .balloon-sidebar-inner,
  .balloon-stage-card {
    padding: 14px;
    border-radius: 24px;
  }

  .balloon-main-header {
    padding: 2px 2px 0;
  }

  .balloon-stage-card {
    min-height: 520px;
  }

  .balloon-press-area {
    min-height: 300px;
    border-radius: 26px;
  }

  .balloon-body {
    width: 112px;
    height: 136px;
  }

  .balloon-pressure-number {
    font-size: 2.55rem;
  }

  .balloon-back-btn {
    width: 100%;
    align-self: stretch;
    text-align: center;
  }
}

@media (max-width: 460px) {
  .balloon-button-row {
    grid-template-columns: 1fr;
  }

  .balloon-player-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .balloon-player-item span:last-child {
    grid-column: 2;
  }
}


/* =========================
   physical game M2 : bomb pass
========================= */

.bomb-pass-card-screen {
  padding: 20px;
}

.bomb-pass-layout {
  min-height: 720px;
}

.bomb-pass-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bomb-pass-main-header,
.bomb-pass-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.bomb-pass-stage-card {
  min-height: 620px;
  padding: 18px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.54), transparent 24%),
    radial-gradient(circle at 88% 16%, rgba(255, 210, 128, 0.24), transparent 24%),
    linear-gradient(180deg, rgba(255, 248, 244, 0.92) 0%, rgba(255, 236, 226, 0.94) 100%);
  border: 3px solid rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42), 0 16px 28px rgba(120, 90, 70, 0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bomb-pass-panel-head h3 {
  font-weight: 800;
  color: var(--soft-brown);
  margin-bottom: 6px;
}

.bomb-pass-state-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #9a6257;
  border: 2px solid rgba(255, 255, 255, 0.9);
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.08);
}

.bomb-pass-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 360px;
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.84), transparent 19%),
    radial-gradient(circle at 16% 24%, rgba(255, 219, 232, 0.5), transparent 28%),
    radial-gradient(circle at 82% 78%, rgba(216, 236, 255, 0.55), transparent 30%),
    linear-gradient(180deg, rgba(255, 250, 246, 0.92) 0%, rgba(255, 232, 221, 0.94) 100%);
  border: 3px dashed rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.34), 0 12px 24px rgba(120, 90, 70, 0.08);
  display: grid;
  place-items: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.bomb-pass-stage.is-running {
  border-color: rgba(255, 203, 132, 0.94);
  animation: bombPassStagePulse 0.82s ease-in-out infinite;
}

.bomb-pass-stage.is-exploded {
  border-color: rgba(255, 134, 134, 0.85);
}

.bomb-pass-stage.is-desktop-blocked::after {
  content: '모바일 전용';
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #9a6257;
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.08);
}

.bomb-pass-visual {
  position: relative;
  width: min(62vw, 310px);
  height: min(62vw, 310px);
  display: grid;
  place-items: center;
  transform-origin: 50% 58%;
  filter: drop-shadow(0 24px 24px rgba(60, 38, 36, 0.18));
}

.bomb-pass-visual.is-running {
  animation: bombPassWobble 0.62s ease-in-out infinite;
}

.bomb-pass-visual.is-exploded .bomb-pass-body,
.bomb-pass-visual.is-exploded .bomb-pass-fuse {
  opacity: 0;
  transform: scale(0.34) rotate(10deg);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.bomb-pass-fuse {
  position: absolute;
  top: 24px;
  left: 54%;
  width: 110px;
  height: 78px;
  transform: rotate(22deg);
  z-index: 1;
}

.bomb-pass-fuse-line {
  position: absolute;
  left: 0;
  top: 28px;
  width: 92px;
  height: 18px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, #5e463a 0 10px, #f4d28f 10px 18px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

.bomb-pass-spark {
  position: absolute;
  right: 2px;
  top: 14px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff9cc 0 26%, #ffd56f 28% 54%, rgba(255, 143, 91, 0.2) 56% 100%);
  color: #ff7a54;
  font-size: 1.45rem;
  animation: bombPassSpark 0.48s ease-in-out infinite alternate;
}

.bomb-pass-body {
  position: relative;
  width: min(44vw, 220px);
  height: min(44vw, 220px);
  max-width: 220px;
  max-height: 220px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.35) 0 12%, transparent 13%),
    radial-gradient(circle at 68% 78%, rgba(0, 0, 0, 0.36), transparent 30%),
    linear-gradient(145deg, #585461 0%, #26242c 52%, #111016 100%);
  border: 5px solid rgba(255, 255, 255, 0.82);
  box-shadow:
    inset -18px -20px 30px rgba(0, 0, 0, 0.28),
    inset 12px 12px 22px rgba(255, 255, 255, 0.08),
    0 18px 28px rgba(60, 38, 36, 0.18);
  display: grid;
  place-items: center;
  z-index: 2;
}

.bomb-pass-face {
  font-size: clamp(4.2rem, 16vw, 7.8rem);
  line-height: 1;
  transform: translateY(2px);
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.18));
}

.bomb-pass-highlight {
  position: absolute;
  top: 28px;
  left: 38px;
  width: 42px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transform: rotate(-22deg);
}

.bomb-pass-boom {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(5rem, 24vw, 12rem);
  opacity: 0;
  transform: scale(0.38) rotate(-10deg);
  pointer-events: none;
  z-index: 5;
  filter: drop-shadow(0 14px 20px rgba(130, 60, 60, 0.22));
}

.bomb-pass-boom.is-active {
  animation: bombPassBoom 0.86s ease-out both;
}

.bomb-pass-control-card {
  padding: 16px;
  border-radius: 24px;
  background: rgba(255, 250, 245, 0.76);
  border: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.05);
}

.bomb-pass-button-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0;
}

.bomb-pass-status-text,
.bomb-pass-device-text {
  margin-top: 12px;
  color: #8a7161;
  line-height: 1.6;
  text-align: center;
  font-weight: 700;
}

.bomb-pass-device-text {
  font-size: 0.9rem;
  color: #9b7d6b;
  font-weight: 600;
}

.bomb-pass-back-btn {
  width: max-content;
  align-self: flex-end;
}

.popup.bomb-pass-result-popup {
  max-width: 440px;
}

@keyframes bombPassStagePulse {
  0%, 100% {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.34), 0 12px 24px rgba(120, 90, 70, 0.08);
  }
  50% {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.34), 0 0 0 5px rgba(255, 214, 126, 0.32), 0 12px 24px rgba(120, 90, 70, 0.1);
  }
}

@keyframes bombPassWobble {
  0%, 100% { transform: translateY(0) scale(1) rotate(-2deg); }
  25% { transform: translateY(-5px) scale(1.035) rotate(2deg); }
  50% { transform: translateY(1px) scale(0.985) rotate(-1deg); }
  75% { transform: translateY(-3px) scale(1.02) rotate(3deg); }
}

@keyframes bombPassSpark {
  from { transform: scale(0.88) rotate(-12deg); opacity: 0.72; }
  to { transform: scale(1.16) rotate(10deg); opacity: 1; }
}

@keyframes bombPassBoom {
  0% {
    opacity: 0;
    transform: scale(0.38) rotate(-10deg);
  }
  24% {
    opacity: 1;
    transform: scale(1.1) rotate(4deg);
  }
  100% {
    opacity: 0;
    transform: scale(1.8) rotate(14deg);
  }
}

@media (max-width: 720px) {
  .bomb-pass-card-screen {
    padding: 12px;
  }

  .bomb-pass-stage-card {
    min-height: 600px;
    padding: 14px;
    border-radius: 24px;
  }

  .bomb-pass-main-header {
    padding: 2px 2px 0;
  }

  .bomb-pass-stage {
    min-height: 350px;
    border-radius: 26px;
  }

  .bomb-pass-control-card {
    padding: 14px;
    border-radius: 22px;
  }

  .bomb-pass-back-btn {
    width: 100%;
    align-self: stretch;
    text-align: center;
  }
}

@media (max-width: 460px) {
  .bomb-pass-button-row {
    grid-template-columns: 1fr;
  }

  .bomb-pass-stage-card {
    min-height: 560px;
  }

  .bomb-pass-stage {
    min-height: 320px;
  }
}


/* =========================
   physical game M3 : shrinking circle
========================= */

.circle-tap-card-screen {
  padding: 20px;
}

.circle-tap-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 16px;
  min-height: 720px;
}

.circle-tap-sidebar {
  min-width: 0;
  background: rgba(255, 255, 255, 0.34);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
}

.circle-tap-sidebar-inner {
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.circle-tap-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.circle-tap-main-header,
.circle-tap-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.circle-tap-stage-card {
  min-height: 590px;
  padding: 18px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.54), transparent 24%),
    radial-gradient(circle at 88% 16%, rgba(216, 236, 255, 0.3), transparent 24%),
    linear-gradient(180deg, rgba(255, 248, 244, 0.92) 0%, rgba(246, 239, 255, 0.94) 100%);
  border: 3px solid rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42), 0 16px 28px rgba(120, 90, 70, 0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.circle-tap-panel-head h3 {
  font-weight: 800;
  color: var(--soft-brown);
  margin-bottom: 6px;
}

.circle-tap-turn-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #7a66a8;
  border: 2px solid rgba(255, 255, 255, 0.9);
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.08);
}

.circle-tap-stage {
  --circle-tap-current-color: #ff82ad;
  position: relative;
  flex: 1 1 auto;
  min-height: 330px;
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.86), transparent 18%),
    radial-gradient(circle at 15% 25%, rgba(255, 219, 232, 0.48), transparent 26%),
    radial-gradient(circle at 84% 78%, rgba(216, 236, 255, 0.58), transparent 28%),
    linear-gradient(180deg, rgba(255, 250, 246, 0.92) 0%, rgba(246, 239, 255, 0.94) 100%);
  border: 3px dashed rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.34), 0 12px 24px rgba(120, 90, 70, 0.08);
  display: grid;
  place-items: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.circle-tap-stage.is-started {
  border-color: color-mix(in srgb, var(--circle-tap-current-color) 72%, #ffffff);
}

.circle-tap-stage.is-finished {
  border-color: rgba(255, 134, 134, 0.85);
}

.circle-tap-stage.is-mobile-blocked::after {
  content: '모바일 전용';
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #7a66a8;
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.08);
}

.circle-tap-target {
  --circle-tap-size: 284px;
  --circle-tap-current-color: #ff82ad;
  position: relative;
  width: var(--circle-tap-size);
  height: var(--circle-tap-size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 34% 25%, rgba(255, 255, 255, 0.78) 0 11%, transparent 12%),
    radial-gradient(circle at 66% 76%, rgba(0, 0, 0, 0.18), transparent 28%),
    linear-gradient(145deg,
      color-mix(in srgb, var(--circle-tap-current-color) 58%, #ffffff) 0%,
      var(--circle-tap-current-color) 54%,
      color-mix(in srgb, var(--circle-tap-current-color) 80%, #000000) 100%
    );
  border: 4px solid rgba(255, 255, 255, 0.88);
  box-shadow:
    inset -16px -18px 26px rgba(0, 0, 0, 0.16),
    inset 10px 10px 20px rgba(255, 255, 255, 0.28),
    0 20px 28px rgba(105, 80, 120, 0.16);
  transform: scale(1);
  transition: width 0.18s ease, height 0.18s ease, transform 0.14s ease, opacity 0.16s ease;
  pointer-events: none;
}

.circle-tap-target.is-active {
  animation: circleTapBreathe 1.3s ease-in-out infinite;
}

.circle-tap-target.is-hit {
  animation: circleTapHit 0.2s ease-out;
}

.circle-tap-target.is-finished {
  opacity: 0.42;
  transform: scale(0.82);
}

.circle-tap-count {
  display: none;
}

.circle-tap-miss-effect {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: 'Gaegu', cursive;
  font-size: clamp(4rem, 18vw, 9rem);
  font-weight: 700;
  color: #ff6f9f;
  opacity: 0;
  transform: scale(0.52) rotate(-7deg);
  pointer-events: none;
  text-shadow: 0 10px 20px rgba(90, 40, 58, 0.2);
  z-index: 5;
}

.circle-tap-miss-effect.is-active {
  animation: circleTapMiss 0.78s ease-out both;
}

.circle-tap-stage-hint {
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.05);
  color: #8a7161;
  line-height: 1.6;
  text-align: center;
  font-weight: 800;
}

.circle-tap-button-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.circle-tap-player-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.circle-tap-player-item,
.circle-tap-player-empty {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 6px 14px rgba(120, 90, 70, 0.05);
  color: #8a7161;
}

.circle-tap-player-empty {
  display: block;
  line-height: 1.55;
}

.circle-tap-player-item strong {
  color: var(--soft-brown);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.circle-tap-player-item span:last-child {
  font-size: 0.86rem;
  font-weight: 800;
  color: #8f7363;
  white-space: nowrap;
}

.circle-tap-player-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--circle-tap-player-color, var(--pink));
}

.circle-tap-player-item.is-current {
  background: linear-gradient(180deg, rgba(255, 248, 222, 0.96) 0%, rgba(255, 241, 199, 0.94) 100%);
  border-color: rgba(255, 213, 111, 0.58);
}

.circle-tap-player-item.is-loser {
  background: linear-gradient(180deg, rgba(255, 239, 244, 0.98) 0%, rgba(255, 221, 233, 0.95) 100%);
  border-color: rgba(255, 130, 173, 0.44);
}

.circle-tap-back-btn {
  width: max-content;
  align-self: flex-end;
}

.popup.circle-tap-result-popup {
  max-width: 440px;
}

@keyframes circleTapBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.025); }
}

@keyframes circleTapHit {
  0% { transform: scale(1); }
  45% { transform: scale(0.92); }
  100% { transform: scale(1); }
}

@keyframes circleTapMiss {
  0% { opacity: 0; transform: scale(0.52) rotate(-7deg); }
  24% { opacity: 1; transform: scale(1.1) rotate(4deg); }
  100% { opacity: 0; transform: scale(1.5) rotate(10deg); }
}

@media (max-width: 1024px) {
  .circle-tap-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .circle-tap-card-screen {
    padding: 12px;
  }

  .circle-tap-sidebar-inner,
  .circle-tap-stage-card {
    padding: 14px;
  }

  .circle-tap-stage-card {
    min-height: 600px;
    border-radius: 24px;
  }

  .circle-tap-stage {
    min-height: 340px;
    border-radius: 26px;
  }

  .circle-tap-main-header {
    padding: 2px 2px 0;
  }

  .circle-tap-back-btn {
    width: 100%;
    align-self: stretch;
    text-align: center;
  }
}

@media (max-width: 460px) {
  .circle-tap-button-row {
    grid-template-columns: 1fr;
  }

  .circle-tap-stage-card {
    min-height: 560px;
  }

  .circle-tap-stage {
    min-height: 320px;
  }
}


/* =========================
   physical game M4 : STAY CLICK keyboard reaction
========================= */

.key-react-card-screen {
  padding: 20px;
}

.key-react-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 16px;
  min-height: 720px;
}

.key-react-sidebar {
  min-width: 0;
  background: rgba(255, 255, 255, 0.34);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
}

.key-react-sidebar-inner {
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.key-react-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.key-react-main-header,
.key-react-panel-head,
.key-react-live-head,
.key-react-key-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.key-react-stage-card {
  min-height: 590px;
  padding: 18px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.54), transparent 24%),
    radial-gradient(circle at 88% 16%, rgba(216, 236, 255, 0.36), transparent 24%),
    linear-gradient(180deg, rgba(255, 248, 244, 0.92) 0%, rgba(239, 247, 255, 0.94) 100%);
  border: 3px solid rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42), 0 16px 28px rgba(120, 90, 70, 0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.key-react-panel-head h3,
.key-react-live-head h3 {
  font-weight: 800;
  color: var(--soft-brown);
  margin-bottom: 6px;
}

.key-react-phase-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #50719d;
  border: 2px solid rgba(255, 255, 255, 0.9);
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.08);
}

.key-react-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 320px;
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.82), transparent 18%),
    radial-gradient(circle at 14% 24%, rgba(255, 219, 232, 0.42), transparent 26%),
    radial-gradient(circle at 86% 80%, rgba(216, 236, 255, 0.62), transparent 29%),
    linear-gradient(180deg, rgba(255, 250, 246, 0.92) 0%, rgba(241, 247, 255, 0.95) 100%);
  border: 3px dashed rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.34), 0 12px 24px rgba(120, 90, 70, 0.08);
  display: grid;
  place-items: center;
  user-select: none;
  -webkit-user-select: none;
}

.key-react-stage.is-stay {
  border-color: rgba(255, 213, 111, 0.85);
}

.key-react-stage.is-click {
  border-color: rgba(101, 231, 207, 0.9);
  animation: keyReactClickPulse 0.48s ease-in-out infinite alternate;
}

.key-react-stage.is-finished {
  border-color: rgba(196, 181, 253, 0.82);
}

.key-react-stage.is-desktop-blocked::after {
  content: 'PC 전용';
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #50719d;
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.08);
}

.key-react-stage-inner {
  width: min(100%, 620px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}

.key-react-signal-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(92px, 16vw, 150px);
  font-family: 'Gaegu', cursive;
  font-size: clamp(4rem, 11vw, 8rem);
  font-weight: 700;
  line-height: 0.9;
  color: #7d6151;
  letter-spacing: 0.02em;
  text-shadow: 0 10px 20px rgba(120, 90, 70, 0.1);
}

.key-react-stage.is-stay .key-react-signal-text {
  color: #ad7b29;
}

.key-react-stage.is-click .key-react-signal-text {
  color: #278b76;
  transform-origin: center;
  animation: keyReactSignalPop 0.42s ease-in-out infinite alternate;
}

.key-react-signal-sub-text {
  color: #8a7161;
  line-height: 1.6;
  font-weight: 800;
}

.key-react-key-chips,
.key-react-key-list,
.key-react-player-list,
.key-react-ranking-list,
.key-react-popup-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.key-react-key-card,
.key-react-live-card {
  padding: 14px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
  border: 2px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.05);
}

.key-react-key-card {
  margin-top: 14px;
}

.key-react-key-head {
  margin-bottom: 12px;
}

.key-react-key-head strong {
  color: var(--soft-brown);
}

.key-react-key-head span,
.key-react-live-head span {
  color: #8c7262;
  font-size: 0.88rem;
  font-weight: 800;
}

.key-react-key-row,
.key-react-player-item,
.key-react-ranking-item,
.key-react-chip,
.key-react-player-empty,
.key-react-ranking-empty,
.key-react-popup-item {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 6px 14px rgba(120, 90, 70, 0.05);
  color: #8a7161;
}

.key-react-key-row {
  grid-template-columns: auto minmax(0, 1fr) 76px;
}

.key-react-player-item {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.key-react-ranking-item,
.key-react-popup-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.key-react-chip {
  display: inline-flex;
  flex-direction: row;
  justify-content: center;
  background: rgba(255, 255, 255, 0.74);
}

.key-react-key-chips {
  width: min(100%, 560px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.key-react-player-empty,
.key-react-ranking-empty {
  display: block;
  line-height: 1.55;
  text-align: center;
}

.key-react-player-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--key-react-player-color, var(--sky));
}

.key-react-key-row strong,
.key-react-player-item strong,
.key-react-ranking-item strong,
.key-react-chip strong,
.key-react-popup-item strong {
  color: var(--soft-brown);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key-react-key-row,
.key-react-key-row * {
  -webkit-user-select: none;
  user-select: none;
}

.key-react-key-row.is-listening {
  background: linear-gradient(180deg, rgba(237, 248, 255, 0.98) 0%, rgba(221, 242, 255, 0.94) 100%);
  border-color: rgba(155, 220, 255, 0.62);
  box-shadow:
    0 0 0 4px rgba(155, 220, 255, 0.18),
    0 8px 18px rgba(120, 90, 70, 0.07);
}

.key-react-key-input {
  width: 76px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 2px solid rgba(216, 236, 255, 0.92);
  background: #fffdfa;
  color: #50719d;
  font-weight: 900;
  text-align: center;
  cursor: pointer;
  text-transform: uppercase;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.key-react-key-input:focus,
.key-react-key-input:focus-visible {
  outline: none;
  border-color: #9bdcff;
  box-shadow: 0 0 0 5px rgba(216, 236, 255, 0.55);
}

.key-react-key-row.is-listening .key-react-key-input {
  background: linear-gradient(180deg, #eaf8ff 0%, #dff3ff 100%);
  color: #2f6f99;
  border-color: #9bdcff;
}

.key-react-key-row.is-duplicate .key-react-key-input {
  border-color: rgba(255, 130, 173, 0.72);
  color: #b14d70;
  background: #fff1f6;
}

.key-react-player-item kbd,
.key-react-chip kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fffdf9 0%, #eaf5ff 100%);
  border: 2px solid rgba(255, 255, 255, 0.92);
  color: #50719d;
  font: inherit;
  font-weight: 900;
  box-shadow: 0 5px 10px rgba(120, 90, 70, 0.06);
}

.key-react-player-item span:last-child,
.key-react-ranking-item span:last-child {
  font-size: 0.88rem;
  font-weight: 900;
  color: #8f7363;
  white-space: nowrap;
}

.key-react-player-item.is-done,
.key-react-chip.is-pressed,
.key-react-ranking-item.is-valid,
.key-react-popup-item.is-valid {
  background: linear-gradient(180deg, rgba(237, 255, 247, 0.96) 0%, rgba(214, 248, 229, 0.94) 100%);
  border-color: rgba(101, 231, 207, 0.36);
}

.key-react-player-item.is-false-start,
.key-react-chip.is-false-start,
.key-react-ranking-item.is-false-start,
.key-react-popup-item.is-false-start {
  background: linear-gradient(180deg, rgba(255, 239, 244, 0.98) 0%, rgba(255, 221, 233, 0.95) 100%);
  border-color: rgba(255, 130, 173, 0.44);
}

.key-react-rank-badge,
.key-react-popup-item span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff8df 0%, #fff0be 100%);
  color: #8a6b41;
  font-weight: 900;
}

.key-react-popup-item em {
  font-style: normal;
  font-weight: 900;
  color: #8f7363;
}

.key-react-button-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.key-react-back-btn {
  width: max-content;
  align-self: flex-end;
}

.popup.key-react-result-popup {
  max-width: 520px;
}

.popup.key-react-result-popup .popup-message {
  max-height: min(62vh, 560px);
  overflow-y: auto;
}

@keyframes keyReactClickPulse {
  from { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.34), 0 12px 24px rgba(120, 90, 70, 0.08); }
  to { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.52), 0 0 32px rgba(101, 231, 207, 0.42); }
}

@keyframes keyReactSignalPop {
  from { transform: scale(1); }
  to { transform: scale(1.055); }
}

@media (max-width: 1024px) {
  .key-react-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .key-react-card-screen {
    padding: 12px;
  }

  .key-react-sidebar-inner,
  .key-react-stage-card {
    padding: 14px;
  }

  .key-react-stage-card {
    min-height: 580px;
    border-radius: 24px;
  }

  .key-react-stage {
    min-height: 300px;
    border-radius: 26px;
  }

  .key-react-key-chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .key-react-key-row,
  .key-react-player-item,
  .key-react-ranking-item,
  .key-react-popup-item {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }

  .key-react-back-btn {
    width: 100%;
    align-self: stretch;
    text-align: center;
  }
}

html.theme-dark .physical-card,
html.theme-dark .balloon-card-screen,
html.theme-dark .bomb-pass-card-screen,
html.theme-dark .circle-tap-card-screen,
html.theme-dark .key-react-card-screen {
  background: rgba(20, 27, 38, 0.84);
  border-color: rgba(130, 151, 174, 0.34);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.24);
}

html.theme-dark .physical-carousel-hint {
  color: #b8c5d6;
}

html.theme-dark .physical-carousel-dot {
  background: rgba(184, 197, 214, 0.28);
}

html.theme-dark .physical-carousel-dot.is-active {
  background: linear-gradient(135deg, #ff82ad, #7fd8ff);
}

html.theme-dark .physical-compat-badge {
  background: linear-gradient(180deg, rgba(31, 68, 62, 0.96) 0%, rgba(22, 54, 50, 0.96) 100%);
  color: #8ff0d7;
  border-color: rgba(143, 240, 215, 0.22);
}

html.theme-dark .physical-compat-badge.is-mobile-only {
  background: linear-gradient(180deg, rgba(69, 45, 35, 0.96) 0%, rgba(54, 34, 30, 0.96) 100%);
  color: #ffb087;
  border-color: rgba(255, 176, 135, 0.22);
}

html.theme-dark .physical-compat-badge.is-desktop-only {
  background: linear-gradient(180deg, rgba(30, 54, 76, 0.96) 0%, rgba(22, 39, 58, 0.96) 100%);
  color: #9bdcff;
  border-color: rgba(155, 220, 255, 0.22);
}

html.theme-dark .balloon-sidebar,
html.theme-dark .balloon-stage-card {
  background: rgba(20, 30, 43, 0.72);
  border-color: rgba(130, 151, 174, 0.3);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.22);
}

html.theme-dark .balloon-stage-card {
  background:
    radial-gradient(circle at top left, rgba(125, 216, 255, 0.14), transparent 25%),
    linear-gradient(180deg, rgba(23, 35, 50, 0.94) 0%, rgba(14, 22, 34, 0.96) 100%);
}

html.theme-dark .balloon-press-area {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.12), transparent 18%),
    radial-gradient(circle at 15% 25%, rgba(255, 130, 173, 0.18), transparent 26%),
    radial-gradient(circle at 84% 78%, rgba(125, 216, 255, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(24, 37, 53, 0.94) 0%, rgba(18, 27, 40, 0.96) 100%);
  border-color: rgba(130, 151, 174, 0.34);
}

html.theme-dark .balloon-turn-badge,
html.theme-dark .balloon-stage-hint,
html.theme-dark .balloon-player-item,
html.theme-dark .balloon-player-empty {
  background: rgba(30, 43, 59, 0.88);
  border-color: rgba(130, 151, 174, 0.28);
  color: #d9e5f0;
}

html.theme-dark .balloon-stage-hint,
html.theme-dark .balloon-player-item span:last-child {
  color: #b8c7d8;
}

html.theme-dark .balloon-turn-badge,
html.theme-dark .balloon-player-item strong {
  color: #ff9fc9;
}

html.theme-dark .balloon-pressure-track {
  background: rgba(12, 18, 28, 0.86);
  border-color: rgba(130, 151, 174, 0.26);
}

html.theme-dark .balloon-player-item.is-current {
  background: linear-gradient(180deg, rgba(55, 45, 25, 0.96) 0%, rgba(69, 52, 24, 0.94) 100%);
  border-color: rgba(255, 213, 111, 0.36);
}

html.theme-dark .balloon-player-item.is-loser {
  background: linear-gradient(180deg, rgba(65, 30, 38, 0.96) 0%, rgba(84, 34, 46, 0.94) 100%);
  border-color: rgba(255, 130, 173, 0.34);
}


html.theme-dark .bomb-pass-stage-card {
  background:
    radial-gradient(circle at top left, rgba(255, 176, 135, 0.14), transparent 25%),
    radial-gradient(circle at 86% 18%, rgba(255, 213, 111, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(23, 35, 50, 0.94) 0%, rgba(14, 22, 34, 0.96) 100%);
  border-color: rgba(130, 151, 174, 0.3);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.22);
}

html.theme-dark .bomb-pass-stage {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.12), transparent 19%),
    radial-gradient(circle at 15% 25%, rgba(255, 130, 173, 0.14), transparent 27%),
    radial-gradient(circle at 84% 78%, rgba(125, 216, 255, 0.16), transparent 29%),
    linear-gradient(180deg, rgba(24, 37, 53, 0.94) 0%, rgba(18, 27, 40, 0.96) 100%);
  border-color: rgba(130, 151, 174, 0.34);
}

html.theme-dark .bomb-pass-state-badge,
html.theme-dark .bomb-pass-control-card,
html.theme-dark .bomb-pass-stage.is-desktop-blocked::after {
  background: rgba(30, 43, 59, 0.88);
  border-color: rgba(130, 151, 174, 0.28);
  color: #ffb087;
}

html.theme-dark .bomb-pass-status-text {
  color: #d9e5f0;
}

html.theme-dark .bomb-pass-device-text {
  color: #b8c7d8;
}

html.theme-dark .bomb-pass-body {
  border-color: rgba(217, 229, 240, 0.72);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.28) 0 12%, transparent 13%),
    radial-gradient(circle at 68% 78%, rgba(0, 0, 0, 0.42), transparent 30%),
    linear-gradient(145deg, #5b6574 0%, #252d3a 52%, #0d121b 100%);
}


html.theme-dark .circle-tap-sidebar,
html.theme-dark .circle-tap-stage-card {
  background: rgba(20, 30, 43, 0.72);
  border-color: rgba(130, 151, 174, 0.3);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.22);
}

html.theme-dark .circle-tap-stage-card {
  background:
    radial-gradient(circle at top left, rgba(125, 216, 255, 0.14), transparent 25%),
    radial-gradient(circle at 86% 18%, rgba(196, 181, 253, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(23, 35, 50, 0.94) 0%, rgba(14, 22, 34, 0.96) 100%);
}

html.theme-dark .circle-tap-stage {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.12), transparent 18%),
    radial-gradient(circle at 15% 25%, rgba(255, 130, 173, 0.14), transparent 26%),
    radial-gradient(circle at 84% 78%, rgba(125, 216, 255, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(24, 37, 53, 0.94) 0%, rgba(18, 27, 40, 0.96) 100%);
  border-color: rgba(130, 151, 174, 0.34);
}

html.theme-dark .circle-tap-turn-badge,
html.theme-dark .circle-tap-stage-hint,
html.theme-dark .circle-tap-player-item,
html.theme-dark .circle-tap-player-empty,
html.theme-dark .circle-tap-stage.is-mobile-blocked::after {
  background: rgba(30, 43, 59, 0.88);
  border-color: rgba(130, 151, 174, 0.28);
  color: #d9e5f0;
}

html.theme-dark .circle-tap-turn-badge,
html.theme-dark .circle-tap-player-item strong {
  color: #c9b6ff;
}

html.theme-dark .circle-tap-stage-hint,
html.theme-dark .circle-tap-player-item span:last-child {
  color: #b8c7d8;
}

html.theme-dark .circle-tap-player-item.is-current {
  background: linear-gradient(180deg, rgba(55, 45, 25, 0.96) 0%, rgba(69, 52, 24, 0.94) 100%);
  border-color: rgba(255, 213, 111, 0.36);
}

html.theme-dark .circle-tap-player-item.is-loser {
  background: linear-gradient(180deg, rgba(65, 30, 38, 0.96) 0%, rgba(84, 34, 46, 0.94) 100%);
  border-color: rgba(255, 130, 173, 0.34);
}


html.theme-dark .key-react-sidebar,
html.theme-dark .key-react-stage-card {
  background: rgba(20, 30, 43, 0.72);
  border-color: rgba(130, 151, 174, 0.3);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.22);
}

html.theme-dark .key-react-stage-card {
  background:
    radial-gradient(circle at top left, rgba(125, 216, 255, 0.14), transparent 25%),
    radial-gradient(circle at 86% 18%, rgba(101, 231, 207, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(23, 35, 50, 0.94) 0%, rgba(14, 22, 34, 0.96) 100%);
}

html.theme-dark .key-react-stage {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.12), transparent 18%),
    radial-gradient(circle at 15% 25%, rgba(255, 130, 173, 0.14), transparent 26%),
    radial-gradient(circle at 84% 78%, rgba(125, 216, 255, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(24, 37, 53, 0.94) 0%, rgba(18, 27, 40, 0.96) 100%);
  border-color: rgba(130, 151, 174, 0.34);
}

html.theme-dark .key-react-stage.is-stay {
  border-color: rgba(255, 213, 111, 0.5);
}

html.theme-dark .key-react-stage.is-click {
  border-color: rgba(101, 231, 207, 0.6);
}

html.theme-dark .key-react-phase-badge,
html.theme-dark .key-react-key-card,
html.theme-dark .key-react-live-card,
html.theme-dark .key-react-key-row,
html.theme-dark .key-react-player-item,
html.theme-dark .key-react-ranking-item,
html.theme-dark .key-react-chip,
html.theme-dark .key-react-player-empty,
html.theme-dark .key-react-ranking-empty,
html.theme-dark .key-react-stage.is-desktop-blocked::after,
html.theme-dark .key-react-popup-item {
  background: rgba(30, 43, 59, 0.88);
  border-color: rgba(130, 151, 174, 0.28);
  color: #d9e5f0;
}

html.theme-dark .key-react-signal-text,
html.theme-dark .key-react-key-row strong,
html.theme-dark .key-react-player-item strong,
html.theme-dark .key-react-ranking-item strong,
html.theme-dark .key-react-chip strong,
html.theme-dark .key-react-popup-item strong,
html.theme-dark .key-react-key-head strong,
html.theme-dark .key-react-panel-head h3,
html.theme-dark .key-react-live-head h3 {
  color: #9bdcff;
}

html.theme-dark .key-react-stage.is-stay .key-react-signal-text {
  color: #ffd56f;
}

html.theme-dark .key-react-stage.is-click .key-react-signal-text {
  color: #65e7cf;
}

html.theme-dark .key-react-signal-sub-text,
html.theme-dark .key-react-key-head span,
html.theme-dark .key-react-live-head span,
html.theme-dark .key-react-player-item span:last-child,
html.theme-dark .key-react-ranking-item span:last-child,
html.theme-dark .key-react-popup-item em {
  color: #b8c7d8;
}

html.theme-dark .key-react-key-input,
html.theme-dark .key-react-player-item kbd,
html.theme-dark .key-react-chip kbd {
  background: rgba(12, 18, 28, 0.86);
  border-color: rgba(130, 151, 174, 0.3);
  color: #9bdcff;
}

html.theme-dark .key-react-key-row.is-listening {
  background: linear-gradient(180deg, rgba(30, 60, 82, 0.96) 0%, rgba(24, 47, 68, 0.94) 100%);
  border-color: rgba(125, 216, 255, 0.42);
  box-shadow:
    0 0 0 4px rgba(125, 216, 255, 0.12),
    0 8px 18px rgba(0, 0, 0, 0.22);
}

html.theme-dark .key-react-key-row.is-listening .key-react-key-input {
  background: linear-gradient(180deg, rgba(34, 68, 94, 0.98) 0%, rgba(25, 50, 72, 0.96) 100%);
  color: #9bdcff;
  border-color: rgba(125, 216, 255, 0.52);
}

html.theme-dark .key-react-key-row.is-duplicate .key-react-key-input {
  border-color: rgba(255, 130, 173, 0.54);
  color: #ff9fc9;
  background: rgba(65, 30, 38, 0.84);
}

html.theme-dark .key-react-player-item.is-done,
html.theme-dark .key-react-chip.is-pressed,
html.theme-dark .key-react-ranking-item.is-valid,
html.theme-dark .key-react-popup-item.is-valid {
  background: linear-gradient(180deg, rgba(20, 64, 57, 0.96) 0%, rgba(18, 55, 51, 0.94) 100%);
  border-color: rgba(101, 231, 207, 0.3);
}

html.theme-dark .key-react-player-item.is-false-start,
html.theme-dark .key-react-chip.is-false-start,
html.theme-dark .key-react-ranking-item.is-false-start,
html.theme-dark .key-react-popup-item.is-false-start {
  background: linear-gradient(180deg, rgba(65, 30, 38, 0.96) 0%, rgba(84, 34, 46, 0.94) 100%);
  border-color: rgba(255, 130, 173, 0.34);
}

html.theme-dark .key-react-rank-badge,
html.theme-dark .key-react-popup-item span {
  background: linear-gradient(180deg, rgba(55, 45, 25, 0.96) 0%, rgba(69, 52, 24, 0.94) 100%);
  color: #ffd56f;
}


/* home banner ad */
.home-screen {
  max-width: 1180px;
  margin: 0 auto;
}

.home-screen-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.home-banner-link {
  display: block;
  width: min(100%, 760px);
  min-height: 120px;
  border-radius: 28px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.22);
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
  background: rgba(0, 0, 0, 0.18);
}

.home-banner-link:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 42px rgba(0, 0, 0, 0.3);
  filter: brightness(1.03);
}

.home-banner-link img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 120px;
  object-fit: cover;
}

@media (max-width: 720px) {
  .home-screen-stack {
    gap: 20px;
  }

  .home-banner-link {
    width: 100%;
    border-radius: 22px;
  }
}



/* final responsive home banner size override */
#homeScreen.home-screen {
  max-width: 1180px;
  margin: 0 auto;
  position: relative;
}

#homeScreen .home-screen-stack {
  width: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

#homeScreen .home-banner-link {
  position: absolute;
  top: calc(100% + 30px);
  left: 50%;
  display: block;
  width: clamp(360px, 31.1vw, 521px);
  height: clamp(116px, 10vw, 168px);
  min-height: 0;
  aspect-ratio: 521 / 168;
  transform: translateX(-50%);
  border-radius: 0;
  overflow: hidden;
  border: 0;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.16);
  z-index: 3;
}

#homeScreen .home-banner-link:hover {
  transform: translateX(-50%) translateY(-4px);
}

#homeScreen .home-banner-link img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  object-position: center center;
}

/* 스마트폰에서는 배너가 너무 아래로 밀리지 않도록 상단 배치 */
@media (max-width: 720px) {
  .app {
    align-items: flex-start;
  }

  #homeScreen.home-screen {
    padding-top: max(18px, env(safe-area-inset-top));
  }

  #homeScreen .home-screen-stack {
    position: static;
    flex-direction: column;
    gap: 16px;
  }

  #homeScreen .home-banner-link {
    position: static;
    order: -1;
    left: auto;
    top: auto;
    width: min(92vw, 480px);
    height: auto;
    aspect-ratio: 521 / 168;
    transform: none;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
  }

  #homeScreen .home-banner-link:hover {
    transform: translateY(-3px);
  }

  #homeScreen .main-card {
    width: min(100%, 680px);
  }
}

@media (max-width: 420px) {
  #homeScreen .home-banner-link {
    width: min(94vw, 380px);
  }
}


.bear-find-svg-filters {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* =========================
   physical M5 : bear find
========================= */

.bear-find-card-screen {
  padding: 20px;
}

.physical-header h2,
.bear-find-card-screen h2 {
  font-family: 'Gaegu', cursive;
  color: var(--soft-brown);
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 10px;
}

.bear-find-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 16px;
  min-height: 720px;
}

.bear-find-sidebar {
  min-width: 0;
  background: rgba(255, 255, 255, 0.34);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
}

.bear-find-button-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bear-find-sidebar-inner {
  height: 100%;
  overflow: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bear-find-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bear-find-main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 2px 4px 0;
  flex-wrap: wrap;
}

.bear-find-stage-card {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--card-strong);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bear-find-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.bear-find-panel-head h3 {
  color: var(--soft-brown);
  margin-bottom: 6px;
}

.bear-find-phase-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 13px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 248, 222, 0.96), rgba(255, 239, 188, 0.96));
  color: #8b6a37;
  font-weight: 900;
  font-size: 0.86rem;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 16px rgba(120, 90, 70, 0.08);
}

.bear-find-stage-button {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  aspect-ratio: 1 / 1;
  max-height: min(62vh, 620px);
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.38), transparent 30%),
    linear-gradient(180deg, #fff6ef 0%, #ffe9da 100%);
  border: 3px solid rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 16px 28px rgba(120, 90, 70, 0.08);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.bear-find-stage-button.is-ready:hover {
  transform: translateY(-3px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42), 0 18px 34px rgba(120, 90, 70, 0.13);
}

.bear-find-stage-button:disabled {
  cursor: not-allowed;
}


.bear-find-stage-button:disabled,
.bear-find-stage-button.is-playing,
html.theme-dark .bear-find-stage-button:disabled,
html.theme-dark .bear-find-stage-button.is-playing {
  opacity: 1 !important;
  filter: none !important;
}

.bear-find-stage-button.is-playing .bear-find-video,
.bear-find-video.is-active {
  opacity: 1 !important;
  filter: none;
  mix-blend-mode: normal;
  color-scheme: only light;
}

.bear-find-stage-button.is-playing .bear-find-video.is-color-matched,
.bear-find-video.is-active.is-color-matched {
  filter: none !important;
}

.bear-find-touch-blocker {
  background: rgba(0, 0, 0, 0) !important;
  backdrop-filter: none !important;
}

.bear-find-poster,
.bear-find-still-frame,
.bear-find-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bear-find-poster {
  display: block;
  opacity: 1;
  z-index: 1;
  transition: none;
}

.bear-find-poster.is-hidden {
  opacity: 1;
}

.bear-find-still-frame {
  display: block;
  opacity: 0;
  visibility: hidden;
  z-index: 2;
  background: transparent;
  pointer-events: none;
  transition: none;
}

.bear-find-still-frame.is-active {
  opacity: 1;
  visibility: visible;
}

.bear-find-video {
  display: block;
  opacity: 0;
  visibility: hidden;
  z-index: 3;
  background: transparent;
  pointer-events: none;
  transition: none;
  transform: translateZ(0);
  backface-visibility: hidden;
  image-rendering: auto;
}

.bear-find-color-probe {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
}

.bear-find-video.is-active {
  opacity: 1;
  visibility: visible;
}

.bear-find-current-label {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(255, 250, 246, 0.88);
  color: #735949;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(80, 45, 25, 0.14);
  border: 2px solid rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(8px);
}

.bear-find-stage-button.is-playing .bear-find-current-label {
  background: rgba(10, 10, 10, 0.52);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.bear-find-stage-hint {
  color: #8c7262;
  line-height: 1.6;
  text-align: center;
  font-weight: 700;
}

.bear-find-player-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  max-height: 310px;
  overflow-y: auto;
  padding-right: 5px;
}

.bear-find-player-list::-webkit-scrollbar {
  width: 8px;
}

.bear-find-player-list::-webkit-scrollbar-thumb {
  background: rgba(157, 125, 107, 0.35);
  border-radius: 999px;
}

.bear-find-player-item,
.bear-find-player-empty {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 2px solid rgba(255, 255, 255, 0.78);
  color: #7a6151;
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.05);
}

.bear-find-player-empty {
  display: block;
  text-align: center;
  line-height: 1.5;
}

.bear-find-player-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #d9c9ff;
  box-shadow: 0 0 0 4px rgba(217, 201, 255, 0.18);
}

.bear-find-player-item.is-current {
  background: linear-gradient(180deg, rgba(255, 248, 222, 0.98), rgba(255, 241, 205, 0.96));
  color: #7e6338;
}

.bear-find-player-item.is-current .bear-find-player-dot {
  background: #ffd56f;
}

.bear-find-player-item.is-bear {
  opacity: 0.78;
}

.bear-find-player-item.is-bear .bear-find-player-dot {
  background: #c89f72;
}

.bear-find-player-item.is-panda {
  background: linear-gradient(180deg, rgba(237, 255, 247, 0.98), rgba(214, 248, 229, 0.96));
  color: #44745a;
}

.bear-find-player-item.is-panda .bear-find-player-dot {
  background: #68f0c0;
  box-shadow: 0 0 0 4px rgba(104, 240, 192, 0.2);
}

.bear-find-touch-blocker {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  background: transparent;
  cursor: wait;
  touch-action: none;
}

.bear-find-touch-blocker.is-active {
  display: block;
}

.popup.bear-find-result-popup {
  max-width: 520px;
}

@media (max-width: 980px) {
  .bear-find-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .bear-find-sidebar {
    order: 2;
  }

  .bear-find-main {
    order: 1;
  }

  .bear-find-stage-button {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .bear-find-card-screen {
    padding: 16px;
  }

  .bear-find-stage-card {
    padding: 13px;
    border-radius: 22px;
  }

  .bear-find-stage-button {
    border-radius: 22px;
  }

  .bear-find-current-label {
    left: 12px;
    bottom: 12px;
    min-height: 34px;
    padding: 8px 12px;
    font-size: 0.86rem;
  }

  .bear-find-player-item {
    grid-template-columns: auto 1fr;
  }

  .bear-find-player-item span:last-child {
    grid-column: 2;
  }
}

html.theme-dark .bear-find-card-screen {
  background: rgba(20, 27, 38, 0.84);
  border-color: rgba(130, 151, 174, 0.34);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.24);
}

html.theme-dark .bear-find-sidebar,
html.theme-dark .bear-find-stage-card {
  background: rgba(26, 35, 48, 0.74);
  border-color: rgba(130, 151, 174, 0.26);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
}

html.theme-dark .bear-find-stage-button {
  background:
    radial-gradient(circle at 50% 40%, rgba(127, 216, 255, 0.13), transparent 34%),
    linear-gradient(180deg, #111926 0%, #0d1420 100%);
  border-color: rgba(130, 151, 174, 0.32);
  box-shadow: inset 0 0 0 1px rgba(143, 170, 205, 0.1), 0 18px 32px rgba(0, 0, 0, 0.3);
}

html.theme-dark .bear-find-current-label {
  background: rgba(13, 20, 31, 0.78);
  color: #d8e4f3;
  border-color: rgba(130, 151, 174, 0.28);
}

html.theme-dark .bear-find-stage-hint,
html.theme-dark .bear-find-player-empty {
  color: #b8c5d6;
}

html.theme-dark .bear-find-phase-badge {
  background: linear-gradient(180deg, rgba(75, 61, 26, 0.96), rgba(57, 46, 22, 0.96));
  color: #ffd66d;
  border-color: rgba(255, 214, 109, 0.2);
}

html.theme-dark .bear-find-player-item,
html.theme-dark .bear-find-player-empty {
  background: rgba(19, 28, 40, 0.82);
  border-color: rgba(130, 151, 174, 0.24);
  color: #d8e4f3;
}

html.theme-dark .bear-find-player-item.is-current {
  background: linear-gradient(180deg, rgba(78, 63, 29, 0.98), rgba(62, 51, 28, 0.96));
  color: #ffe29a;
}

html.theme-dark .bear-find-player-item.is-panda {
  background: linear-gradient(180deg, rgba(31, 68, 62, 0.96), rgba(22, 54, 50, 0.96));
  color: #8ff0d7;
}


/* =========================
   final requested fixes: unobtrusive home ad, mobile vertical race, roulette fast-forward/gun flip
========================= */
#homeScreen .home-screen-stack {
  gap: clamp(14px, 2.2vh, 22px);
}

#homeScreen .home-banner-link {
  position: static;
  order: 2;
  left: auto;
  top: auto;
  display: block;
  width: clamp(320px, 34vw, 520px);
  height: auto;
  min-height: 0;
  aspect-ratio: 2048 / 665;
  margin-top: -2px;
  transform: none;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 12, 22, 0.38);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
  opacity: 0.88;
  filter: saturate(0.92) brightness(0.94);
  transition: opacity 0.22s ease, filter 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

#homeScreen .home-banner-link:hover {
  transform: translateY(-2px);
  opacity: 1;
  filter: saturate(1) brightness(1);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.24);
}

#homeScreen .home-banner-link img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  object-position: center center;
}

.key-react-back-btn {
  display: none !important;
}

#game5Screen .roulette-gun-emoji {
  display: inline-block;
  transform-origin: center center;
}

#game5Screen .roulette-gun-core.is-right-aim .roulette-gun-emoji {
  transform: scaleY(-1);
}

@media (max-width: 720px) {
  #homeScreen .home-screen-stack {
    gap: 14px;
  }

  #homeScreen .home-banner-link {
    order: -1;
    width: min(92vw, 430px);
    margin: 0 0 2px;
    border-radius: 16px;
    transform: none;
  }

  #homeScreen .home-banner-link:hover {
    transform: translateY(-2px);
  }
}

@media (max-width: 1024px) and (pointer: coarse) and (orientation: portrait) {
  body.game2-mobile-layout #game2Screen .race-track-wrap {
    padding: 12px;
    border-radius: 22px;
    min-height: clamp(410px, 66vh, 620px);
  }

  body.game2-mobile-layout #game2Screen .race-track-stage-head {
    display: none;
  }

  body.game2-mobile-layout #game2Screen .race-track-lanes {
    display: grid;
    grid-template-columns: repeat(var(--race-lane-count, 3), minmax(38px, 1fr));
    align-items: stretch;
    gap: 8px;
    min-height: clamp(380px, 62vh, 570px);
  }

  body.game2-mobile-layout #game2Screen .race-lane {
    min-height: inherit;
    height: 100%;
    border-radius: 18px;
    background:
      repeating-linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.18) 0px,
        rgba(255, 255, 255, 0.18) 28px,
        rgba(255, 255, 255, 0.07) 28px,
        rgba(255, 255, 255, 0.07) 56px
      ),
      linear-gradient(90deg, #dcb89a 0%, #cfa37d 100%);
  }

  body.game2-mobile-layout #game2Screen .race-lane-label {
    display: none;
  }

  body.game2-mobile-layout #game2Screen .race-start-line,
  body.game2-mobile-layout #game2Screen .race-finish-line {
    left: 0;
    right: 0;
    width: auto;
    height: 8px;
    z-index: 1;
  }

  body.game2-mobile-layout #game2Screen .race-start-line {
    top: 14px;
    bottom: auto;
    background: repeating-linear-gradient(90deg, #fff 0 8px, #ff8f8f 8px 16px);
  }

  body.game2-mobile-layout #game2Screen .race-finish-line {
    top: auto;
    bottom: 14px;
    background: repeating-linear-gradient(90deg, #fff 0 8px, #444 8px 16px);
  }

  body.game2-mobile-layout #game2Screen .race-track-inner {
    position: absolute;
    inset: 34px 0;
    min-height: 0;
    margin: 0;
  }

  body.game2-mobile-layout #game2Screen .race-horse {
    left: 50% !important;
    top: var(--race-progress, 0%);
    width: 48px;
    height: 48px;
    min-width: 48px;
    max-width: 48px;
    padding: 0;
    gap: 0;
    justify-content: center;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: top 0.08s linear, transform 0.18s ease, box-shadow 0.18s ease;
  }

  body.game2-mobile-layout #game2Screen .race-horse .horse-info {
    display: none !important;
  }

  body.game2-mobile-layout #game2Screen .race-horse .horse-emoji {
    font-size: 1.48rem;
    line-height: 1;
    transform: rotate(90deg);
  }

  body.game2-mobile-layout #game2Screen .race-horse.horse-finished {
    animation: mobileHorseFinishPop 0.7s ease, horseFinishGlow 1.4s ease-in-out infinite alternate;
  }

  body.game2-mobile-layout #game2Screen .race-horse.horse-finished::after {
    right: -6px;
    top: -8px;
  }
}

@keyframes mobileHorseFinishPop {
  0% { transform: translate(-50%, -50%) scale(1); }
  40% { transform: translate(-50%, -50%) scale(1.12); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* =========================
   STAY CLICK compact one-screen polish
========================= */
body.key-react-compact-mode {
  overflow: hidden;
}

body.key-react-compact-mode .app {
  height: 100vh;
  min-height: 100vh;
  align-items: center;
  padding: 8px 12px;
}

body.key-react-compact-mode #physicalKeyReactScreen {
  height: calc(100vh - 16px);
  max-width: 1140px;
}

body.key-react-compact-mode .key-react-card-screen {
  height: 100%;
  padding: 14px;
  overflow: hidden;
}

body.key-react-compact-mode .key-react-layout {
  height: 100%;
  min-height: 0;
  grid-template-columns: minmax(265px, 310px) minmax(0, 1fr);
  gap: 14px;
}

body.key-react-compact-mode .key-react-sidebar,
body.key-react-compact-mode .key-react-main {
  min-height: 0;
  height: 100%;
}

body.key-react-compact-mode .key-react-sidebar-inner {
  min-height: 0;
  height: 100%;
  padding: 14px;
  gap: 10px;
  overflow: hidden;
}

body.key-react-compact-mode .key-react-main {
  gap: 10px;
}

body.key-react-compact-mode .key-react-main-header {
  flex: 0 0 auto;
  gap: 8px;
}

body.key-react-compact-mode .key-react-main-header h2 {
  margin-bottom: 4px;
  font-size: clamp(2.3rem, 4vw, 3.2rem);
}

body.key-react-compact-mode .key-react-main-header .small-badge {
  margin-bottom: 8px;
  padding: 8px 13px;
}

body.key-react-compact-mode .key-react-main-header .sub-text,
body.key-react-compact-mode .key-react-panel-head .sub-text,
body.key-react-compact-mode .sidebar-head .sub-text {
  line-height: 1.45;
  font-size: 0.9rem;
}

body.key-react-compact-mode .key-react-stage-card {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px;
  gap: 10px;
  border-radius: 24px;
}

body.key-react-compact-mode .key-react-panel-head {
  flex: 0 0 auto;
  gap: 8px;
}

body.key-react-compact-mode .key-react-stage {
  flex: 1 1 auto;
  min-height: 210px;
  border-radius: 24px;
}

body.key-react-compact-mode .key-react-stage-inner {
  gap: 12px;
  padding: 18px;
}

body.key-react-compact-mode .key-react-signal-text {
  min-height: clamp(72px, 11vw, 110px);
  font-size: clamp(3.8rem, 8.6vw, 6.6rem);
}

body.key-react-compact-mode .key-react-key-chips {
  width: min(100%, 480px);
  gap: 8px;
}

body.key-react-compact-mode .key-react-live-card {
  flex: 0 0 auto;
  padding: 12px;
  max-height: 112px;
  overflow: hidden;
}

body.key-react-compact-mode .key-react-ranking-list {
  max-height: 58px;
  overflow-y: auto;
  padding-right: 3px;
}

body.key-react-compact-mode .controls-wrap,
body.key-react-compact-mode .scoreboard-card {
  padding: 14px;
  border-radius: 20px;
}

body.key-react-compact-mode .key-react-key-card {
  padding: 12px;
  margin-top: 10px;
}

body.key-react-compact-mode .key-react-key-row,
body.key-react-compact-mode .key-react-player-item,
body.key-react-compact-mode .key-react-ranking-item,
body.key-react-compact-mode .key-react-chip,
body.key-react-compact-mode .key-react-player-empty,
body.key-react-compact-mode .key-react-ranking-empty {
  padding: 9px 10px;
  border-radius: 15px;
}

body.key-react-compact-mode .key-react-key-list,
body.key-react-compact-mode .key-react-player-list {
  gap: 8px;
}

body.key-react-compact-mode .key-react-player-list {
  max-height: 134px;
  overflow-y: auto;
  padding-right: 3px;
}

body.key-react-compact-mode .status-text {
  margin-top: 10px;
  font-size: 0.88rem;
  line-height: 1.4;
}

body.key-react-compact-mode .button-row {
  margin-top: 12px;
  gap: 10px;
}

.key-react-stage.is-stay {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 241, 185, 0.92), transparent 22%),
    radial-gradient(circle at 14% 24%, rgba(255, 187, 97, 0.46), transparent 28%),
    radial-gradient(circle at 86% 80%, rgba(255, 130, 80, 0.48), transparent 30%),
    linear-gradient(180deg, rgba(255, 246, 211, 0.98) 0%, rgba(255, 205, 113, 0.96) 100%);
  border-color: rgba(255, 183, 64, 0.95);
}

.key-react-stage.is-click {
  background:
    radial-gradient(circle at 50% 18%, rgba(212, 255, 243, 0.94), transparent 24%),
    radial-gradient(circle at 15% 25%, rgba(101, 231, 207, 0.55), transparent 29%),
    radial-gradient(circle at 84% 78%, rgba(125, 216, 255, 0.72), transparent 32%),
    linear-gradient(180deg, rgba(213, 255, 244, 0.98) 0%, rgba(87, 218, 196, 0.96) 100%);
  border-color: rgba(26, 196, 166, 0.95);
}

.key-react-stage.is-click::before,
.key-react-stage.is-stay::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
}

.key-react-stage.is-stay::before {
  background: repeating-linear-gradient(135deg, rgba(255,255,255,0.2) 0 12px, transparent 12px 24px);
}

.key-react-stage.is-click::before {
  background: radial-gradient(circle at center, rgba(255,255,255,0.56), transparent 36%);
  animation: keyReactClickFlash 0.42s ease-in-out infinite alternate;
}

.key-react-stage.is-stay .key-react-signal-text {
  color: #794a00;
  text-shadow: 0 8px 20px rgba(124, 78, 0, 0.24);
}

.key-react-stage.is-click .key-react-signal-text {
  color: #024c43;
  text-shadow: 0 8px 20px rgba(0, 83, 72, 0.24);
}

@keyframes keyReactClickFlash {
  from { opacity: 0.32; transform: scale(1); }
  to { opacity: 0.82; transform: scale(1.04); }
}

html.theme-dark .key-react-stage.is-stay {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 213, 111, 0.28), transparent 22%),
    radial-gradient(circle at 14% 24%, rgba(255, 170, 72, 0.24), transparent 28%),
    radial-gradient(circle at 86% 80%, rgba(255, 86, 86, 0.22), transparent 30%),
    linear-gradient(180deg, rgba(91, 62, 20, 0.96) 0%, rgba(135, 79, 22, 0.96) 100%);
  border-color: rgba(255, 213, 111, 0.88);
}

html.theme-dark .key-react-stage.is-click {
  background:
    radial-gradient(circle at 50% 18%, rgba(101, 231, 207, 0.28), transparent 24%),
    radial-gradient(circle at 15% 25%, rgba(101, 231, 207, 0.26), transparent 29%),
    radial-gradient(circle at 84% 78%, rgba(125, 216, 255, 0.24), transparent 32%),
    linear-gradient(180deg, rgba(12, 92, 82, 0.96) 0%, rgba(10, 130, 116, 0.96) 100%);
  border-color: rgba(101, 231, 207, 0.9);
}

html.theme-dark .key-react-stage.is-stay .key-react-signal-text {
  color: #fff3c2;
}

html.theme-dark .key-react-stage.is-click .key-react-signal-text {
  color: #e8fff9;
}

@media (max-width: 1024px) {
  body.key-react-compact-mode {
    overflow-y: auto;
  }

  body.key-react-compact-mode .app {
    height: auto;
    min-height: 100vh;
    align-items: flex-start;
    padding: 10px;
  }

  body.key-react-compact-mode #physicalKeyReactScreen,
  body.key-react-compact-mode .key-react-card-screen,
  body.key-react-compact-mode .key-react-layout,
  body.key-react-compact-mode .key-react-sidebar,
  body.key-react-compact-mode .key-react-main,
  body.key-react-compact-mode .key-react-sidebar-inner {
    height: auto;
  }

  body.key-react-compact-mode .key-react-layout {
    grid-template-columns: 1fr;
  }
}

/* STAY CLICK: countdown -> random STAY timing -> CLICK */
.key-react-stage.is-countdown {
  background:
    radial-gradient(circle at 50% 18%, rgba(216, 236, 255, 0.95), transparent 24%),
    radial-gradient(circle at 15% 25%, rgba(196, 181, 253, 0.50), transparent 29%),
    radial-gradient(circle at 84% 78%, rgba(125, 216, 255, 0.64), transparent 32%),
    linear-gradient(180deg, rgba(231, 243, 255, 0.98) 0%, rgba(185, 215, 255, 0.96) 100%);
  border-color: rgba(125, 216, 255, 0.92);
}

.key-react-stage.is-countdown::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.46;
  background: radial-gradient(circle at center, rgba(255,255,255,0.58), transparent 38%);
  animation: keyReactCountdownBreath 0.9s ease-in-out infinite alternate;
}

.key-react-stage.is-countdown .key-react-signal-text {
  color: #285f9a;
  text-shadow: 0 8px 20px rgba(34, 86, 150, 0.22);
  animation: keyReactCountdownPop 1s ease-in-out infinite;
}

html.theme-dark .key-react-stage.is-countdown {
  background:
    radial-gradient(circle at 50% 18%, rgba(125, 216, 255, 0.24), transparent 24%),
    radial-gradient(circle at 15% 25%, rgba(196, 181, 253, 0.24), transparent 29%),
    radial-gradient(circle at 84% 78%, rgba(125, 216, 255, 0.20), transparent 32%),
    linear-gradient(180deg, rgba(25, 64, 105, 0.96) 0%, rgba(34, 91, 150, 0.96) 100%);
  border-color: rgba(125, 216, 255, 0.82);
}

html.theme-dark .key-react-stage.is-countdown .key-react-signal-text {
  color: #dff3ff;
}

@keyframes keyReactCountdownBreath {
  from { opacity: 0.28; transform: scale(1); }
  to { opacity: 0.62; transform: scale(1.04); }
}

@keyframes keyReactCountdownPop {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.08); }
}

/* =========================
   final fix: mobile home vertical centering
   모바일 홈 화면이 위로 붙지 않도록, 홈 화면에서만 세로 중앙 정렬을 강제한다.
========================= */
@media (max-width: 720px) {
  .app:has(#homeScreen.active) {
    min-height: 100dvh;
    align-items: center;
    justify-content: center;
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  #homeScreen.home-screen.active {
    padding-top: 0;
  }

  #homeScreen.active .home-screen-stack {
    width: 100%;
    justify-content: center;
    align-items: center;
  }
}

@supports not selector(.app:has(#homeScreen.active)) {
  @media (max-width: 720px) {
    body.home-screen-mode .app {
      min-height: 100dvh;
      align-items: center;
      justify-content: center;
      padding-top: max(18px, env(safe-area-inset-top));
      padding-bottom: max(18px, env(safe-area-inset-bottom));
    }

    body.home-screen-mode #homeScreen.home-screen {
      padding-top: 0;
    }
  }
}


/* =========================
   final fix: mobile menu/physical/luck vertical centering
   모바일 메뉴/게임선택 화면이 위로 치우치지 않도록 선택 화면에서만 세로 중앙 정렬
========================= */
@media (max-width: 720px) {
  body.menu-screen-mode .app,
  body.physical-screen-mode .app,
  body.luck-screen-mode .app {
    min-height: 100dvh;
    align-items: center;
    justify-content: center;
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  body.menu-screen-mode #menuScreen,
  body.physical-screen-mode #physicalScreen,
  body.luck-screen-mode #luckScreen {
    width: 100%;
    margin: 0 auto;
  }

  body.menu-screen-mode .menu-card,
  body.physical-screen-mode .physical-card,
  body.luck-screen-mode .luck-card {
    margin: 0 auto;
  }
}

/* =========================
   mobile physical redesign: M1/M2/M3 no-scroll compact play screens + M5 mobile ordering
========================= */
@media (max-width: 767px) {
  body.physical-balloon-mode,
  body.physical-bomb-mode,
  body.physical-circle-mode {
    overflow: hidden !important;
    overscroll-behavior: none;
    min-height: 100vh;
    min-height: 100dvh;
  }

  body.physical-balloon-mode .background-deco,
  body.physical-bomb-mode .background-deco,
  body.physical-circle-mode .background-deco {
    display: none;
  }

  body.physical-balloon-mode .app,
  body.physical-bomb-mode .app,
  body.physical-circle-mode .app {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    align-items: stretch;
    padding: max(6px, env(safe-area-inset-top)) 8px max(6px, env(safe-area-inset-bottom));
  }

  body.physical-balloon-mode #physicalBalloonScreen,
  body.physical-bomb-mode #physicalBombScreen,
  body.physical-circle-mode #physicalCircleScreen {
    height: 100%;
    max-width: 520px;
    margin: 0 auto;
  }

  body.physical-balloon-mode .balloon-card-screen,
  body.physical-bomb-mode .bomb-pass-card-screen,
  body.physical-circle-mode .circle-tap-card-screen {
    height: 100%;
    min-height: 0;
    padding: clamp(8px, 1.5dvh, 12px);
    border-radius: 24px;
    overflow: hidden;
  }

  body.physical-balloon-mode .balloon-layout,
  body.physical-bomb-mode .bomb-pass-layout,
  body.physical-circle-mode .circle-tap-layout {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(7px, 1.2dvh, 10px);
  }

  body.physical-balloon-mode .balloon-main,
  body.physical-circle-mode .circle-tap-main,
  body.physical-balloon-mode .balloon-sidebar,
  body.physical-circle-mode .circle-tap-sidebar,
  body.physical-balloon-mode .balloon-sidebar-inner,
  body.physical-circle-mode .circle-tap-sidebar-inner {
    display: contents;
  }

  body.physical-balloon-mode .balloon-main-header,
  body.physical-bomb-mode .bomb-pass-main-header,
  body.physical-circle-mode .circle-tap-main-header {
    order: 1;
    flex: 0 0 auto;
    padding: 0 4px;
    gap: 6px;
  }

  body.physical-balloon-mode .game-mini-badge,
  body.physical-bomb-mode .game-mini-badge,
  body.physical-circle-mode .game-mini-badge {
    margin-bottom: 7px;
    padding: 7px 12px;
    font-size: clamp(0.76rem, 3vw, 0.92rem);
  }

  body.physical-balloon-mode .balloon-main-header h2,
  body.physical-bomb-mode .bomb-pass-main-header h2,
  body.physical-circle-mode .circle-tap-main-header h2 {
    font-size: clamp(2rem, 9vw, 2.65rem);
    line-height: 0.95;
    margin-bottom: 6px;
  }

  body.physical-balloon-mode .balloon-main-header .sub-text,
  body.physical-bomb-mode .bomb-pass-main-header .sub-text,
  body.physical-circle-mode .circle-tap-main-header .sub-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: clamp(0.88rem, 3.4vw, 1rem);
    line-height: 1.42;
  }

  body.physical-balloon-mode .balloon-stage-card,
  body.physical-bomb-mode .bomb-pass-stage-card,
  body.physical-circle-mode .circle-tap-stage-card {
    order: 2;
    flex: 1 1 auto;
    min-height: 0;
    padding: clamp(10px, 1.8dvh, 14px);
    border-radius: 22px;
    gap: clamp(7px, 1.2dvh, 10px);
    overflow: hidden;
  }

  body.physical-balloon-mode .balloon-panel-head,
  body.physical-bomb-mode .bomb-pass-panel-head,
  body.physical-circle-mode .circle-tap-panel-head {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
  }

  body.physical-balloon-mode .balloon-panel-head h3,
  body.physical-bomb-mode .bomb-pass-panel-head h3,
  body.physical-circle-mode .circle-tap-panel-head h3 {
    font-size: clamp(1.05rem, 4vw, 1.28rem);
    margin-bottom: 0;
  }

  body.physical-balloon-mode .balloon-panel-head .sub-text,
  body.physical-bomb-mode .bomb-pass-panel-head .sub-text,
  body.physical-circle-mode .circle-tap-panel-head .sub-text {
    display: none;
  }

  body.physical-balloon-mode .balloon-turn-badge,
  body.physical-bomb-mode .bomb-pass-state-badge,
  body.physical-circle-mode .circle-tap-turn-badge {
    min-height: 32px;
    padding: 7px 11px;
    font-size: 0.82rem;
  }

  body.physical-balloon-mode .balloon-press-area,
  body.physical-bomb-mode .bomb-pass-stage,
  body.physical-circle-mode .circle-tap-stage {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    border-radius: 22px;
  }

  body.physical-balloon-mode .balloon-press-area {
    min-height: clamp(210px, 35dvh, 330px);
  }

  body.physical-bomb-mode .bomb-pass-stage {
    min-height: clamp(210px, 35dvh, 330px);
  }

  body.physical-circle-mode .circle-tap-stage {
    min-height: clamp(210px, 36dvh, 340px);
  }

  body.physical-balloon-mode .balloon-body {
    width: clamp(96px, 27vw, 124px);
    height: clamp(118px, 33vw, 148px);
  }

  body.physical-balloon-mode .balloon-pressure-number {
    font-size: clamp(2rem, 8vw, 2.7rem);
  }

  body.physical-circle-mode .circle-tap-target {
    width: min(var(--circle-tap-size), 84vw, 38dvh);
    height: min(var(--circle-tap-size), 84vw, 38dvh);
  }

  body.physical-bomb-mode .bomb-pass-visual {
    width: min(58vw, 250px, 30dvh);
    height: min(58vw, 250px, 30dvh);
  }

  body.physical-bomb-mode .bomb-pass-body {
    width: min(42vw, 188px, 23dvh);
    height: min(42vw, 188px, 23dvh);
  }

  body.physical-bomb-mode .bomb-pass-fuse {
    top: 10px;
    left: 53%;
    transform: rotate(22deg) scale(0.86);
    transform-origin: left center;
  }

  body.physical-balloon-mode .balloon-stage-hint,
  body.physical-circle-mode .circle-tap-stage-hint {
    flex: 0 0 auto;
    min-height: 0;
    padding: 9px 12px;
    border-radius: 16px;
    font-size: clamp(0.82rem, 3.2vw, 0.96rem);
    line-height: 1.4;
  }

  body.physical-balloon-mode .balloon-sidebar .sidebar-head,
  body.physical-circle-mode .circle-tap-sidebar .sidebar-head,
  body.physical-balloon-mode .balloon-sidebar .input-card,
  body.physical-circle-mode .circle-tap-sidebar .input-card,
  body.physical-balloon-mode .balloon-player-card,
  body.physical-circle-mode .circle-tap-player-card {
    display: none !important;
  }

  body.physical-balloon-mode .balloon-sidebar .controls-wrap,
  body.physical-circle-mode .circle-tap-sidebar .controls-wrap,
  body.physical-bomb-mode .bomb-pass-control-card {
    order: 3;
    flex: 0 0 auto;
    min-height: 0;
    margin: 0;
    padding: 0 4px;
    border: 0;
    background: transparent;
    box-shadow: none;
    display: grid;
    gap: 7px;
  }

  body.physical-balloon-mode .balloon-button-row,
  body.physical-circle-mode .circle-tap-button-row,
  body.physical-bomb-mode .bomb-pass-button-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(10px, 3vw, 16px);
    margin: 0;
  }

  body.physical-balloon-mode .action-btn,
  body.physical-circle-mode .action-btn,
  body.physical-bomb-mode .action-btn {
    width: 100%;
    min-height: clamp(44px, 6.2dvh, 58px);
    padding: 10px 8px;
    font-size: clamp(1rem, 4.4vw, 1.28rem);
    font-weight: 900;
  }

  body.physical-balloon-mode .status-text,
  body.physical-circle-mode .status-text,
  body.physical-bomb-mode .bomb-pass-status-text,
  body.physical-bomb-mode .bomb-pass-device-text {
    margin: 0;
    min-height: 0;
    padding: 8px 10px;
    border-radius: 16px;
    font-size: clamp(0.78rem, 3.2vw, 0.94rem);
    line-height: 1.38;
    text-align: center;
  }

  body.physical-bomb-mode .bomb-pass-device-text {
    padding-top: 0;
    font-size: clamp(0.72rem, 2.9vw, 0.86rem);
    opacity: 0.9;
  }

  body.physical-circle-mode .circle-tap-back-btn,
  body.physical-bomb-mode .bomb-pass-back-btn {
    order: 4;
    flex: 0 0 auto;
    width: 100%;
    min-height: clamp(40px, 5.4dvh, 52px);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: clamp(0.9rem, 3.6vw, 1.05rem);
    text-align: center;
  }

  body.physical-balloon-mode .utility-controls,
  body.physical-bomb-mode .utility-controls,
  body.physical-circle-mode .utility-controls {
    right: 6px;
    bottom: calc(6px + env(safe-area-inset-bottom));
    gap: 7px;
    transform: scale(0.84);
    transform-origin: right bottom;
  }

  body.physical-balloon-mode .utility-btn,
  body.physical-bomb-mode .utility-btn,
  body.physical-circle-mode .utility-btn {
    width: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 16px;
  }

  body.physical-balloon-mode .popup-overlay,
  body.physical-bomb-mode .popup-overlay,
  body.physical-circle-mode .popup-overlay {
    padding: 12px;
  }

  body.physical-balloon-mode .popup,
  body.physical-bomb-mode .popup,
  body.physical-circle-mode .popup {
    max-width: min(92vw, 360px);
  }
}

@media (max-width: 767px) and (max-height: 720px) {
  body.physical-balloon-mode .balloon-main-header .sub-text,
  body.physical-bomb-mode .bomb-pass-main-header .sub-text,
  body.physical-circle-mode .circle-tap-main-header .sub-text {
    -webkit-line-clamp: 1;
  }

  body.physical-balloon-mode .game-mini-badge,
  body.physical-bomb-mode .game-mini-badge,
  body.physical-circle-mode .game-mini-badge {
    display: none;
  }

  body.physical-balloon-mode .balloon-stage-hint,
  body.physical-circle-mode .circle-tap-stage-hint {
    font-size: 0.78rem;
    padding-block: 7px;
  }

  body.physical-bomb-mode .bomb-pass-device-text {
    display: none;
  }
}

@media (max-width: 767px) {
  body.physical-bearfind-mode .app {
    align-items: flex-start;
    padding: 12px 10px calc(84px + env(safe-area-inset-bottom));
  }

  body.physical-bearfind-mode #physicalBearFindScreen {
    max-width: 520px;
    margin: 0 auto;
  }

  body.physical-bearfind-mode .bear-find-card-screen {
    padding: 14px;
    border-radius: 24px;
    overflow: visible;
  }

  body.physical-bearfind-mode .bear-find-layout,
  body.physical-bearfind-mode .bear-find-main,
  body.physical-bearfind-mode .bear-find-sidebar,
  body.physical-bearfind-mode .bear-find-sidebar-inner {
    display: contents;
  }

  body.physical-bearfind-mode .bear-find-main-header {
    order: 1;
    padding: 0 4px;
  }

  body.physical-bearfind-mode .bear-find-sidebar .controls-wrap {
    order: 2;
    margin: 12px 0 14px;
    padding: 14px;
    border-radius: 22px;
  }

  body.physical-bearfind-mode .bear-find-stage-card {
    order: 3;
    padding: 14px;
    border-radius: 22px;
  }

  body.physical-bearfind-mode .bear-find-player-card {
    order: 4;
    margin-top: 14px;
    max-height: 40vh;
    overflow: hidden;
  }

  body.physical-bearfind-mode .bear-find-player-list {
    max-height: 34vh;
  }

  body.physical-bearfind-mode .bear-find-main-header h2 {
    font-size: clamp(2rem, 9vw, 2.65rem);
    line-height: 1;
  }

  body.physical-bearfind-mode .bear-find-main-header .sub-text,
  body.physical-bearfind-mode .bear-find-sidebar .sidebar-head .sub-text,
  body.physical-bearfind-mode .bear-find-stage-hint {
    font-size: 0.94rem;
    line-height: 1.55;
  }

  body.physical-bearfind-mode .bear-find-stage-button {
    aspect-ratio: 1 / 1;
    border-radius: 22px;
  }

  body.physical-bearfind-mode .bear-find-button-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  body.physical-balloon-mode .status-text,
  body.physical-circle-mode .status-text,
  body.physical-bomb-mode .bomb-pass-status-text,
  body.physical-bomb-mode .bomb-pass-device-text {
    background: rgba(255, 250, 245, 0.74);
    border: 2px solid rgba(255, 255, 255, 0.68);
  }

  html.theme-dark body.physical-balloon-mode .status-text,
  html.theme-dark body.physical-circle-mode .status-text,
  html.theme-dark body.physical-bomb-mode .bomb-pass-status-text,
  html.theme-dark body.physical-bomb-mode .bomb-pass-device-text {
    background: rgba(30, 43, 59, 0.76);
    border-color: rgba(130, 151, 174, 0.24);
    color: #d9e5f0 !important;
  }
}

/* =========================
   patch: remove opaque mobile control boxes + restore utility button size
   요청 수정: M1/M2/M3 모바일 시작/리셋 뒤 불투명 박스 제거, 우측 하단 유틸 버튼 원래 크기 복구
========================= */
@media (max-width: 767px) {
  body.physical-balloon-mode .balloon-sidebar .controls-wrap,
  body.physical-balloon-mode .controls-wrap,
  body.physical-circle-mode .circle-tap-sidebar .controls-wrap,
  body.physical-circle-mode .controls-wrap,
  body.physical-bomb-mode .bomb-pass-control-card {
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  body.physical-balloon-mode .balloon-button-row,
  body.physical-circle-mode .circle-tap-button-row,
  body.physical-bomb-mode .bomb-pass-button-row {
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  body.physical-balloon-mode .utility-controls,
  body.physical-bomb-mode .utility-controls,
  body.physical-circle-mode .utility-controls {
    right: 14px !important;
    bottom: calc(14px + env(safe-area-inset-bottom)) !important;
    gap: 10px !important;
    transform: none !important;
    transform-origin: right bottom !important;
  }

  body.physical-balloon-mode .utility-btn,
  body.physical-bomb-mode .utility-btn,
  body.physical-circle-mode .utility-btn {
    min-width: 52px !important;
    width: 52px !important;
    min-height: 52px !important;
    height: 52px !important;
    padding: 0 !important;
    border-radius: 18px !important;
  }

  body.physical-balloon-mode .utility-btn-icon,
  body.physical-bomb-mode .utility-btn-icon,
  body.physical-circle-mode .utility-btn-icon {
    font-size: 1.15rem !important;
  }
}

/* =========================
   patch: lock active M1/M2/M3 start button while game is running
   요청 수정: 게임 진행 중 시작 버튼 중복 입력 방지 + 눌린 상태 시각화
========================= */
.action-btn.primary.is-game-running,
.action-btn.primary:disabled.is-game-running {
  opacity: 1 !important;
  cursor: not-allowed !important;
  pointer-events: none;
  color: rgba(255, 244, 250, 0.92) !important;
  background: linear-gradient(180deg, #9b5f82 0%, #6f415f 100%) !important;
  box-shadow:
    inset 0 5px 12px rgba(41, 22, 36, 0.42),
    inset 0 -1px 0 rgba(255, 255, 255, 0.16),
    0 5px 10px rgba(18, 28, 44, 0.12) !important;
  transform: translateY(2px) scale(0.985) !important;
  filter: saturate(0.86) brightness(0.88);
}

html.theme-dark .action-btn.primary.is-game-running,
html.theme-dark .action-btn.primary:disabled.is-game-running {
  color: #f8d7e8 !important;
  background: linear-gradient(180deg, #6d3859 0%, #44243b 100%) !important;
  box-shadow:
    inset 0 5px 14px rgba(5, 9, 15, 0.54),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1),
    0 5px 10px rgba(5, 9, 15, 0.18) !important;
}

/* =========================
   patch: M5 bear find mobile layout matches uploaded reference
   요청 수정: 곰찾기 모바일 화면을 설정 → 선물 상자 스테이지 → 참가자 현황 순서의 세로형 카드 UI로 정리
========================= */
@media (max-width: 767px) {
  body.physical-bearfind-mode {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  body.physical-bearfind-mode .background-deco {
    display: none;
  }

  body.physical-bearfind-mode .app {
    align-items: flex-start;
    justify-content: center;
    padding: max(22px, env(safe-area-inset-top)) 18px calc(98px + env(safe-area-inset-bottom));
  }

  body.physical-bearfind-mode #physicalBearFindScreen {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
  }

  body.physical-bearfind-mode .bear-find-card-screen {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 20px 16px 22px;
    border-radius: 28px;
    overflow: visible;
  }

  body.physical-bearfind-mode .bear-find-layout,
  body.physical-bearfind-mode .bear-find-main,
  body.physical-bearfind-mode .bear-find-sidebar,
  body.physical-bearfind-mode .bear-find-sidebar-inner {
    display: contents !important;
  }

  body.physical-bearfind-mode .bear-find-sidebar .sidebar-head {
    display: none !important;
  }

  body.physical-bearfind-mode .bear-find-main-header {
    order: 1;
    display: block;
    padding: 0 4px 4px;
  }

  body.physical-bearfind-mode .bear-find-main-header .game-mini-badge {
    margin: 0 0 16px;
    padding: 8px 16px;
    font-size: clamp(0.9rem, 4vw, 1.05rem);
    border-radius: 999px;
  }

  body.physical-bearfind-mode .bear-find-main-header h2 {
    margin: 0 0 14px;
    font-size: clamp(2.15rem, 11vw, 3rem);
    line-height: 0.95;
    letter-spacing: -0.03em;
  }

  body.physical-bearfind-mode .bear-find-main-header .sub-text {
    margin: 0;
    max-width: 100%;
    font-size: clamp(0.98rem, 4.2vw, 1.12rem);
    line-height: 1.65;
    word-break: keep-all;
  }

  body.physical-bearfind-mode .bear-find-sidebar .controls-wrap {
    order: 2;
    margin: 0 10px;
    padding: 22px 20px 20px;
    border-radius: 24px;
    display: grid;
    gap: 14px;
  }

  body.physical-bearfind-mode .bear-find-sidebar .input-card {
    gap: 10px;
  }

  body.physical-bearfind-mode .bear-find-sidebar .input-card label {
    font-size: 1.02rem;
    font-weight: 900;
  }

  body.physical-bearfind-mode #bearFindCountInput {
    min-height: 58px;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 1.02rem;
    font-weight: 700;
  }

  body.physical-bearfind-mode .bear-find-sidebar .helper-text,
  body.physical-bearfind-mode #bearFindStatusText {
    font-size: clamp(0.92rem, 3.8vw, 1rem);
    line-height: 1.6;
    word-break: keep-all;
  }

  body.physical-bearfind-mode .bear-find-button-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 8px 0 2px;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  body.physical-bearfind-mode .bear-find-button-row .action-btn {
    width: 100%;
    min-height: 58px;
    padding: 13px 10px;
    border-radius: 999px;
    font-size: clamp(1.04rem, 4.6vw, 1.25rem);
    font-weight: 900;
  }

  body.physical-bearfind-mode .bear-find-stage-card {
    order: 3;
    margin: 0;
    padding: 18px;
    border-radius: 26px;
    gap: 16px;
  }

  body.physical-bearfind-mode .bear-find-panel-head {
    display: block;
  }

  body.physical-bearfind-mode .bear-find-panel-head h3 {
    margin: 0 0 10px;
    font-size: clamp(1.32rem, 5.5vw, 1.65rem);
    line-height: 1.1;
    font-weight: 900;
  }

  body.physical-bearfind-mode .bear-find-panel-head .sub-text {
    margin: 0;
    font-size: clamp(0.92rem, 3.9vw, 1rem);
    line-height: 1.55;
  }

  body.physical-bearfind-mode .bear-find-phase-badge {
    margin-top: 14px;
    min-height: 36px;
    padding: 7px 16px;
    font-size: 0.9rem;
  }

  body.physical-bearfind-mode .bear-find-stage-button {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: none;
    border-radius: 24px;
  }

  body.physical-bearfind-mode .bear-find-current-label {
    left: 16px;
    bottom: 16px;
    min-height: 38px;
    padding: 9px 14px;
    font-size: 0.9rem;
  }

  body.physical-bearfind-mode .bear-find-stage-hint {
    margin: 0;
    font-size: clamp(0.95rem, 4vw, 1.08rem);
    line-height: 1.55;
    text-align: center;
    word-break: keep-all;
  }

  body.physical-bearfind-mode .bear-find-player-card {
    order: 4;
    margin: 4px 18px 0;
    padding: 20px 18px;
    border-radius: 24px;
    max-height: min(46vh, 460px);
    overflow: hidden;
  }

  body.physical-bearfind-mode .bear-find-player-card .scoreboard-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
  }

  body.physical-bearfind-mode .bear-find-player-card .scoreboard-head h3 {
    font-size: clamp(1.05rem, 4.4vw, 1.25rem);
    font-weight: 900;
  }

  body.physical-bearfind-mode #bearFindTotalInfo {
    white-space: nowrap;
    font-size: clamp(0.9rem, 3.8vw, 1.02rem);
    font-weight: 900;
  }

  body.physical-bearfind-mode .bear-find-player-list {
    max-height: min(38vh, 360px);
    margin-top: 16px;
    padding-right: 6px;
    gap: 12px;
  }

  body.physical-bearfind-mode .bear-find-player-item,
  body.physical-bearfind-mode .bear-find-player-empty {
    min-height: 82px;
    padding: 14px 16px;
    border-radius: 18px;
    grid-template-columns: auto 1fr;
    row-gap: 8px;
  }

  body.physical-bearfind-mode .bear-find-player-item span:last-child {
    grid-column: 2;
  }

  body.physical-bearfind-mode .utility-controls {
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  body.physical-bearfind-mode .app {
    padding-left: 12px;
    padding-right: 12px;
  }

  body.physical-bearfind-mode .bear-find-card-screen {
    padding-left: 14px;
    padding-right: 14px;
  }

  body.physical-bearfind-mode .bear-find-sidebar .controls-wrap {
    margin-inline: 4px;
    padding: 18px 16px;
  }

  body.physical-bearfind-mode .bear-find-stage-card {
    padding: 14px;
  }

  body.physical-bearfind-mode .bear-find-player-card {
    margin-inline: 8px;
    padding: 18px 14px;
  }
}

html.theme-dark body.physical-bearfind-mode .bear-find-card-screen {
  background:
    radial-gradient(circle at 78% 14%, rgba(29, 53, 80, 0.32), transparent 30%),
    linear-gradient(180deg, rgba(15, 25, 38, 0.96) 0%, rgba(10, 17, 27, 0.96) 100%);
  border-color: rgba(89, 112, 138, 0.52);
  box-shadow: inset 0 0 0 2px rgba(34, 58, 86, 0.42), 0 18px 38px rgba(0, 0, 0, 0.28);
}

html.theme-dark body.physical-bearfind-mode .bear-find-sidebar .controls-wrap,
html.theme-dark body.physical-bearfind-mode .bear-find-stage-card,
html.theme-dark body.physical-bearfind-mode .bear-find-player-card {
  background: linear-gradient(180deg, rgba(26, 37, 52, 0.92) 0%, rgba(17, 28, 42, 0.92) 100%);
  border-color: rgba(93, 116, 143, 0.44);
  box-shadow: inset 0 0 0 1px rgba(110, 135, 163, 0.08), 0 14px 28px rgba(0, 0, 0, 0.24);
}

html.theme-dark body.physical-bearfind-mode #bearFindCountInput {
  background: rgba(8, 15, 24, 0.86);
  border-color: rgba(92, 117, 145, 0.42);
  color: #edf4ff;
}

html.theme-dark body.physical-bearfind-mode .bear-find-main-header h2,
html.theme-dark body.physical-bearfind-mode .bear-find-panel-head h3,
html.theme-dark body.physical-bearfind-mode .bear-find-player-card .scoreboard-head h3,
html.theme-dark body.physical-bearfind-mode .bear-find-sidebar .input-card label {
  color: #ffd8e7;
}

/* volume controls patch */
@media (max-width: 1024px) {
  .utility-volume-panel {
    width: 218px;
    padding: 12px;
    border-radius: 20px;
  }

  .volume-control {
    grid-template-columns: 46px minmax(0, 1fr) 38px;
    gap: 8px;
    font-size: 0.8rem;
  }
}

@media (max-width: 767px) {
  .utility-volume-panel {
    width: 172px;
    gap: 8px;
    padding: 10px;
    border-radius: 18px;
  }

  .volume-control {
    grid-template-columns: 42px minmax(0, 1fr) 34px;
    gap: 7px;
    font-size: 0.72rem;
  }

  .volume-range::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
    margin-top: -5px;
  }

  .volume-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
  }
}

@media (max-width: 420px) {
  .utility-controls {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
  }

  .utility-volume-panel {
    width: min(164px, calc(100vw - 20px));
  }

  .volume-control {
    grid-template-columns: 38px minmax(0, 1fr) 32px;
    gap: 6px;
  }
}

@media (max-width: 767px) {
  body.physical-balloon-mode .utility-volume-panel,
  body.physical-bomb-mode .utility-volume-panel,
  body.physical-circle-mode .utility-volume-panel {
    width: 168px;
  }
}

/* restore game5 bottom information panels */
#game5Screen .roulette-bottom-grid .naval-log-panel,
#game5Screen .roulette-bottom-grid .naval-ranking-panel {
  display: block;
}

#game5Screen .roulette-bottom-grid {
  margin-top: 16px;
}

.stock-bottom-grid {
  margin-top: 16px;
}

/* =========================
   stability/layout patch: runtime panels + unified game cards
   목적: 누락된 UI 타깃 복구, 게임별 하단 정보 패널 톤 통일, 모바일 겹침 완화
========================= */
.game-progress-meter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: min(100%, 560px);
  margin: 12px auto 0;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 250, 245, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.07);
}

.game-progress-meter-label {
  font-size: 0.84rem;
  font-weight: 900;
  color: var(--soft-brown);
  white-space: nowrap;
}

.game-progress-meter-track {
  position: relative;
  display: block;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(230, 216, 205, 0.82);
  box-shadow: inset 0 2px 5px rgba(120, 90, 70, 0.12);
}

.game-progress-meter-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #bfe8d8 0%, #f9db8f 72%, #ff9b85 100%);
  transition: width 0.12s linear, filter 0.12s ease;
}

.game-progress-meter-fill.is-warning {
  filter: saturate(1.12) brightness(1.02);
}

.game-progress-meter-fill.is-danger {
  filter: saturate(1.35) brightness(0.95);
}

.balloon-pressure-label {
  display: block;
  margin-top: 2px;
  font-size: clamp(0.74rem, 1.8vw, 0.9rem);
  font-weight: 900;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(80, 38, 54, 0.32);
  line-height: 1;
}

.balloon-visual.is-warning .balloon-body {
  filter: saturate(1.12) brightness(1.04);
}

.balloon-visual.is-danger .balloon-body {
  filter: saturate(1.25) brightness(0.98);
}

.circle-tap-runtime-panel {
  width: min(100%, 420px);
  margin: 12px auto 0;
  padding: 12px 14px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 250, 245, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 18px rgba(120, 90, 70, 0.07);
  color: var(--soft-brown);
}

.circle-tap-runtime-panel span {
  font-size: 0.86rem;
  font-weight: 800;
}

.circle-tap-runtime-panel strong {
  min-width: 64px;
  text-align: right;
  font-size: 1rem;
  font-weight: 900;
  color: var(--brown);
}

.sim-ranking-card,
.naval-ranking-panel,
.naval-log-panel,
.stock-portfolio-card.controls-wrap {
  background: var(--card-strong);
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(130, 100, 80, 0.06);
}

.sim-ranking-card {
  margin-top: 16px;
}

.sim-ranking-list,
.roulette-ranking-list,
.roulette-log-list,
.stock-ranking-list,
.stock-portfolio-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.sim-ranking-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 11px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 6px 14px rgba(120, 90, 70, 0.05);
}

.sim-ranking-item.top {
  background: linear-gradient(180deg, rgba(255, 248, 226, 0.96) 0%, rgba(255, 241, 205, 0.9) 100%);
}

.sim-ranking-item.is-out {
  opacity: 0.66;
  filter: grayscale(0.25);
}

.sim-ranking-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: var(--brown);
  background: linear-gradient(135deg, var(--lavender), var(--sky));
}

.sim-ranking-main {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.sim-ranking-name {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  color: var(--brown);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sim-ranking-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8);
}

.sim-ranking-hp-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(226, 213, 201, 0.9);
}

.sim-ranking-hp-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #cfeadf 0%, #f9db8f 70%, #ff9b85 100%);
  transition: width 0.18s linear;
}

.sim-ranking-state {
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 900;
  color: #8f7363;
}

.sim-ranking-empty,
.roulette-ranking-empty,
.roulette-log-empty,
.stock-empty-state,
.stock-holder-empty {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  color: #8c7262;
  line-height: 1.55;
}

#game4Screen .sim-panel-head,
#game5Screen .naval-panel-head,
#game6Screen .stock-portfolio-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

#game4Screen .sim-panel-head h3,
#game5Screen .naval-panel-head h3,
#game6Screen .stock-portfolio-head h4 {
  font-family: 'Gaegu', cursive;
  color: var(--soft-brown);
  font-size: 1.55rem;
  line-height: 1.1;
}

html.theme-dark .game-progress-meter,
html.theme-dark .circle-tap-runtime-panel,
html.theme-dark .sim-ranking-card,
html.theme-dark .naval-ranking-panel,
html.theme-dark .naval-log-panel,
html.theme-dark .stock-portfolio-card.controls-wrap {
  background: rgba(16, 24, 36, 0.82);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.22);
}

html.theme-dark .game-progress-meter-track,
html.theme-dark .sim-ranking-hp-track {
  background: rgba(255, 255, 255, 0.13);
}

html.theme-dark .circle-tap-runtime-panel,
html.theme-dark .circle-tap-runtime-panel strong,
html.theme-dark .game-progress-meter-label,
html.theme-dark .sim-ranking-name,
html.theme-dark .sim-ranking-num,
html.theme-dark #game4Screen .sim-panel-head h3,
html.theme-dark #game5Screen .naval-panel-head h3,
html.theme-dark #game6Screen .stock-portfolio-head h4 {
  color: #f1ded2;
}

html.theme-dark .sim-ranking-item,
html.theme-dark .sim-ranking-empty,
html.theme-dark .roulette-ranking-empty,
html.theme-dark .roulette-log-empty,
html.theme-dark .stock-empty-state,
html.theme-dark .stock-holder-empty {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(241, 222, 210, 0.82);
}

html.theme-dark .sim-ranking-item.top {
  background: linear-gradient(180deg, rgba(64, 54, 30, 0.88) 0%, rgba(46, 39, 25, 0.86) 100%);
}

@media (max-width: 760px) {
  .game-progress-meter,
  .circle-tap-runtime-panel {
    width: 100%;
    margin-top: 10px;
    padding: 10px 12px;
  }

  .sim-ranking-item {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .sim-ranking-state {
    grid-column: 2;
    justify-self: start;
  }

  .sim-ranking-card,
  .naval-ranking-panel,
  .naval-log-panel,
  .stock-portfolio-card.controls-wrap {
    border-radius: 22px;
  }
}

/* =====================================================================
   UNIFIED DESIGN PASS v2
   기능은 건드리지 않고, 화면 전반의 시각 언어만 하나로 정리한다.
   방향: 검은 복도 배너와 어울리는 블루프린트/느와르 기반 UI + 게임 색상은 기능성 유지.
===================================================================== */

:root {
  --ui-bg: #f3f2ec;
  --ui-bg-2: #e8e1d6;
  --ui-surface: rgba(250, 248, 242, 0.92);
  --ui-surface-2: rgba(239, 235, 226, 0.90);
  --ui-surface-3: rgba(255, 255, 255, 0.72);
  --ui-line: rgba(19, 61, 122, 0.18);
  --ui-line-strong: rgba(19, 61, 122, 0.32);
  --ui-text: #121723;
  --ui-text-soft: #2c3546;
  --ui-muted: #6c7482;
  --ui-blue: #133d7a;
  --ui-blue-2: #0f2b54;
  --ui-cream: #f3f2ec;
  --ui-gold: #c9aa72;
  --ui-red: #a8463a;
  --ui-green: #2d7569;
  --ui-shadow: 0 24px 70px rgba(18, 26, 42, 0.13);
  --ui-shadow-soft: 0 14px 36px rgba(18, 26, 42, 0.10);
  --ui-radius-xl: 28px;
  --ui-radius-lg: 22px;
  --ui-radius-md: 16px;
  --ui-grid-line: rgba(19, 61, 122, 0.055);
}

html.theme-dark {
  --ui-bg: #05070b;
  --ui-bg-2: #0b1019;
  --ui-surface: rgba(13, 19, 30, 0.90);
  --ui-surface-2: rgba(18, 27, 42, 0.88);
  --ui-surface-3: rgba(26, 39, 60, 0.76);
  --ui-line: rgba(243, 242, 236, 0.12);
  --ui-line-strong: rgba(84, 142, 218, 0.38);
  --ui-text: #f3f2ec;
  --ui-text-soft: #dce5f2;
  --ui-muted: #9ba9bf;
  --ui-blue: #1f66c2;
  --ui-blue-2: #133d7a;
  --ui-cream: #f3f2ec;
  --ui-gold: #d8c39a;
  --ui-red: #d45b4e;
  --ui-green: #6dd4be;
  --ui-shadow: 0 28px 80px rgba(0, 0, 0, 0.46);
  --ui-shadow-soft: 0 18px 44px rgba(0, 0, 0, 0.32);
  --ui-grid-line: rgba(243, 242, 236, 0.045);
}

html,
body {
  background: var(--ui-bg) !important;
}

body {
  color: var(--ui-text) !important;
  font-family: 'Pretendard', system-ui, -apple-system, BlinkMacSystemFont, sans-serif !important;
  letter-spacing: -0.015em;
  background:
    linear-gradient(var(--ui-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--ui-grid-line) 1px, transparent 1px),
    radial-gradient(circle at 12% 10%, rgba(19, 61, 122, 0.16), transparent 28%),
    radial-gradient(circle at 92% 88%, rgba(201, 170, 114, 0.16), transparent 30%),
    linear-gradient(180deg, var(--ui-bg) 0%, var(--ui-bg-2) 100%) !important;
  background-size: 32px 32px, 32px 32px, auto, auto, auto !important;
}

html.theme-dark body {
  background:
    linear-gradient(var(--ui-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--ui-grid-line) 1px, transparent 1px),
    radial-gradient(circle at 10% 8%, rgba(19, 61, 122, 0.38), transparent 30%),
    radial-gradient(circle at 92% 82%, rgba(201, 170, 114, 0.12), transparent 32%),
    linear-gradient(180deg, var(--ui-bg) 0%, var(--ui-bg-2) 100%) !important;
  background-size: 34px 34px, 34px 34px, auto, auto, auto !important;
}

.background-deco {
  display: none !important;
}

.app {
  padding: clamp(18px, 2.4vw, 36px) clamp(12px, 2vw, 28px) !important;
}

.screen {
  max-width: 1220px;
}

.card,
.controls-wrap,
.scoreboard-card,
.game-board-card,
.race-panel,
.race-track-wrap,
.battle-table-card,
.battle-panel,
.sim-setup-card,
.sim-arena-card,
.sim-battle-summary-card,
.naval-board-card,
.stock-portfolio-card,
.bear-find-stage-card,
.bear-find-sidebar,
.popup,
.orientation-lock-card,
.game-sidebar,
.race-sidebar,
.battle-sidebar,
.sim-sidebar,
.naval-sidebar,
.balloon-sidebar,
.circle-tap-sidebar,
.key-react-sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    var(--ui-surface) !important;
  color: var(--ui-text) !important;
  border: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius-xl) !important;
  box-shadow: var(--ui-shadow) !important;
  backdrop-filter: blur(18px) saturate(120%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(120%) !important;
}

html.theme-dark .card,
html.theme-dark .controls-wrap,
html.theme-dark .scoreboard-card,
html.theme-dark .game-board-card,
html.theme-dark .race-panel,
html.theme-dark .race-track-wrap,
html.theme-dark .battle-table-card,
html.theme-dark .battle-panel,
html.theme-dark .sim-setup-card,
html.theme-dark .sim-arena-card,
html.theme-dark .sim-battle-summary-card,
html.theme-dark .naval-board-card,
html.theme-dark .stock-portfolio-card,
html.theme-dark .bear-find-stage-card,
html.theme-dark .bear-find-sidebar,
html.theme-dark .popup,
html.theme-dark .orientation-lock-card,
html.theme-dark .game-sidebar,
html.theme-dark .race-sidebar,
html.theme-dark .battle-sidebar,
html.theme-dark .sim-sidebar,
html.theme-dark .naval-sidebar,
html.theme-dark .balloon-sidebar,
html.theme-dark .circle-tap-sidebar,
html.theme-dark .key-react-sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    var(--ui-surface) !important;
  color: var(--ui-text) !important;
  border-color: var(--ui-line) !important;
  box-shadow: var(--ui-shadow) !important;
}

.card::before,
.game-card::before,
.main-card::before,
.menu-card::before,
.luck-card::before,
.physical-card::before {
  content: '';
  display: block;
  height: 3px;
  width: min(210px, 45%);
  margin: -3px auto clamp(16px, 2vw, 22px);
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--ui-blue), var(--ui-gold), transparent);
  opacity: 0.92;
}

.main-card,
.menu-card {
  max-width: 720px;
  padding: clamp(34px, 5vw, 58px) clamp(22px, 4vw, 48px) !important;
}

.main-card h1,
.menu-card h2,
.luck-card h2,
.physical-card h2,
.game-card h2,
.popup h3,
.sidebar-title,
#game4Screen .sim-panel-head h3,
#game5Screen .naval-panel-head h3,
#game6Screen .stock-portfolio-head h4,
.physical-header h2,
.bear-find-card-screen h2 {
  font-family: 'Pretendard', system-ui, sans-serif !important;
  color: var(--ui-text) !important;
  font-weight: 900 !important;
  letter-spacing: -0.06em !important;
  line-height: 1.05 !important;
}

.main-card h1 {
  font-size: clamp(2.55rem, 5.6vw, 5.2rem) !important;
}

.menu-card h2,
.luck-card h2,
.physical-card h2,
.game-card h2 {
  font-size: clamp(2rem, 4vw, 3.65rem) !important;
}

.sub-text,
.helper-text,
.status-text,
#totalInfo,
.game-item p,
.popup-message,
.orientation-lock-card p,
.game-board-head span,
.race-track-stage-desc,
.bomb-pass-status-text,
.bomb-pass-device-text,
.balloon-stage-hint,
.circle-tap-stage-hint,
.bear-find-stage-hint {
  color: var(--ui-muted) !important;
  line-height: 1.65 !important;
}

.small-badge,
.game-mini-badge,
.physical-compat-badge,
.game-ff-badge,
.battle-deck-label,
.sim-phase-badge,
.naval-phase-badge,
.stock-ready-badge,
.ladder-reveal-badge,
.balloon-turn-badge,
.bomb-pass-state-badge,
.circle-tap-turn-badge,
.key-react-phase-badge,
.bear-find-phase-badge {
  min-height: 0 !important;
  padding: 8px 12px !important;
  border-radius: 999px !important;
  background: rgba(19, 61, 122, 0.10) !important;
  border: 1px solid var(--ui-line-strong) !important;
  color: var(--ui-blue) !important;
  font-family: 'Pretendard', system-ui, sans-serif !important;
  font-size: 0.78rem !important;
  font-weight: 900 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  box-shadow: none !important;
}

html.theme-dark .small-badge,
html.theme-dark .game-mini-badge,
html.theme-dark .physical-compat-badge,
html.theme-dark .game-ff-badge,
html.theme-dark .battle-deck-label,
html.theme-dark .sim-phase-badge,
html.theme-dark .naval-phase-badge,
html.theme-dark .stock-ready-badge,
html.theme-dark .ladder-reveal-badge,
html.theme-dark .balloon-turn-badge,
html.theme-dark .bomb-pass-state-badge,
html.theme-dark .circle-tap-turn-badge,
html.theme-dark .key-react-phase-badge,
html.theme-dark .bear-find-phase-badge {
  background: rgba(31, 102, 194, 0.16) !important;
  border-color: rgba(84, 142, 218, 0.36) !important;
  color: #9bc6ff !important;
}

.main-btn,
.action-btn,
.back-btn,
.popup-btn,
.menu-btn,
.utility-btn,
.drawer-toggle-btn,
.sim-info-btn,
.sim-arena-zoom-btn,
.race-track-zoom-btn,
.roulette-stage-zoom-btn {
  border-radius: 999px !important;
  font-family: 'Pretendard', system-ui, sans-serif !important;
  font-weight: 900 !important;
  letter-spacing: -0.025em;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease !important;
}

.main-btn,
.action-btn.primary {
  background: linear-gradient(135deg, var(--ui-blue), #2762aa) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 14px 32px rgba(19, 61, 122, 0.28) !important;
}

.action-btn.secondary,
.menu-btn,
.drawer-toggle-btn,
.sim-info-btn,
.sim-arena-zoom-btn,
.race-track-zoom-btn,
.roulette-stage-zoom-btn {
  background: var(--ui-surface-2) !important;
  color: var(--ui-text) !important;
  border: 1px solid var(--ui-line) !important;
  box-shadow: var(--ui-shadow-soft) !important;
}

.action-btn.soft,
.back-btn,
.popup-btn,
.utility-btn {
  background: rgba(201, 170, 114, 0.12) !important;
  color: var(--ui-text) !important;
  border: 1px solid rgba(201, 170, 114, 0.34) !important;
  box-shadow: var(--ui-shadow-soft) !important;
}

.main-btn:hover,
.action-btn:hover,
.menu-btn:hover,
.game-item:hover,
.back-btn:hover,
.popup-btn:hover,
.drawer-toggle-btn:hover,
.utility-btn:hover {
  transform: translateY(-2px) !important;
}

.action-btn:disabled,
.action-btn.is-game-running,
.main-btn:disabled,
button[aria-disabled='true'] {
  opacity: 0.48 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
  filter: saturate(0.65) !important;
}

.input-card input,
input:disabled,
select,
textarea {
  background: rgba(255, 255, 255, 0.58) !important;
  color: var(--ui-text) !important;
  border: 1px solid var(--ui-line) !important;
  border-radius: 16px !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

html.theme-dark .input-card input,
html.theme-dark input:disabled,
html.theme-dark select,
html.theme-dark textarea {
  background: rgba(5, 8, 13, 0.78) !important;
  color: var(--ui-text) !important;
  border-color: rgba(243, 242, 236, 0.14) !important;
}

.input-card input:focus {
  border-color: var(--ui-blue) !important;
  box-shadow: 0 0 0 4px rgba(31, 102, 194, 0.16) !important;
}

.menu-buttons {
  gap: 14px !important;
}

.menu-btn {
  min-height: 150px !important;
  flex: 1 1 220px;
  overflow: hidden;
  position: relative;
}

.menu-btn::after,
.game-item::after {
  content: '';
  position: absolute;
  inset: auto 16px 14px auto;
  width: 46px;
  height: 46px;
  border-right: 1px solid var(--ui-line-strong);
  border-bottom: 1px solid var(--ui-line-strong);
  opacity: 0.42;
  pointer-events: none;
}

.menu-btn .emoji {
  font-size: 2.2rem !important;
  filter: saturate(0.86);
}

.luck-card,
.physical-card,
.game-card {
  padding: clamp(20px, 2.6vw, 34px) !important;
}

.luck-header,
.physical-header,
.game-main-header,
.race-main-header,
.battle-main-header,
.sim-main-header,
.naval-main-header,
.stock-main-header,
.ladder-main-header,
.balloon-main-header,
.bomb-pass-main-header,
.circle-tap-main-header,
.key-react-main-header,
.bear-find-main-header {
  margin-bottom: clamp(14px, 2vw, 22px) !important;
}

.game-grid,
.physical-game-grid {
  gap: 14px !important;
}

.game-item,
.game-item.game-launch,
.physical-game-item,
html.theme-dark .game-item,
html.theme-dark .game-item.game-launch,
html.theme-dark .physical-game-item,
html.theme-dark .game-item:nth-child(2),
html.theme-dark .game-item:nth-child(3),
html.theme-dark .game-item:nth-child(4),
html.theme-dark .game-item:nth-child(5),
html.theme-dark .game-item:nth-child(6),
html.theme-dark .game-item:nth-child(7),
html.theme-dark .game-item:nth-child(8) {
  min-height: 214px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    var(--ui-surface-2) !important;
  color: var(--ui-text) !important;
  border: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius-lg) !important;
  box-shadow: var(--ui-shadow-soft) !important;
  text-align: left !important;
}

.game-item h3,
.game-num,
.game-meta-label,
.game-meta-value,
.scoreboard-head h3,
.input-card label,
.race-panel-head h3,
.battle-panel-head h3,
.sim-panel-head h3,
.naval-panel-head h3,
.stock-portfolio-head h4,
.ladder-panel-head h3,
.balloon-panel-head h3,
.bomb-pass-panel-head h3,
.circle-tap-panel-head h3,
.key-react-panel-head h3,
.bear-find-panel-head h3 {
  font-family: 'Pretendard', system-ui, sans-serif !important;
  color: var(--ui-text) !important;
  letter-spacing: -0.035em !important;
}

.game-item h3 {
  font-size: 1.34rem !important;
  font-weight: 900 !important;
  margin-bottom: 8px !important;
}

.game-num,
.battle-rank-num {
  width: 42px !important;
  height: 42px !important;
  margin: 0 0 14px !important;
  border-radius: 14px !important;
  background: linear-gradient(135deg, var(--ui-blue), var(--ui-blue-2)) !important;
  color: #fff !important;
  font-size: 1.1rem !important;
  font-weight: 900 !important;
  box-shadow: 0 10px 24px rgba(19, 61, 122, 0.22);
}

.game-meta-row {
  min-height: 38px !important;
  padding: 8px 12px !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.42) !important;
  border: 1px solid var(--ui-line) !important;
  box-shadow: none !important;
}

html.theme-dark .game-meta-row {
  background: rgba(255, 255, 255, 0.055) !important;
  border-color: rgba(243, 242, 236, 0.10) !important;
}

.game-meta-label {
  color: var(--ui-muted) !important;
  font-size: 0.74rem !important;
  font-weight: 800 !important;
}

.game-meta-value {
  color: var(--ui-text) !important;
  font-size: 0.86rem !important;
  font-weight: 900 !important;
}

/* game play stage panels */
.game-canvas-wrap,
.race-track-wrap,
.sim-arena-wrap,
.sim-arena-zoom-stage,
.naval-board-wrap,
.battle-table-card,
.stock-board,
.ladder-board,
.balloon-stage-card,
.bomb-pass-stage-card,
.circle-tap-stage-card,
.key-react-stage-card,
.bear-find-stage-card,
.bear-find-stage-button {
  background:
    linear-gradient(var(--ui-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--ui-grid-line) 1px, transparent 1px),
    linear-gradient(180deg, var(--ui-surface-2), rgba(255, 255, 255, 0.42)) !important;
  background-size: 24px 24px, 24px 24px, auto !important;
  border: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius-lg) !important;
  box-shadow: var(--ui-shadow-soft) !important;
}

html.theme-dark .game-canvas-wrap,
html.theme-dark .race-track-wrap,
html.theme-dark .sim-arena-wrap,
html.theme-dark .sim-arena-zoom-stage,
html.theme-dark .naval-board-wrap,
html.theme-dark .battle-table-card,
html.theme-dark .stock-board,
html.theme-dark .ladder-board,
html.theme-dark .balloon-stage-card,
html.theme-dark .bomb-pass-stage-card,
html.theme-dark .circle-tap-stage-card,
html.theme-dark .key-react-stage-card,
html.theme-dark .bear-find-stage-card,
html.theme-dark .bear-find-stage-button {
  background:
    linear-gradient(var(--ui-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--ui-grid-line) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, rgba(31, 102, 194, 0.14), transparent 38%),
    linear-gradient(180deg, rgba(10, 16, 25, 0.96), rgba(6, 9, 14, 0.96)) !important;
  background-size: 26px 26px, 26px 26px, auto, auto !important;
  border-color: rgba(243, 242, 236, 0.12) !important;
}

.controls-wrap,
.scoreboard-card,
.game-progress-meter,
.circle-tap-runtime-panel,
.sim-ranking-card,
.naval-ranking-panel,
.naval-log-panel,
.stock-portfolio-card.controls-wrap,
.key-react-live-card,
.key-react-key-card,
.bear-find-result-card {
  border-radius: var(--ui-radius-lg) !important;
  box-shadow: var(--ui-shadow-soft) !important;
}

.legend-chip,
.race-ranking-item,
.battle-ranking-item,
.battle-ranking-empty,
.sim-empty-state,
.naval-log-item,
.naval-ranking-item,
.naval-player-chip,
.naval-elimination-item,
.sim-ranking-item,
.sim-ranking-empty,
.roulette-ranking-empty,
.roulette-log-empty,
.stock-empty-state,
.stock-holder-empty,
.balloon-player-item,
.circle-tap-player-item,
.key-react-player-item,
.key-react-key-row,
.bear-find-player-item,
.bear-find-player-empty,
.ladder-check-item,
.stock-roster-item,
.stock-player-tab,
.stock-portfolio-item {
  background: rgba(255, 255, 255, 0.46) !important;
  border: 1px solid var(--ui-line) !important;
  color: var(--ui-text) !important;
  border-radius: 14px !important;
  box-shadow: none !important;
}

html.theme-dark .legend-chip,
html.theme-dark .race-ranking-item,
html.theme-dark .battle-ranking-item,
html.theme-dark .battle-ranking-empty,
html.theme-dark .sim-empty-state,
html.theme-dark .naval-log-item,
html.theme-dark .naval-ranking-item,
html.theme-dark .naval-player-chip,
html.theme-dark .naval-elimination-item,
html.theme-dark .sim-ranking-item,
html.theme-dark .sim-ranking-empty,
html.theme-dark .roulette-ranking-empty,
html.theme-dark .roulette-log-empty,
html.theme-dark .stock-empty-state,
html.theme-dark .stock-holder-empty,
html.theme-dark .balloon-player-item,
html.theme-dark .circle-tap-player-item,
html.theme-dark .key-react-player-item,
html.theme-dark .key-react-key-row,
html.theme-dark .bear-find-player-item,
html.theme-dark .bear-find-player-empty,
html.theme-dark .ladder-check-item,
html.theme-dark .stock-roster-item,
html.theme-dark .stock-player-tab,
html.theme-dark .stock-portfolio-item {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(243, 242, 236, 0.10) !important;
  color: var(--ui-text) !important;
}

/* Preserve functional color cues for current/win/finish states while matching the system. */
.race-ranking-item.top,
.battle-ranking-item.top,
.sim-ranking-item.top,
.naval-ranking-item.top,
.bear-find-player-item.is-panda,
.key-react-ranking-item.is-valid,
.key-react-popup-item.is-valid,
html.theme-dark .race-ranking-item.top,
html.theme-dark .battle-ranking-item.top,
html.theme-dark .sim-ranking-item.top,
html.theme-dark .naval-ranking-item.top,
html.theme-dark .bear-find-player-item.is-panda,
html.theme-dark .key-react-ranking-item.is-valid,
html.theme-dark .key-react-popup-item.is-valid {
  background: linear-gradient(180deg, rgba(45, 117, 105, 0.22), rgba(45, 117, 105, 0.10)) !important;
  border-color: rgba(45, 117, 105, 0.46) !important;
}

/* Home: landing card and ad banner are treated as one product page. */
#homeScreen .home-screen-stack {
  gap: clamp(18px, 2.6vw, 28px) !important;
}

#homeScreen .main-card {
  position: relative;
  overflow: hidden;
}

#homeScreen .main-card::after {
  content: 'RANDOM GAME PORTAL';
  position: absolute;
  right: 24px;
  bottom: 20px;
  color: var(--ui-line-strong);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  pointer-events: none;
}

#homeScreen .home-banner-link {
  width: min(100%, 620px) !important;
  max-width: 620px !important;
  border-radius: 20px !important;
  border: 1px solid rgba(243, 242, 236, 0.14) !important;
  box-shadow: var(--ui-shadow-soft) !important;
  opacity: 1 !important;
  filter: saturate(0.94) brightness(0.98) !important;
}

#homeScreen .home-banner-link:hover {
  transform: translateY(-2px) !important;
  filter: saturate(1.02) brightness(1.02) !important;
}

/* Utility controls: same material as the app, less cute, less noisy. */
.utility-controls {
  right: clamp(12px, 2vw, 24px) !important;
  bottom: calc(clamp(12px, 2vw, 24px) + env(safe-area-inset-bottom)) !important;
  gap: 8px !important;
}

.utility-btn {
  min-width: 118px !important;
  min-height: 44px !important;
  padding: 0 14px !important;
  backdrop-filter: blur(18px) !important;
  -webkit-backdrop-filter: blur(18px) !important;
}

.utility-volume-panel {
  width: 220px !important;
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-line) !important;
  box-shadow: var(--ui-shadow-soft) !important;
  border-radius: 18px !important;
}

html.theme-dark .utility-volume-panel {
  background: var(--ui-surface) !important;
  border-color: var(--ui-line) !important;
}

.volume-range::-webkit-slider-runnable-track {
  background:
    linear-gradient(90deg, var(--ui-blue) 0%, var(--ui-blue) var(--volume-progress, 50%), rgba(127, 137, 151, 0.25) var(--volume-progress, 50%), rgba(127, 137, 151, 0.25) 100%) !important;
}

.volume-range::-moz-range-progress {
  background: var(--ui-blue) !important;
}

.volume-range::-webkit-slider-thumb,
.volume-range::-moz-range-thumb {
  border-color: var(--ui-blue) !important;
}

/* Race track, slots and gameplay surfaces keep readability but use the same structural palette. */
.race-lane,
html.theme-dark .race-lane {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.12) 0 26px, rgba(255,255,255,0.035) 26px 52px),
    linear-gradient(180deg, rgba(19, 61, 122, 0.30), rgba(15, 43, 84, 0.32)) !important;
  border-color: var(--ui-line) !important;
}

.race-horse,
.horse-finished,
.battle-card-face,
.battle-result-pill,
.battle-final-rank,
.battle-final-result-box,
.stock-sector-card,
.stock-allocation-card,
.stock-chart-panel,
.ladder-path-label,
.ladder-result-pill {
  border-color: rgba(255, 255, 255, 0.26) !important;
  box-shadow: var(--ui-shadow-soft) !important;
}

/* Bear find: the Christmas gift asset is kept, but the surrounding UI stops looking like a separate theme. */
.bear-find-poster,
.bear-find-video,
.bear-find-still-frame,
.bear-find-stage-media {
  border-radius: 18px !important;
}

.bear-find-stage-button {
  overflow: hidden;
}

.bear-find-current-label,
#bearFindCurrentLabel {
  background: rgba(19, 61, 122, 0.14) !important;
  color: var(--ui-text) !important;
  border: 1px solid var(--ui-line) !important;
  border-radius: 999px !important;
}

/* Popups */
.popup-overlay {
  background: rgba(5, 7, 11, 0.62) !important;
  backdrop-filter: blur(8px) !important;
}

.popup {
  max-width: 420px;
}

.popup-icon {
  filter: saturate(0.8);
}

/* Mobile carousel and compact screens inherit the unified material. */
@media (max-width: 720px) {
  .app {
    padding: max(14px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom)) !important;
  }

  .main-card,
  .menu-card,
  .luck-card,
  .physical-card,
  .game-card {
    border-radius: 24px !important;
  }

  .game-grid,
  .physical-game-grid {
    gap: 12px !important;
  }

  .game-item,
  .physical-game-item,
  html.theme-dark .game-item,
  html.theme-dark .physical-game-item {
    min-height: 188px !important;
    padding: 18px 14px !important;
  }

  .game-item[data-ff-state] {
    padding-top: 52px !important;
  }

  .game-num {
    width: 38px !important;
    height: 38px !important;
    border-radius: 12px !important;
    font-size: 1rem !important;
  }

  .button-row,
  body.game2-mobile-layout #game2Screen .button-row {
    gap: 8px !important;
  }

  .action-btn,
  .back-btn {
    min-height: 46px !important;
  }

  .utility-controls {
    right: 10px !important;
    bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  }

  .utility-volume-panel,
  .utility-btn-label {
    display: none !important;
  }

  .utility-btn {
    min-width: 44px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
  }

  #homeScreen .home-banner-link {
    width: min(92vw, 480px) !important;
    border-radius: 16px !important;
  }

  #homeScreen .main-card::after {
    display: none;
  }
}

@media (max-width: 1024px) and (pointer: coarse) and (orientation: portrait) {
  body.game2-mobile-layout #game2Screen .race-lane {
    background:
      repeating-linear-gradient(180deg, rgba(255,255,255,0.14) 0 26px, rgba(255,255,255,0.035) 26px 52px),
      linear-gradient(90deg, rgba(19, 61, 122, 0.32), rgba(15, 43, 84, 0.34)) !important;
  }

  body.game2-mobile-layout #game2Screen .race-horse {
    border: 1px solid rgba(255, 255, 255, 0.34) !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.20) !important;
  }
}

/* Keep high-contrast game states intact. */
.key-react-stage.is-countdown,
.key-react-stage.is-stay,
.key-react-stage.is-click,
html.theme-dark .key-react-stage.is-countdown,
html.theme-dark .key-react-stage.is-stay,
html.theme-dark .key-react-stage.is-click {
  border-width: 1px !important;
  box-shadow: var(--ui-shadow-soft) !important;
}

/* Reduce the old pastel randomness that made screens feel unrelated. */
.game-item:nth-child(2),
.game-item:nth-child(3),
.game-item:nth-child(4),
.game-item:nth-child(5),
.game-item:nth-child(6),
.game-item:nth-child(7),
.game-item:nth-child(8),
.menu-btn.physical,
.menu-btn.luck {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    var(--ui-surface-2) !important;
}

/* =====================================================================
   FIX v3: game1(Damara) layout correction
   원인: UNIFIED DESIGN PASS의 .card::before 장식선이 #game1Screen .game-card-full의
   CSS grid 자식으로 참여하면서 담아라 화면의 사이드바/보드 배치를 밀어냈다.
   해결: game1 카드에서는 장식선을 absolute overlay로 바꿔 grid flow에서 제외한다.
===================================================================== */
#game1Screen .game-card-full {
  position: relative !important;
}

#game1Screen .game-card-full::before {
  content: '' !important;
  position: absolute !important;
  top: 12px !important;
  left: 50% !important;
  display: block !important;
  width: min(210px, 45%) !important;
  height: 3px !important;
  margin: 0 !important;
  transform: translateX(-50%) !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, transparent, var(--ui-blue), var(--ui-gold), transparent) !important;
  opacity: 0.92 !important;
  pointer-events: none !important;
  z-index: 2 !important;
}

/* game1 보드는 물리 캔버스가 핵심이므로, 통일 디자인용 전역 스테이지 배경이
   과하게 덮이지 않도록 담아라 전용 보드 배경을 다시 지정한다. */
#game1Screen .game-canvas-wrap {
  background:
    radial-gradient(circle at 50% 0%, rgba(31, 102, 194, 0.10), transparent 34%),
    linear-gradient(180deg, rgba(239, 235, 226, 0.94), rgba(250, 248, 242, 0.92)) !important;
  background-size: auto !important;
}

html.theme-dark #game1Screen .game-canvas-wrap {
  background:
    radial-gradient(circle at 50% 0%, rgba(122, 190, 255, 0.10), transparent 32%),
    radial-gradient(circle at 50% 100%, rgba(106, 149, 220, 0.08), transparent 26%),
    linear-gradient(180deg, #071120 0%, #030a16 100%) !important;
  background-size: auto !important;
  border: 2px solid rgba(118, 179, 239, 0.34) !important;
  box-shadow:
    inset 0 0 0 1px rgba(214, 236, 255, 0.06),
    inset 0 16px 28px rgba(88, 151, 219, 0.06),
    0 14px 30px rgba(0, 0, 0, 0.34) !important;
}

/* =====================================================================
   CUTE POP STYLE PASS v4
   기능/레이아웃 JS는 유지하고, 통일 디자인을 귀염 뽀짝 파스텔 톤으로 재정리한다.
   핵심: 밝은 파스텔 배경, 둥근 카드, 말랑한 버튼, 통일된 선/그림자.
===================================================================== */
:root {
  --ui-bg: #fff5fb !important;
  --ui-bg-2: #fff8e9 !important;
  --ui-surface: rgba(255, 255, 255, 0.86) !important;
  --ui-surface-2: rgba(255, 248, 252, 0.90) !important;
  --ui-surface-3: rgba(255, 255, 255, 0.76) !important;
  --ui-line: rgba(255, 158, 195, 0.42) !important;
  --ui-line-strong: rgba(255, 122, 174, 0.62) !important;
  --ui-text: #6f4e62 !important;
  --ui-text-soft: #8b6478 !important;
  --ui-muted: #9f7d8f !important;
  --ui-blue: #8bcfff !important;
  --ui-blue-2: #b7e3ff !important;
  --ui-cream: #fff8e9 !important;
  --ui-gold: #ffd76f !important;
  --ui-red: #ff77a7 !important;
  --ui-green: #8de8cc !important;
  --ui-shadow: 0 18px 42px rgba(220, 125, 168, 0.18) !important;
  --ui-shadow-soft: 0 10px 24px rgba(220, 125, 168, 0.13) !important;
  --ui-radius-xl: 32px !important;
  --ui-radius-lg: 26px !important;
  --ui-radius-md: 20px !important;
  --ui-grid-line: rgba(255, 160, 200, 0.14) !important;

  --bg: #fff5fb !important;
  --bg2: #fff8e9 !important;
  --card: rgba(255, 255, 255, 0.86) !important;
  --card-strong: rgba(255, 252, 247, 0.94) !important;
  --brown: #6f4e62 !important;
  --soft-brown: #9a5f7b !important;
  --pink: #ffc6dd !important;
  --mint: #c6f4e4 !important;
  --sky: #cdeeff !important;
  --lavender: #ded5ff !important;
  --yellow: #ffefad !important;
  --peach: #ffd6bd !important;
  --shadow: 0 18px 42px rgba(220, 125, 168, 0.18) !important;
  --radius-xl: 32px !important;
  --radius-lg: 26px !important;
}

html.theme-dark {
  --ui-bg: #221a33 !important;
  --ui-bg-2: #2d2342 !important;
  --ui-surface: rgba(48, 37, 69, 0.88) !important;
  --ui-surface-2: rgba(58, 45, 82, 0.88) !important;
  --ui-surface-3: rgba(72, 56, 98, 0.76) !important;
  --ui-line: rgba(255, 192, 222, 0.26) !important;
  --ui-line-strong: rgba(255, 157, 204, 0.42) !important;
  --ui-text: #fff2fa !important;
  --ui-text-soft: #ffd8eb !important;
  --ui-muted: #dbc6da !important;
  --ui-blue: #98d9ff !important;
  --ui-blue-2: #b9e7ff !important;
  --ui-cream: #fff4d6 !important;
  --ui-gold: #ffe28a !important;
  --ui-red: #ff8fbd !important;
  --ui-green: #a8f0dc !important;
  --ui-shadow: 0 22px 50px rgba(9, 5, 18, 0.42) !important;
  --ui-shadow-soft: 0 14px 32px rgba(9, 5, 18, 0.30) !important;
  --ui-grid-line: rgba(255, 202, 228, 0.07) !important;

  --bg: #221a33 !important;
  --bg2: #2d2342 !important;
  --card: rgba(48, 37, 69, 0.88) !important;
  --card-strong: rgba(58, 45, 82, 0.90) !important;
  --brown: #fff2fa !important;
  --soft-brown: #ffd8eb !important;
}

html,
body {
  background: var(--ui-bg) !important;
}

body,
html.theme-dark body {
  color: var(--ui-text) !important;
  font-family: 'Pretendard', system-ui, -apple-system, BlinkMacSystemFont, sans-serif !important;
  letter-spacing: -0.02em !important;
  background:
    radial-gradient(circle at 9% 12%, rgba(255, 198, 221, 0.56), transparent 20%),
    radial-gradient(circle at 88% 14%, rgba(198, 244, 228, 0.52), transparent 22%),
    radial-gradient(circle at 16% 88%, rgba(205, 238, 255, 0.50), transparent 22%),
    radial-gradient(circle at 86% 84%, rgba(255, 239, 173, 0.52), transparent 23%),
    linear-gradient(135deg, var(--ui-bg) 0%, var(--ui-bg-2) 100%) !important;
  background-size: auto !important;
}

html.theme-dark body {
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 143, 189, 0.18), transparent 26%),
    radial-gradient(circle at 88% 14%, rgba(152, 217, 255, 0.16), transparent 26%),
    radial-gradient(circle at 16% 86%, rgba(168, 240, 220, 0.12), transparent 24%),
    linear-gradient(135deg, var(--ui-bg) 0%, var(--ui-bg-2) 100%) !important;
}

.background-deco {
  display: block !important;
  opacity: 0.74 !important;
  filter: blur(0.5px) !important;
  box-shadow: 0 14px 28px rgba(255, 150, 194, 0.14) !important;
}

.deco1 { background: #ffd5e6 !important; }
.deco2 { background: #c9f6e7 !important; }
.deco3 { background: #ddd6ff !important; }
.deco4 { background: #fff0b1 !important; }

.app {
  padding: clamp(18px, 2.4vw, 34px) clamp(12px, 2vw, 28px) !important;
}

.screen { max-width: 1220px !important; }

.card,
.controls-wrap,
.scoreboard-card,
.game-board-card,
.race-panel,
.race-track-wrap,
.battle-table-card,
.battle-panel,
.sim-setup-card,
.sim-arena-card,
.sim-battle-summary-card,
.naval-board-card,
.stock-portfolio-card,
.bear-find-stage-card,
.bear-find-sidebar,
.popup,
.orientation-lock-card,
.game-sidebar,
.race-sidebar,
.battle-sidebar,
.sim-sidebar,
.naval-sidebar,
.balloon-sidebar,
.circle-tap-sidebar,
.key-react-sidebar,
.bomb-pass-stage-card,
.balloon-stage-card,
.circle-tap-stage-card,
.key-react-stage-card,
.bear-find-stage-button {
  position: relative !important;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.78), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 248, 253, 0.88)) !important;
  color: var(--ui-text) !important;
  border: 2px solid rgba(255, 255, 255, 0.78) !important;
  outline: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius-xl) !important;
  box-shadow: var(--ui-shadow) !important;
  backdrop-filter: blur(16px) saturate(128%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(128%) !important;
}

html.theme-dark .card,
html.theme-dark .controls-wrap,
html.theme-dark .scoreboard-card,
html.theme-dark .game-board-card,
html.theme-dark .race-panel,
html.theme-dark .race-track-wrap,
html.theme-dark .battle-table-card,
html.theme-dark .battle-panel,
html.theme-dark .sim-setup-card,
html.theme-dark .sim-arena-card,
html.theme-dark .sim-battle-summary-card,
html.theme-dark .naval-board-card,
html.theme-dark .stock-portfolio-card,
html.theme-dark .bear-find-stage-card,
html.theme-dark .bear-find-sidebar,
html.theme-dark .popup,
html.theme-dark .orientation-lock-card,
html.theme-dark .game-sidebar,
html.theme-dark .race-sidebar,
html.theme-dark .battle-sidebar,
html.theme-dark .sim-sidebar,
html.theme-dark .naval-sidebar,
html.theme-dark .balloon-sidebar,
html.theme-dark .circle-tap-sidebar,
html.theme-dark .key-react-sidebar,
html.theme-dark .bomb-pass-stage-card,
html.theme-dark .balloon-stage-card,
html.theme-dark .circle-tap-stage-card,
html.theme-dark .key-react-stage-card,
html.theme-dark .bear-find-stage-button {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.10), transparent 36%),
    linear-gradient(180deg, rgba(58, 45, 82, 0.92), rgba(43, 34, 62, 0.88)) !important;
  border-color: rgba(255, 235, 247, 0.18) !important;
  outline-color: var(--ui-line) !important;
  color: var(--ui-text) !important;
}

/* 기존 통일 디자인의 장식선이 grid/flex 레이아웃을 밀지 않도록 전체를 absolute 장식으로 교체 */
.card::before,
.game-card::before,
.main-card::before,
.menu-card::before,
.luck-card::before,
.physical-card::before,
#game1Screen .game-card-full::before {
  content: '' !important;
  position: absolute !important;
  top: 14px !important;
  left: 50% !important;
  display: block !important;
  width: min(180px, 42%) !important;
  height: 8px !important;
  margin: 0 !important;
  transform: translateX(-50%) !important;
  border-radius: 999px !important;
  background:
    radial-gradient(circle, #fff 0 28%, transparent 30%) 0 50% / 18px 18px repeat-x,
    linear-gradient(90deg, #ffc6dd, #ffefad, #c6f4e4, #cdeeff, #ded5ff) !important;
  opacity: 0.96 !important;
  pointer-events: none !important;
  z-index: 1 !important;
}

.card::after,
.main-card::after,
.menu-card::after,
.luck-card::after,
.physical-card::after,
.game-card::after {
  content: '✦' !important;
  position: absolute !important;
  right: 18px !important;
  top: 16px !important;
  color: rgba(255, 122, 174, 0.36) !important;
  font-size: 1.25rem !important;
  line-height: 1 !important;
  pointer-events: none !important;
}

.main-card,
.menu-card {
  max-width: 720px !important;
  padding: clamp(38px, 5vw, 62px) clamp(22px, 4vw, 48px) !important;
}

.main-card h1,
.menu-card h2,
.luck-card h2,
.physical-card h2,
.game-card h2,
.popup h3,
.sidebar-title,
#game4Screen .sim-panel-head h3,
#game5Screen .naval-panel-head h3,
#game6Screen .stock-portfolio-head h4,
.physical-header h2,
.bear-find-card-screen h2 {
  font-family: 'Gaegu', 'Pretendard', cursive !important;
  color: var(--soft-brown) !important;
  font-weight: 700 !important;
  letter-spacing: -0.035em !important;
  line-height: 1.04 !important;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.72) !important;
}

html.theme-dark .main-card h1,
html.theme-dark .menu-card h2,
html.theme-dark .luck-card h2,
html.theme-dark .physical-card h2,
html.theme-dark .game-card h2,
html.theme-dark .popup h3,
html.theme-dark .sidebar-title,
html.theme-dark #game4Screen .sim-panel-head h3,
html.theme-dark #game5Screen .naval-panel-head h3,
html.theme-dark #game6Screen .stock-portfolio-head h4,
html.theme-dark .physical-header h2,
html.theme-dark .bear-find-card-screen h2 {
  color: var(--ui-text-soft) !important;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18) !important;
}

.main-card h1 { font-size: clamp(2.7rem, 5.8vw, 5.2rem) !important; }
.menu-card h2,
.luck-card h2,
.physical-card h2,
.game-card h2 { font-size: clamp(2.15rem, 4.2vw, 3.7rem) !important; }

.sub-text,
.helper-text,
.status-text,
#totalInfo,
.game-item p,
.popup-message,
.orientation-lock-card p,
.game-board-head span,
.race-track-stage-desc,
.bomb-pass-status-text,
.bomb-pass-device-text,
.balloon-stage-hint,
.circle-tap-stage-hint,
.bear-find-stage-hint {
  color: var(--ui-muted) !important;
  line-height: 1.68 !important;
}

.small-badge,
.game-mini-badge,
.physical-compat-badge,
.game-ff-badge,
.battle-deck-label,
.sim-phase-badge,
.naval-phase-badge,
.stock-ready-badge,
.ladder-reveal-badge,
.balloon-turn-badge,
.bomb-pass-state-badge,
.circle-tap-turn-badge,
.key-react-phase-badge,
.bear-find-phase-badge,
.race-lane-label,
.ff-guide-chip {
  background: linear-gradient(135deg, rgba(255, 235, 246, 0.98), rgba(255, 249, 220, 0.96)) !important;
  color: #a25b7c !important;
  border: 2px dashed rgba(255, 147, 190, 0.56) !important;
  border-radius: 999px !important;
  box-shadow: 0 8px 18px rgba(220, 125, 168, 0.12) !important;
  font-weight: 800 !important;
}

html.theme-dark .small-badge,
html.theme-dark .game-mini-badge,
html.theme-dark .physical-compat-badge,
html.theme-dark .game-ff-badge,
html.theme-dark .battle-deck-label,
html.theme-dark .sim-phase-badge,
html.theme-dark .naval-phase-badge,
html.theme-dark .stock-ready-badge,
html.theme-dark .ladder-reveal-badge,
html.theme-dark .balloon-turn-badge,
html.theme-dark .bomb-pass-state-badge,
html.theme-dark .circle-tap-turn-badge,
html.theme-dark .key-react-phase-badge,
html.theme-dark .bear-find-phase-badge,
html.theme-dark .race-lane-label,
html.theme-dark .ff-guide-chip {
  background: linear-gradient(135deg, rgba(255, 153, 199, 0.16), rgba(152, 217, 255, 0.14)) !important;
  color: #ffd8eb !important;
  border-color: rgba(255, 198, 221, 0.32) !important;
}

.main-btn,
.menu-btn,
.action-btn,
.back-btn,
.popup-btn,
.drawer-toggle-btn,
.utility-btn,
.utility-prevstep-btn,
.race-track-zoom-btn,
.sim-info-btn,
.sim-arena-zoom-btn,
.roulette-stage-zoom-btn {
  border-radius: 999px !important;
  border: 2px solid rgba(255, 255, 255, 0.82) !important;
  outline: 1px solid rgba(255, 150, 194, 0.42) !important;
  color: #764b61 !important;
  background: linear-gradient(135deg, #ffc6dd 0%, #ffefad 100%) !important;
  box-shadow: 0 10px 22px rgba(220, 125, 168, 0.18), inset 0 1px 0 rgba(255,255,255,0.72) !important;
  font-weight: 900 !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease !important;
}

.main-btn:hover,
.menu-btn:hover,
.action-btn:hover,
.back-btn:hover,
.popup-btn:hover,
.drawer-toggle-btn:hover,
.utility-btn:hover,
.utility-prevstep-btn:hover,
.game-item:hover,
.physical-game-item:hover {
  transform: translateY(-3px) scale(1.015) !important;
  filter: saturate(1.04) brightness(1.015) !important;
}

.action-btn.primary,
.main-btn {
  background: linear-gradient(135deg, #ff9fc8 0%, #ffd6e8 46%, #ffe98f 100%) !important;
}
.action-btn.secondary,
.drawer-toggle-btn,
.race-track-zoom-btn,
.sim-info-btn,
.sim-arena-zoom-btn,
.roulette-stage-zoom-btn {
  background: linear-gradient(135deg, #b7e3ff 0%, #ded5ff 100%) !important;
}
.action-btn.soft,
.back-btn,
.popup-btn {
  background: linear-gradient(135deg, #fff0ad 0%, #ffd6bd 100%) !important;
}
.action-btn.is-game-running,
.action-btn:disabled,
button:disabled {
  opacity: 0.58 !important;
  filter: grayscale(0.10) !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5) !important;
}

html.theme-dark .main-btn,
html.theme-dark .menu-btn,
html.theme-dark .action-btn,
html.theme-dark .back-btn,
html.theme-dark .popup-btn,
html.theme-dark .drawer-toggle-btn,
html.theme-dark .utility-btn,
html.theme-dark .utility-prevstep-btn,
html.theme-dark .race-track-zoom-btn,
html.theme-dark .sim-info-btn,
html.theme-dark .sim-arena-zoom-btn,
html.theme-dark .roulette-stage-zoom-btn {
  color: #44243a !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
}

.input-card input,
select,
textarea,
html.theme-dark .input-card input,
html.theme-dark input:disabled,
html.theme-dark select,
html.theme-dark textarea {
  background: rgba(255, 255, 255, 0.78) !important;
  color: #764b61 !important;
  border: 2px solid rgba(255, 177, 210, 0.52) !important;
  border-radius: 20px !important;
  box-shadow: inset 0 2px 6px rgba(220, 125, 168, 0.07) !important;
}

html.theme-dark .input-card input,
html.theme-dark input:disabled,
html.theme-dark select,
html.theme-dark textarea {
  background: rgba(255, 242, 250, 0.12) !important;
  color: #fff2fa !important;
}

.input-card input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 122, 174, 0.72) !important;
  box-shadow: 0 0 0 5px rgba(255, 198, 221, 0.32) !important;
}

.game-grid,
.physical-game-grid { gap: 18px !important; }

.game-item,
.physical-game-item,
html.theme-dark .game-item,
html.theme-dark .physical-game-item,
.game-item.game-launch,
html.theme-dark .game-item.game-launch {
  background:
    radial-gradient(circle at 20% 14%, rgba(255, 255, 255, 0.72), transparent 30%),
    linear-gradient(180deg, #fffafd 0%, #fff1f8 100%) !important;
  color: var(--ui-text) !important;
  border: 2px solid rgba(255, 255, 255, 0.82) !important;
  outline: 1px solid rgba(255, 166, 203, 0.34) !important;
  border-radius: 28px !important;
  box-shadow: var(--ui-shadow-soft) !important;
  padding-top: 22px !important;
}

.game-item[data-ff-state] { padding-top: 56px !important; }

.game-grid > .game-item:nth-child(1),
.physical-game-grid > .physical-game-item:nth-child(1) { background: linear-gradient(180deg, #fffafd, #ffeef7) !important; }
.game-grid > .game-item:nth-child(2),
.physical-game-grid > .physical-game-item:nth-child(2) { background: linear-gradient(180deg, #f4fffb, #e9fff6) !important; }
.game-grid > .game-item:nth-child(3),
.physical-game-grid > .physical-game-item:nth-child(3) { background: linear-gradient(180deg, #f7f5ff, #eeeaff) !important; }
.game-grid > .game-item:nth-child(4),
.physical-game-grid > .physical-game-item:nth-child(4) { background: linear-gradient(180deg, #fffaf0, #fff0c5) !important; }
.game-grid > .game-item:nth-child(5),
.physical-game-grid > .physical-game-item:nth-child(5) { background: linear-gradient(180deg, #fff5ef, #ffe5d6) !important; }
.game-grid > .game-item:nth-child(6) { background: linear-gradient(180deg, #f3fffa, #e2fff4) !important; }
.game-grid > .game-item:nth-child(7) { background: linear-gradient(180deg, #fbf5ff, #f1e4ff) !important; }
.game-grid > .game-item:nth-child(8) { background: linear-gradient(180deg, #f1fbff, #e5f6ff) !important; }

html.theme-dark .game-grid > .game-item,
html.theme-dark .physical-game-grid > .physical-game-item {
  background: linear-gradient(180deg, rgba(255, 242, 250, 0.10), rgba(255, 198, 221, 0.08)) !important;
}

.game-num {
  width: 56px !important;
  height: 56px !important;
  border-radius: 20px !important;
  background: linear-gradient(135deg, #ffc6dd 0%, #cdeeff 100%) !important;
  color: #764b61 !important;
  font-family: 'Gaegu', cursive !important;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.68), 0 8px 14px rgba(220, 125, 168, 0.14) !important;
}

.game-item h3,
.physical-game-item h3 {
  font-family: 'Gaegu', 'Pretendard', cursive !important;
  color: var(--soft-brown) !important;
  font-weight: 700 !important;
  font-size: 1.85rem !important;
}

.game-meta-row,
html.theme-dark .game-meta-row {
  background: rgba(255, 255, 255, 0.66) !important;
  border: 1px solid rgba(255, 176, 210, 0.32) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.74) !important;
}

html.theme-dark .game-meta-row {
  background: rgba(255, 242, 250, 0.10) !important;
}

.game-meta-label { color: #b16082 !important; }
.game-meta-value { color: var(--ui-text) !important; }

.legend-chip,
.race-ranking-item,
.battle-ranking-item,
.battle-ranking-empty,
.sim-empty-state,
.naval-log-item,
.naval-ranking-item,
.naval-player-chip,
.naval-elimination-item,
.sim-ranking-item,
.sim-ranking-empty,
.roulette-ranking-empty,
.roulette-log-empty,
.stock-empty-state,
.stock-holder-empty,
.balloon-player-item,
.circle-tap-player-item,
.key-react-player-item,
.key-react-key-row,
.bear-find-player-item,
.bear-find-player-empty,
.ladder-check-item,
.stock-roster-item,
.stock-player-tab,
html.theme-dark .legend-chip,
html.theme-dark .race-ranking-item,
html.theme-dark .battle-ranking-item,
html.theme-dark .battle-ranking-empty,
html.theme-dark .sim-empty-state,
html.theme-dark .naval-log-item,
html.theme-dark .naval-ranking-item,
html.theme-dark .naval-player-chip,
html.theme-dark .naval-elimination-item,
html.theme-dark .sim-ranking-item,
html.theme-dark .sim-ranking-empty,
html.theme-dark .roulette-ranking-empty,
html.theme-dark .roulette-log-empty,
html.theme-dark .stock-empty-state,
html.theme-dark .stock-holder-empty,
html.theme-dark .balloon-player-item,
html.theme-dark .circle-tap-player-item,
html.theme-dark .key-react-player-item,
html.theme-dark .key-react-key-row,
html.theme-dark .bear-find-player-item,
html.theme-dark .bear-find-player-empty,
html.theme-dark .ladder-check-item,
html.theme-dark .stock-roster-item,
html.theme-dark .stock-player-tab,
html.theme-dark .stock-portfolio-item {
  background: rgba(255, 255, 255, 0.66) !important;
  color: var(--ui-text) !important;
  border: 1px solid rgba(255, 176, 210, 0.36) !important;
  border-radius: 18px !important;
  box-shadow: var(--ui-shadow-soft) !important;
}

html.theme-dark .legend-chip,
html.theme-dark .race-ranking-item,
html.theme-dark .battle-ranking-item,
html.theme-dark .battle-ranking-empty,
html.theme-dark .sim-empty-state,
html.theme-dark .naval-log-item,
html.theme-dark .naval-ranking-item,
html.theme-dark .naval-player-chip,
html.theme-dark .naval-elimination-item,
html.theme-dark .sim-ranking-item,
html.theme-dark .sim-ranking-empty,
html.theme-dark .roulette-ranking-empty,
html.theme-dark .roulette-log-empty,
html.theme-dark .stock-empty-state,
html.theme-dark .stock-holder-empty,
html.theme-dark .balloon-player-item,
html.theme-dark .circle-tap-player-item,
html.theme-dark .key-react-player-item,
html.theme-dark .key-react-key-row,
html.theme-dark .bear-find-player-item,
html.theme-dark .bear-find-player-empty,
html.theme-dark .ladder-check-item,
html.theme-dark .stock-roster-item,
html.theme-dark .stock-player-tab,
html.theme-dark .stock-portfolio-item {
  background: rgba(255, 242, 250, 0.10) !important;
}

.race-ranking-item.top,
.battle-ranking-item.top,
.sim-ranking-item.top,
.naval-ranking-item.top,
.bear-find-player-item.is-panda,
.key-react-ranking-item.is-valid,
.key-react-popup-item.is-valid,
html.theme-dark .race-ranking-item.top,
html.theme-dark .battle-ranking-item.top,
html.theme-dark .sim-ranking-item.top,
html.theme-dark .naval-ranking-item.top,
html.theme-dark .bear-find-player-item.is-panda,
html.theme-dark .key-react-ranking-item.is-valid,
html.theme-dark .key-react-popup-item.is-valid {
  background: linear-gradient(135deg, rgba(255, 239, 173, 0.92), rgba(255, 214, 232, 0.86)) !important;
  border-color: rgba(255, 214, 111, 0.72) !important;
}

.game-canvas-wrap,
.race-track-wrap,
.sim-arena-wrap,
.sim-arena-zoom-stage,
.naval-board-wrap,
.battle-table-card,
.stock-board,
.ladder-board,
.balloon-stage-card,
.bomb-pass-stage-card,
.circle-tap-stage-card,
.key-react-stage-card,
.bear-find-stage-card,
.bear-find-stage-button,
html.theme-dark .game-canvas-wrap,
html.theme-dark .race-track-wrap,
html.theme-dark .sim-arena-wrap,
html.theme-dark .sim-arena-zoom-stage,
html.theme-dark .naval-board-wrap,
html.theme-dark .battle-table-card,
html.theme-dark .stock-board,
html.theme-dark .ladder-board,
html.theme-dark .balloon-stage-card,
html.theme-dark .bomb-pass-stage-card,
html.theme-dark .circle-tap-stage-card,
html.theme-dark .key-react-stage-card,
html.theme-dark .bear-find-stage-card,
html.theme-dark .bear-find-stage-button {
  background:
    radial-gradient(circle at 16px 16px, rgba(255, 198, 221, 0.24) 0 4px, transparent 5px) 0 0 / 34px 34px,
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 248, 236, 0.82)) !important;
  border: 2px solid rgba(255,255,255,0.78) !important;
  outline: 1px solid rgba(255, 176, 210, 0.38) !important;
  box-shadow: var(--ui-shadow-soft) !important;
}

html.theme-dark .game-canvas-wrap,
html.theme-dark .race-track-wrap,
html.theme-dark .sim-arena-wrap,
html.theme-dark .sim-arena-zoom-stage,
html.theme-dark .naval-board-wrap,
html.theme-dark .battle-table-card,
html.theme-dark .stock-board,
html.theme-dark .ladder-board,
html.theme-dark .balloon-stage-card,
html.theme-dark .bomb-pass-stage-card,
html.theme-dark .circle-tap-stage-card,
html.theme-dark .key-react-stage-card,
html.theme-dark .bear-find-stage-card,
html.theme-dark .bear-find-stage-button {
  background:
    radial-gradient(circle at 16px 16px, rgba(255, 198, 221, 0.10) 0 4px, transparent 5px) 0 0 / 34px 34px,
    linear-gradient(180deg, rgba(58, 45, 82, 0.84), rgba(43, 34, 62, 0.82)) !important;
}

#game1Screen .game-canvas-wrap,
html.theme-dark #game1Screen .game-canvas-wrap {
  background:
    radial-gradient(circle at 18px 18px, rgba(255, 198, 221, 0.24) 0 4px, transparent 5px) 0 0 / 36px 36px,
    linear-gradient(180deg, #fffafd 0%, #fff4e9 100%) !important;
  border: 2px solid rgba(255, 255, 255, 0.84) !important;
  outline: 1px solid rgba(255, 176, 210, 0.48) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.52), var(--ui-shadow-soft) !important;
}

html.theme-dark #game1Screen .game-canvas-wrap {
  background:
    radial-gradient(circle at 18px 18px, rgba(255, 198, 221, 0.11) 0 4px, transparent 5px) 0 0 / 36px 36px,
    linear-gradient(180deg, rgba(58, 45, 82, 0.90), rgba(37, 30, 54, 0.90)) !important;
}

.race-lane,
html.theme-dark .race-lane,
body.game2-mobile-layout #game2Screen .race-lane,
body.game2-mobile-layout #game2Screen .race-track-lanes.is-vertical-track .race-lane {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.32) 0 24px, rgba(255,255,255,0.12) 24px 48px),
    linear-gradient(180deg, #ffd6bd 0%, #ffc6dd 100%) !important;
  border-color: rgba(255,255,255,0.76) !important;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25) !important;
}

@media (max-width: 1024px) and (pointer: coarse) and (orientation: portrait) {
  body.game2-mobile-layout #game2Screen .race-lane,
  body.game2-mobile-layout #game2Screen .race-track-lanes.is-vertical-track .race-lane {
    background:
      repeating-linear-gradient(180deg, rgba(255,255,255,0.32) 0 24px, rgba(255,255,255,0.12) 24px 48px),
      linear-gradient(90deg, #ffd6bd 0%, #ffc6dd 100%) !important;
  }
}

.race-start-line,
.race-finish-line {
  border-radius: 999px !important;
}
.race-horse,
.horse-finished,
.battle-card-face,
.battle-result-pill,
.battle-final-rank,
.battle-final-result-box,
.stock-sector-card,
.stock-allocation-card,
.stock-chart-panel,
.ladder-path-label,
.ladder-result-pill {
  border-color: rgba(255,255,255,0.80) !important;
  box-shadow: var(--ui-shadow-soft) !important;
}

.battle-card-back {
  background: linear-gradient(145deg, #ffc6dd 0%, #ded5ff 50%, #c6f4e4 100%) !important;
}
.battle-card.type-operator .battle-card-back {
  background: linear-gradient(145deg, #ffefad 0%, #ffd6bd 52%, #ffc6dd 100%) !important;
}
.battle-card.type-result .battle-card-back {
  background: linear-gradient(145deg, #fff0ad 0%, #ffd6bd 52%, #fff8e9 100%) !important;
}
.battle-card-front,
.battle-card.type-operator .battle-card-front,
.battle-card.type-result .battle-card-front {
  background: linear-gradient(180deg, #fffdf8 0%, #fff1f8 100%) !important;
  color: var(--ui-text) !important;
}

.balloon-body {
  background: radial-gradient(circle at 35% 26%, rgba(255,255,255,0.82), transparent 22%), linear-gradient(135deg, #ff9fc8, #ffc6dd) !important;
  box-shadow: 0 16px 30px rgba(255, 122, 174, 0.26) !important;
}
.balloon-knot { border-top-color: #ff9fc8 !important; }
.bomb-pass-body {
  background: radial-gradient(circle at 35% 22%, rgba(255,255,255,0.42), transparent 24%), linear-gradient(135deg, #6f4e62, #a25b7c) !important;
}
.circle-tap-target {
  box-shadow: 0 14px 26px rgba(255, 122, 174, 0.26), inset 0 4px 0 rgba(255,255,255,0.36) !important;
}

.home-screen-stack { gap: 20px !important; }
.home-banner-link,
#homeScreen .home-banner-link {
  border-radius: 24px !important;
  border: 3px solid rgba(255, 255, 255, 0.80) !important;
  outline: 1px solid rgba(255, 176, 210, 0.46) !important;
  box-shadow: 0 18px 40px rgba(220, 125, 168, 0.20) !important;
  background: linear-gradient(135deg, #fffafd, #fff0f7) !important;
  padding: 6px !important;
}
.home-banner-link img,
#homeScreen .home-banner-link img {
  border-radius: 18px !important;
  display: block !important;
}

.popup-overlay,
html.theme-dark .popup-overlay {
  background: rgba(143, 88, 118, 0.25) !important;
  backdrop-filter: blur(10px) saturate(120%) !important;
}
.popup-icon { filter: saturate(1.2) !important; }

.utility-controls { gap: 9px !important; }
.utility-volume-panel,
html.theme-dark .utility-volume-panel {
  background: var(--ui-surface) !important;
  border: 2px solid rgba(255, 255, 255, 0.72) !important;
  outline: 1px solid rgba(255, 176, 210, 0.34) !important;
  box-shadow: var(--ui-shadow-soft) !important;
}
.volume-range::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, #ff9fc8 0%, #ff9fc8 var(--volume-progress, 50%), rgba(255, 198, 221, 0.42) var(--volume-progress, 50%), rgba(255, 198, 221, 0.42) 100%) !important;
}
.volume-range::-moz-range-progress { background: #ff9fc8 !important; }
.volume-range::-webkit-slider-thumb,
.volume-range::-moz-range-thumb { border-color: #ff9fc8 !important; }

.key-react-stage.is-countdown,
.key-react-stage.is-stay,
.key-react-stage.is-click,
html.theme-dark .key-react-stage.is-countdown,
html.theme-dark .key-react-stage.is-stay,
html.theme-dark .key-react-stage.is-click {
  border-width: 2px !important;
  box-shadow: var(--ui-shadow-soft) !important;
}

/* 모바일에서도 같은 귀여운 톤을 유지하되, 기존 공간 절약 규칙은 유지 */
@media (max-width: 720px) {
  .app {
    padding: max(12px, env(safe-area-inset-top)) 10px max(14px, env(safe-area-inset-bottom)) !important;
  }
  .main-card,
  .menu-card,
  .luck-card,
  .physical-card,
  .game-card {
    border-radius: 26px !important;
  }
  .game-grid,
  .physical-game-grid { gap: 12px !important; }
  .game-item,
  .physical-game-item,
  html.theme-dark .game-item,
  html.theme-dark .physical-game-item {
    min-height: 188px !important;
    padding: 18px 14px !important;
  }
  .game-item[data-ff-state] { padding-top: 52px !important; }
  .game-num {
    width: 42px !important;
    height: 42px !important;
    border-radius: 16px !important;
    font-size: 1.25rem !important;
  }
  .action-btn,
  .back-btn { min-height: 46px !important; }
  .utility-controls {
    right: 10px !important;
    bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  }
  .utility-volume-panel,
  .utility-btn-label { display: none !important; }
  .utility-btn {
    min-width: 44px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
  }
  #homeScreen .home-banner-link {
    width: min(92vw, 480px) !important;
    border-radius: 20px !important;
  }
  .card::after,
  .main-card::after,
  .menu-card::after,
  .luck-card::after,
  .physical-card::after,
  .game-card::after {
    display: none !important;
  }
}

/* =========================================================
   COLOR BALANCE PATCH v2
   Adobe Color inspired cute palette + golden-ratio color use
   Day: clear daylight / Night: clear midnight concept
   Ratio target: dominant 61.8% · support 23.6% · accent 9% · spark 5.6%
========================================================= */
:root {
  --day-dominant: #fff4d6;
  --day-dominant-2: #fff9ec;
  --day-support: #bdeaff;
  --day-support-2: #e6f7ff;
  --day-accent: #ff6fa8;
  --day-accent-2: #ff9a7a;
  --day-spark: #ffd84d;
  --day-mint: #58d7b5;
  --day-lavender: #a98cff;
  --day-ink: #3f342b;
  --day-ink-soft: #6c594c;
  --day-line: rgba(99, 75, 52, 0.16);

  --night-dominant: #081225;
  --night-dominant-2: #0e1a33;
  --night-support: #173b6d;
  --night-support-2: #1f4d88;
  --night-accent: #ff6fb1;
  --night-accent-2: #8bd3ff;
  --night-spark: #ffd966;
  --night-mint: #70e3cf;
  --night-ink: #fff7e6;
  --night-ink-soft: #c9d8ef;
  --night-line: rgba(139, 211, 255, 0.25);
}

html:not(.theme-dark) {
  color-scheme: light;
  --bg: var(--day-dominant);
  --bg2: var(--day-support-2);
  --card: rgba(255, 255, 251, 0.92);
  --card-strong: rgba(255, 253, 246, 0.97);
  --brown: var(--day-ink);
  --soft-brown: #5a4c8a;
  --pink: var(--day-accent);
  --mint: var(--day-mint);
  --sky: #6fc7ff;
  --lavender: var(--day-lavender);
  --yellow: var(--day-spark);
  --peach: var(--day-accent-2);
  --shadow: 0 18px 34px rgba(90, 67, 44, 0.13);
}

html:not(.theme-dark) body {
  color: var(--day-ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 216, 77, 0.38) 0 8%, transparent 23%),
    radial-gradient(circle at 84% 16%, rgba(189, 234, 255, 0.88) 0 15%, transparent 34%),
    radial-gradient(circle at 92% 84%, rgba(255, 111, 168, 0.20) 0 10%, transparent 28%),
    linear-gradient(135deg, var(--day-dominant) 0%, var(--day-dominant-2) 58%, var(--day-support-2) 100%);
}

html:not(.theme-dark) body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.32) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,0.28) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.55), transparent 72%);
  opacity: 0.42;
}

html:not(.theme-dark) .background-deco {
  opacity: 0.52;
  filter: blur(4px) saturate(1.08);
}

html:not(.theme-dark) .card,
html:not(.theme-dark) .controls-wrap,
html:not(.theme-dark) .scoreboard-card,
html:not(.theme-dark) .game-board-card,
html:not(.theme-dark) .race-panel,
html:not(.theme-dark) .battle-table-card,
html:not(.theme-dark) .battle-panel,
html:not(.theme-dark) .sim-setup-card,
html:not(.theme-dark) .sim-arena-card,
html:not(.theme-dark) .sim-battle-summary-card,
html:not(.theme-dark) .naval-board-card,
html:not(.theme-dark) .popup,
html:not(.theme-dark) .orientation-lock-card,
html:not(.theme-dark) .game-sidebar,
html:not(.theme-dark) .race-sidebar,
html:not(.theme-dark) .battle-sidebar,
html:not(.theme-dark) .sim-sidebar,
html:not(.theme-dark) .naval-sidebar {
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.90), rgba(255,255,255,0.18) 42%, transparent 68%),
    linear-gradient(180deg, rgba(255,255,251,0.96) 0%, rgba(255,250,232,0.92) 100%);
  color: var(--day-ink);
  border-color: rgba(255,255,255,0.86);
  box-shadow:
    0 16px 32px rgba(90, 67, 44, 0.12),
    inset 0 0 0 1px rgba(255,255,255,0.62);
}

html:not(.theme-dark) .main-card,
html:not(.theme-dark) .menu-card,
html:not(.theme-dark) .luck-card,
html:not(.theme-dark) .physical-card {
  border-color: rgba(255,255,255,0.92);
}

html:not(.theme-dark) .main-card h1,
html:not(.theme-dark) .menu-card h2,
html:not(.theme-dark) .luck-card h2,
html:not(.theme-dark) .physical-card h2,
html:not(.theme-dark) .game-card h2,
html:not(.theme-dark) .popup h3,
html:not(.theme-dark) .sidebar-title,
html:not(.theme-dark) .scoreboard-head h3,
html:not(.theme-dark) .game-board-head h3,
html:not(.theme-dark) .race-track-stage-title,
html:not(.theme-dark) .battle-panel-head h3 {
  color: #4b407d;
  text-shadow: 0 1px 0 rgba(255,255,255,0.86);
}

html:not(.theme-dark) .sub-text,
html:not(.theme-dark) .helper-text,
html:not(.theme-dark) .status-text,
html:not(.theme-dark) #totalInfo,
html:not(.theme-dark) .game-item p,
html:not(.theme-dark) .popup-message,
html:not(.theme-dark) .race-track-stage-desc,
html:not(.theme-dark) .game-board-head span,
html:not(.theme-dark) .orientation-lock-card p {
  color: var(--day-ink-soft) !important;
}

html:not(.theme-dark) .small-badge,
html:not(.theme-dark) .game-mini-badge,
html:not(.theme-dark) .battle-deck-label,
html:not(.theme-dark) .legend-chip,
html:not(.theme-dark) .race-ranking-item,
html:not(.theme-dark) .battle-ranking-item,
html:not(.theme-dark) .battle-ranking-empty,
html:not(.theme-dark) .sim-empty-state,
html:not(.theme-dark) .naval-log-item,
html:not(.theme-dark) .naval-ranking-item,
html:not(.theme-dark) .naval-player-chip,
html:not(.theme-dark) .naval-elimination-item {
  background: linear-gradient(180deg, #ffffff 0%, #fff3d0 100%);
  color: #5c4778;
  border-color: rgba(255, 216, 77, 0.48);
  box-shadow: 0 8px 18px rgba(90, 67, 44, 0.08);
}

html:not(.theme-dark) .small-badge::first-letter {
  color: var(--day-accent);
}

html:not(.theme-dark) .main-btn,
html:not(.theme-dark) .action-btn.primary {
  background: linear-gradient(135deg, #ff5f9f 0%, #ff8f70 100%);
  color: #fffdf8;
  border: 2px solid rgba(255,255,255,0.92);
  box-shadow: 0 12px 24px rgba(255, 95, 159, 0.28);
  text-shadow: 0 1px 1px rgba(92, 35, 65, 0.22);
}

html:not(.theme-dark) .action-btn.secondary,
html:not(.theme-dark) .drawer-toggle-btn,
html:not(.theme-dark) .menu-btn.luck {
  background: linear-gradient(135deg, #74cbff 0%, #58d7b5 100%);
  color: #183f4b;
  border: 2px solid rgba(255,255,255,0.88);
}

html:not(.theme-dark) .action-btn.soft,
html:not(.theme-dark) .popup-btn,
html:not(.theme-dark) .menu-btn.physical {
  background: linear-gradient(135deg, #ffd84d 0%, #ffb36b 100%);
  color: #49351d;
  border: 2px solid rgba(255,255,255,0.9);
}

html:not(.theme-dark) .back-btn,
html:not(.theme-dark) .sim-info-btn,
html:not(.theme-dark) .sim-arena-zoom-btn,
html:not(.theme-dark) .utility-btn,
html:not(.theme-dark) .utility-volume-panel {
  background: rgba(255, 255, 251, 0.94);
  color: #4b407d;
  border: 2px solid rgba(112, 199, 255, 0.38);
  box-shadow: 0 12px 24px rgba(90, 67, 44, 0.12);
}

html:not(.theme-dark) .game-item,
html:not(.theme-dark) .game-item.game-launch,
html:not(.theme-dark) .physical-game-item {
  background:
    radial-gradient(circle at 16% 12%, rgba(255,255,255,0.86), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #fff5de 100%);
  color: var(--day-ink);
  border: 2px solid rgba(255, 216, 77, 0.42);
  box-shadow: 0 12px 22px rgba(90, 67, 44, 0.10);
}

html:not(.theme-dark) .game-item:nth-child(2),
html:not(.theme-dark) .physical-game-item:nth-child(2) {
  background: linear-gradient(180deg, #ffffff 0%, #e4f8ff 100%);
  border-color: rgba(111, 199, 255, 0.48);
}

html:not(.theme-dark) .game-item:nth-child(3),
html:not(.theme-dark) .physical-game-item:nth-child(3) {
  background: linear-gradient(180deg, #ffffff 0%, #f0eaff 100%);
  border-color: rgba(169, 140, 255, 0.42);
}

html:not(.theme-dark) .game-item:nth-child(4),
html:not(.theme-dark) .physical-game-item:nth-child(4) {
  background: linear-gradient(180deg, #ffffff 0%, #e9fff7 100%);
  border-color: rgba(88, 215, 181, 0.42);
}

html:not(.theme-dark) .game-item:nth-child(5),
html:not(.theme-dark) .physical-game-item:nth-child(5) {
  background: linear-gradient(180deg, #ffffff 0%, #ffeaf3 100%);
  border-color: rgba(255, 111, 168, 0.42);
}

html:not(.theme-dark) .game-item:nth-child(6) {
  background: linear-gradient(180deg, #ffffff 0%, #fff1df 100%);
  border-color: rgba(255, 154, 122, 0.42);
}

html:not(.theme-dark) .game-item:nth-child(7) {
  background: linear-gradient(180deg, #ffffff 0%, #eef9ff 100%);
  border-color: rgba(111, 199, 255, 0.42);
}

html:not(.theme-dark) .game-item:nth-child(8) {
  background: linear-gradient(180deg, #ffffff 0%, #fff7c6 100%);
  border-color: rgba(255, 216, 77, 0.58);
}

html:not(.theme-dark) .game-num,
html:not(.theme-dark) .battle-rank-num {
  background: linear-gradient(135deg, #ff6fa8 0%, #ffd84d 100%);
  color: #fffdf7;
  box-shadow: 0 8px 16px rgba(255, 111, 168, 0.24);
  text-shadow: 0 1px 1px rgba(84, 42, 61, 0.22);
}

html:not(.theme-dark) .game-meta-row {
  background: rgba(255,255,255,0.84);
  border-color: rgba(255, 216, 77, 0.32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.82), 0 7px 14px rgba(90, 67, 44, 0.06);
}

html:not(.theme-dark) .game-meta-label {
  color: #7254a7;
}

html:not(.theme-dark) .game-meta-value,
html:not(.theme-dark) .slot-name,
html:not(.theme-dark) .slot-meta,
html:not(.theme-dark) .horse-name,
html:not(.theme-dark) .battle-player-name,
html:not(.theme-dark) .sim-player-name,
html:not(.theme-dark) .battle-rank-name {
  color: var(--day-ink);
}

html:not(.theme-dark) .input-card input,
html:not(.theme-dark) input:disabled {
  background: #fffef8;
  color: var(--day-ink);
  border-color: rgba(112, 199, 255, 0.44);
}

html:not(.theme-dark) .input-card input:focus {
  border-color: rgba(255, 111, 168, 0.72);
  box-shadow: 0 0 0 5px rgba(255, 111, 168, 0.16);
}

html:not(.theme-dark) .game-canvas-wrap,
html:not(.theme-dark) .race-track-wrap,
html:not(.theme-dark) .sim-arena-wrap,
html:not(.theme-dark) .sim-arena-zoom-stage,
html:not(.theme-dark) .naval-board-wrap {
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.86), transparent 28%),
    linear-gradient(180deg, #fffdf1 0%, #e6f7ff 100%);
  border-color: rgba(255,255,255,0.88);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.55), 0 16px 28px rgba(90, 67, 44, 0.10);
}

html:not(.theme-dark) .race-lane {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.30) 0 28px, rgba(255,255,255,0.12) 28px 56px),
    linear-gradient(180deg, #ffd995 0%, #ffba75 100%);
  border-color: rgba(255,255,255,0.68);
}

html:not(.theme-dark) .race-lane-label {
  background: rgba(255,255,251,0.94);
  color: #4b407d;
}

html:not(.theme-dark) .popup-overlay {
  background: rgba(65, 49, 38, 0.26);
}

html:not(.theme-dark) .volume-control-value {
  color: var(--day-ink-soft);
}

html:not(.theme-dark) .volume-range::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, rgba(255, 111, 168, 0.94) 0%, rgba(255, 111, 168, 0.94) var(--volume-progress, 50%), rgba(189, 234, 255, 0.88) var(--volume-progress, 50%), rgba(189, 234, 255, 0.88) 100%);
  border-color: rgba(255,255,255,0.72);
}

html:not(.theme-dark) .volume-range::-moz-range-track {
  background: rgba(189, 234, 255, 0.88);
  border-color: rgba(255,255,255,0.72);
}

html:not(.theme-dark) .volume-range::-moz-range-progress {
  background: rgba(255, 111, 168, 0.94);
}

html:not(.theme-dark) .volume-range::-webkit-slider-thumb,
html:not(.theme-dark) .volume-range::-moz-range-thumb {
  background: #fffef8;
  border-color: rgba(255, 111, 168, 0.88);
}

html.theme-dark {
  color-scheme: dark;
  --bg: var(--night-dominant);
  --bg2: #030713;
  --card: rgba(12, 24, 46, 0.92);
  --card-strong: rgba(15, 30, 57, 0.96);
  --brown: var(--night-ink);
  --soft-brown: #cfe8ff;
  --pink: var(--night-accent);
  --mint: var(--night-mint);
  --sky: var(--night-accent-2);
  --lavender: #9f8cff;
  --yellow: var(--night-spark);
  --peach: #ffad75;
  --shadow: 0 18px 38px rgba(0, 0, 0, 0.45);
  --night-surface-1: #081225;
  --night-surface-2: #0e1a33;
  --night-surface-3: #173b6d;
  --night-surface-4: #1f4d88;
  --night-border: rgba(139, 211, 255, 0.25);
  --night-border-strong: rgba(139, 211, 255, 0.52);
  --night-text: var(--night-ink);
  --night-text-2: var(--night-ink-soft);
  --night-text-3: #9eb2d3;
  --night-muted-chip: #122849;
}

html.theme-dark body {
  color: var(--night-ink);
  background:
    radial-gradient(circle at 14% 8%, rgba(255, 217, 102, 0.22) 0 4%, transparent 18%),
    radial-gradient(circle at 78% 18%, rgba(139, 211, 255, 0.20) 0 13%, transparent 34%),
    radial-gradient(circle at 18% 84%, rgba(255, 111, 177, 0.16) 0 9%, transparent 28%),
    linear-gradient(145deg, #081225 0%, #0e1a33 58%, #030713 100%);
}

html.theme-dark body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.72) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(255,217,102,0.72) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(139,211,255,0.64) 0 1px, transparent 1.6px);
  background-size: 88px 88px, 132px 132px, 170px 170px;
  background-position: 12px 18px, 64px 44px, 22px 86px;
  opacity: 0.42;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.76), rgba(0,0,0,0.24) 78%, transparent);
}

html.theme-dark .background-deco {
  opacity: 0.18;
  filter: blur(12px) saturate(1.2);
}

html.theme-dark .card,
html.theme-dark .controls-wrap,
html.theme-dark .scoreboard-card,
html.theme-dark .game-board-card,
html.theme-dark .race-panel,
html.theme-dark .battle-table-card,
html.theme-dark .battle-panel,
html.theme-dark .sim-setup-card,
html.theme-dark .sim-arena-card,
html.theme-dark .sim-battle-summary-card,
html.theme-dark .naval-board-card,
html.theme-dark .popup,
html.theme-dark .orientation-lock-card,
html.theme-dark .game-sidebar,
html.theme-dark .race-sidebar,
html.theme-dark .battle-sidebar,
html.theme-dark .sim-sidebar,
html.theme-dark .naval-sidebar {
  background:
    radial-gradient(circle at top left, rgba(139,211,255,0.12), transparent 42%),
    linear-gradient(180deg, rgba(12, 24, 46, 0.97) 0%, rgba(7, 14, 29, 0.95) 100%);
  color: var(--night-ink);
  border-color: var(--night-line);
  box-shadow:
    0 18px 38px rgba(0,0,0,0.48),
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 0 0 1px rgba(139,211,255,0.05);
}

html.theme-dark .main-card h1,
html.theme-dark .menu-card h2,
html.theme-dark .luck-card h2,
html.theme-dark .physical-card h2,
html.theme-dark .game-card h2,
html.theme-dark .popup h3,
html.theme-dark .sidebar-title,
html.theme-dark .scoreboard-head h3,
html.theme-dark .game-board-head h3,
html.theme-dark .race-track-stage-title,
html.theme-dark .battle-panel-head h3 {
  color: #cfe8ff;
  text-shadow: 0 0 16px rgba(139, 211, 255, 0.18);
}

html.theme-dark .sub-text,
html.theme-dark .helper-text,
html.theme-dark .status-text,
html.theme-dark #totalInfo,
html.theme-dark .game-item p,
html.theme-dark .popup-message,
html.theme-dark .horse-status,
html.theme-dark .battle-rank-formula,
html.theme-dark .battle-player-sub,
html.theme-dark .sim-player-sub,
html.theme-dark .game-board-head span,
html.theme-dark .orientation-lock-card p,
html.theme-dark .race-track-stage-desc,
html.theme-dark .race-ranking-item div {
  color: var(--night-ink-soft) !important;
}

html.theme-dark .small-badge,
html.theme-dark .game-mini-badge,
html.theme-dark .battle-deck-label,
html.theme-dark .legend-chip,
html.theme-dark .race-ranking-item,
html.theme-dark .battle-ranking-item,
html.theme-dark .battle-ranking-empty,
html.theme-dark .sim-empty-state,
html.theme-dark .naval-log-item,
html.theme-dark .naval-ranking-item,
html.theme-dark .naval-player-chip,
html.theme-dark .naval-elimination-item {
  background: linear-gradient(180deg, rgba(23, 59, 109, 0.88) 0%, rgba(12, 28, 54, 0.96) 100%);
  color: var(--night-ink);
  border-color: rgba(139, 211, 255, 0.24);
  box-shadow: 0 10px 20px rgba(0,0,0,0.30), inset 0 1px 0 rgba(255,255,255,0.04);
}

html.theme-dark .main-btn,
html.theme-dark .action-btn.primary {
  background: linear-gradient(135deg, #ff6fb1 0%, #8bd3ff 100%);
  color: #061020;
  border: 2px solid rgba(255,255,255,0.26);
  box-shadow: 0 0 0 1px rgba(255,111,177,0.22), 0 14px 28px rgba(255,111,177,0.22);
  text-shadow: none;
}

html.theme-dark .action-btn.secondary,
html.theme-dark .drawer-toggle-btn,
html.theme-dark .menu-btn.luck {
  background: linear-gradient(135deg, #173b6d 0%, #1f4d88 100%);
  color: #f3f9ff;
  border-color: rgba(139,211,255,0.36);
}

html.theme-dark .action-btn.soft,
html.theme-dark .popup-btn,
html.theme-dark .menu-btn.physical {
  background: linear-gradient(135deg, #ffd966 0%, #ffad75 100%);
  color: #17110b;
  border-color: rgba(255,255,255,0.24);
}

html.theme-dark .back-btn,
html.theme-dark .sim-info-btn,
html.theme-dark .sim-arena-zoom-btn,
html.theme-dark .utility-btn,
html.theme-dark .utility-volume-panel {
  background: rgba(10, 24, 48, 0.94);
  color: #f6fbff;
  border-color: rgba(139, 211, 255, 0.32);
  box-shadow: 0 14px 28px rgba(0,0,0,0.42);
}

html.theme-dark .game-item,
html.theme-dark .game-item.game-launch,
html.theme-dark .physical-game-item,
html.theme-dark .menu-btn.physical,
html.theme-dark .menu-btn.luck {
  background:
    radial-gradient(circle at top left, rgba(139,211,255,0.14), transparent 40%),
    linear-gradient(180deg, rgba(15, 35, 66, 0.98) 0%, rgba(8, 18, 37, 0.98) 100%);
  color: var(--night-ink);
  border: 2px solid rgba(139, 211, 255, 0.24);
  box-shadow: 0 15px 30px rgba(0,0,0,0.42);
}

html.theme-dark .game-item:nth-child(2),
html.theme-dark .game-item:nth-child(3),
html.theme-dark .game-item:nth-child(4),
html.theme-dark .game-item:nth-child(5),
html.theme-dark .game-item:nth-child(6),
html.theme-dark .game-item:nth-child(7),
html.theme-dark .game-item:nth-child(8),
html.theme-dark .physical-game-item:nth-child(2),
html.theme-dark .physical-game-item:nth-child(3),
html.theme-dark .physical-game-item:nth-child(4),
html.theme-dark .physical-game-item:nth-child(5) {
  background:
    radial-gradient(circle at top left, rgba(255,111,177,0.10), transparent 36%),
    linear-gradient(180deg, rgba(17, 39, 74, 0.98) 0%, rgba(8, 18, 37, 0.98) 100%);
  border-color: rgba(139, 211, 255, 0.24);
}

html.theme-dark .game-num,
html.theme-dark .battle-rank-num {
  background: linear-gradient(135deg, #ff6fb1 0%, #ffd966 100%);
  color: #061020;
  box-shadow: 0 0 18px rgba(255, 111, 177, 0.22);
  text-shadow: none;
}

html.theme-dark .game-meta-row {
  background: rgba(6, 16, 32, 0.74);
  border-color: rgba(139, 211, 255, 0.20);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 16px rgba(0,0,0,0.24);
}

html.theme-dark .game-meta-label {
  color: #8bd3ff;
}

html.theme-dark .game-meta-value,
html.theme-dark .slot-name,
html.theme-dark .slot-meta,
html.theme-dark .horse-name,
html.theme-dark .battle-player-name,
html.theme-dark .sim-player-name,
html.theme-dark .battle-rank-name,
html.theme-dark .race-lane-label {
  color: var(--night-ink);
}

html.theme-dark .input-card input,
html.theme-dark input:disabled {
  background: rgba(3, 8, 18, 0.88);
  color: var(--night-ink);
  border-color: rgba(139, 211, 255, 0.26);
}

html.theme-dark .input-card input:focus {
  border-color: rgba(255, 111, 177, 0.74);
  box-shadow: 0 0 0 5px rgba(255, 111, 177, 0.15);
}

html.theme-dark .game-canvas-wrap,
html.theme-dark .race-track-wrap,
html.theme-dark .sim-arena-wrap,
html.theme-dark .sim-arena-zoom-stage,
html.theme-dark .naval-board-wrap,
html.theme-dark .battle-table-card {
  background:
    radial-gradient(circle at top left, rgba(139,211,255,0.10), transparent 28%),
    linear-gradient(180deg, #0b1c37 0%, #061020 100%);
  border-color: rgba(139, 211, 255, 0.24);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 18px 30px rgba(0,0,0,0.42);
}

html.theme-dark .race-lane {
  background:
    repeating-linear-gradient(90deg, rgba(139,211,255,0.09) 0 28px, rgba(255,255,255,0.025) 28px 56px),
    linear-gradient(180deg, #183b6d 0%, #0e1a33 100%);
  border-color: rgba(139,211,255,0.20);
}

html.theme-dark .race-lane-label {
  background: rgba(6, 16, 32, 0.86);
  color: var(--night-ink);
}

html.theme-dark .popup-overlay {
  background: rgba(0, 4, 12, 0.72);
}

html.theme-dark .volume-control-value {
  color: rgba(201, 216, 239, 0.86);
}

html.theme-dark .volume-range::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, rgba(255, 111, 177, 0.96) 0%, rgba(255, 111, 177, 0.96) var(--volume-progress, 50%), rgba(139, 211, 255, 0.20) var(--volume-progress, 50%), rgba(139, 211, 255, 0.20) 100%);
  border-color: rgba(139, 211, 255, 0.18);
}

html.theme-dark .volume-range::-moz-range-track {
  background: rgba(139, 211, 255, 0.20);
  border-color: rgba(139, 211, 255, 0.18);
}

html.theme-dark .volume-range::-moz-range-progress {
  background: rgba(255, 111, 177, 0.96);
}

html.theme-dark .volume-range::-webkit-slider-thumb,
html.theme-dark .volume-range::-moz-range-thumb {
  background: #061020;
  border-color: rgba(255, 111, 177, 0.92);
}

html:not(.theme-dark) .action-btn:disabled,
html:not(.theme-dark) .action-btn.is-game-running,
html:not(.theme-dark) .main-btn:disabled,
html:not(.theme-dark) .main-btn.is-game-running,
html:not(.theme-dark) .game-item:disabled,
html:not(.theme-dark) .game-item.is-game-running,
html.theme-dark .action-btn:disabled,
html.theme-dark .action-btn.is-game-running,
html.theme-dark .main-btn:disabled,
html.theme-dark .main-btn.is-game-running,
html.theme-dark .game-item:disabled,
html.theme-dark .game-item.is-game-running {
  opacity: 0.62;
  cursor: not-allowed;
  transform: none !important;
  filter: saturate(0.74) brightness(0.96);
}

html:not(.theme-dark) .action-btn:focus-visible,
html:not(.theme-dark) .main-btn:focus-visible,
html:not(.theme-dark) .back-btn:focus-visible,
html:not(.theme-dark) .game-item:focus-visible,
html:not(.theme-dark) .menu-btn:focus-visible {
  outline: 4px solid rgba(255, 111, 168, 0.36);
  outline-offset: 4px;
}

html.theme-dark .action-btn:focus-visible,
html.theme-dark .main-btn:focus-visible,
html.theme-dark .back-btn:focus-visible,
html.theme-dark .game-item:focus-visible,
html.theme-dark .menu-btn:focus-visible {
  outline: 4px solid rgba(139, 211, 255, 0.32);
  outline-offset: 4px;
}

html:not(.theme-dark) .slot-legend::-webkit-scrollbar-thumb,
html:not(.theme-dark) .race-ranking-list::-webkit-scrollbar-thumb,
html:not(.theme-dark) .race-track-lanes::-webkit-scrollbar-thumb {
  background: rgba(255, 111, 168, 0.38);
}

html.theme-dark .slot-legend::-webkit-scrollbar-thumb,
html.theme-dark .race-ranking-list::-webkit-scrollbar-thumb,
html.theme-dark .race-track-lanes::-webkit-scrollbar-thumb {
  background: rgba(139, 211, 255, 0.35);
}

/* =========================================================
   FINAL VISIBILITY THEME PASS
   낮: 푸른 하늘 + 파스텔 / 밤: 어두운 밤 + 네온 사인
   비율 원칙: dominant 61.8 / surface 23.6 / accent 9 / point 5.6
   기능 레이아웃은 건드리지 않고 색상·가독성만 재정리.
========================================================= */

html:not(.theme-dark) {
  color-scheme: light;
  --sky-day-main: #9fd7ff;
  --sky-day-deep: #64b8f3;
  --sky-day-cloud: #f8fcff;
  --sky-day-cream: #fff6dc;
  --sky-day-surface: rgba(255, 253, 247, 0.92);
  --sky-day-surface-solid: #fffdf7;
  --sky-day-surface-2: #edf8ff;
  --sky-day-line: rgba(58, 133, 184, 0.24);
  --sky-day-line-strong: rgba(44, 121, 179, 0.42);
  --sky-day-text: #24384a;
  --sky-day-text-2: #4f6373;
  --sky-day-text-3: #6c7b88;
  --sky-day-accent: #ff6f9f;
  --sky-day-accent-2: #ff9f7a;
  --sky-day-point: #ffd166;
  --sky-day-mint: #69d9ba;
  --sky-day-lavender: #b9a7ff;
  --sky-day-shadow: 0 18px 34px rgba(53, 119, 166, 0.16);

  --bg: var(--sky-day-main) !important;
  --bg2: #dff4ff !important;
  --card: var(--sky-day-surface) !important;
  --card-strong: rgba(255, 255, 252, 0.96) !important;
  --brown: var(--sky-day-text) !important;
  --soft-brown: #2e5f86 !important;
  --pink: var(--sky-day-accent) !important;
  --mint: var(--sky-day-mint) !important;
  --sky: #bfe8ff !important;
  --lavender: var(--sky-day-lavender) !important;
  --yellow: var(--sky-day-point) !important;
  --peach: #ffbd94 !important;
  --shadow: var(--sky-day-shadow) !important;
}

html:not(.theme-dark) body {
  color: var(--sky-day-text) !important;
  background:
    radial-gradient(circle at 12% 9%, rgba(255, 255, 255, 0.92) 0 5%, transparent 18%),
    radial-gradient(circle at 78% 13%, rgba(255, 255, 255, 0.72) 0 9%, transparent 25%),
    radial-gradient(circle at 18% 82%, rgba(255, 209, 102, 0.24) 0 11%, transparent 27%),
    linear-gradient(180deg, #86ccff 0%, #bfe8ff 42%, #fff4d6 100%) !important;
}

html:not(.theme-dark) body::before {
  content: '' !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 0 !important;
  pointer-events: none !important;
  background:
    radial-gradient(ellipse at 18% 24%, rgba(255,255,255,0.72) 0 8%, transparent 19%),
    radial-gradient(ellipse at 31% 20%, rgba(255,255,255,0.56) 0 7%, transparent 18%),
    radial-gradient(ellipse at 84% 34%, rgba(255,255,255,0.58) 0 8%, transparent 20%),
    linear-gradient(180deg, rgba(255,255,255,0.0), rgba(255,255,255,0.18)) !important;
  opacity: 0.9 !important;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.92), rgba(0,0,0,0.48) 72%, transparent 100%) !important;
}

html:not(.theme-dark) body::after {
  content: '' !important;
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  height: 38vh !important;
  z-index: 0 !important;
  pointer-events: none !important;
  background:
    linear-gradient(180deg, transparent 0%, rgba(255, 246, 220, 0.36) 100%) !important;
}

html.theme-dark {
  color-scheme: dark;
  --night-main: #050b16;
  --night-deep: #020612;
  --night-surface: rgba(10, 20, 36, 0.92);
  --night-surface-solid: #0b172a;
  --night-surface-2: #102542;
  --night-surface-3: #17375e;
  --night-line: rgba(105, 216, 255, 0.26);
  --night-line-strong: rgba(105, 216, 255, 0.46);
  --night-text: #edf8ff;
  --night-text-2: #b9cce0;
  --night-text-3: #8fa7bd;
  --night-neon-cyan: #69d8ff;
  --night-neon-blue: #4d8dff;
  --night-neon-pink: #ff5fa2;
  --night-neon-purple: #b58cff;
  --night-neon-yellow: #ffe66d;
  --night-shadow: 0 20px 42px rgba(0, 0, 0, 0.52);

  --bg: var(--night-main) !important;
  --bg2: var(--night-deep) !important;
  --card: var(--night-surface) !important;
  --card-strong: rgba(14, 28, 50, 0.97) !important;
  --brown: var(--night-text) !important;
  --soft-brown: #d7efff !important;
  --pink: var(--night-neon-pink) !important;
  --mint: #63e6be !important;
  --sky: var(--night-neon-cyan) !important;
  --lavender: var(--night-neon-purple) !important;
  --yellow: var(--night-neon-yellow) !important;
  --peach: #ffad75 !important;
  --shadow: var(--night-shadow) !important;
}

html.theme-dark body {
  color: var(--night-text) !important;
  background:
    radial-gradient(circle at 16% 10%, rgba(255, 230, 109, 0.16) 0 4%, transparent 15%),
    radial-gradient(circle at 76% 18%, rgba(105, 216, 255, 0.18) 0 10%, transparent 31%),
    radial-gradient(circle at 18% 82%, rgba(255, 95, 162, 0.13) 0 10%, transparent 28%),
    linear-gradient(180deg, #071326 0%, #050b16 54%, #020612 100%) !important;
}

html.theme-dark body::before {
  content: '' !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 0 !important;
  pointer-events: none !important;
  background-image:
    radial-gradient(circle, rgba(237,248,255,0.76) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(105,216,255,0.62) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255,230,109,0.50) 0 1px, transparent 1.5px),
    linear-gradient(90deg, transparent 0 48%, rgba(105,216,255,0.12) 49%, transparent 51%);
  background-size: 92px 92px, 142px 142px, 188px 188px, 100% 100%;
  background-position: 12px 18px, 64px 44px, 22px 86px, center;
  opacity: 0.48 !important;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.86), rgba(0,0,0,0.42) 76%, transparent 100%) !important;
}

html.theme-dark body::after {
  content: '' !important;
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  height: 44vh !important;
  z-index: 0 !important;
  pointer-events: none !important;
  background:
    linear-gradient(90deg, transparent 0 5%, rgba(105,216,255,0.20) 5% 5.4%, transparent 5.4% 13%, rgba(255,95,162,0.20) 13% 13.45%, transparent 13.45% 24%, rgba(255,230,109,0.16) 24% 24.38%, transparent 24.38%),
    linear-gradient(180deg, transparent 0%, rgba(105,216,255,0.06) 54%, rgba(255,95,162,0.08) 100%) !important;
  opacity: 0.82 !important;
}

html:not(.theme-dark) .background-deco.deco1 { background: #ffffff !important; opacity: 0.42 !important; filter: blur(8px) !important; }
html:not(.theme-dark) .background-deco.deco2 { background: #bfe8ff !important; opacity: 0.52 !important; filter: blur(10px) !important; }
html:not(.theme-dark) .background-deco.deco3 { background: #fff2bf !important; opacity: 0.54 !important; filter: blur(12px) !important; }
html:not(.theme-dark) .background-deco.deco4 { background: #ffd6e6 !important; opacity: 0.50 !important; filter: blur(10px) !important; }

html.theme-dark .background-deco.deco1 { background: var(--night-neon-cyan) !important; opacity: 0.16 !important; filter: blur(16px) !important; }
html.theme-dark .background-deco.deco2 { background: var(--night-neon-pink) !important; opacity: 0.14 !important; filter: blur(18px) !important; }
html.theme-dark .background-deco.deco3 { background: var(--night-neon-purple) !important; opacity: 0.15 !important; filter: blur(18px) !important; }
html.theme-dark .background-deco.deco4 { background: var(--night-neon-yellow) !important; opacity: 0.11 !important; filter: blur(18px) !important; }

html:not(.theme-dark) .card,
html:not(.theme-dark) .controls-wrap,
html:not(.theme-dark) .scoreboard-card,
html:not(.theme-dark) .game-board-card,
html:not(.theme-dark) .race-panel,
html:not(.theme-dark) .battle-table-card,
html:not(.theme-dark) .battle-panel,
html:not(.theme-dark) .sim-setup-card,
html:not(.theme-dark) .sim-arena-card,
html:not(.theme-dark) .sim-battle-summary-card,
html:not(.theme-dark) .naval-board-card,
html:not(.theme-dark) .stock-portfolio-card,
html:not(.theme-dark) .bear-find-stage-card,
html:not(.theme-dark) .balloon-stage-card,
html:not(.theme-dark) .bomb-pass-stage-card,
html:not(.theme-dark) .circle-tap-stage-card,
html:not(.theme-dark) .key-react-stage-card,
html:not(.theme-dark) .ladder-stage-card,
html:not(.theme-dark) .roulette-stage-card,
html:not(.theme-dark) .popup,
html:not(.theme-dark) .orientation-lock-card,
html:not(.theme-dark) .game-sidebar,
html:not(.theme-dark) .race-sidebar,
html:not(.theme-dark) .battle-sidebar,
html:not(.theme-dark) .sim-sidebar,
html:not(.theme-dark) .naval-sidebar,
html:not(.theme-dark) .balloon-sidebar,
html:not(.theme-dark) .circle-tap-sidebar,
html:not(.theme-dark) .key-react-sidebar,
html:not(.theme-dark) .bear-find-sidebar {
  background:
    radial-gradient(circle at 15% 0%, rgba(255,255,255,0.88), transparent 32%),
    linear-gradient(180deg, rgba(255,255,252,0.96) 0%, rgba(246,251,255,0.91) 100%) !important;
  color: var(--sky-day-text) !important;
  border: 2px solid rgba(255,255,255,0.82) !important;
  box-shadow: 0 16px 32px rgba(48, 111, 158, 0.15), inset 0 1px 0 rgba(255,255,255,0.85) !important;
}

html.theme-dark .card,
html.theme-dark .controls-wrap,
html.theme-dark .scoreboard-card,
html.theme-dark .game-board-card,
html.theme-dark .race-panel,
html.theme-dark .battle-table-card,
html.theme-dark .battle-panel,
html.theme-dark .sim-setup-card,
html.theme-dark .sim-arena-card,
html.theme-dark .sim-battle-summary-card,
html.theme-dark .naval-board-card,
html.theme-dark .stock-portfolio-card,
html.theme-dark .bear-find-stage-card,
html.theme-dark .balloon-stage-card,
html.theme-dark .bomb-pass-stage-card,
html.theme-dark .circle-tap-stage-card,
html.theme-dark .key-react-stage-card,
html.theme-dark .ladder-stage-card,
html.theme-dark .roulette-stage-card,
html.theme-dark .popup,
html.theme-dark .orientation-lock-card,
html.theme-dark .game-sidebar,
html.theme-dark .race-sidebar,
html.theme-dark .battle-sidebar,
html.theme-dark .sim-sidebar,
html.theme-dark .naval-sidebar,
html.theme-dark .balloon-sidebar,
html.theme-dark .circle-tap-sidebar,
html.theme-dark .key-react-sidebar,
html.theme-dark .bear-find-sidebar {
  background:
    radial-gradient(circle at 13% 0%, rgba(105,216,255,0.11), transparent 35%),
    linear-gradient(180deg, rgba(13, 27, 48, 0.96) 0%, rgba(6, 14, 28, 0.96) 100%) !important;
  color: var(--night-text) !important;
  border: 1px solid rgba(105,216,255,0.24) !important;
  box-shadow:
    0 22px 44px rgba(0,0,0,0.50),
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 0 0 1px rgba(105,216,255,0.05) !important;
}

html:not(.theme-dark) .card::before,
html:not(.theme-dark) .game-card::before,
html:not(.theme-dark) .main-card::before,
html:not(.theme-dark) .menu-card::before,
html:not(.theme-dark) .luck-card::before,
html:not(.theme-dark) .physical-card::before,
html:not(.theme-dark) #game1Screen .game-card-full::before {
  background:
    radial-gradient(circle, #ffffff 0 28%, transparent 30%) 0 50% / 18px 18px repeat-x,
    linear-gradient(90deg, transparent, #8fd3ff, #ffd166, #ff9fbe, transparent) !important;
  box-shadow: none !important;
  opacity: 0.86 !important;
}

html.theme-dark .card::before,
html.theme-dark .game-card::before,
html.theme-dark .main-card::before,
html.theme-dark .menu-card::before,
html.theme-dark .luck-card::before,
html.theme-dark .physical-card::before,
html.theme-dark #game1Screen .game-card-full::before {
  background:
    linear-gradient(90deg, transparent, rgba(105,216,255,0.0), rgba(105,216,255,0.95), rgba(255,95,162,0.74), rgba(255,230,109,0.48), transparent) !important;
  height: 4px !important;
  box-shadow: 0 0 12px rgba(105,216,255,0.42), 0 0 22px rgba(255,95,162,0.14) !important;
  opacity: 0.72 !important;
}

html:not(.theme-dark) .main-card h1,
html:not(.theme-dark) .menu-card h2,
html:not(.theme-dark) .luck-card h2,
html:not(.theme-dark) .physical-card h2,
html:not(.theme-dark) .game-card h2,
html:not(.theme-dark) .popup h3,
html:not(.theme-dark) .sidebar-title,
html:not(.theme-dark) .scoreboard-head h3,
html:not(.theme-dark) .game-board-head h3,
html:not(.theme-dark) .race-track-stage-title,
html:not(.theme-dark) .battle-panel-head h3,
html:not(.theme-dark) .game-item h3,
html:not(.theme-dark) .physical-game-item h3 {
  color: #255b83 !important;
  text-shadow: 0 1px 0 rgba(255,255,255,0.64) !important;
}

html.theme-dark .main-card h1,
html.theme-dark .menu-card h2,
html.theme-dark .luck-card h2,
html.theme-dark .physical-card h2,
html.theme-dark .game-card h2,
html.theme-dark .popup h3,
html.theme-dark .sidebar-title,
html.theme-dark .scoreboard-head h3,
html.theme-dark .game-board-head h3,
html.theme-dark .race-track-stage-title,
html.theme-dark .battle-panel-head h3,
html.theme-dark .game-item h3,
html.theme-dark .physical-game-item h3 {
  color: #eaf8ff !important;
  text-shadow: 0 0 10px rgba(105,216,255,0.20) !important;
}

html:not(.theme-dark) .sub-text,
html:not(.theme-dark) .helper-text,
html:not(.theme-dark) .status-text,
html:not(.theme-dark) #totalInfo,
html:not(.theme-dark) .game-item p,
html:not(.theme-dark) .popup-message,
html:not(.theme-dark) .horse-status,
html:not(.theme-dark) .battle-rank-formula,
html:not(.theme-dark) .battle-player-sub,
html:not(.theme-dark) .sim-player-sub,
html:not(.theme-dark) .game-board-head span,
html:not(.theme-dark) .orientation-lock-card p,
html:not(.theme-dark) .race-track-stage-desc,
html:not(.theme-dark) .race-ranking-item div,
html:not(.theme-dark) .bomb-pass-status-text,
html:not(.theme-dark) .bomb-pass-device-text,
html:not(.theme-dark) .balloon-stage-hint,
html:not(.theme-dark) .circle-tap-stage-hint,
html:not(.theme-dark) .bear-find-stage-hint {
  color: var(--sky-day-text-2) !important;
}

html.theme-dark .sub-text,
html.theme-dark .helper-text,
html.theme-dark .status-text,
html.theme-dark #totalInfo,
html.theme-dark .game-item p,
html.theme-dark .popup-message,
html.theme-dark .horse-status,
html.theme-dark .battle-rank-formula,
html.theme-dark .battle-player-sub,
html.theme-dark .sim-player-sub,
html.theme-dark .game-board-head span,
html.theme-dark .orientation-lock-card p,
html.theme-dark .race-track-stage-desc,
html.theme-dark .race-ranking-item div,
html.theme-dark .bomb-pass-status-text,
html.theme-dark .bomb-pass-device-text,
html.theme-dark .balloon-stage-hint,
html.theme-dark .circle-tap-stage-hint,
html.theme-dark .bear-find-stage-hint {
  color: var(--night-text-2) !important;
}

html:not(.theme-dark) .small-badge,
html:not(.theme-dark) .game-mini-badge,
html:not(.theme-dark) .physical-compat-badge,
html:not(.theme-dark) .game-ff-badge,
html:not(.theme-dark) .battle-deck-label,
html:not(.theme-dark) .sim-phase-badge,
html:not(.theme-dark) .naval-phase-badge,
html:not(.theme-dark) .stock-ready-badge,
html:not(.theme-dark) .legend-chip,
html:not(.theme-dark) .race-ranking-item,
html:not(.theme-dark) .battle-ranking-item,
html:not(.theme-dark) .battle-ranking-empty,
html:not(.theme-dark) .sim-empty-state,
html:not(.theme-dark) .naval-log-item,
html:not(.theme-dark) .naval-ranking-item,
html:not(.theme-dark) .naval-player-chip,
html:not(.theme-dark) .naval-elimination-item {
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(235,248,255,0.92) 100%) !important;
  color: var(--sky-day-text) !important;
  border-color: rgba(94, 174, 229, 0.30) !important;
  box-shadow: 0 8px 16px rgba(53,119,166,0.10) !important;
}

html.theme-dark .small-badge,
html.theme-dark .game-mini-badge,
html.theme-dark .physical-compat-badge,
html.theme-dark .game-ff-badge,
html.theme-dark .battle-deck-label,
html.theme-dark .sim-phase-badge,
html.theme-dark .naval-phase-badge,
html.theme-dark .stock-ready-badge,
html.theme-dark .legend-chip,
html.theme-dark .race-ranking-item,
html.theme-dark .battle-ranking-item,
html.theme-dark .battle-ranking-empty,
html.theme-dark .sim-empty-state,
html.theme-dark .naval-log-item,
html.theme-dark .naval-ranking-item,
html.theme-dark .naval-player-chip,
html.theme-dark .naval-elimination-item {
  background: linear-gradient(180deg, rgba(18,45,76,0.94) 0%, rgba(9,20,38,0.96) 100%) !important;
  color: var(--night-text) !important;
  border-color: rgba(105,216,255,0.28) !important;
  box-shadow: 0 10px 20px rgba(0,0,0,0.34), 0 0 12px rgba(105,216,255,0.06) !important;
}

html:not(.theme-dark) .main-btn,
html:not(.theme-dark) .action-btn.primary {
  background: linear-gradient(135deg, #ff6f9f 0%, #ff9f7a 100%) !important;
  color: #ffffff !important;
  border: 2px solid rgba(255,255,255,0.90) !important;
  box-shadow: 0 12px 22px rgba(255,111,159,0.24), 0 2px 0 rgba(133,75,98,0.12) !important;
  text-shadow: 0 1px 1px rgba(75,40,58,0.22) !important;
}

html.theme-dark .main-btn,
html.theme-dark .action-btn.primary {
  background: linear-gradient(135deg, #ff5fa2 0%, #69d8ff 100%) !important;
  color: #06111f !important;
  border: 1px solid rgba(237,248,255,0.24) !important;
  box-shadow: 0 0 14px rgba(255,95,162,0.20), 0 0 24px rgba(105,216,255,0.14), 0 12px 28px rgba(0,0,0,0.34) !important;
  text-shadow: none !important;
}

html:not(.theme-dark) .action-btn.secondary,
html:not(.theme-dark) .drawer-toggle-btn,
html:not(.theme-dark) .menu-btn.luck {
  background: linear-gradient(135deg, #c9ecff 0%, #8ee6cd 100%) !important;
  color: #183f4b !important;
  border-color: rgba(255,255,255,0.90) !important;
}

html.theme-dark .action-btn.secondary,
html.theme-dark .drawer-toggle-btn,
html.theme-dark .menu-btn.luck {
  background: linear-gradient(135deg, #12345a 0%, #104866 100%) !important;
  color: #edf8ff !important;
  border-color: rgba(105,216,255,0.34) !important;
  box-shadow: 0 0 12px rgba(105,216,255,0.10), 0 12px 24px rgba(0,0,0,0.34) !important;
}

html:not(.theme-dark) .action-btn.soft,
html:not(.theme-dark) .popup-btn,
html:not(.theme-dark) .menu-btn.physical {
  background: linear-gradient(135deg, #ffdc7a 0%, #ffc19e 100%) !important;
  color: #4a3520 !important;
  border-color: rgba(255,255,255,0.92) !important;
}

html.theme-dark .action-btn.soft,
html.theme-dark .popup-btn,
html.theme-dark .menu-btn.physical {
  background: linear-gradient(135deg, #ffe66d 0%, #ffad75 100%) !important;
  color: #15100a !important;
  border-color: rgba(255,255,255,0.20) !important;
  box-shadow: 0 0 14px rgba(255,230,109,0.16), 0 12px 24px rgba(0,0,0,0.34) !important;
}

html:not(.theme-dark) .back-btn,
html:not(.theme-dark) .sim-info-btn,
html:not(.theme-dark) .sim-arena-zoom-btn,
html:not(.theme-dark) .utility-btn,
html:not(.theme-dark) .utility-volume-panel {
  background: rgba(255,255,255,0.94) !important;
  color: #255b83 !important;
  border: 2px solid rgba(100,184,243,0.30) !important;
  box-shadow: 0 10px 20px rgba(53,119,166,0.12) !important;
}

html.theme-dark .back-btn,
html.theme-dark .sim-info-btn,
html.theme-dark .sim-arena-zoom-btn,
html.theme-dark .utility-btn,
html.theme-dark .utility-volume-panel {
  background: rgba(7,18,34,0.94) !important;
  color: #edf8ff !important;
  border: 1px solid rgba(105,216,255,0.30) !important;
  box-shadow: 0 0 12px rgba(105,216,255,0.08), 0 12px 26px rgba(0,0,0,0.42) !important;
}

html:not(.theme-dark) .game-item,
html:not(.theme-dark) .game-item.game-launch,
html:not(.theme-dark) .physical-game-item,
html:not(.theme-dark) .menu-btn {
  background:
    radial-gradient(circle at 16% 10%, rgba(255,255,255,0.85), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #edf8ff 100%) !important;
  color: var(--sky-day-text) !important;
  border-color: rgba(94, 174, 229, 0.28) !important;
  box-shadow: 0 12px 22px rgba(53,119,166,0.13) !important;
}

html:not(.theme-dark) .game-item:nth-child(2),
html:not(.theme-dark) .physical-game-item:nth-child(2) { background: linear-gradient(180deg, #ffffff 0%, #e9fbff 100%) !important; }
html:not(.theme-dark) .game-item:nth-child(3),
html:not(.theme-dark) .physical-game-item:nth-child(3) { background: linear-gradient(180deg, #ffffff 0%, #f1edff 100%) !important; }
html:not(.theme-dark) .game-item:nth-child(4),
html:not(.theme-dark) .physical-game-item:nth-child(4) { background: linear-gradient(180deg, #ffffff 0%, #eafbf5 100%) !important; }
html:not(.theme-dark) .game-item:nth-child(5),
html:not(.theme-dark) .physical-game-item:nth-child(5) { background: linear-gradient(180deg, #ffffff 0%, #ffeaf3 100%) !important; }
html:not(.theme-dark) .game-item:nth-child(6) { background: linear-gradient(180deg, #ffffff 0%, #fff1e6 100%) !important; }
html:not(.theme-dark) .game-item:nth-child(7) { background: linear-gradient(180deg, #ffffff 0%, #eaf6ff 100%) !important; }
html:not(.theme-dark) .game-item:nth-child(8) { background: linear-gradient(180deg, #ffffff 0%, #fff7d6 100%) !important; }

html.theme-dark .game-item,
html.theme-dark .game-item.game-launch,
html.theme-dark .physical-game-item,
html.theme-dark .menu-btn {
  background:
    radial-gradient(circle at 14% 8%, rgba(105,216,255,0.12), transparent 37%),
    linear-gradient(180deg, #102542 0%, #081426 100%) !important;
  color: var(--night-text) !important;
  border-color: rgba(105,216,255,0.24) !important;
  box-shadow: 0 16px 30px rgba(0,0,0,0.42), 0 0 0 1px rgba(105,216,255,0.05) !important;
}

html.theme-dark .game-item:nth-child(2),
html.theme-dark .physical-game-item:nth-child(2) { background: linear-gradient(180deg, #123152 0%, #081426 100%) !important; }
html.theme-dark .game-item:nth-child(3),
html.theme-dark .physical-game-item:nth-child(3) { background: linear-gradient(180deg, #191f49 0%, #081426 100%) !important; }
html.theme-dark .game-item:nth-child(4),
html.theme-dark .physical-game-item:nth-child(4) { background: linear-gradient(180deg, #123b45 0%, #081426 100%) !important; }
html.theme-dark .game-item:nth-child(5),
html.theme-dark .physical-game-item:nth-child(5) { background: linear-gradient(180deg, #3a1834 0%, #081426 100%) !important; }
html.theme-dark .game-item:nth-child(6) { background: linear-gradient(180deg, #39251a 0%, #081426 100%) !important; }
html.theme-dark .game-item:nth-child(7) { background: linear-gradient(180deg, #102542 0%, #081426 100%) !important; }
html.theme-dark .game-item:nth-child(8) { background: linear-gradient(180deg, #303018 0%, #081426 100%) !important; }

html:not(.theme-dark) .game-num,
html:not(.theme-dark) .battle-rank-num {
  background: linear-gradient(135deg, #ff7eaa 0%, #ffd166 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 16px rgba(255,111,159,0.22) !important;
  text-shadow: 0 1px 1px rgba(70,40,55,0.20) !important;
}

html.theme-dark .game-num,
html.theme-dark .battle-rank-num {
  background: linear-gradient(135deg, #ff5fa2 0%, #69d8ff 100%) !important;
  color: #06111f !important;
  box-shadow: 0 0 14px rgba(105,216,255,0.20), 0 0 18px rgba(255,95,162,0.13) !important;
  text-shadow: none !important;
}

html:not(.theme-dark) .game-meta-row,
html:not(.theme-dark) .input-card input,
html:not(.theme-dark) .key-react-key-card,
html:not(.theme-dark) .battle-row,
html:not(.theme-dark) .battle-slot,
html:not(.theme-dark) .race-ranking-item,
html:not(.theme-dark) .battle-ranking-item,
html:not(.theme-dark) .stock-player-tab,
html:not(.theme-dark) .stock-allocation-row,
html:not(.theme-dark) .naval-log-item {
  background: rgba(255,255,255,0.88) !important;
  color: var(--sky-day-text) !important;
  border-color: rgba(94,174,229,0.24) !important;
}

html.theme-dark .game-meta-row,
html.theme-dark .input-card input,
html.theme-dark .key-react-key-card,
html.theme-dark .battle-row,
html.theme-dark .battle-slot,
html.theme-dark .race-ranking-item,
html.theme-dark .battle-ranking-item,
html.theme-dark .stock-player-tab,
html.theme-dark .stock-allocation-row,
html.theme-dark .naval-log-item {
  background: rgba(5,12,24,0.72) !important;
  color: var(--night-text) !important;
  border-color: rgba(105,216,255,0.18) !important;
}

html:not(.theme-dark) .game-meta-label,
html:not(.theme-dark) .input-card label {
  color: #2c6f9e !important;
}

html.theme-dark .game-meta-label,
html.theme-dark .input-card label {
  color: var(--night-neon-cyan) !important;
}

html:not(.theme-dark) .game-meta-value,
html:not(.theme-dark) .slot-name,
html:not(.theme-dark) .slot-meta,
html:not(.theme-dark) .horse-name,
html:not(.theme-dark) .battle-player-name,
html:not(.theme-dark) .sim-player-name,
html:not(.theme-dark) .battle-rank-name,
html:not(.theme-dark) .race-lane-label,
html:not(.theme-dark) .stock-player-name,
html:not(.theme-dark) .stock-summary-title {
  color: var(--sky-day-text) !important;
}

html.theme-dark .game-meta-value,
html.theme-dark .slot-name,
html.theme-dark .slot-meta,
html.theme-dark .horse-name,
html.theme-dark .battle-player-name,
html.theme-dark .sim-player-name,
html.theme-dark .battle-rank-name,
html.theme-dark .race-lane-label,
html.theme-dark .stock-player-name,
html.theme-dark .stock-summary-title {
  color: var(--night-text) !important;
}

html:not(.theme-dark) .game-canvas-wrap,
html:not(.theme-dark) .race-track-wrap,
html:not(.theme-dark) .sim-arena-wrap,
html:not(.theme-dark) .sim-arena-zoom-stage,
html:not(.theme-dark) .naval-board-wrap,
html:not(.theme-dark) .battle-table-card,
html:not(.theme-dark) .bear-find-stage-button,
html:not(.theme-dark) .bomb-pass-stage,
html:not(.theme-dark) .circle-tap-stage,
html:not(.theme-dark) .key-react-stage,
html:not(.theme-dark) .balloon-press-area {
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.86), transparent 28%),
    linear-gradient(180deg, #fffdf3 0%, #e8f7ff 100%) !important;
  border-color: rgba(255,255,255,0.88) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.56), 0 14px 26px rgba(53,119,166,0.13) !important;
}

html.theme-dark .game-canvas-wrap,
html.theme-dark .race-track-wrap,
html.theme-dark .sim-arena-wrap,
html.theme-dark .sim-arena-zoom-stage,
html.theme-dark .naval-board-wrap,
html.theme-dark .battle-table-card,
html.theme-dark .bear-find-stage-button,
html.theme-dark .bomb-pass-stage,
html.theme-dark .circle-tap-stage,
html.theme-dark .key-react-stage,
html.theme-dark .balloon-press-area {
  background:
    radial-gradient(circle at 20% 10%, rgba(105,216,255,0.10), transparent 28%),
    linear-gradient(180deg, #0c2038 0%, #050d1b 100%) !important;
  border-color: rgba(105,216,255,0.22) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.035), 0 18px 30px rgba(0,0,0,0.44), 0 0 18px rgba(105,216,255,0.04) !important;
}

html:not(.theme-dark) .race-lane {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.32) 0 28px, rgba(255,255,255,0.12) 28px 56px),
    linear-gradient(180deg, #ffdca0 0%, #ffbe7f 100%) !important;
  border-color: rgba(255,255,255,0.72) !important;
}

html.theme-dark .race-lane {
  background:
    repeating-linear-gradient(90deg, rgba(105,216,255,0.08) 0 28px, rgba(255,255,255,0.025) 28px 56px),
    linear-gradient(180deg, #17375e 0%, #081426 100%) !important;
  border-color: rgba(105,216,255,0.20) !important;
}

html:not(.theme-dark) .race-start-line { background: repeating-linear-gradient(180deg, #ffffff 0 8px, #ff7eaa 8px 16px) !important; }
html:not(.theme-dark) .race-finish-line { background: repeating-linear-gradient(180deg, #ffffff 0 8px, #34556f 8px 16px) !important; }
html.theme-dark .race-start-line { background: repeating-linear-gradient(180deg, #69d8ff 0 8px, #0b172a 8px 16px) !important; box-shadow: 0 0 10px rgba(105,216,255,0.22) !important; }
html.theme-dark .race-finish-line { background: repeating-linear-gradient(180deg, #edf8ff 0 8px, #ff5fa2 8px 16px) !important; box-shadow: 0 0 10px rgba(255,95,162,0.20) !important; }

html:not(.theme-dark) .popup-overlay { background: rgba(47,103,143,0.28) !important; }
html.theme-dark .popup-overlay { background: rgba(1,5,12,0.74) !important; }

html:not(.theme-dark) .action-btn:disabled,
html:not(.theme-dark) .action-btn.is-game-running,
html:not(.theme-dark) .main-btn:disabled,
html:not(.theme-dark) .main-btn.is-game-running,
html:not(.theme-dark) .game-item:disabled,
html:not(.theme-dark) .game-item.is-game-running,
html.theme-dark .action-btn:disabled,
html.theme-dark .action-btn.is-game-running,
html.theme-dark .main-btn:disabled,
html.theme-dark .main-btn.is-game-running,
html.theme-dark .game-item:disabled,
html.theme-dark .game-item.is-game-running {
  opacity: 0.66 !important;
  cursor: not-allowed !important;
  transform: none !important;
  filter: saturate(0.72) brightness(0.94) !important;
}

html:not(.theme-dark) .action-btn:focus-visible,
html:not(.theme-dark) .main-btn:focus-visible,
html:not(.theme-dark) .back-btn:focus-visible,
html:not(.theme-dark) .game-item:focus-visible,
html:not(.theme-dark) .menu-btn:focus-visible,
html:not(.theme-dark) input:focus-visible {
  outline: 4px solid rgba(44, 121, 179, 0.28) !important;
  outline-offset: 4px !important;
}

html.theme-dark .action-btn:focus-visible,
html.theme-dark .main-btn:focus-visible,
html.theme-dark .back-btn:focus-visible,
html.theme-dark .game-item:focus-visible,
html.theme-dark .menu-btn:focus-visible,
html.theme-dark input:focus-visible {
  outline: 4px solid rgba(105,216,255,0.34) !important;
  outline-offset: 4px !important;
}

html:not(.theme-dark) .volume-range::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, #ff6f9f 0%, #ff6f9f var(--volume-progress, 50%), rgba(159,215,255,0.76) var(--volume-progress, 50%), rgba(159,215,255,0.76) 100%) !important;
  border-color: rgba(255,255,255,0.74) !important;
}

html.theme-dark .volume-range::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, #69d8ff 0%, #69d8ff var(--volume-progress, 50%), rgba(105,216,255,0.18) var(--volume-progress, 50%), rgba(105,216,255,0.18) 100%) !important;
  border-color: rgba(105,216,255,0.20) !important;
}

html:not(.theme-dark) .slot-legend::-webkit-scrollbar-thumb,
html:not(.theme-dark) .race-ranking-list::-webkit-scrollbar-thumb,
html:not(.theme-dark) .race-track-lanes::-webkit-scrollbar-thumb { background: rgba(77, 156, 214, 0.36) !important; }
html.theme-dark .slot-legend::-webkit-scrollbar-thumb,
html.theme-dark .race-ranking-list::-webkit-scrollbar-thumb,
html.theme-dark .race-track-lanes::-webkit-scrollbar-thumb { background: rgba(105, 216, 255, 0.34) !important; }

/* =========================================================
   2026-06 palette refinement
   Day mode: sunny coastal pastel palette with strong readability
   Night mode: neon cyberpunk palette with soft contrast for eye comfort
   ========================================================= */

:root {
  --bg: #dff3ff;
  --bg2: #fff7ee;
  --card: rgba(255, 255, 255, 0.88);
  --card-strong: rgba(255, 255, 255, 0.94);
  --brown: #274b67;
  --soft-brown: #456680;
  --pink: #ffb8c9;
  --mint: #a9efe4;
  --sky: #8ed8ff;
  --lavender: #c8cbff;
  --yellow: #ffe18f;
  --peach: #ffc4a8;
  --shadow: 0 18px 34px rgba(74, 117, 151, 0.14);
}

body {
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 18%),
    radial-gradient(circle at 84% 16%, rgba(164, 232, 255, 0.36) 0%, rgba(164, 232, 255, 0) 24%),
    radial-gradient(circle at 22% 88%, rgba(255, 231, 150, 0.26) 0%, rgba(255, 231, 150, 0) 22%),
    linear-gradient(180deg, #cfeeff 0%, #e9f7ff 34%, #f9fcff 62%, #fff7ee 100%);
  color: var(--brown);
}

.background-deco {
  opacity: 0.62;
  filter: blur(3px);
}

.deco1 { background: #ccecff; }
.deco2 { background: #b9f3e6; }
.deco3 { background: #ffe6a8; }
.deco4 { background: #ffd0b8; }

.card,
.controls-wrap,
.scoreboard-card,
.game-board-card,
.race-panel,
.battle-table-card,
.battle-panel,
.sim-setup-card,
.sim-arena-card,
.sim-battle-summary-card,
.naval-board-card,
.popup,
.orientation-lock-card,
.game-sidebar,
.race-sidebar,
.battle-sidebar,
.sim-sidebar,
.naval-sidebar {
  background: linear-gradient(180deg, rgba(255,255,255,0.94) 0%, rgba(248,253,255,0.92) 54%, rgba(255,250,245,0.92) 100%);
  border-color: rgba(255,255,255,0.82);
  box-shadow:
    0 18px 34px rgba(74, 117, 151, 0.14),
    inset 0 1px 0 rgba(255,255,255,0.72);
}

.small-badge,
.battle-deck-label,
.sim-phase-badge,
.legend-chip,
.race-ranking-item,
.battle-ranking-item,
.battle-ranking-empty,
.sim-empty-state,
.naval-log-item,
.naval-ranking-item,
.naval-player-chip,
.naval-elimination-item {
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(241,250,255,0.92) 100%);
  color: #486887;
  border-color: rgba(196, 228, 246, 0.82);
}

.small-badge {
  background: linear-gradient(180deg, #ffffff 0%, #f0fbff 100%);
  color: #4f7290;
  border-color: #b9e8f7;
}

.sub-text,
.helper-text,
.status-text,
#totalInfo,
.game-item p,
.popup-message,
.horse-status,
.battle-rank-formula,
.battle-player-sub,
.sim-player-sub,
.game-board-head span,
.orientation-lock-card p,
.race-ranking-item div,
.slot-meta {
  color: #5f7e97;
}

.main-card h1,
.menu-card h2,
.luck-card h2,
.game-card h2,
.popup h3,
.sidebar-title,
.game-item h3,
.game-board-head h3,
.scoreboard-head h3,
.input-card label {
  color: #385a77;
}

.main-btn {
  background: linear-gradient(135deg, #8ed8ff 0%, #a9efe4 48%, #ffe18f 100%);
  color: #21445f;
  box-shadow: 0 16px 28px rgba(120, 203, 241, 0.3);
}

.back-btn,
.popup-btn,
.sim-info-btn,
.sim-arena-zoom-btn,
.utility-btn {
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(240,249,255,0.94) 100%);
  color: #456680;
  border: 2px solid rgba(196, 228, 246, 0.82);
  box-shadow: 0 10px 20px rgba(89, 136, 170, 0.12);
}

.utility-volume-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(240,249,255,0.94) 100%);
  color: #456680;
  border: 2px solid rgba(196, 228, 246, 0.82);
  box-shadow: 0 12px 24px rgba(89, 136, 170, 0.12);
}

.volume-control-value {
  color: #6887a2;
}

.volume-range::-webkit-slider-runnable-track {
  background:
    linear-gradient(90deg, rgba(142,216,255,1) 0%, rgba(142,216,255,1) var(--volume-progress, 50%), rgba(226,239,246,1) var(--volume-progress, 50%), rgba(226,239,246,1) 100%);
  border-color: rgba(201, 225, 237, 0.84);
}

.volume-range::-moz-range-track {
  background: rgba(226,239,246,1);
  border-color: rgba(201, 225, 237, 0.84);
}

.volume-range::-moz-range-progress {
  background: rgba(142,216,255,1);
}

.volume-range::-webkit-slider-thumb,
.volume-range::-moz-range-thumb {
  background: #ffffff;
  border-color: rgba(95, 161, 201, 0.88);
}

.menu-btn.physical {
  background: linear-gradient(135deg, #a9efe4 0%, #d8fff8 100%);
}

.menu-btn.luck {
  background: linear-gradient(135deg, #8ed8ff 0%, #d8efff 100%);
}

.game-item,
.game-item.game-launch,
.action-btn.secondary,
.drawer-toggle-btn {
  background: linear-gradient(180deg, rgba(255,255,255,0.97) 0%, rgba(241,250,255,0.96) 100%);
  border-color: rgba(198, 227, 243, 0.88);
  color: #345873;
}

.game-item:nth-child(2) { background: linear-gradient(180deg, #f5fffd 0%, #e5fbf6 100%); }
.game-item:nth-child(3) { background: linear-gradient(180deg, #f5fbff 0%, #eaf4ff 100%); }
.game-item:nth-child(4) { background: linear-gradient(180deg, #fffdf3 0%, #fff3c8 100%); }
.game-item:nth-child(5) { background: linear-gradient(180deg, #fff7f2 0%, #ffe3d3 100%); }
.game-item:nth-child(6) { background: linear-gradient(180deg, #fcfff8 0%, #eefbdd 100%); }
.game-item:nth-child(7) { background: linear-gradient(180deg, #f8f7ff 0%, #ecebff 100%); }
.game-item:nth-child(8) { background: linear-gradient(180deg, #f4fcff 0%, #ddf4ff 100%); }

.game-num,
.battle-rank-num {
  background: linear-gradient(135deg, #8ed8ff 0%, #c8cbff 100%);
  color: #21445f;
}

.game-meta-row {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.82), transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(243,250,255,0.95) 100%);
  border-color: rgba(214, 234, 246, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    0 8px 16px rgba(89, 136, 170, 0.08);
}

.game-meta-label {
  color: #6487a2;
}

.game-meta-value,
.slot-name,
.horse-name,
.battle-player-name,
.sim-player-name,
.battle-rank-name,
.race-lane-label {
  color: #315270;
}

.action-btn.primary {
  background: linear-gradient(135deg, #8ed8ff 0%, #a9efe4 58%, #ffe18f 100%);
  color: #21445f;
}

.action-btn.secondary {
  background: linear-gradient(135deg, #dff2ff 0%, #f2f8ff 100%);
  color: #365a75;
}

.action-btn.soft {
  background: linear-gradient(135deg, #ffe18f 0%, #ffd0b8 100%);
  color: #5d5330;
}

.input-card input {
  background: rgba(255,255,255,0.98);
  color: #2f536f;
  border-color: rgba(196, 228, 246, 0.88);
}

.input-card input:focus {
  border-color: rgba(105, 190, 236, 0.9);
  box-shadow: 0 0 0 5px rgba(142, 216, 255, 0.22);
}

.game-canvas-wrap,
.race-track-wrap,
.sim-arena-wrap,
.sim-arena-zoom-stage,
.naval-board-wrap,
.battle-table-card {
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.58), transparent 24%),
    linear-gradient(180deg, #f9fdff 0%, #edf8ff 56%, #fff9f1 100%);
  border-color: rgba(203, 228, 242, 0.9);
}

.race-lane {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255,255,255,0.34) 0px,
      rgba(255,255,255,0.34) 28px,
      rgba(255,255,255,0.14) 28px,
      rgba(255,255,255,0.14) 56px
    ),
    linear-gradient(180deg, #9cd3f0 0%, #7bc2e8 100%);
  border-color: rgba(255,255,255,0.6);
}

.race-horse,
.battle-row,
.sim-player-row,
.battle-slot,
.battle-card-front,
.sim-stat-card-front {
  box-shadow: 0 10px 20px rgba(96, 141, 174, 0.16);
}

.popup-overlay {
  background: rgba(129, 180, 214, 0.18);
}

.orientation-lock-overlay {
  background: rgba(226, 243, 255, 0.94);
}

/* ---------- night mode : neon cyberpunk, readable and low-strain ---------- */
html.theme-dark {
  color-scheme: dark;
  --bg: #08101f;
  --bg2: #0f1831;
  --card: rgba(15, 24, 49, 0.9);
  --card-strong: rgba(17, 28, 56, 0.95);
  --brown: #eef7ff;
  --soft-brown: #b7cae9;
  --pink: #ff5bc8;
  --mint: #52e6ff;
  --sky: #67b4ff;
  --lavender: #a780ff;
  --yellow: #ffd36b;
  --peach: #ff967c;
  --shadow: 0 20px 40px rgba(2, 8, 20, 0.5);
  --night-surface-1: #0a1125;
  --night-surface-2: #101936;
  --night-surface-3: #162347;
  --night-surface-4: #1d2d59;
  --night-border: rgba(82, 230, 255, 0.24);
  --night-border-strong: rgba(118, 196, 255, 0.38);
  --night-text: #eef7ff;
  --night-text-2: #c1d2f0;
  --night-text-3: #89a1c8;
  --night-muted-chip: #101936;
}

html.theme-dark body {
  background:
    radial-gradient(circle at 15% 16%, rgba(82, 230, 255, 0.11) 0%, rgba(82, 230, 255, 0) 20%),
    radial-gradient(circle at 82% 14%, rgba(255, 91, 200, 0.12) 0%, rgba(255, 91, 200, 0) 18%),
    radial-gradient(circle at 58% 88%, rgba(167, 128, 255, 0.11) 0%, rgba(167, 128, 255, 0) 24%),
    linear-gradient(180deg, #07111f 0%, #0b1430 36%, #0e1a3c 72%, #07111d 100%);
  color: var(--night-text);
}

html.theme-dark .background-deco {
  opacity: 0.36;
  filter: blur(10px);
}

html.theme-dark .deco1 { background: rgba(82, 230, 255, 0.4); }
html.theme-dark .deco2 { background: rgba(255, 91, 200, 0.34); }
html.theme-dark .deco3 { background: rgba(167, 128, 255, 0.34); }
html.theme-dark .deco4 { background: rgba(103, 180, 255, 0.34); }

html.theme-dark .card,
html.theme-dark .controls-wrap,
html.theme-dark .scoreboard-card,
html.theme-dark .game-board-card,
html.theme-dark .race-panel,
html.theme-dark .battle-table-card,
html.theme-dark .battle-panel,
html.theme-dark .sim-setup-card,
html.theme-dark .sim-arena-card,
html.theme-dark .sim-battle-summary-card,
html.theme-dark .naval-board-card,
html.theme-dark .popup,
html.theme-dark .orientation-lock-card,
html.theme-dark .game-sidebar,
html.theme-dark .race-sidebar,
html.theme-dark .battle-sidebar,
html.theme-dark .sim-sidebar,
html.theme-dark .naval-sidebar {
  background: linear-gradient(180deg, rgba(12, 20, 43, 0.95) 0%, rgba(9, 16, 36, 0.95) 100%);
  border-color: rgba(100, 188, 255, 0.16);
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(82, 230, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html.theme-dark .small-badge,
html.theme-dark .battle-deck-label,
html.theme-dark .sim-phase-badge,
html.theme-dark .battle-result-pill,
html.theme-dark .battle-final-rank,
html.theme-dark .battle-final-result-box,
html.theme-dark .legend-chip,
html.theme-dark .race-ranking-item,
html.theme-dark .battle-ranking-item,
html.theme-dark .battle-ranking-empty,
html.theme-dark .sim-empty-state,
html.theme-dark .naval-log-item,
html.theme-dark .naval-ranking-item,
html.theme-dark .naval-player-chip,
html.theme-dark .naval-elimination-item {
  background: linear-gradient(180deg, rgba(19, 31, 63, 0.96) 0%, rgba(15, 25, 52, 0.96) 100%);
  color: var(--night-text);
  border-color: rgba(102, 177, 255, 0.18);
}

html.theme-dark .small-badge {
  color: #d7f8ff;
  border-color: rgba(82, 230, 255, 0.34);
}

html.theme-dark .back-btn,
html.theme-dark .popup-btn,
html.theme-dark .sim-info-btn,
html.theme-dark .sim-arena-zoom-btn,
html.theme-dark .utility-btn {
  background: linear-gradient(180deg, rgba(17, 27, 55, 0.96) 0%, rgba(12, 21, 44, 0.96) 100%);
  color: var(--night-text);
  border-color: rgba(102, 177, 255, 0.18);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(82, 230, 255, 0.06) inset;
}

html.theme-dark .utility-volume-panel {
  background: linear-gradient(180deg, rgba(17, 27, 55, 0.96) 0%, rgba(12, 21, 44, 0.96) 100%);
  color: var(--night-text);
  border-color: rgba(102, 177, 255, 0.18);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(82, 230, 255, 0.06) inset;
}

html.theme-dark .volume-control-value {
  color: var(--night-text-3);
}

html.theme-dark .volume-range::-webkit-slider-runnable-track {
  background:
    linear-gradient(90deg, rgba(82,230,255,0.96) 0%, rgba(82,230,255,0.96) var(--volume-progress, 50%), rgba(255,255,255,0.1) var(--volume-progress, 50%), rgba(255,255,255,0.1) 100%);
  border-color: rgba(102, 177, 255, 0.16);
}

html.theme-dark .volume-range::-moz-range-track {
  background: rgba(255,255,255,0.1);
  border-color: rgba(102, 177, 255, 0.16);
}

html.theme-dark .volume-range::-moz-range-progress {
  background: rgba(82,230,255,0.96);
}

html.theme-dark .volume-range::-webkit-slider-thumb,
html.theme-dark .volume-range::-moz-range-thumb {
  background: #0e1732;
  border-color: rgba(82,230,255,0.84);
  box-shadow: 0 0 0 3px rgba(82,230,255,0.12);
}

html.theme-dark .main-btn {
  background: linear-gradient(135deg, #52e6ff 0%, #67b4ff 50%, #ff5bc8 100%);
  color: #061120;
  box-shadow: 0 14px 30px rgba(82, 230, 255, 0.18), 0 0 18px rgba(255, 91, 200, 0.12);
}

html.theme-dark .menu-btn.physical,
html.theme-dark .menu-btn.luck,
html.theme-dark .game-item,
html.theme-dark .game-item.game-launch,
html.theme-dark .action-btn.secondary,
html.theme-dark .drawer-toggle-btn {
  background: linear-gradient(180deg, rgba(16, 26, 54, 0.97) 0%, rgba(11, 19, 40, 0.97) 100%);
  color: var(--night-text);
  border-color: rgba(102, 177, 255, 0.16);
}

html.theme-dark .game-item:nth-child(2) { background: linear-gradient(180deg, rgba(13, 27, 52, 0.97) 0%, rgba(10, 20, 40, 0.97) 100%); }
html.theme-dark .game-item:nth-child(3) { background: linear-gradient(180deg, rgba(15, 29, 58, 0.97) 0%, rgba(11, 20, 44, 0.97) 100%); }
html.theme-dark .game-item:nth-child(4) { background: linear-gradient(180deg, rgba(25, 26, 52, 0.97) 0%, rgba(14, 18, 40, 0.97) 100%); }
html.theme-dark .game-item:nth-child(5) { background: linear-gradient(180deg, rgba(32, 22, 48, 0.97) 0%, rgba(18, 14, 33, 0.97) 100%); }
html.theme-dark .game-item:nth-child(6) { background: linear-gradient(180deg, rgba(13, 31, 49, 0.97) 0%, rgba(9, 21, 36, 0.97) 100%); }
html.theme-dark .game-item:nth-child(7) { background: linear-gradient(180deg, rgba(21, 21, 58, 0.97) 0%, rgba(13, 14, 38, 0.97) 100%); }
html.theme-dark .game-item:nth-child(8) { background: linear-gradient(180deg, rgba(12, 28, 56, 0.97) 0%, rgba(10, 19, 42, 0.97) 100%); }

html.theme-dark .action-btn.primary {
  background: linear-gradient(135deg, #52e6ff 0%, #67b4ff 55%, #ff5bc8 100%);
  color: #061120;
}

html.theme-dark .action-btn.secondary {
  background: linear-gradient(135deg, rgba(18, 33, 68, 0.98) 0%, rgba(14, 26, 56, 0.98) 100%);
  color: var(--night-text);
}

html.theme-dark .action-btn.soft {
  background: linear-gradient(135deg, #ffd36b 0%, #ff967c 100%);
  color: #2a1d10;
}

html.theme-dark .sub-text,
html.theme-dark .helper-text,
html.theme-dark .status-text,
html.theme-dark #totalInfo,
html.theme-dark .game-item p,
html.theme-dark .popup-message,
html.theme-dark .horse-status,
html.theme-dark .battle-rank-formula,
html.theme-dark .battle-player-sub,
html.theme-dark .sim-player-sub,
html.theme-dark .game-board-head span,
html.theme-dark .orientation-lock-card p,
html.theme-dark .race-ranking-item div,
html.theme-dark .slot-meta {
  color: var(--night-text-2) !important;
}

html.theme-dark .game-num,
html.theme-dark .battle-rank-num {
  background: linear-gradient(135deg, rgba(82,230,255,0.96) 0%, rgba(167,128,255,0.96) 100%);
  color: #08111f;
  box-shadow: 0 0 0 1px rgba(82,230,255,0.18), 0 0 14px rgba(82,230,255,0.14);
}

html.theme-dark .slot-name,
html.theme-dark .horse-name,
html.theme-dark .battle-player-name,
html.theme-dark .sim-player-name,
html.theme-dark .battle-rank-name,
html.theme-dark .race-lane-label,
html.theme-dark .game-meta-value,
html.theme-dark .main-card h1,
html.theme-dark .menu-card h2,
html.theme-dark .luck-card h2,
html.theme-dark .game-card h2,
html.theme-dark .popup h3,
html.theme-dark .sidebar-title,
html.theme-dark .game-item h3,
html.theme-dark .game-board-head h3,
html.theme-dark .scoreboard-head h3,
html.theme-dark .input-card label {
  color: var(--night-text);
}

html.theme-dark .game-meta-row {
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.06), transparent 36%),
    linear-gradient(180deg, rgba(18,31,63,0.98) 0%, rgba(12,24,50,0.98) 100%);
  border-color: rgba(102, 177, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 16px rgba(0,0,0,0.2);
}

html.theme-dark .game-meta-label {
  color: var(--night-text-3);
}

html.theme-dark .input-card input,
html.theme-dark input:disabled {
  background: rgba(7, 14, 31, 0.96);
  color: var(--night-text);
  border-color: rgba(102, 177, 255, 0.18);
}

html.theme-dark .input-card input:focus {
  border-color: rgba(82,230,255,0.84);
  box-shadow: 0 0 0 5px rgba(82,230,255,0.14);
}

html.theme-dark .game-canvas-wrap,
html.theme-dark .race-track-wrap,
html.theme-dark .sim-arena-wrap,
html.theme-dark .sim-arena-zoom-stage,
html.theme-dark .naval-board-wrap,
html.theme-dark .battle-table-card {
  background:
    radial-gradient(circle at top left, rgba(82,230,255,0.06), transparent 22%),
    linear-gradient(180deg, #111b37 0%, #0b1430 54%, #081222 100%);
  border-color: rgba(102, 177, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03), 0 18px 28px rgba(0,0,0,0.28);
}

html.theme-dark .race-lane {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.08) 0px,
      rgba(255, 255, 255, 0.08) 28px,
      rgba(255, 255, 255, 0.03) 28px,
      rgba(255, 255, 255, 0.03) 56px
    ),
    linear-gradient(180deg, #1b2b55 0%, #132041 100%);
  border-color: rgba(102, 177, 255, 0.14);
}

html.theme-dark .race-horse,
html.theme-dark .battle-row,
html.theme-dark .sim-player-row,
html.theme-dark .battle-slot,
html.theme-dark .battle-card-front,
html.theme-dark .sim-stat-card-front {
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(82,230,255,0.04) inset;
}

html.theme-dark .popup-overlay {
  background: rgba(4, 8, 18, 0.72);
}

html.theme-dark .orientation-lock-overlay {
  background: rgba(5, 10, 22, 0.92);
}

/* 2026-06 hotfix: remove unintended neon pillars in dark mode bottom-left */
html.theme-dark body::after {
  content: '' !important;
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  height: 42vh !important;
  z-index: 0 !important;
  pointer-events: none !important;
  background:
    radial-gradient(circle at 16% 86%, rgba(255,95,162,0.10) 0, rgba(255,95,162,0.06) 9%, transparent 24%),
    radial-gradient(circle at 84% 88%, rgba(255,230,109,0.06) 0, rgba(255,230,109,0.03) 8%, transparent 18%),
    linear-gradient(180deg, transparent 0%, rgba(105,216,255,0.035) 60%, rgba(10,18,34,0.16) 100%) !important;
  opacity: 0.72 !important;
}


/* =========================================================
   DAY MODE CONTRAST REBALANCE
   요청 팔레트: #FFD233 / #F7F7F9 / #59B4E3 / #76B947 / #FF8C42
   원칙: 단색 중심, 낮 모드 가독성 강화, 게임 카드 컬러 분리
========================================================= */
html:not(.theme-dark) {
  --day-bright-yellow: #FFD233;
  --day-cloud-dancer: #F7F7F9;
  --day-sky-blue: #59B4E3;
  --day-moss-green: #76B947;
  --day-coral-orange: #FF8C42;
  --day-ink: #17384B;
  --day-ink-soft: #4B6777;
  --day-outline: rgba(23, 56, 75, 0.16);
  --day-shadow-strong: 0 16px 30px rgba(33, 90, 124, 0.14);
  --day-shadow-soft: 0 10px 18px rgba(33, 90, 124, 0.10);

  --bg: var(--day-sky-blue) !important;
  --bg2: #9bd1ee !important;
  --card: rgba(247, 247, 249, 0.96) !important;
  --card-strong: #F7F7F9 !important;
  --brown: var(--day-ink) !important;
  --soft-brown: var(--day-ink) !important;
  --pink: var(--day-coral-orange) !important;
  --mint: var(--day-moss-green) !important;
  --sky: var(--day-sky-blue) !important;
  --lavender: #B9C8F7 !important;
  --yellow: var(--day-bright-yellow) !important;
  --peach: var(--day-coral-orange) !important;
  --shadow: var(--day-shadow-strong) !important;
}

html:not(.theme-dark) body {
  color: var(--day-ink) !important;
  background: linear-gradient(180deg, #59B4E3 0%, #97D1EF 54%, #F7F7F9 100%) !important;
}

html:not(.theme-dark) body::before {
  background:
    radial-gradient(ellipse at 18% 18%, rgba(247,247,249,0.92) 0 10%, transparent 24%),
    radial-gradient(ellipse at 76% 20%, rgba(247,247,249,0.72) 0 9%, transparent 22%),
    linear-gradient(180deg, rgba(247,247,249,0.00), rgba(247,247,249,0.20)) !important;
  opacity: 0.88 !important;
}

html:not(.theme-dark) body::after {
  background: linear-gradient(180deg, transparent 0%, rgba(255, 210, 51, 0.18) 100%) !important;
}

html:not(.theme-dark) .card,
html:not(.theme-dark) .controls-wrap,
html:not(.theme-dark) .scoreboard-card,
html:not(.theme-dark) .game-board-card,
html:not(.theme-dark) .race-panel,
html:not(.theme-dark) .battle-table-card,
html:not(.theme-dark) .battle-panel,
html:not(.theme-dark) .sim-setup-card,
html:not(.theme-dark) .sim-arena-card,
html:not(.theme-dark) .sim-battle-summary-card,
html:not(.theme-dark) .naval-board-card,
html:not(.theme-dark) .stock-portfolio-card,
html:not(.theme-dark) .bear-find-stage-card,
html:not(.theme-dark) .balloon-stage-card,
html:not(.theme-dark) .bomb-pass-stage-card,
html:not(.theme-dark) .circle-tap-stage-card,
html:not(.theme-dark) .key-react-stage-card,
html:not(.theme-dark) .ladder-stage-card,
html:not(.theme-dark) .roulette-stage-card,
html:not(.theme-dark) .popup,
html:not(.theme-dark) .orientation-lock-card,
html:not(.theme-dark) .game-sidebar,
html:not(.theme-dark) .race-sidebar,
html:not(.theme-dark) .battle-sidebar,
html:not(.theme-dark) .sim-sidebar,
html:not(.theme-dark) .naval-sidebar,
html:not(.theme-dark) .balloon-sidebar,
html:not(.theme-dark) .circle-tap-sidebar,
html:not(.theme-dark) .key-react-sidebar,
html:not(.theme-dark) .bear-find-sidebar {
  background: #F7F7F9 !important;
  color: var(--day-ink) !important;
  border: 2px solid rgba(255,255,255,0.86) !important;
  box-shadow: var(--day-shadow-strong) !important;
}

html:not(.theme-dark) .main-card,
html:not(.theme-dark) .menu-card,
html:not(.theme-dark) .luck-card,
html:not(.theme-dark) .physical-card {
  background: #F7F7F9 !important;
}

html:not(.theme-dark) .main-card h1,
html:not(.theme-dark) .menu-card h2,
html:not(.theme-dark) .luck-card h2,
html:not(.theme-dark) .physical-card h2,
html:not(.theme-dark) .game-card h2,
html:not(.theme-dark) .popup h3,
html:not(.theme-dark) .sidebar-title,
html:not(.theme-dark) .game-item h3,
html:not(.theme-dark) .physical-game-item h3 {
  color: var(--day-ink) !important;
}

html:not(.theme-dark) .sub-text,
html:not(.theme-dark) .helper-text,
html:not(.theme-dark) .status-text,
html:not(.theme-dark) #totalInfo,
html:not(.theme-dark) .game-item p,
html:not(.theme-dark) .popup-message,
html:not(.theme-dark) .race-track-stage-desc,
html:not(.theme-dark) .game-board-head span,
html:not(.theme-dark) .orientation-lock-card p,
html:not(.theme-dark) .horse-status,
html:not(.theme-dark) .battle-rank-formula,
html:not(.theme-dark) .battle-player-sub,
html:not(.theme-dark) .sim-player-sub {
  color: var(--day-ink-soft) !important;
}

html:not(.theme-dark) .small-badge,
html:not(.theme-dark) .game-mini-badge,
html:not(.theme-dark) .physical-compat-badge,
html:not(.theme-dark) .game-ff-badge,
html:not(.theme-dark) .battle-deck-label,
html:not(.theme-dark) .sim-phase-badge,
html:not(.theme-dark) .naval-phase-badge,
html:not(.theme-dark) .stock-ready-badge,
html:not(.theme-dark) .legend-chip {
  background: #F7F7F9 !important;
  color: var(--day-ink) !important;
  border: 2px solid rgba(89, 180, 227, 0.32) !important;
  box-shadow: var(--day-shadow-soft) !important;
}

html:not(.theme-dark) .main-btn,
html:not(.theme-dark) .action-btn.primary {
  background: #FF8C42 !important;
  color: #17384B !important;
  border: 2px solid rgba(255,255,255,0.88) !important;
  box-shadow: 0 12px 22px rgba(255, 140, 66, 0.26) !important;
  text-shadow: none !important;
}

html:not(.theme-dark) .action-btn.secondary,
html:not(.theme-dark) .drawer-toggle-btn,
html:not(.theme-dark) .menu-btn.luck {
  background: #59B4E3 !important;
  color: #17384B !important;
  border: 2px solid rgba(255,255,255,0.86) !important;
  box-shadow: 0 12px 22px rgba(89, 180, 227, 0.22) !important;
}

html:not(.theme-dark) .action-btn.soft,
html:not(.theme-dark) .popup-btn,
html:not(.theme-dark) .menu-btn.physical {
  background: #FFD233 !important;
  color: #17384B !important;
  border: 2px solid rgba(255,255,255,0.88) !important;
  box-shadow: 0 12px 22px rgba(255, 210, 51, 0.20) !important;
}

html:not(.theme-dark) .back-btn,
html:not(.theme-dark) .sim-info-btn,
html:not(.theme-dark) .sim-arena-zoom-btn,
html:not(.theme-dark) .utility-btn,
html:not(.theme-dark) .utility-volume-panel {
  background: #F7F7F9 !important;
  color: #17384B !important;
  border: 2px solid rgba(89, 180, 227, 0.26) !important;
  box-shadow: var(--day-shadow-soft) !important;
}

html:not(.theme-dark) .game-item,
html:not(.theme-dark) .game-item.game-launch,
html:not(.theme-dark) .physical-game-item,
html:not(.theme-dark) .menu-btn {
  background: #F7F7F9 !important;
  color: var(--day-ink) !important;
  border: 2px solid rgba(255,255,255,0.88) !important;
  box-shadow: var(--day-shadow-soft) !important;
}

html:not(.theme-dark) .game-item:nth-child(5n+1),
html:not(.theme-dark) .physical-game-item:nth-child(5n+1) {
  background: #FFD233 !important;
}

html:not(.theme-dark) .game-item:nth-child(5n+2),
html:not(.theme-dark) .physical-game-item:nth-child(5n+2) {
  background: #59B4E3 !important;
}

html:not(.theme-dark) .game-item:nth-child(5n+3),
html:not(.theme-dark) .physical-game-item:nth-child(5n+3) {
  background: #F7F7F9 !important;
}

html:not(.theme-dark) .game-item:nth-child(5n+4),
html:not(.theme-dark) .physical-game-item:nth-child(5n+4) {
  background: #76B947 !important;
}

html:not(.theme-dark) .game-item:nth-child(5n),
html:not(.theme-dark) .physical-game-item:nth-child(5n) {
  background: #FF8C42 !important;
}

html:not(.theme-dark) .game-item h3,
html:not(.theme-dark) .game-item p,
html:not(.theme-dark) .physical-game-item h3,
html:not(.theme-dark) .physical-game-item p {
  color: var(--day-ink) !important;
}

html:not(.theme-dark) .game-num {
  width: 62px !important;
  height: 62px !important;
  background: #F7F7F9 !important;
  color: var(--day-ink) !important;
  border: 2px solid rgba(23, 56, 75, 0.14) !important;
  box-shadow: 0 8px 14px rgba(33, 90, 124, 0.10) !important;
  font-size: 2rem !important;
  line-height: 1 !important;
  text-shadow: none !important;
}

html:not(.theme-dark) .game-meta-row,
html:not(.theme-dark) .input-card input,
html:not(.theme-dark) .key-react-key-card,
html:not(.theme-dark) .battle-row,
html:not(.theme-dark) .battle-slot,
html:not(.theme-dark) .race-ranking-item,
html:not(.theme-dark) .battle-ranking-item,
html:not(.theme-dark) .stock-player-tab,
html:not(.theme-dark) .stock-allocation-row,
html:not(.theme-dark) .naval-log-item {
  background: rgba(247, 247, 249, 0.92) !important;
  color: var(--day-ink) !important;
  border: 1px solid rgba(23, 56, 75, 0.10) !important;
}

html:not(.theme-dark) .game-meta-label,
html:not(.theme-dark) .input-card label {
  color: #355769 !important;
}

html:not(.theme-dark) .game-meta-value,
html:not(.theme-dark) .slot-name,
html:not(.theme-dark) .slot-meta,
html:not(.theme-dark) .horse-name,
html:not(.theme-dark) .battle-player-name,
html:not(.theme-dark) .sim-player-name,
html:not(.theme-dark) .battle-rank-name,
html:not(.theme-dark) .race-lane-label,
html:not(.theme-dark) .stock-player-name,
html:not(.theme-dark) .stock-summary-title {
  color: var(--day-ink) !important;
}

html:not(.theme-dark) .game-canvas-wrap,
html:not(.theme-dark) .race-track-wrap,
html:not(.theme-dark) .sim-arena-wrap,
html:not(.theme-dark) .sim-arena-zoom-stage,
html:not(.theme-dark) .naval-board-wrap {
  background: #F7F7F9 !important;
  border: 3px solid rgba(255,255,255,0.90) !important;
  box-shadow: var(--day-shadow-strong) !important;
}

html:not(.theme-dark) .race-lane {
  background:
    repeating-linear-gradient(90deg, rgba(247,247,249,0.32) 0px, rgba(247,247,249,0.32) 28px, rgba(247,247,249,0.14) 28px, rgba(247,247,249,0.14) 56px),
    #76B947 !important;
}

html:not(.theme-dark) .race-horse {
  background: #F7F7F9 !important;
  color: var(--day-ink) !important;
  border: 2px solid rgba(255,255,255,0.90) !important;
}


/* =========================================================
   DAY MODE DISTINCT GAME COLORS PASS
   목적: 각 게임의 낮모드 요소가 덜 하얗고, 더 잘 구분되게 조정
========================================================= */
html:not(.theme-dark) .game-item,
html:not(.theme-dark) .physical-game-item {
  --tile-bg: #F7F7F9;
  --tile-surface: #EEF4F8;
  --tile-accent: #59B4E3;
}

html:not(.theme-dark) .game-item:nth-child(5n+1),
html:not(.theme-dark) .physical-game-item:nth-child(5n+1) {
  --tile-bg: #FFD233;
  --tile-surface: #FFF0A8;
  --tile-accent: #FF8C42;
}

html:not(.theme-dark) .game-item:nth-child(5n+2),
html:not(.theme-dark) .physical-game-item:nth-child(5n+2) {
  --tile-bg: #59B4E3;
  --tile-surface: #CDEBFA;
  --tile-accent: #17384B;
}

html:not(.theme-dark) .game-item:nth-child(5n+3),
html:not(.theme-dark) .physical-game-item:nth-child(5n+3) {
  --tile-bg: #F7F7F9;
  --tile-surface: #E8F0F5;
  --tile-accent: #59B4E3;
}

html:not(.theme-dark) .game-item:nth-child(5n+4),
html:not(.theme-dark) .physical-game-item:nth-child(5n+4) {
  --tile-bg: #76B947;
  --tile-surface: #D8EDC9;
  --tile-accent: #17384B;
}

html:not(.theme-dark) .game-item:nth-child(5n),
html:not(.theme-dark) .physical-game-item:nth-child(5n) {
  --tile-bg: #FF8C42;
  --tile-surface: #FFD8BE;
  --tile-accent: #17384B;
}

html:not(.theme-dark) .game-item,
html:not(.theme-dark) .game-item.game-launch,
html:not(.theme-dark) .physical-game-item {
  background: var(--tile-bg) !important;
  border-color: rgba(255,255,255,0.92) !important;
}

html:not(.theme-dark) .game-item .game-num,
html:not(.theme-dark) .physical-game-item .game-num {
  background: var(--tile-surface) !important;
  color: var(--day-ink) !important;
  border-color: rgba(23, 56, 75, 0.16) !important;
}

html:not(.theme-dark) .game-item .game-meta-row,
html:not(.theme-dark) .physical-game-item .game-meta-row,
html:not(.theme-dark) .game-item .physical-compat-badge,
html:not(.theme-dark) .physical-game-item .physical-compat-badge {
  background: var(--tile-surface) !important;
  border-color: rgba(23, 56, 75, 0.10) !important;
  color: var(--day-ink) !important;
}

html:not(.theme-dark) .game-item .game-meta-label,
html:not(.theme-dark) .physical-game-item .game-meta-label {
  color: rgba(23, 56, 75, 0.76) !important;
}

html:not(.theme-dark) .game-item .game-meta-value,
html:not(.theme-dark) .physical-game-item .game-meta-value {
  color: var(--day-ink) !important;
}

html:not(.theme-dark) .game-screen {
  --screen-accent: #59B4E3;
  --screen-surface: #DDEFF9;
  --screen-surface-2: #C8E6F6;
  --screen-stage: #F7F7F9;
}

html:not(.theme-dark) #game1Screen,
html:not(.theme-dark) #physicalBearFindScreen {
  --screen-accent: #FF8C42;
  --screen-surface: #FFE1CE;
  --screen-surface-2: #FFD2B6;
  --screen-stage: #FFF1E7;
}

html:not(.theme-dark) #game2Screen,
html:not(.theme-dark) #game7Screen,
html:not(.theme-dark) #physicalKeyReactScreen {
  --screen-accent: #76B947;
  --screen-surface: #E0F0D4;
  --screen-surface-2: #D1E8C0;
  --screen-stage: #F2F9EC;
}

html:not(.theme-dark) #game3Screen,
html:not(.theme-dark) #game6Screen,
html:not(.theme-dark) #physicalCircleScreen {
  --screen-accent: #59B4E3;
  --screen-surface: #DDEFF9;
  --screen-surface-2: #C8E6F6;
  --screen-stage: #EEF7FC;
}

html:not(.theme-dark) #game4Screen,
html:not(.theme-dark) #physicalBombScreen {
  --screen-accent: #FFD233;
  --screen-surface: #FFF0B3;
  --screen-surface-2: #FFE78D;
  --screen-stage: #FFF8D9;
}

html:not(.theme-dark) #game5Screen,
html:not(.theme-dark) #physicalBalloonScreen {
  --screen-accent: #FF8C42;
  --screen-surface: #FFE1CE;
  --screen-surface-2: #FFD2B6;
  --screen-stage: #FFF1E7;
}

html:not(.theme-dark) .game-screen .controls-wrap,
html:not(.theme-dark) .game-screen .scoreboard-card,
html:not(.theme-dark) .game-screen .game-board-card,
html:not(.theme-dark) .game-screen .race-panel,
html:not(.theme-dark) .game-screen .battle-panel,
html:not(.theme-dark) .game-screen .sim-setup-card,
html:not(.theme-dark) .game-screen .sim-arena-card,
html:not(.theme-dark) .game-screen .sim-battle-summary-card,
html:not(.theme-dark) .game-screen .naval-board-card,
html:not(.theme-dark) .game-screen .stock-portfolio-card,
html:not(.theme-dark) .game-screen .bear-find-stage-card,
html:not(.theme-dark) .game-screen .balloon-stage-card,
html:not(.theme-dark) .game-screen .bomb-pass-stage-card,
html:not(.theme-dark) .game-screen .circle-tap-stage-card,
html:not(.theme-dark) .game-screen .key-react-stage-card,
html:not(.theme-dark) .game-screen .ladder-stage-card,
html:not(.theme-dark) .game-screen .roulette-stage-card,
html:not(.theme-dark) .game-screen .game-sidebar,
html:not(.theme-dark) .game-screen .race-sidebar,
html:not(.theme-dark) .game-screen .battle-sidebar,
html:not(.theme-dark) .game-screen .sim-sidebar,
html:not(.theme-dark) .game-screen .naval-sidebar,
html:not(.theme-dark) .game-screen .balloon-sidebar,
html:not(.theme-dark) .game-screen .circle-tap-sidebar,
html:not(.theme-dark) .game-screen .key-react-sidebar,
html:not(.theme-dark) .game-screen .bear-find-sidebar {
  background: var(--screen-surface) !important;
  border: 2px solid rgba(255,255,255,0.88) !important;
  box-shadow: var(--day-shadow-soft) !important;
}

html:not(.theme-dark) .game-screen .small-badge,
html:not(.theme-dark) .game-screen .game-mini-badge,
html:not(.theme-dark) .game-screen .sim-phase-badge,
html:not(.theme-dark) .game-screen .battle-deck-label,
html:not(.theme-dark) .game-screen .legend-chip,
html:not(.theme-dark) .game-screen .physical-compat-badge {
  background: var(--screen-surface-2) !important;
  border-color: rgba(23,56,75,0.10) !important;
  color: var(--day-ink) !important;
}

html:not(.theme-dark) .game-screen .input-card input,
html:not(.theme-dark) .game-screen .game-meta-row,
html:not(.theme-dark) .game-screen .slot-box,
html:not(.theme-dark) .game-screen .battle-row,
html:not(.theme-dark) .game-screen .battle-slot,
html:not(.theme-dark) .game-screen .race-ranking-item,
html:not(.theme-dark) .game-screen .battle-ranking-item,
html:not(.theme-dark) .game-screen .stock-player-tab,
html:not(.theme-dark) .game-screen .stock-allocation-row,
html:not(.theme-dark) .game-screen .naval-log-item,
html:not(.theme-dark) .game-screen .naval-ranking-item,
html:not(.theme-dark) .game-screen .naval-player-chip,
html:not(.theme-dark) .game-screen .naval-elimination-item,
html:not(.theme-dark) .game-screen .sim-empty-state {
  background: var(--screen-stage) !important;
  border-color: rgba(23,56,75,0.10) !important;
  color: var(--day-ink) !important;
}

html:not(.theme-dark) .game-screen .game-board-head,
html:not(.theme-dark) .game-screen .scoreboard-head,
html:not(.theme-dark) .game-screen .battle-panel-head,
html:not(.theme-dark) .game-screen .stock-panel-head,
html:not(.theme-dark) .game-screen .race-track-stage-head {
  background: var(--screen-surface-2) !important;
  border-radius: 18px !important;
  padding: 12px 14px !important;
}

html:not(.theme-dark) .game-screen .game-canvas-wrap,
html:not(.theme-dark) .game-screen .race-track-wrap,
html:not(.theme-dark) .game-screen .sim-arena-wrap,
html:not(.theme-dark) .game-screen .sim-arena-zoom-stage,
html:not(.theme-dark) .game-screen .naval-board-wrap {
  background: var(--screen-stage) !important;
  border: 3px solid rgba(255,255,255,0.90) !important;
}

html:not(.theme-dark) .game-screen .back-btn,
html:not(.theme-dark) .game-screen .drawer-toggle-btn,
html:not(.theme-dark) .game-screen .sim-info-btn,
html:not(.theme-dark) .game-screen .sim-arena-zoom-btn {
  background: var(--screen-surface-2) !important;
  color: var(--day-ink) !important;
  border-color: rgba(23,56,75,0.12) !important;
}


/* =========================================================
   NIGHT MODE DISTINCT GAME COLORS PASS
   목적: 밤모드도 낮모드처럼 게임별/패널별 구분감을 명확히 유지
   원칙: 낮모드와 같은 구조, 밤 팔레트(네온/사이버펑크) 유지
========================================================= */
html.theme-dark .game-item,
html.theme-dark .physical-game-item {
  --night-tile-bg: #102542;
  --night-tile-surface: #183251;
  --night-tile-accent: #69d8ff;
}

html.theme-dark .game-item:nth-child(5n+1),
html.theme-dark .physical-game-item:nth-child(5n+1) {
  --night-tile-bg: #3a1834;
  --night-tile-surface: #4a2342;
  --night-tile-accent: #ff5fa2;
}

html.theme-dark .game-item:nth-child(5n+2),
html.theme-dark .physical-game-item:nth-child(5n+2) {
  --night-tile-bg: #123152;
  --night-tile-surface: #1a4270;
  --night-tile-accent: #69d8ff;
}

html.theme-dark .game-item:nth-child(5n+3),
html.theme-dark .physical-game-item:nth-child(5n+3) {
  --night-tile-bg: #191f49;
  --night-tile-surface: #272f63;
  --night-tile-accent: #b58cff;
}

html.theme-dark .game-item:nth-child(5n+4),
html.theme-dark .physical-game-item:nth-child(5n+4) {
  --night-tile-bg: #123b45;
  --night-tile-surface: #1c4e5b;
  --night-tile-accent: #63e6be;
}

html.theme-dark .game-item:nth-child(5n),
html.theme-dark .physical-game-item:nth-child(5n) {
  --night-tile-bg: #39251a;
  --night-tile-surface: #523526;
  --night-tile-accent: #ffe66d;
}

html.theme-dark .game-item,
html.theme-dark .game-item.game-launch,
html.theme-dark .physical-game-item,
html.theme-dark .menu-btn {
  background: var(--night-tile-bg) !important;
  color: var(--night-text) !important;
  border: 1px solid rgba(237,248,255,0.08) !important;
  box-shadow: 0 18px 30px rgba(0,0,0,0.42), 0 0 0 1px rgba(255,255,255,0.03) inset !important;
}

html.theme-dark .game-item .game-num,
html.theme-dark .physical-game-item .game-num {
  background: var(--night-tile-surface) !important;
  color: var(--night-text) !important;
  border: 1px solid rgba(237,248,255,0.10) !important;
  box-shadow: 0 10px 18px rgba(0,0,0,0.26), 0 0 12px color-mix(in srgb, var(--night-tile-accent) 18%, transparent) !important;
}

html.theme-dark .game-item .game-meta-row,
html.theme-dark .physical-game-item .game-meta-row,
html.theme-dark .game-item .physical-compat-badge,
html.theme-dark .physical-game-item .physical-compat-badge {
  background: var(--night-tile-surface) !important;
  border-color: rgba(237,248,255,0.08) !important;
  color: var(--night-text) !important;
}

html.theme-dark .game-item .game-meta-label,
html.theme-dark .physical-game-item .game-meta-label {
  color: var(--night-text-2) !important;
}

html.theme-dark .game-item .game-meta-value,
html.theme-dark .physical-game-item .game-meta-value,
html.theme-dark .game-item h3,
html.theme-dark .game-item p,
html.theme-dark .physical-game-item h3,
html.theme-dark .physical-game-item p {
  color: var(--night-text) !important;
}

html.theme-dark .game-screen {
  --dark-screen-accent: #69d8ff;
  --dark-screen-surface: #102542;
  --dark-screen-surface-2: #183251;
  --dark-screen-stage: #0b172a;
}

html.theme-dark #game1Screen,
html.theme-dark #physicalBearFindScreen {
  --dark-screen-accent: #ff5fa2;
  --dark-screen-surface: #3a1834;
  --dark-screen-surface-2: #4a2342;
  --dark-screen-stage: #1f1320;
}

html.theme-dark #game2Screen,
html.theme-dark #game7Screen,
html.theme-dark #physicalKeyReactScreen {
  --dark-screen-accent: #63e6be;
  --dark-screen-surface: #123b45;
  --dark-screen-surface-2: #1c4e5b;
  --dark-screen-stage: #0d1f24;
}

html.theme-dark #game3Screen,
html.theme-dark #game6Screen,
html.theme-dark #physicalCircleScreen {
  --dark-screen-accent: #69d8ff;
  --dark-screen-surface: #123152;
  --dark-screen-surface-2: #1a4270;
  --dark-screen-stage: #0d1a2c;
}

html.theme-dark #game4Screen,
html.theme-dark #physicalBombScreen {
  --dark-screen-accent: #ffe66d;
  --dark-screen-surface: #39251a;
  --dark-screen-surface-2: #523526;
  --dark-screen-stage: #1d1610;
}

html.theme-dark #game5Screen,
html.theme-dark #physicalBalloonScreen {
  --dark-screen-accent: #b58cff;
  --dark-screen-surface: #191f49;
  --dark-screen-surface-2: #272f63;
  --dark-screen-stage: #11162d;
}

html.theme-dark .game-screen .controls-wrap,
html.theme-dark .game-screen .scoreboard-card,
html.theme-dark .game-screen .game-board-card,
html.theme-dark .game-screen .race-panel,
html.theme-dark .game-screen .battle-panel,
html.theme-dark .game-screen .sim-setup-card,
html.theme-dark .game-screen .sim-arena-card,
html.theme-dark .game-screen .sim-battle-summary-card,
html.theme-dark .game-screen .naval-board-card,
html.theme-dark .game-screen .stock-portfolio-card,
html.theme-dark .game-screen .bear-find-stage-card,
html.theme-dark .game-screen .balloon-stage-card,
html.theme-dark .game-screen .bomb-pass-stage-card,
html.theme-dark .game-screen .circle-tap-stage-card,
html.theme-dark .game-screen .key-react-stage-card,
html.theme-dark .game-screen .ladder-stage-card,
html.theme-dark .game-screen .roulette-stage-card,
html.theme-dark .game-screen .game-sidebar,
html.theme-dark .game-screen .race-sidebar,
html.theme-dark .game-screen .battle-sidebar,
html.theme-dark .game-screen .sim-sidebar,
html.theme-dark .game-screen .naval-sidebar,
html.theme-dark .game-screen .balloon-sidebar,
html.theme-dark .game-screen .circle-tap-sidebar,
html.theme-dark .game-screen .key-react-sidebar,
html.theme-dark .game-screen .bear-find-sidebar {
  background: var(--dark-screen-surface) !important;
  border: 1px solid rgba(237,248,255,0.08) !important;
  box-shadow: 0 18px 30px rgba(0,0,0,0.42), 0 0 0 1px rgba(255,255,255,0.03) inset !important;
}

html.theme-dark .game-screen .small-badge,
html.theme-dark .game-screen .game-mini-badge,
html.theme-dark .game-screen .sim-phase-badge,
html.theme-dark .game-screen .battle-deck-label,
html.theme-dark .game-screen .legend-chip,
html.theme-dark .game-screen .physical-compat-badge,
html.theme-dark .game-screen .race-ranking-item,
html.theme-dark .game-screen .battle-ranking-item,
html.theme-dark .game-screen .battle-ranking-empty,
html.theme-dark .game-screen .sim-empty-state,
html.theme-dark .game-screen .naval-log-item,
html.theme-dark .game-screen .naval-ranking-item,
html.theme-dark .game-screen .naval-player-chip,
html.theme-dark .game-screen .naval-elimination-item {
  background: var(--dark-screen-surface-2) !important;
  border-color: rgba(237,248,255,0.08) !important;
  color: var(--night-text) !important;
}

html.theme-dark .game-screen .input-card input,
html.theme-dark .game-screen .game-meta-row,
html.theme-dark .game-screen .slot-box,
html.theme-dark .game-screen .battle-row,
html.theme-dark .game-screen .battle-slot,
html.theme-dark .game-screen .stock-player-tab,
html.theme-dark .game-screen .stock-allocation-row,
html.theme-dark .game-screen .sim-player-row,
html.theme-dark .game-screen .key-react-key-card {
  background: var(--dark-screen-stage) !important;
  border-color: rgba(237,248,255,0.08) !important;
  color: var(--night-text) !important;
}

html.theme-dark .game-screen .game-board-head,
html.theme-dark .game-screen .scoreboard-head,
html.theme-dark .game-screen .battle-panel-head,
html.theme-dark .game-screen .stock-panel-head,
html.theme-dark .game-screen .race-track-stage-head {
  background: var(--dark-screen-surface-2) !important;
  border-radius: 18px !important;
  padding: 12px 14px !important;
}

html.theme-dark .game-screen .game-canvas-wrap,
html.theme-dark .game-screen .race-track-wrap,
html.theme-dark .game-screen .sim-arena-wrap,
html.theme-dark .game-screen .sim-arena-zoom-stage,
html.theme-dark .game-screen .naval-board-wrap {
  background: var(--dark-screen-stage) !important;
  border: 2px solid rgba(237,248,255,0.08) !important;
  box-shadow: 0 16px 28px rgba(0,0,0,0.34) !important;
}

html.theme-dark .game-screen .back-btn,
html.theme-dark .game-screen .drawer-toggle-btn,
html.theme-dark .game-screen .sim-info-btn,
html.theme-dark .game-screen .sim-arena-zoom-btn,
html.theme-dark .game-screen .utility-btn,
html.theme-dark .game-screen .utility-volume-panel {
  background: var(--dark-screen-surface-2) !important;
  color: var(--night-text) !important;
  border-color: rgba(237,248,255,0.08) !important;
  box-shadow: 0 12px 22px rgba(0,0,0,0.28) !important;
}

html.theme-dark .game-screen .action-btn.primary {
  background: var(--dark-screen-accent) !important;
  color: #07111f !important;
  border-color: rgba(255,255,255,0.12) !important;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--dark-screen-accent) 28%, transparent) !important;
}

html.theme-dark .game-screen .action-btn.secondary {
  background: var(--dark-screen-surface-2) !important;
  color: var(--night-text) !important;
  border-color: rgba(237,248,255,0.08) !important;
}

html.theme-dark .game-screen .action-btn.soft,
html.theme-dark .game-screen .popup-btn {
  background: color-mix(in srgb, var(--dark-screen-accent) 68%, #101936) !important;
  color: var(--night-text) !important;
  border-color: rgba(237,248,255,0.08) !important;
}

html.theme-dark .game-screen .race-lane {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.06) 0px, rgba(255,255,255,0.06) 28px, rgba(255,255,255,0.025) 28px, rgba(255,255,255,0.025) 56px),
    var(--dark-screen-surface-2) !important;
  border-color: rgba(237,248,255,0.08) !important;
}

html.theme-dark .game-screen .race-horse,
html.theme-dark .game-screen .battle-card-front,
html.theme-dark .game-screen .sim-stat-card-front {
  background: var(--dark-screen-stage) !important;
  color: var(--night-text) !important;
  border-color: rgba(237,248,255,0.08) !important;
}

/* =========================================================
   FINAL HOTFIX 2026-06-10
   밤모드 왼쪽 하단에 보이던 의도치 않은 세로 네온 라인 제거.
   기존 body::after의 90deg stripe gradient를 완전히 덮어쓴다.
========================================================= */
html.theme-dark body::after {
  content: '' !important;
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  height: 44vh !important;
  z-index: 0 !important;
  pointer-events: none !important;
  background:
    radial-gradient(circle at 18% 92%, rgba(255, 95, 162, 0.09) 0%, rgba(255, 95, 162, 0.045) 12%, transparent 30%),
    radial-gradient(circle at 82% 90%, rgba(105, 216, 255, 0.08) 0%, rgba(105, 216, 255, 0.035) 12%, transparent 30%),
    linear-gradient(180deg, transparent 0%, rgba(105, 216, 255, 0.045) 56%, rgba(5, 11, 22, 0.22) 100%) !important;
  opacity: 0.78 !important;
}


/* =========================================================
   FINAL HOTFIX 2026-06-10-2
   STAY CLICK 설정 패널 겹침/가림 수정 + 게임 화면 사용성 보강
   - 스크린샷의 빨간 영역처럼 시작/리셋 버튼이 참가자 현황 카드에 눌려 보이는 문제 방지
   - 좁은 데스크톱/노트북 높이에서도 설정 패널 내부 스크롤 허용
   - STAY CLICK 자체 헤더에 목록 복귀 버튼 복원
   - 우측 유틸리티 패널이 게임 화면을 덮지 않도록 중간 폭에서는 아이콘형으로 축소
========================================================= */
body.key-react-compact-mode {
  overflow-x: hidden !important;
}

body.key-react-compact-mode .key-react-sidebar-inner {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  scrollbar-gutter: stable !important;
  padding-bottom: 18px !important;
}

body.key-react-compact-mode .key-react-sidebar-inner > .sidebar-head,
body.key-react-compact-mode .key-react-sidebar-inner > .controls-wrap,
body.key-react-compact-mode .key-react-sidebar-inner > .scoreboard-card,
body.key-react-compact-mode .key-react-key-card,
body.key-react-compact-mode .key-react-button-row,
body.key-react-compact-mode .status-text {
  flex: 0 0 auto !important;
  min-height: 0 !important;
}

body.key-react-compact-mode .key-react-sidebar-inner > .controls-wrap {
  overflow: visible !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

body.key-react-compact-mode .key-react-key-card {
  margin-top: 0 !important;
}

body.key-react-compact-mode .key-react-key-head {
  margin-bottom: 10px !important;
}

body.key-react-compact-mode .key-react-key-list {
  max-height: clamp(142px, 24vh, 210px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-right: 3px !important;
}

body.key-react-compact-mode .key-react-button-row {
  position: relative !important;
  z-index: 4 !important;
  margin-top: 2px !important;
  padding-top: 2px !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

body.key-react-compact-mode .key-react-button-row .action-btn {
  min-height: 44px !important;
  width: 100% !important;
}

body.key-react-compact-mode #keyReactStatusText {
  max-height: 58px !important;
  overflow-y: auto !important;
  padding-right: 3px !important;
}

body.key-react-compact-mode .key-react-player-card {
  max-height: clamp(128px, 25vh, 190px) !important;
  overflow: hidden !important;
}

body.key-react-compact-mode .key-react-player-list {
  max-height: clamp(76px, 17vh, 132px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

#physicalKeyReactScreen .key-react-main-header {
  align-items: flex-start !important;
}

#physicalKeyReactScreen .key-react-header-actions {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: flex-end !important;
  flex: 0 0 auto !important;
  margin-left: auto !important;
}

#physicalKeyReactScreen .key-react-back-btn {
  display: inline-flex !important;
  width: auto !important;
  min-height: 42px !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
}

@media (max-width: 1024px) {
  #physicalKeyReactScreen .key-react-header-actions {
    width: 100% !important;
    justify-content: stretch !important;
    margin-left: 0 !important;
  }

  #physicalKeyReactScreen .key-react-back-btn {
    width: 100% !important;
  }
}

@media (min-width: 1025px) and (max-width: 1520px) {
  body.app-active-game .utility-controls {
    right: 12px !important;
    bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    gap: 8px !important;
  }

  body.app-active-game .utility-volume-panel {
    display: none !important;
  }

  body.app-active-game .utility-btn {
    min-width: 46px !important;
    width: 46px !important;
    min-height: 46px !important;
    height: 46px !important;
    padding: 0 !important;
    border-radius: 16px !important;
  }

  body.app-active-game .utility-btn-label {
    display: none !important;
  }
}

@media (max-height: 760px) and (min-width: 1025px) {
  body.key-react-compact-mode .key-react-main-header h2 {
    font-size: clamp(2rem, 3.2vw, 2.65rem) !important;
  }

  body.key-react-compact-mode .key-react-main-header .sub-text,
  body.key-react-compact-mode .key-react-panel-head .sub-text,
  body.key-react-compact-mode .sidebar-head .sub-text {
    font-size: 0.84rem !important;
    line-height: 1.38 !important;
  }

  body.key-react-compact-mode .key-react-stage-card {
    gap: 8px !important;
  }

  body.key-react-compact-mode .key-react-stage {
    min-height: 190px !important;
  }
}

/* =========================================================
   FINAL HOTFIX 2026-06-10-3
   NIGHT MODE LAYOUT PARITY WITH DAY MODE
   목적: 밤모드는 색상만 다르게 보이고, 요소 크기/간격/외곽선 두께/카드 레이아웃은 낮모드 기준과 동일하게 고정한다.
   주의: 아래는 색상 팔레트가 아니라 박스 모델만 맞추는 패치다.
========================================================= */
html.theme-dark .main-btn,
html.theme-dark .action-btn.primary,
html.theme-dark .game-screen .action-btn.primary {
  border-width: 2px !important;
  border-style: solid !important;
}

html.theme-dark .action-btn.secondary,
html.theme-dark .drawer-toggle-btn,
html.theme-dark .menu-btn.luck,
html.theme-dark .game-screen .action-btn.secondary,
html.theme-dark .game-screen .drawer-toggle-btn {
  border-width: 2px !important;
  border-style: solid !important;
}

html.theme-dark .action-btn.soft,
html.theme-dark .popup-btn,
html.theme-dark .menu-btn.physical,
html.theme-dark .game-screen .action-btn.soft,
html.theme-dark .game-screen .popup-btn {
  border-width: 2px !important;
  border-style: solid !important;
}

html.theme-dark .back-btn,
html.theme-dark .sim-info-btn,
html.theme-dark .sim-arena-zoom-btn,
html.theme-dark .utility-btn,
html.theme-dark .utility-volume-panel,
html.theme-dark .game-screen .back-btn,
html.theme-dark .game-screen .sim-info-btn,
html.theme-dark .game-screen .sim-arena-zoom-btn,
html.theme-dark .game-screen .utility-btn,
html.theme-dark .game-screen .utility-volume-panel {
  border-width: 2px !important;
  border-style: solid !important;
}

html.theme-dark .game-item,
html.theme-dark .game-item.game-launch,
html.theme-dark .physical-game-item,
html.theme-dark .menu-btn {
  border-width: 2px !important;
  border-style: solid !important;
}

html.theme-dark .game-num,
html.theme-dark .game-item .game-num,
html.theme-dark .physical-game-item .game-num {
  width: 62px !important;
  height: 62px !important;
  font-size: 2rem !important;
  line-height: 1 !important;
  border-width: 2px !important;
  border-style: solid !important;
}

html.theme-dark .game-meta-row,
html.theme-dark .input-card input,
html.theme-dark .key-react-key-card,
html.theme-dark .battle-row,
html.theme-dark .battle-slot,
html.theme-dark .race-ranking-item,
html.theme-dark .battle-ranking-item,
html.theme-dark .stock-player-tab,
html.theme-dark .stock-allocation-row,
html.theme-dark .naval-log-item,
html.theme-dark .game-screen .input-card input,
html.theme-dark .game-screen .game-meta-row,
html.theme-dark .game-screen .slot-box,
html.theme-dark .game-screen .battle-row,
html.theme-dark .game-screen .battle-slot,
html.theme-dark .game-screen .race-ranking-item,
html.theme-dark .game-screen .battle-ranking-item,
html.theme-dark .game-screen .stock-player-tab,
html.theme-dark .game-screen .stock-allocation-row,
html.theme-dark .game-screen .naval-log-item,
html.theme-dark .game-screen .naval-ranking-item,
html.theme-dark .game-screen .naval-player-chip,
html.theme-dark .game-screen .naval-elimination-item,
html.theme-dark .game-screen .sim-empty-state,
html.theme-dark .game-screen .sim-player-row,
html.theme-dark .game-screen .key-react-key-card {
  border-width: 1px !important;
  border-style: solid !important;
}

html.theme-dark .small-badge,
html.theme-dark .game-mini-badge,
html.theme-dark .physical-compat-badge,
html.theme-dark .game-ff-badge,
html.theme-dark .battle-deck-label,
html.theme-dark .sim-phase-badge,
html.theme-dark .naval-phase-badge,
html.theme-dark .stock-ready-badge,
html.theme-dark .legend-chip,
html.theme-dark .game-screen .small-badge,
html.theme-dark .game-screen .game-mini-badge,
html.theme-dark .game-screen .physical-compat-badge,
html.theme-dark .game-screen .battle-deck-label,
html.theme-dark .game-screen .legend-chip,
html.theme-dark .game-screen .sim-phase-badge {
  border-width: 2px !important;
  border-style: solid !important;
}

html.theme-dark .game-screen .controls-wrap,
html.theme-dark .game-screen .scoreboard-card,
html.theme-dark .game-screen .game-board-card,
html.theme-dark .game-screen .race-panel,
html.theme-dark .game-screen .battle-panel,
html.theme-dark .game-screen .sim-setup-card,
html.theme-dark .game-screen .sim-arena-card,
html.theme-dark .game-screen .sim-battle-summary-card,
html.theme-dark .game-screen .naval-board-card,
html.theme-dark .game-screen .stock-portfolio-card,
html.theme-dark .game-screen .bear-find-stage-card,
html.theme-dark .game-screen .balloon-stage-card,
html.theme-dark .game-screen .bomb-pass-stage-card,
html.theme-dark .game-screen .circle-tap-stage-card,
html.theme-dark .game-screen .key-react-stage-card,
html.theme-dark .game-screen .ladder-stage-card,
html.theme-dark .game-screen .roulette-stage-card,
html.theme-dark .game-screen .game-sidebar,
html.theme-dark .game-screen .race-sidebar,
html.theme-dark .game-screen .battle-sidebar,
html.theme-dark .game-screen .sim-sidebar,
html.theme-dark .game-screen .naval-sidebar,
html.theme-dark .game-screen .balloon-sidebar,
html.theme-dark .game-screen .circle-tap-sidebar,
html.theme-dark .game-screen .key-react-sidebar,
html.theme-dark .game-screen .bear-find-sidebar {
  border-width: 2px !important;
  border-style: solid !important;
}

html.theme-dark .game-canvas-wrap,
html.theme-dark .race-track-wrap,
html.theme-dark .sim-arena-wrap,
html.theme-dark .sim-arena-zoom-stage,
html.theme-dark .naval-board-wrap,
html.theme-dark .game-screen .game-canvas-wrap,
html.theme-dark .game-screen .race-track-wrap,
html.theme-dark .game-screen .sim-arena-wrap,
html.theme-dark .game-screen .sim-arena-zoom-stage,
html.theme-dark .game-screen .naval-board-wrap {
  border-width: 3px !important;
  border-style: solid !important;
}

html.theme-dark .race-horse,
html.theme-dark .game-screen .race-horse,
html.theme-dark .battle-card-front,
html.theme-dark .sim-stat-card-front,
html.theme-dark .game-screen .battle-card-front,
html.theme-dark .game-screen .sim-stat-card-front {
  border-width: 2px !important;
  border-style: solid !important;
}

/* =========================================================
   FINAL HOTFIX 2026-06-10-4
   운 게임 메뉴창 전용 낮모드 아이콘 위치 보정
   - 낮모드 운 게임 카드의 이모지 칸(.game-num)만 밤모드처럼 조금 위로 올린다.
   - 피지컬 목록, 실제 게임 화면, 밤모드 레이아웃에는 영향이 없도록 #luckScreen + :not(.theme-dark)로 제한한다.
========================================================= */
html:not(.theme-dark) #luckScreen .luck-card .game-item .game-num {
  margin-top: -8px !important;
  margin-bottom: 14px !important;
}

@media (max-width: 820px) and (pointer: coarse) {
  html:not(.theme-dark) body.luck-carousel-mode #luckScreen .luck-card .game-item .game-num {
    margin-top: -8px !important;
  }
}

/* =========================================================
   FINAL HOTFIX 2026-06-10-5
   운 게임 메뉴 낮모드 레이아웃을 밤모드 기준으로 통일
   - 낮모드 운 게임 카드에서 빨리감기 배지 공간 때문에 생기던 상단 밀림을 제거한다.
   - 색상은 낮모드를 유지하고, 아이콘/제목/설명/메타 정보의 위치만 밤모드 구조에 맞춘다.
   - 적용 범위는 #luckScreen 낮모드로 제한해 피지컬 목록과 개별 게임 화면에는 영향이 없게 한다.
========================================================= */
html:not(.theme-dark) #luckScreen .luck-card .game-item,
html:not(.theme-dark) #luckScreen .luck-card .game-item.game-launch {
  padding: 18px 18px 18px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
}

html:not(.theme-dark) #luckScreen .luck-card .game-item[data-ff-state] {
  padding-top: 18px !important;
}

html:not(.theme-dark) #luckScreen .luck-card .game-item .game-num {
  margin: 0 0 18px 0 !important;
}

html:not(.theme-dark) #luckScreen .luck-card .game-item h3 {
  margin-bottom: 8px !important;
}

html:not(.theme-dark) #luckScreen .luck-card .game-item p {
  margin-bottom: 22px !important;
}

html:not(.theme-dark) #luckScreen .luck-card .game-item .game-meta {
  margin-top: auto !important;
  padding-top: 0 !important;
  gap: 10px !important;
}

@media (max-width: 820px) and (pointer: coarse) {
  html:not(.theme-dark) body.luck-carousel-mode #luckScreen .luck-card .game-item,
  html:not(.theme-dark) body.luck-carousel-mode #luckScreen .luck-card .game-item.game-launch {
    min-height: 320px !important;
    padding: 18px 18px 18px !important;
  }

  html:not(.theme-dark) body.luck-carousel-mode #luckScreen .luck-card .game-item[data-ff-state] {
    padding-top: 18px !important;
  }

  html:not(.theme-dark) body.luck-carousel-mode #luckScreen .luck-card .game-item .game-num {
    margin: 0 0 18px 0 !important;
  }
}

/* =========================================================
   FINAL HOTFIX 2026-06-10-6
   운 게임 메뉴 반복 표시 수정
   - 무한 스와이프용 복제 카드(data-clone)가 데스크톱/일반 그리드에서도 보이던 문제를 차단한다.
   - 기존처럼 운 게임 목록은 원본 8개만 표시된다.
   - 모바일 캐러셀 모드에서는 기존 스와이프 루프 동작을 유지한다.
========================================================= */
body:not(.luck-carousel-mode) #luckScreen .luck-card .game-item[data-clone] {
  display: none !important;
}

/* 2026-06-10 physical tweak: 풍선 터짐 기준 노출 방지 */
.balloon-pressure-meter {
  display: none !important;
}

.balloon-visual.is-warning .balloon-body,
.balloon-visual.is-danger .balloon-body {
  animation: none !important;
  filter: none !important;
}

/* 2026-06-10 physical tweak: 작아지는 원 랜덤 위치 이동 */
.circle-tap-stage {
  display: block !important;
}

.circle-tap-target {
  position: absolute !important;
  left: var(--circle-tap-x, 50%) !important;
  top: var(--circle-tap-y, 50%) !important;
  transform: translate(-50%, -50%) scale(1);
  transition:
    left 0.18s ease,
    top 0.18s ease,
    width 0.18s ease,
    height 0.18s ease,
    transform 0.14s ease,
    opacity 0.16s ease;
}

.circle-tap-target.is-finished {
  transform: translate(-50%, -50%) scale(0.82);
}

@keyframes circleTapBreathe {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.025); }
}

@keyframes circleTapHit {
  0% { transform: translate(-50%, -50%) scale(1); }
  45% { transform: translate(-50%, -50%) scale(0.92); }
  100% { transform: translate(-50%, -50%) scale(1); }
}


/* =========================================================
   FINAL HOTFIX 2026-06-10-7
   풍선 불기: 풍선 색을 현재 차례 참가자 색으로 동기화
   - 기존 스카이데이 고정 핑크 풍선 오버라이드를 다시 CSS 변수 기반으로 되돌린다.
   - 현재 차례 배지도 같은 색 계열로 표시해 누가 누를 차례인지 더 명확하게 보이게 한다.
========================================================= */
.balloon-press-area,
.balloon-turn-badge,
.balloon-visual {
  --balloon-current-color: #ff6f9f;
}

.balloon-body {
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.82) 0 12%, transparent 13%),
    radial-gradient(circle at 62% 76%, rgba(0, 0, 0, 0.14), transparent 28%),
    linear-gradient(
      145deg,
      color-mix(in srgb, var(--balloon-current-color, #ff6f9f) 58%, #ffffff) 0%,
      var(--balloon-current-color, #ff6f9f) 52%,
      color-mix(in srgb, var(--balloon-current-color, #ff6f9f) 82%, #000000) 100%
    ) !important;
  box-shadow:
    inset -14px -16px 24px rgba(0, 0, 0, 0.12),
    inset 9px 9px 18px rgba(255, 255, 255, 0.28),
    0 16px 24px color-mix(in srgb, var(--balloon-current-color, #ff6f9f) 34%, transparent) !important;
}

.balloon-knot {
  background:
    linear-gradient(
      180deg,
      var(--balloon-current-color, #ff6f9f) 0%,
      color-mix(in srgb, var(--balloon-current-color, #ff6f9f) 78%, #000000) 100%
    ) !important;
  border-color: rgba(255, 255, 255, 0.72) !important;
}

.balloon-turn-badge {
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--balloon-current-color, #ff6f9f) 18%, #ffffff) 0%,
      color-mix(in srgb, var(--balloon-current-color, #ff6f9f) 30%, #ffffff) 100%
    ) !important;
  border-color: color-mix(in srgb, var(--balloon-current-color, #ff6f9f) 45%, #ffffff) !important;
  color: color-mix(in srgb, var(--balloon-current-color, #ff6f9f) 72%, #1f2430) !important;
}

html.theme-dark .balloon-turn-badge {
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--balloon-current-color, #ff6f9f) 30%, #0b1b2e) 0%,
      color-mix(in srgb, var(--balloon-current-color, #ff6f9f) 20%, #06101d) 100%
    ) !important;
  border-color: color-mix(in srgb, var(--balloon-current-color, #ff6f9f) 48%, #69d8ff) !important;
  color: #ffffff !important;
}

/* =========================================================
   FINAL HOTFIX 2026-06-10-5
   밤모드 경마 말 색상 복구.
   기존 밤모드 공통 game-screen 패치가 .race-horse 배경을
   var(--dark-screen-stage)로 덮어써 참가자별 색상이 사라지는 문제 수정.
========================================================= */
html.theme-dark #game2Screen .race-horse,
html.theme-dark .game-screen #game2Screen .race-horse,
html.theme-dark body.game2-mode #game2Screen .race-horse {
  background: var(--horse-color, #80d8ff) !important;
  border-color: rgba(255, 255, 255, 0.72) !important;
  color: #0f1b34 !important;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -10px 16px rgba(8, 16, 31, 0.08) !important;
}

html.theme-dark #game2Screen .race-horse .horse-name {
  color: #0f1b34 !important;
}

html.theme-dark #game2Screen .race-horse .horse-status {
  color: rgba(15, 27, 52, 0.72) !important;
}
