@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@700;900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b1224; }

.game-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#renderCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}

/* HUD */
#hud {
  position: absolute;
  top: 16px; left: 16px; right: 16px;
  display: flex; justify-content: space-between; align-items: flex-start;
  font-family: 'Nunito', sans-serif; font-weight: 900; color: #fff;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.5s;
}
#hud.show { opacity: 1; }

.hud-left {
  display: flex; flex-direction: column; gap: 8px;
}
.hud-zone {
  background: rgba(0,0,0,0.4); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  padding: 10px 18px; border-radius: 12px;
  font-size: 16px; letter-spacing: 1.5px;
  color: #FFD740;
  border: 1px solid rgba(255,255,255,0.08);
  display: inline-block; align-self: flex-start;
}
.hud-objective {
  background: rgba(0,0,0,0.4); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  padding: 9px 16px; border-radius: 10px;
  border: 1px solid rgba(255, 215, 64, 0.25);
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 13px; color: rgba(255,255,255,0.92);
  font-weight: 700; letter-spacing: 0.5px;
  align-self: flex-start;
}
.hud-objective.hide { opacity: 0; pointer-events: none; transition: opacity 0.5s; }
.objective-icon {
  color: #FFD740;
  font-size: 18px;
  animation: objectivePulse 1.4s ease-in-out infinite;
}
@keyframes objectivePulse { 0%,100% { transform: scale(1) } 50% { transform: scale(1.2) } }
.hud-controls {
  background: rgba(0,0,0,0.4);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  padding: 10px 16px; border-radius: 12px;
  font-size: 12px; font-weight: 700;
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.08);
  max-width: 60%; text-align: right;
}

/* Loading screen */
#loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #0a142b 0%, #1a2845 100%);
  z-index: 100;
  transition: opacity 0.5s;
}
#loading.fade { opacity: 0; pointer-events: none; }

.loading-card {
  text-align: center;
  font-family: 'Nunito', sans-serif;
  color: #fff;
  padding: 30px;
}
.loading-card h1 {
  font-size: 36px; font-weight: 900;
  color: #FFD740;
  letter-spacing: 1px;
  text-shadow: 3px 3px 0 #E65100, 0 0 30px rgba(255,215,0,0.3);
  margin-bottom: 4px;
}
.loading-card .sub {
  font-size: 14px; font-weight: 700;
  color: rgba(255,255,255,0.5);
  letter-spacing: 3px;
  margin-bottom: 30px;
}

.bar {
  width: 340px; height: 12px;
  background: rgba(255,255,255,0.08);
  border-radius: 6px; overflow: hidden;
  margin: 0 auto 14px;
}
.bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #FFD740, #FF9800);
  transition: width 0.2s ease;
}
.loading-card .status {
  font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.6);
}

/* ─── Touch Controls (mobile / iPad) ─── */
#touch-controls {
  position: absolute;
  inset: auto 0 0 0;
  display: none;  /* Hidden by default; shown on touch devices */
  z-index: 10;
  pointer-events: none;
  padding: 20px 24px 64px;  /* lifted up so the stick/buttons aren't cut off at the bottom */
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
  justify-content: space-between;
  align-items: flex-end;
}
#touch-controls.show { display: flex; }

#touch-stick {
  width: 140px; height: 140px;
  background: rgba(0,0,0,0.35);
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  position: relative;
  pointer-events: auto;
  touch-action: none;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
#touch-stick-knob {
  width: 58px; height: 58px;
  background: rgba(255,215,64,0.85);
  border: 3px solid rgba(255,255,255,0.9);
  border-radius: 50%;
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: background 0.1s;
}

.touch-buttons {
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: auto;
}
.touch-btn {
  width: 88px; height: 88px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.9);
  background: rgba(0,0,0,0.4);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 13px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.touch-btn:active {
  background: rgba(255,215,64,0.8);
  color: #1a1a2e;
  transform: scale(0.95);
}

#touch-jump { background: rgba(76, 175, 80, 0.55); }
#touch-dance { background: rgba(233, 30, 99, 0.55); }
#touch-sprint { background: rgba(33, 150, 243, 0.55); }
#touch-sprint.active { background: rgba(33, 150, 243, 0.9); color: #fff; }

/* Small circular pause button in the top-right corner */
.touch-pause-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.9);
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 2px;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.touch-pause-btn:active { transform: scale(0.94); background: rgba(255,215,64,0.7); color: #1a1a2e; }

/* ─── Start button (revealed when loading done) ─── */
.start-btn {
  display: none;
  margin: 20px auto 0;
  padding: 14px 36px;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 18px;
  color: #1a1a2e;
  background: linear-gradient(135deg, #FFD740 0%, #FFC107 100%);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 1px;
  box-shadow: 0 8px 28px rgba(255, 193, 7, 0.4), inset 0 2px 0 rgba(255,255,255,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.start-btn.show { display: inline-block; animation: startPop 0.5s ease-out; }
.start-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(255, 193, 7, 0.55), inset 0 2px 0 rgba(255,255,255,0.5); }
.start-btn:active { transform: scale(0.96); }

.skip-btn {
  display: none;
  margin: 12px auto 0;
  padding: 8px 18px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s, border-color 0.15s;
}
.skip-btn.show { display: inline-block; }
.skip-btn:hover { color: #FFD740; border-color: rgba(255, 215, 64, 0.5); }

@keyframes startPop {
  0% { opacity: 0; transform: scale(0.7); }
  60% { transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

/* ─── Chapter title card ─── */
#title-card {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a2845 0%, #050a18 100%);
  z-index: 80;
  font-family: 'Nunito', sans-serif;
  color: #fff;
  text-align: center;
  padding: 0 20px;
}
#title-card.show {
  display: flex;
  animation: titleFadeIn 0.8s ease-out;
}
#title-card.fade-out {
  animation: titleFadeOut 1s ease-in forwards;
}
.chapter-eyebrow {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 8px;
  color: #FFD740;
  margin-bottom: 14px;
  animation: slideUp 0.7s 0.1s ease-out backwards;
}
.chapter-title {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 24px;
  color: #fff;
  text-shadow: 0 4px 24px rgba(255, 215, 64, 0.4);
  animation: slideUp 0.8s 0.25s ease-out backwards;
}
.chapter-sub {
  font-size: 16px;
  color: rgba(255,255,255,0.6);
  max-width: 480px;
  font-weight: 700;
  animation: slideUp 0.8s 0.45s ease-out backwards;
}
@keyframes titleFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes titleFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ─── Speech bubble (over the canvas) ─── */
#speech-bubble {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%) scale(0.85);
  background: #fff;
  color: #1a1a2e;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 28px;
  padding: 20px 32px;
  border-radius: 28px;
  border: 4px solid #1a1a2e;
  box-shadow: 0 8px 0 #1a1a2e, 0 12px 28px rgba(0,0,0,0.3);
  display: none;
  z-index: 20;
  pointer-events: none;
  letter-spacing: 0.5px;
  /* Wrap long lines instead of overflowing the screen */
  max-width: min(720px, calc(100vw - 40px));
  text-align: center;
  line-height: 1.25;
  white-space: normal;
  word-wrap: break-word;
}
#speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  border: 14px solid transparent;
  border-top-color: #1a1a2e;
}
#speech-bubble::before {
  content: 'tap / space to continue';
  position: absolute;
  bottom: -38px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  animation: hintBlink 1.4s ease-in-out infinite;
}
@keyframes hintBlink { 0%,100% { opacity: 0.4 } 50% { opacity: 0.9 } }
#speech-bubble.show {
  display: block;
  animation: bubblePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
#speech-bubble.hide {
  animation: bubblePop 0.3s ease-in reverse forwards;
}
@keyframes bubblePop {
  0% { transform: translateX(-50%) scale(0.4); opacity: 0; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ─── Black fade overlay (between cutscene phases) ─── */
#fade-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.8s ease;
}
#fade-overlay.show { opacity: 1; }

/* ─── Pause menu ─── */
#pause-menu {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 10, 24, 0.75);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 60;
  font-family: 'Nunito', sans-serif;
}
#pause-menu.show { display: flex; }
.pause-card {
  background: rgba(20, 30, 60, 0.92);
  border: 2px solid rgba(255, 215, 64, 0.4);
  border-radius: 22px;
  padding: 32px 40px;
  text-align: center;
  width: min(720px, calc(100vw - 40px));
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  color: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.pause-card h2 {
  font-size: 28px; font-weight: 900;
  color: #FFD740;
  letter-spacing: 6px;
  margin-bottom: 20px;
}

/* Tab bar */
.pause-tabs {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.pause-tab {
  padding: 8px 14px;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 1.5px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.pause-tab:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.pause-tab.active {
  background: rgba(255, 215, 64, 0.85);
  color: #1a1a2e;
  border-color: #FFD740;
}

/* Panels */
.pause-panel { display: block; }
.pause-panel.hide { display: none; }
.panel-intro {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 18px;
  line-height: 1.5;
}
.panel-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 16px;
  font-style: italic;
}

/* GAME panel actions */
.pause-action {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 10px auto;
  padding: 12px 16px;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 1px;
  background: rgba(255, 215, 64, 0.15);
  color: #fff;
  border: 1.5px solid rgba(255, 215, 64, 0.4);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.pause-action:hover { background: rgba(255, 215, 64, 0.35); color: #1a1a2e; }
.pause-action:active { transform: scale(0.97); }
.pause-action.big { font-size: 16px; padding: 16px; background: linear-gradient(135deg, #FFD740, #FFC107); color: #1a1a2e; border: none; }
.pause-action.danger { background: rgba(229, 75, 75, 0.15); border-color: rgba(229, 75, 75, 0.5); color: #FFB0B0; }
.pause-action.danger:hover { background: rgba(229, 75, 75, 0.4); color: #fff; }

/* SAVE SLOTS — Kirby-style file picker */
.save-slots { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.save-slot {
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: border-color 0.15s, background 0.15s;
}
.save-slot:hover { border-color: rgba(255, 215, 64, 0.4); background: rgba(255, 215, 64, 0.05); }
.save-slot.has-data { background: rgba(111, 168, 200, 0.08); border-color: rgba(111, 168, 200, 0.4); }
.save-slot.active { border-color: #FFD740; box-shadow: 0 0 0 2px rgba(255, 215, 64, 0.25) inset; }
.slot-num {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #FFD740;
  flex-shrink: 0;
  min-width: 60px;
  text-align: left;
}
.slot-body { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 14px; }
.slot-info { text-align: left; flex: 1; }
.slot-chapter { font-size: 16px; font-weight: 900; color: #fff; }
.slot-meta { font-size: 11px; color: rgba(255, 255, 255, 0.55); margin-top: 4px; letter-spacing: 0.5px; }
.slot-actions { display: flex; gap: 6px; flex-shrink: 0; }
.slot-actions button {
  padding: 7px 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.slot-actions button:hover:not(:disabled) { background: rgba(255, 215, 64, 0.3); color: #1a1a2e; border-color: #FFD740; }
.slot-actions button:active:not(:disabled) { transform: scale(0.95); }
.slot-actions button:disabled { opacity: 0.3; cursor: not-allowed; }
.slot-actions .slot-save { background: rgba(75, 229, 133, 0.15); color: #B0FFD0; border-color: rgba(75, 229, 133, 0.4); }
.slot-actions .slot-load { background: rgba(111, 168, 200, 0.15); color: #B0DFFF; border-color: rgba(111, 168, 200, 0.4); }
.slot-actions .slot-delete { background: rgba(229, 75, 75, 0.1); color: #FFB0B0; border-color: rgba(229, 75, 75, 0.3); }

/* REPLAY CHAPTERS panel */
.replay-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; text-align: left; }
.replay-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  font-family: 'Nunito', sans-serif;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.replay-row:hover { background: rgba(255, 215, 64, 0.15); border-color: rgba(255, 215, 64, 0.5); color: #fff; }
.replay-row:active { transform: scale(0.98); }
.replay-num {
  font-weight: 900;
  letter-spacing: 1.5px;
  font-size: 12px;
  color: #FFD740;
  flex-shrink: 0;
  min-width: 50px;
}
.replay-name { flex: 1; font-weight: 700; font-size: 14px; }
.replay-go { font-weight: 900; font-size: 12px; letter-spacing: 1px; color: rgba(255, 215, 64, 0.7); flex-shrink: 0; }
.replay-row:hover .replay-go { color: #FFE99C; }

/* Locked state — Replay Chapters stays locked until the game is beaten */
.pause-tab:disabled, .pause-tab.locked { opacity: 0.4; cursor: not-allowed; }
.pause-tab:disabled:hover { background: transparent; color: rgba(255, 255, 255, 0.55); }
.pause-action:disabled, .pause-action.locked { opacity: 0.5; cursor: not-allowed; }
.pause-action:disabled:hover { background: rgba(255, 255, 255, 0.06); }
.replay-row:disabled, .replay-row.locked { opacity: 0.4; cursor: not-allowed; }
.replay-row:disabled:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.85); transform: none; }
.replay-row:disabled:hover .replay-go { color: rgba(255, 215, 64, 0.7); }

/* Taunt prompt — appears near Scratchett's jail cell in free-play */
#taunt-prompt {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%) translateY(10px);
  padding: 10px 20px;
  background: rgba(11, 18, 36, 0.82);
  border: 2px solid rgba(255, 215, 64, 0.6);
  border-radius: 999px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  letter-spacing: 0.5px;
  z-index: 24;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}
#taunt-prompt.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; cursor: pointer; }
#taunt-prompt .taunt-key {
  display: inline-block;
  min-width: 22px;
  padding: 2px 8px;
  margin: 0 2px;
  background: #FFD740;
  color: #1a1a2e;
  border-radius: 7px;
  font-weight: 900;
  text-align: center;
}
#taunt-prompt .taunt-tap {
  display: inline-block;
  padding: 4px 14px;
  background: linear-gradient(135deg, #FFD740, #FFC107);
  color: #1a1a2e;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 1px;
}

/* Collected-acorns counter (free-play) */
#acorn-hud {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 8px 16px;
  background: rgba(11, 18, 36, 0.78);
  border: 2px solid rgba(255, 215, 64, 0.55);
  border-radius: 999px;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 17px;
  color: #FFE99C;
  z-index: 22;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  -webkit-user-select: none;
  user-select: none;
}
#acorn-hud.show { opacity: 1; }

/* Fast-travel button + menu (free-play, once the portal is unlocked) */
#travel-btn {
  position: absolute; top: 16px; left: 16px;
  padding: 8px 16px;
  background: rgba(11, 18, 36, 0.82); border: 2px solid rgba(155, 107, 255, 0.7);
  border-radius: 999px; font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 15px;
  color: #D9C7FF; z-index: 23; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity 0.2s;
  -webkit-user-select: none; user-select: none;
}
#travel-btn.show { opacity: 1; pointer-events: auto; }
#travel-btn:hover { background: rgba(155, 107, 255, 0.25); }
#travel-menu {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: rgba(8, 10, 24, 0.82); z-index: 55; opacity: 0; pointer-events: none; transition: opacity 0.2s;
  font-family: 'Nunito', sans-serif;
}
#travel-menu.show { opacity: 1; pointer-events: auto; }
#travel-menu .travel-title { font-size: 28px; font-weight: 900; color: #D9C7FF; letter-spacing: 4px; margin-bottom: 8px; }
#travel-menu .travel-opt {
  min-width: 280px; padding: 16px 28px; font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 18px;
  background: linear-gradient(135deg, #9B6BFF, #7A3AFF); color: #fff; border: none; border-radius: 16px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(122, 58, 255, 0.4); transition: transform 0.12s;
}
#travel-menu .travel-opt:hover { transform: translateY(-2px); }
#travel-menu .travel-close {
  margin-top: 8px; padding: 12px 24px; font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 15px;
  background: transparent; color: rgba(255, 255, 255, 0.7); border: 1.5px solid rgba(255, 255, 255, 0.3); border-radius: 999px; cursor: pointer;
}

/* 2-Player message + character select */
#twop-msg {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  max-width: 420px; padding: 18px 26px; text-align: center;
  background: rgba(11, 18, 36, 0.92); border: 2px solid rgba(229, 57, 53, 0.7); border-radius: 16px;
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 17px; color: #fff;
  z-index: 65; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
#twop-msg.show { opacity: 1; }
#twop-select {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: rgba(8, 10, 24, 0.9); z-index: 62; opacity: 0; pointer-events: none; transition: opacity 0.2s; font-family: 'Nunito', sans-serif;
}
#twop-select.show { opacity: 1; pointer-events: auto; }
#twop-select .twop-title { font-size: 30px; font-weight: 900; color: #FFD740; letter-spacing: 5px; }
#twop-select .twop-cards { display: flex; gap: 22px; }
#twop-select .twop-card {
  width: 180px; padding: 22px 16px; text-align: center; font-size: 40px;
  background: rgba(255, 255, 255, 0.06); border: 2px solid rgba(255, 215, 64, 0.5); border-radius: 18px; color: #fff;
}
#twop-select .twop-card .twop-pl { font-size: 13px; font-weight: 900; letter-spacing: 2px; color: #FFD740; margin: 8px 0 4px; }
#twop-select .twop-card b { font-size: 22px; display: block; }
#twop-select .twop-card small { font-size: 12px; color: rgba(255, 255, 255, 0.6); display: block; margin-top: 6px; }
#twop-select .twop-play {
  padding: 16px 40px; font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 20px;
  background: linear-gradient(135deg, #FFD740, #FFC107); color: #1a1a2e; border: none; border-radius: 999px; cursor: pointer;
}
#twop-select .twop-cancel {
  padding: 10px 22px; font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 14px;
  background: transparent; color: rgba(255, 255, 255, 0.7); border: 1.5px solid rgba(255, 255, 255, 0.3); border-radius: 999px; cursor: pointer;
}

/* CONTROLS panel */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  text-align: left;
}
.control-section {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 18px;
}
.control-section h3 {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #FFD740;
  margin-bottom: 12px;
}
.control-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 12px; color: rgba(255, 255, 255, 0.85); }
.control-row .key {
  font-weight: 900;
  background: rgba(255, 215, 64, 0.15);
  color: #FFE99C;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* CONNECT panel */
.connect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  text-align: left;
  margin-top: 8px;
}
.connect-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 18px;
}
.connect-card h3 { font-size: 13px; font-weight: 900; color: #FFD740; margin-bottom: 10px; letter-spacing: 1px; }
.connect-card ol, .connect-card p { font-size: 12px; color: rgba(255, 255, 255, 0.8); line-height: 1.5; padding-left: 16px; }
.connect-card p { padding-left: 0; }
.connect-card b { color: #FFE99C; }

.pause-hint {
  margin-top: 16px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 1px;
}
