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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
  touch-action: manipulation;
}

.hidden {
  display: none !important;
}

/* ============ SPLASH SCREEN ============ */
#splash-screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  position: relative;
  cursor: pointer;
}

#splash-logo {
  max-width: 40%;
  max-height: 40%;
  object-fit: contain;
  background: transparent;
  opacity: 0;
  animation: splash-fade-in 2s ease forwards, splash-fade-out 2s ease 4s forwards;
}

@keyframes splash-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes splash-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ============ MAIN MENU ============ */
#menu-screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: url('background.jpeg') center/cover no-repeat;
  position: relative;
}

#menu-title-logo {
  max-width: 45%;
  max-height: 17%;
  object-fit: contain;
  flex-shrink: 0;
  position: absolute;
  top: 5px;
  pointer-events: none;
}

#menu-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 10px 30px 30px;
  max-width: 1200px;
  width: 90%;
}

.menu-tile {
  aspect-ratio: 1;
  border: 3px solid #000000;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 15px;
  transition: background-color 0.15s, transform 0.15s;
}

.menu-tile:hover {
  background-color: rgba(245, 245, 245, 0.9);
  transform: scale(1.03);
}

.menu-tile:active {
  background-color: rgba(232, 232, 232, 0.9);
  transform: scale(0.98);
}

.menu-tile.placeholder {
  border-color: #999999;
  cursor: default;
  opacity: 0.5;
}

.menu-tile.placeholder:hover {
  background-color: rgba(255, 255, 255, 0.8);
  transform: none;
}

.menu-tile.placeholder:active {
  background-color: rgba(255, 255, 255, 0.8);
  transform: none;
}

.tile-icon {
  flex: 1;
  width: 65%;
  max-height: 70%;
  pointer-events: none;
}

.tile-label {
  font-size: 22px;
  font-weight: normal;
  color: #000;
  margin-top: 8px;
  pointer-events: none;
}

.menu-tile.placeholder .tile-label {
  font-size: 36px;
  color: #999;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
}

#menu-exit {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 65px;
  height: 65px;
  border: 3px solid #000000;
  background: #660000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
  border-radius: 8px;
}

#menu-exit:hover {
  background-color: #880000;
}

/* ============ SCREENS ============ */
#paint-screen {
  width: 100%;
  height: 100%;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

/* Main area: canvas + sidebar */
#main-area {
  display: flex;
  flex: 1;
  min-height: 0;
}

#canvas-container {
  flex: 1;
  padding: 8px;
  min-width: 0;
}

#drawing-canvas {
  width: 100%;
  height: 100%;
  display: block;
  border: 3px solid #000000;
  background: #ffffff;
  cursor: crosshair;
}

/* Sidebar */
#sidebar {
  display: flex;
  flex-direction: column;
  width: 120px;
  flex-shrink: 0;
  padding: 8px 8px 8px 0;
  gap: 4px;
}

.sidebar-btn {
  flex: 1;
  border: 3px solid #000000;
  background: #ffffff;
  font-size: 18px;
  font-weight: normal;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  padding: 4px;
  transition: background-color 0.15s;
  position: relative;
  overflow: hidden;
}

.btn-icon {
  position: absolute;
  width: 70%;
  height: 70%;
  opacity: 0.35;
  pointer-events: none;
}

.btn-label {
  position: relative;
  z-index: 1;
}

.sidebar-btn:hover {
  background-color: #f0f0f0;
}

.sidebar-btn:active {
  background-color: #e0e0e0;
}

/* Bottom bar: palette + eraser + exit */
#bottom-bar {
  display: flex;
  align-items: center;
  padding: 8px;
  padding-top: 0;
  gap: 8px;
  height: 80px;
  flex-shrink: 0;
}

#palette {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.color-circle {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.color-circle:hover {
  transform: scale(1.1);
}

.color-circle.active {
  border: 4px solid #000000;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 5px #000000;
}

#bottom-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#btn-eraser {
  width: 80px;
  height: 55px;
  border: 3px solid #000000;
  background: #ffffff;
  font-size: 18px;
  cursor: pointer;
  transition: background-color 0.15s;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.eraser-icon {
  position: absolute;
  width: 65%;
  height: 65%;
  opacity: 0.3;
  pointer-events: none;
}

.eraser-label {
  position: relative;
  z-index: 1;
}

#btn-eraser:hover {
  background-color: #f0f0f0;
}

#btn-eraser.active {
  background-color: #e0e0e0;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 5px #000000;
}

#btn-exit {
  width: 65px;
  height: 65px;
  border: 3px solid #000000;
  background: #660000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
}

#btn-exit:hover {
  background-color: #880000;
}

/* Confirm dialog overlay */
#confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#confirm-overlay.hidden {
  display: none;
}

#confirm-box {
  background: #ffffff;
  border: 3px solid #000000;
  padding: 30px 40px;
  text-align: center;
  min-width: 350px;
}

#confirm-message {
  font-size: 22px;
  margin-bottom: 24px;
}

#confirm-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
}

#confirm-buttons button {
  font-size: 20px;
  padding: 10px 40px;
  border: 3px solid #000000;
  background: #ffffff;
  cursor: pointer;
  transition: background-color 0.15s;
}

#confirm-buttons button:hover {
  background-color: #f0f0f0;
}

/* Toast notification */
#toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: #333333;
  color: #ffffff;
  padding: 12px 30px;
  font-size: 20px;
  border-radius: 8px;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.5s;
}

#toast.hidden {
  display: none;
}

#toast.fade-out {
  opacity: 0;
}

/* ============ PUZZLE SCREENS ============ */

#puzzle-count-screen,
#puzzle-select-screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url('background.jpeg') center/cover no-repeat;
  position: relative;
}

/* Piece count grid: 4 buttons in a row */
#puzzle-count-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 30px;
  max-width: 1000px;
  width: 80%;
}

.puzzle-count-tile {
  aspect-ratio: 1;
  border: 3px solid #000000;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 15px;
  transition: background-color 0.15s, transform 0.15s;
}

.puzzle-count-tile:hover {
  background-color: rgba(245, 245, 245, 0.9);
  transform: scale(1.03);
}

.puzzle-count-tile:active {
  background-color: rgba(232, 232, 232, 0.9);
  transform: scale(0.98);
}

/* Puzzle selection grid: 2 rows x 5 columns */
#puzzle-select-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
  padding: 30px;
  max-width: 1200px;
  width: 90%;
}

.puzzle-theme-tile {
  aspect-ratio: 1;
  border: 3px solid #000000;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  overflow: hidden;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s, transform 0.15s;
}

.puzzle-theme-tile:hover {
  background-color: rgba(245, 245, 245, 0.9);
  transform: scale(1.03);
}

.puzzle-theme-tile:active {
  background-color: rgba(232, 232, 232, 0.9);
  transform: scale(0.98);
}

.puzzle-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
  pointer-events: none;
  background: #ffffff;
}

/* Shared exit/back button for puzzle screens */
.puzzle-exit-btn {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 65px;
  height: 65px;
  border: 3px solid #000000;
  background: #660000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
  border-radius: 8px;
  z-index: 50;
}

.puzzle-exit-btn:hover {
  background-color: #880000;
}

/* Guide toggle button */
.puzzle-toggle-btn {
  position: absolute;
  bottom: 20px;
  right: 95px;
  width: 65px;
  height: 65px;
  border: 3px solid #000000;
  background: #005599;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
  border-radius: 8px;
  z-index: 50;
}

.puzzle-toggle-btn:hover {
  background-color: #0077cc;
}

.puzzle-toggle-btn.guide-off {
  background: #555555;
}

.puzzle-toggle-btn.guide-off:hover {
  background-color: #777777;
}

/* ============ PUZZLE GAME SCREEN ============ */
#puzzle-game-screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #333333;
  position: relative;
}

#puzzle-game-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 10px;
}

#puzzle-board {
  position: relative;
  border: 2px solid #555;
}

.puzzle-cell {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-sizing: border-box;
}

.puzzle-guide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.2;
  pointer-events: none;
  z-index: 0;
}

.puzzle-piece {
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.3);
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
}

.puzzle-piece.placed {
  cursor: default;
  border-color: rgba(255, 255, 255, 0.35);
  z-index: 5;
}

.puzzle-piece.dragging {
  cursor: grabbing;
  z-index: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* Pieces bar at bottom */
#puzzle-pieces-bar {
  height: 130px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #222222;
  flex-shrink: 0;
}

#fireworks-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

/* ============ SETTINGS ============ */

/* Cogwheel button - bottom left of menu */
#menu-settings {
  position: absolute;
  bottom: 20px;
  left: 20px;
  width: 65px;
  height: 65px;
  border: 3px solid #000000;
  background: #005599;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
  border-radius: 8px;
}

#menu-settings:hover {
  background-color: #0077cc;
}

/* Settings screen */
#settings-screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: url('background.jpeg') center/cover no-repeat;
  position: relative;
}

#settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 30px;
  max-width: 900px;
  width: 80%;
}

.settings-card {
  aspect-ratio: 1;
  border: 3px solid #000000;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 15px;
  transition: background-color 0.15s, transform 0.15s;
}

.settings-card:hover {
  background-color: rgba(245, 245, 245, 0.9);
  transform: scale(1.03);
}

.settings-card:active {
  background-color: rgba(232, 232, 232, 0.9);
  transform: scale(0.98);
}

/* ============ PIN PAD ============ */
#pin-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#pin-box {
  background: #ffffff;
  border: 3px solid #000000;
  border-radius: 16px;
  padding: 30px 40px;
  text-align: center;
  position: relative;
  min-width: 320px;
}

#pin-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#pin-title {
  font-size: 24px;
  margin-bottom: 20px;
  color: #333;
}

#pin-display {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 24px;
}

.pin-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid #333;
  background: transparent;
  transition: background-color 0.15s, border-color 0.15s;
}

.pin-dot.filled {
  background: #333;
}

.pin-dot.error {
  background: #cc0000;
  border-color: #cc0000;
}

#pin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 280px;
  margin: 0 auto;
}

.pin-btn {
  width: 75px;
  height: 75px;
  border: 2px solid #333;
  border-radius: 50%;
  background: #f5f5f5;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.1s;
}

.pin-btn:hover {
  background: #e0e0e0;
}

.pin-btn:active {
  background: #ccc;
}

.pin-backspace {
  font-size: 24px;
}

.pin-spacer {
  width: 75px;
  height: 75px;
}

/* ============ CAMERA OVERLAY ============ */
#camera-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#camera-box {
  position: relative;
  width: 80%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#camera-close {
  position: absolute;
  top: -50px;
  right: 0;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#camera-video,
#camera-preview-img {
  width: 100%;
  max-height: 60vh;
  border-radius: 12px;
  object-fit: contain;
  background: #000;
}

#camera-controls {
  display: flex;
  gap: 24px;
  margin-top: 20px;
  justify-content: center;
}

.camera-btn {
  width: 60px;
  height: 60px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.camera-btn:hover {
  opacity: 0.8;
}

/* ============ DELETE IMAGES OVERLAY ============ */
#delete-images-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#delete-images-box {
  background: #ffffff;
  border: 3px solid #000000;
  border-radius: 16px;
  padding: 30px;
  position: relative;
  width: 80%;
  max-width: 700px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

#delete-images-close,
#custom-viewer-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-title {
  font-size: 22px;
  margin-bottom: 20px;
  color: #333;
  text-align: center;
}

#delete-images-grid,
#custom-viewer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  overflow-y: auto;
  max-height: 50vh;
  padding: 4px;
}

.delete-thumb,
.custom-thumb {
  aspect-ratio: 1;
  border: 3px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s;
}

.delete-thumb img,
.custom-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.delete-thumb.selected {
  border-color: #cc0000;
  box-shadow: 0 0 0 2px #cc0000;
}

.delete-thumb.selected::after {
  content: '\2713';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  background: #cc0000;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.custom-thumb:hover {
  border-color: #005599;
  transform: scale(1.03);
}

#delete-images-confirm {
  margin-top: 16px;
  padding: 12px 32px;
  font-size: 18px;
  font-weight: bold;
  color: white;
  background: #cc0000;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  align-self: center;
}

#delete-images-confirm:hover {
  background: #aa0000;
}

.no-images-msg {
  text-align: center;
  color: #999;
  font-size: 18px;
  padding: 40px;
  grid-column: 1 / -1;
}

/* ============ CUSTOM VIEWER OVERLAY ============ */
#custom-viewer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#custom-viewer-box {
  background: #ffffff;
  border: 3px solid #000000;
  border-radius: 16px;
  padding: 30px;
  position: relative;
  width: 80%;
  max-width: 700px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

/* ============ PUZZLE SPECIAL TILES ============ */
.puzzle-special-tile {
  aspect-ratio: 1;
  border: 3px solid #000000;
  border-radius: 20px;
  background: rgba(200, 230, 255, 0.85);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  gap: 8px;
  transition: background-color 0.15s, transform 0.15s;
}

.puzzle-special-tile:hover {
  background-color: rgba(180, 215, 245, 0.95);
  transform: scale(1.03);
}

.puzzle-special-tile:active {
  background-color: rgba(160, 200, 235, 0.95);
  transform: scale(0.98);
}

.puzzle-special-tile .tile-icon {
  width: 50%;
  height: auto;
  flex: none;
  max-height: 55%;
}

.puzzle-special-tile .tile-label {
  font-size: 16px;
  margin-top: 0;
}

/* ============================================================
   PIANO / MUSIC TOOL
   ============================================================ */

#music-game-screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #1a1a2e;
  position: relative;
  overflow: hidden;
}

/* ---- Song selection bar (top 20%) — 2 rows × 5 columns ---- */
#music-song-bar {
  height: 20%;
  min-height: 90px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  background: #11112a;
  border-bottom: 2px solid #333;
  flex-shrink: 0;
  box-sizing: border-box;
}

.music-song-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 6px;
  border: 2px solid #555;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: #ccc;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.music-song-emoji {
  font-size: 1.3rem;
  line-height: 1.1;
}

.music-song-name {
  font-size: 0.62rem;
  text-align: center;
  word-break: break-word;
  line-height: 1.2;
}

.music-song-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: #888;
  color: #fff;
}

.music-song-btn.active {
  background: rgba(34,136,204,0.35);
  border-color: #2288CC;
  color: #fff;
}

/* ---- Highway + sidebar wrapper (full remaining height) ---- */
#music-highway-wrapper {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-height: 0;
}

/* ---- Left column: canvas + piano, same width as canvas columns ---- */
#music-left-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

#music-highway-canvas {
  display: block;
  flex: 1;
  min-height: 0;
}

/* ---- Sidebar (right column, over highway) ---- */
#music-sidebar {
  width: 78px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 14px;
  background: #0e0e22;
  border-left: 2px solid #333;
}

.music-toggle-btn {
  width: 54px;
  height: 54px;
  border: 2.5px solid #555;
  border-radius: 10px;
  background: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.music-toggle-btn:hover {
  background: #444;
  border-color: #888;
}

.music-toggle-active {
  background: #1a6e3a !important;
  border-color: #2ecc71 !important;
}

#music-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: rgba(255,255,255,0.9);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  line-height: 1.1;
}

.music-score-divider {
  width: 38px;
  height: 2px;
  background: rgba(255,255,255,0.45);
  border-radius: 1px;
  flex-shrink: 0;
}

.music-exit-btn {
  width: 54px;
  height: 54px;
  border: 2.5px solid #000;
  border-radius: 10px;
  background: #660000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.music-exit-btn:hover {
  background: #880000;
}

/* ---- Piano keyboard (bottom 30%) ---- */
#music-piano {
  height: 30%;
  min-height: 110px;
  flex-shrink: 0;
  position: relative;
  background: #111;
  border-top: 3px solid #444;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.music-key {
  position: absolute;
  top: 0;
  cursor: pointer;
  border-radius: 0 0 6px 6px;
  transition: background-color 0.04s;
  box-sizing: border-box;
}

.music-white-key {
  bottom: 0;
  background: #f2f0e8;
  border: 1px solid #bbb;
  border-top: none;
  z-index: 1;
}

.music-white-key.music-key-active {
  transform: scaleY(0.97);
  transform-origin: top center;
}


.music-key-dot {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  opacity: 0.65;
  pointer-events: none;
}

.music-key-label {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #888;
  pointer-events: none;
  font-family: 'Segoe UI', sans-serif;
  font-weight: 600;
}

/* ============================================================
   SETTINGS: Piano autoplay toggle row
   ============================================================ */

#settings-piano-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  margin: 12px auto 0;
  max-width: 600px;
  width: 90%;
  background: rgba(255,255,255,0.8);
  border: 3px solid #000;
  border-radius: 20px;
}

.settings-toggle-label {
  display: flex;
  align-items: center;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #222;
  gap: 10px;
}

.settings-toggle-switch {
  position: relative;
  display: inline-block;
  width: 58px;
  height: 30px;
  flex-shrink: 0;
}

.settings-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 30px;
  cursor: pointer;
  transition: background 0.2s;
}

.settings-toggle-slider:before {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.settings-toggle-switch input:checked + .settings-toggle-slider {
  background: #008844;
}

.settings-toggle-switch input:checked + .settings-toggle-slider:before {
  transform: translateX(28px);
}
