/* ---------- Pause menu ---------- */
#pause-menu {
  position: fixed;
  inset: 0;
  z-index: 715;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: "Georgia", serif;
}
#pause-menu.open {
  display: flex;
}
.pause-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(60, 10, 50, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.pause-card {
  position: relative;
  width: min(520px, 94vw);
  max-height: min(760px, 92dvh);
  overflow-y: auto;
  padding: 22px 24px;
  background: linear-gradient(180deg, #fff7fb 0%, #ffe6f2 100%);
  border: 4px solid #ff8ac0;
  border-radius: 26px;
  color: #5a1c3a;
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.45),
    0 0 80px rgba(255, 138, 192, 0.5);
}
.pause-card h2 {
  margin: 0 0 14px;
  font-size: 26px;
  color: #b03579;
  text-align: center;
}
.pause-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.pause-actions .pause-btn {
  margin: 0;
}
.pause-actions .pause-btn.primary {
  grid-column: 1 / -1;
}
.pause-section {
  margin: 20px 0 8px;
  font-size: 16px;
  color: #b03579;
  text-align: center;
}
.pause-btn {
  display: block;
  width: 100%;
  margin: 10px 0;
  padding: 16px 20px;
  min-height: 56px;
  background: linear-gradient(180deg, #fff 0%, #ffe6f2 100%);
  color: #b03579;
  font-family: "Georgia", serif;
  font-size: 17px;
  font-weight: 700;
  border: 2px solid #ff8ac0;
  border-radius: 14px;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 3px 0 rgba(176, 53, 121, 0.18);
  transition:
    transform 0.16s cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 0.16s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.pause-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 5px 0 rgba(176, 53, 121, 0.18),
    0 6px 14px rgba(255, 138, 192, 0.42);
}
.pause-btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 1px 0 rgba(176, 53, 121, 0.18);
}
.pause-btn:focus-visible {
  outline: 3px solid rgba(123, 224, 200, 0.85);
  outline-offset: 3px;
}
.pause-btn.primary {
  background: linear-gradient(180deg, #ff8ac0 0%, #d44e8f 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow:
    0 3px 0 rgba(120, 30, 80, 0.32),
    0 4px 14px rgba(212, 78, 143, 0.4);
}
.pause-btn.primary:hover {
  box-shadow:
    0 5px 0 rgba(120, 30, 80, 0.32),
    0 6px 16px rgba(212, 78, 143, 0.5);
}
.pause-confirm {
  margin-top: 12px;
  padding: 12px;
  border: 2px solid rgba(255, 216, 107, 0.58);
  border-radius: 14px;
  background: rgba(255, 247, 200, 0.72);
  text-align: center;
}
.pause-confirm[hidden] {
  display: none;
}
.pause-confirm p {
  margin: 0 0 10px;
  color: #6b2247;
  font:
    900 14px/1.25 "Arial Rounded MT Bold",
    "Trebuchet MS",
    Arial,
    sans-serif;
}
.pause-confirm-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.pause-confirm-actions .pause-btn {
  margin: 0;
}
.pause-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0;
  font-size: 14px;
}
.pause-row label {
  font-weight: 700;
  color: #6b2247;
}
.pause-row input[type="range"] {
  flex: 1;
  height: 32px;
  accent-color: #ff5b8d;
  touch-action: manipulation;
}
.pause-row select {
  padding: 10px 14px;
  min-height: 44px;
  border: 2px solid #ff8ac0;
  border-radius: 8px;
  background: #fff;
  color: #5a1c3a;
  font-family: "Georgia", serif;
  font-size: 15px;
  touch-action: manipulation;
}
.pause-toggle-row {
  justify-content: flex-start;
  margin-top: 14px;
}
.pause-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 700;
  color: #6b2247;
  cursor: pointer;
  touch-action: manipulation;
}
.pause-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.pause-switch-track {
  width: 48px;
  height: 28px;
  padding: 3px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(176, 53, 121, 0.2);
  border: 2px solid rgba(176, 53, 121, 0.28);
  transition:
    background 0.18s ease,
    border-color 0.18s ease;
}
.pause-switch-thumb {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(90, 28, 58, 0.28);
  transform: translateX(0);
  transition: transform 0.18s ease;
}
.pause-switch input:checked + .pause-switch-track {
  background: rgba(123, 224, 200, 0.42);
  border-color: rgba(74, 174, 154, 0.8);
}
.pause-switch input:checked + .pause-switch-track .pause-switch-thumb {
  transform: translateX(20px);
}
.pause-switch input:focus-visible + .pause-switch-track {
  outline: 3px solid rgba(123, 224, 200, 0.85);
  outline-offset: 3px;
}
.pause-setting-note {
  margin: -4px 0 10px;
  color: #6b2247;
  font-size: 12px;
  line-height: 1.35;
}
.pause-controls-help {
  margin: 0;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #6b2247;
}
.pause-details {
  margin: 10px 0;
  border: 2px solid rgba(176, 53, 121, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  overflow: hidden;
}
.pause-details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  color: #6b2247;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  list-style: none;
}
.pause-details summary::-webkit-details-marker {
  display: none;
}
.pause-details summary::after {
  content: "›";
  color: #b03579;
  font-size: 24px;
  line-height: 1;
  transition: transform 0.18s ease;
}
.pause-details[open] summary::after {
  transform: rotate(90deg);
}
.pause-details summary:focus-visible {
  outline: 3px solid rgba(123, 224, 200, 0.85);
  outline-offset: -3px;
}
.pause-details .pause-controls-help {
  border-top: 1px solid rgba(176, 53, 121, 0.14);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.42);
}
.pause-details .achievement-grid {
  margin: 0;
  padding: 0 12px 12px;
}
.achievement-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
.achievement {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.4);
  border: 2px solid rgba(176, 53, 121, 0.25);
  font-size: 22px;
  color: #b03579;
  filter: grayscale(1) opacity(0.4);
  position: relative;
  cursor: help;
}
.achievement.unlocked {
  filter: none;
  background: linear-gradient(135deg, #fff7e0 0%, #ffe0a0 100%);
  border-color: #ffd86b;
  box-shadow: 0 0 8px rgba(255, 216, 107, 0.5);
}
.achievement[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #5a1c3a;
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-family: "Inter", sans-serif;
  z-index: 10;
}

body.cozy-mode canvas {
  filter: saturate(0.86) brightness(0.93) contrast(0.96);
}
body.cozy-mode .hud,
body.cozy-mode #touch-controls,
body.cozy-mode .game-center-panel,
body.cozy-mode .pause-card {
  filter: saturate(0.9);
}
body.cozy-mode .dust-toast,
body.cozy-mode .helper-toast,
body.cozy-mode .pass-toast {
  animation-duration: 0.28s;
}
body.cozy-mode * {
  scroll-behavior: auto;
}

@media (prefers-reduced-motion: reduce) {
  .pause-switch-track,
  .pause-switch-thumb,
  .pause-details summary::after {
    transition: none;
  }
  body.cozy-mode .dust-toast,
  body.cozy-mode .helper-toast,
  body.cozy-mode .pass-toast {
    animation: none;
  }
}

@media (max-width: 520px) {
  .pause-card {
    width: min(94vw, 430px);
    padding: 18px;
  }
  .pause-actions {
    grid-template-columns: 1fr;
  }
  .pause-confirm-actions {
    grid-template-columns: 1fr;
  }
  .pause-row {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }
  .pause-row select,
  .pause-row input[type="range"] {
    width: 100%;
  }
}
