/* ----------------------------
   Silentap - Styles
---------------------------- */

:root {
  color-scheme: only light;
  --menu-top: max(16px, env(safe-area-inset-top, 0px));
  --menu-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  --menu-left: max(16px, env(safe-area-inset-left, 0px));
  --menu-right: max(16px, env(safe-area-inset-right, 0px));
}

html,
body {
  color-scheme: only light;
  height: 100%;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background-color: #ffffff;
}

body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #f9fcff 0%, #f2f6fb 45%, #edf2f8 100%);
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  color: #1f2a37;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  position: fixed;
  inset: 0;
  min-height: 100dvh;
}

.hidden {
  display: none !important;
}


button,
a {
  -webkit-touch-callout: none;
  user-select: none;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  padding: var(--menu-top) var(--menu-right) var(--menu-bottom) var(--menu-left);
  box-sizing: border-box;
}

.card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #dbe6f2;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 14px 34px rgba(33, 52, 74, 0.14);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card h2 {
  margin: 0;
  font-size: 22px;
}

.card p {
  margin: 0;
  color: #555;
}

#profile-name {
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #cfcfcf;
  font-size: 16px;
}

#profile-save,
#profile-cancel,
#resume-button,
#pause-menu,
#mode-normal,
#mode-split,
#mode-pressure,
#mode-blackhole,
#mode-upward,
#mode-back,
#intro-accept,
#intro-decline,
#mode-explain-start,
#mode-explain-back {
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(180deg, #2b4b6d 0%, #203a56 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

#pause-menu.secondary,
#profile-cancel.secondary,
#mode-back.secondary,
#intro-decline.secondary,
#mode-explain-back.secondary {
  background: #e9e9e9;
  color: #333;
}

#mode-normal.active,
#mode-split.active,
#mode-pressure.active,
#mode-blackhole.active,
#mode-upward.active {
  outline: 2px solid #d6ae76;
}

#profile-error {
  color: #b40000;
  font-size: 14px;
}


.profile-actions {
  display: flex;
  gap: 10px;
}

.profile-actions button {
  flex: 1;
}


.intro-card {
  width: min(620px, calc(100vw - 40px));
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  gap: 12px;
}


.intro-preview {
  border-radius: 14px;
  border: 1px solid #d0deec;
  background: linear-gradient(180deg, #f9fcff 0%, #eef4fb 100%);
  padding: 10px;
}

.intro-preview-label {
  font-weight: 700;
  color: #2c4663;
  margin-bottom: 8px;
}

.intro-preview-stage {
  position: relative;
  height: 120px;
  border-radius: 12px;
  background: #f6f9fd;
  overflow: hidden;
  border: 1px solid #d9e3ee;
}

.intro-preview-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #dce6f3;
  opacity: 0;
  transition: opacity 200ms ease;
}

.intro-preview-dot {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #233f5c;
  top: 49px;
  left: 18px;
}

.intro-dot-main {
  animation: intro-dot-normal 3.6s ease-in-out infinite;
}

.intro-dot-split {
  opacity: 0;
  left: calc(100% - 40px);
}

.intro-preview-pulse {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(60, 102, 142, 0.35);
  top: 45px;
  left: 14px;
  animation: intro-pulse 1.2s ease-out infinite;
}

.intro-preview-timer {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  opacity: 0;
  background: conic-gradient(#d26b6b 0deg, #d26b6b 0deg, #dfe7f2 0deg);
}

.intro-preview-stage[data-mode="split"] .intro-preview-divider {
  opacity: 1;
}

.intro-preview-stage[data-mode="split"] .intro-dot-main {
  left: 25%;
  top: 49px;
  animation: intro-dot-split-left 2.2s ease-in-out infinite;
}

.intro-preview-stage[data-mode="split"] .intro-dot-split {
  opacity: 1;
  left: calc(75% - 11px);
  animation: intro-dot-split-right 2.2s ease-in-out infinite;
}

.intro-preview-stage[data-mode="split"] .intro-preview-pulse {
  left: calc(25% - 15px);
  animation: intro-pulse-split 1.1s ease-out infinite;
}

.intro-preview-stage[data-mode="pressure"] .intro-preview-divider,
.intro-preview-stage[data-mode="pressure"] .intro-dot-split {
  opacity: 0;
}

.intro-preview-stage[data-mode="pressure"] .intro-dot-main {
  left: 50%;
  top: 49px;
  transform: translateX(-50%);
  animation: intro-dot-pressure 0.14s linear infinite;
}

.intro-preview-stage[data-mode="pressure"] .intro-preview-pulse {
  left: calc(50% - 15px);
  animation: intro-pulse-pressure 0.8s ease-out infinite;
}

.intro-preview-stage[data-mode="pressure"] .intro-preview-timer {
  opacity: 1;
  animation: intro-pressure-timer 2.6s linear infinite;
}


.intro-preview-blackhole {
  position: absolute;
  left: 50%;
  bottom: -24px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  transform: translateX(-50%);
  opacity: 0;
  background:
    radial-gradient(circle at 50% 50%, #040409 0 23%, #1f2457 45%, #7a44c7 63%, rgba(122, 68, 199, 0.12) 74%, rgba(122, 68, 199, 0) 78%),
    conic-gradient(from 20deg, rgba(157, 94, 255, 0.0), rgba(157, 94, 255, 0.8), rgba(100, 206, 255, 0.55), rgba(157, 94, 255, 0.0));
  filter: drop-shadow(0 -2px 12px rgba(98, 71, 196, 0.45));
}

.intro-preview-stage[data-mode="blackhole"] .intro-preview-divider,
.intro-preview-stage[data-mode="blackhole"] .intro-dot-split,
.intro-preview-stage[data-mode="blackhole"] .intro-preview-timer {
  opacity: 0;
}

.intro-preview-stage[data-mode="blackhole"] .intro-dot-main {
  left: 50%;
  top: 52px;
  transform: translateX(-50%);
  animation: intro-dot-blackhole 2.4s ease-in infinite;
}

.intro-preview-stage[data-mode="blackhole"] .intro-preview-pulse {
  left: calc(50% - 15px);
  animation: intro-pulse-blackhole 0.9s ease-out infinite;
}

.intro-preview-stage[data-mode="blackhole"] .intro-preview-blackhole {
  opacity: 1;
  animation: intro-blackhole-spin 1.8s linear infinite;
}

.intro-preview-upward { display: none; width: 100%; height: 100%; }

.intro-preview-stage[data-mode="upward"] .intro-dot-main,
.intro-preview-stage[data-mode="upward"] .intro-dot-split,
.intro-preview-stage[data-mode="upward"] .intro-preview-pulse,
.intro-preview-stage[data-mode="upward"] .intro-preview-divider,
.intro-preview-stage[data-mode="upward"] .intro-preview-timer,
.intro-preview-stage[data-mode="upward"] .intro-preview-blackhole { display: none; }

.intro-preview-stage[data-mode="upward"] .intro-preview-upward { display: block; }

#intro-preview-description { font-size: 14px; line-height: 1.4; margin-top: 8px; }

@keyframes intro-dot-normal {
  0%, 100% { left: 18px; top: 49px; }
  30% { left: 65%; top: 16px; }
  60% { left: 42%; top: 82px; }
}

@keyframes intro-pulse {
  0% { transform: scale(0.5); opacity: 0.75; }
  100% { transform: scale(1.55); opacity: 0; }
}

@keyframes intro-dot-split-left {
  0%, 100% { top: 49px; }
  50% { top: 22px; }
}

@keyframes intro-dot-split-right {
  0%, 100% { top: 22px; }
  50% { top: 49px; }
}

@keyframes intro-pulse-split {
  0% { transform: scale(0.5); opacity: 0.75; }
  45% { transform: scale(1.35); opacity: 0; }
  55% { left: calc(75% - 15px); transform: scale(0.5); opacity: 0.75; }
  100% { left: calc(75% - 15px); transform: scale(1.35); opacity: 0; }
}

@keyframes intro-dot-pressure {
  0% { transform: translateX(-50%) translate(0, 0); }
  25% { transform: translateX(-50%) translate(2px, -1px); }
  50% { transform: translateX(-50%) translate(-2px, 1px); }
  75% { transform: translateX(-50%) translate(1px, 2px); }
  100% { transform: translateX(-50%) translate(0, 0); }
}

@keyframes intro-pulse-pressure {
  0% { transform: scale(0.55); opacity: 0.8; }
  100% { transform: scale(1.75); opacity: 0; }
}

@keyframes intro-pressure-timer {
  0% { background: conic-gradient(#d26b6b 360deg, #d26b6b 360deg, #dfe7f2 360deg); }
  100% { background: conic-gradient(#d26b6b 0deg, #d26b6b 0deg, #dfe7f2 0deg); }
}

@keyframes intro-dot-blackhole {
  0% { transform: translateX(-50%) translateY(0); }
  25% { transform: translateX(-50%) translate(-32px, -26px); }
  45% { transform: translateX(-50%) translate(26px, -44px); }
  70% { transform: translateX(-50%) translate(-12px, -12px); }
  100% { transform: translateX(-50%) translateY(0); }
}

@keyframes intro-pulse-blackhole {
  0% { transform: scale(0.55); opacity: 0.65; }
  100% { transform: scale(1.95); opacity: 0; }
}

@keyframes intro-blackhole-spin {
  from { transform: translateX(-50%) rotate(0deg); }
  to { transform: translateX(-50%) rotate(360deg); }
}

.intro-mode-list {
  margin: 0;
  padding-left: 20px;
  color: #3e4b58;
  text-align: left;
  display: grid;
  gap: 8px;
}

.intro-question {
  margin-top: 4px;
  font-weight: 600;
  color: #1f2a37;
}

.intro-actions {
  display: flex;
  gap: 10px;
}

.intro-actions button {
  flex: 1;
}

#intro-close-hint {
  color: #b40000;
  font-size: 14px;
}

.intro-install-hint {
  margin: 0;
  font-size: 13px;
  color: #536579;
  text-align: left;
  line-height: 1.4;
}

#start-screen {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto auto 1fr;
  align-items: center;
  justify-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  text-align: center;
}

#highscore-button {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid #d7c8b5;
  background: linear-gradient(180deg, #fff8ef 0%, #f2dfc7 100%);
  box-shadow: 0 8px 18px rgba(78, 52, 26, 0.18);
  font-size: 26px;
  cursor: pointer;
  z-index: 22;
}

#highscore-button:hover {
  filter: brightness(1.03);
}


#settings-button {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid #b9c9dc;
  background: linear-gradient(180deg, #ffffff 0%, #e6edf6 100%);
  box-shadow: 0 8px 18px rgba(42, 69, 100, 0.18);
  font-size: 24px;
  cursor: pointer;
  z-index: 22;
}

#settings-button:hover {
  filter: brightness(1.03);
}
#mode-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: var(--menu-top) var(--menu-right) var(--menu-bottom) var(--menu-left);
  overflow: hidden;
  text-align: center;
  background: rgba(237, 244, 251, 0.84);
  backdrop-filter: blur(2px);
  z-index: 25;
}

.mode-card {
  width: min(520px, 100%);
  min-height: 0;
  flex: 0 1 auto;
}


.mode-explain-card {
  width: min(560px, calc(100vw - 40px));
  max-height: calc(100dvh - 40px);
  box-sizing: border-box;
  overflow-y: auto;
  gap: 12px;
}

.mode-explain-animation {
  flex-shrink: 0;
  position: relative;
  height: 130px;
  border: 1px solid #d6e2ef;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbff 0%, #edf3fb 100%);
  overflow: hidden;
}

.mode-explain-dot,
.mode-explain-dot-right {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #233f5c;
  top: 55px;
}

.mode-explain-dot {
  left: 14px;
  animation: modeExplainMoveNormal 3s ease-in-out infinite;
}

.mode-explain-dot-right {
  display: none;
  right: 14px;
  left: auto;
}

.mode-explain-divider {
  position: absolute;
  inset: 10px auto 10px 50%;
  width: 4px;
  transform: translateX(-50%);
  border-radius: 99px;
  background: #d8e3f0;
  opacity: 0;
}

.mode-explain-timer {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  opacity: 0;
  background: conic-gradient(#d95f5f 0deg, #d95f5f 0deg, #dbe4f0 0deg);
}

.mode-explain-blackhole {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 56px;
  height: 18px;
  transform: translateX(-50%);
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(ellipse at center, #000 0%, #222 45%, #556 100%);
}

.mode-explain-animation[data-mode="split"] .mode-explain-divider,
.mode-explain-animation[data-mode="split"] .mode-explain-dot-right {
  display: block;
  opacity: 1;
}

.mode-explain-animation[data-mode="split"] .mode-explain-dot {
  animation: modeExplainMoveSplitLeft 2.2s ease-in-out infinite;
}

.mode-explain-animation[data-mode="split"] .mode-explain-dot-right {
  animation: modeExplainMoveSplitRight 2.2s ease-in-out infinite;
}

.mode-explain-animation[data-mode="pressure"] .mode-explain-timer {
  opacity: 1;
  animation: modeExplainTimer 2.2s linear infinite;
}

.mode-explain-animation[data-mode="blackhole"] .mode-explain-blackhole {
  opacity: 0.95;
}

.mode-explain-animation[data-mode="blackhole"] .mode-explain-dot {
  animation: modeExplainBlackhole 2.6s ease-in-out infinite;
}

.mode-explain-upward-demo { display: none; width: 100%; height: 100%; }
.mode-explain-animation[data-mode="upward"] .mode-explain-upward-demo { display: block; }
.mode-explain-animation[data-mode="upward"] .mode-explain-dot { display: none; }

.mode-explain-actions {
  display: flex;
  gap: 10px;
}

.mode-explain-actions button {
  flex: 1;
}

@keyframes modeExplainMoveNormal {
  0%, 100% { left: 14px; top: 55px; }
  50% { left: calc(100% - 34px); top: 55px; }
}

@keyframes modeExplainMoveSplitLeft {
  0%, 100% { left: 14px; }
  50% { left: calc(50% - 26px); }
}

@keyframes modeExplainMoveSplitRight {
  0%, 100% { right: 14px; }
  50% { right: calc(50% - 26px); }
}

@keyframes modeExplainTimer {
  0% { background: conic-gradient(#d95f5f 0deg, #d95f5f 360deg, #dbe4f0 360deg); }
  100% { background: conic-gradient(#d95f5f 0deg, #d95f5f 0deg, #dbe4f0 0deg); }
}

@keyframes modeExplainBlackhole {
  0% { left: 20px; top: 20px; transform: scale(1); }
  60% { left: calc(100% - 40px); top: 40px; transform: scale(1.05); }
  100% { left: calc(50% - 10px); top: 96px; transform: scale(0.85); }
}

#start-header {
  align-self: start;
  margin-top: 10px;
  text-align: center;
  width: min(680px, 100%);
  justify-self: center;
}

#username-label {
  font-size: 24px;
  color: #1f2a37;
  font-weight: 800;
}

#start-button {
  padding: 13px 30px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #2b4b6d 0%, #203a56 100%);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(32, 58, 86, 0.28);
  z-index: 20;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

#start-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

#switch-user-button,
#settings-language-button,
#settings-close {
  margin-top: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid #b9c9dc;
  background: rgba(255, 255, 255, 0.85);
  color: #2c4663;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

#switch-user-button:hover,
#settings-language-button:hover,
#settings-close:hover {
  background: #ffffff;
}


.highscore-card {
  width: min(460px, calc(100vw - 40px));
}

.highscore-mode-selector {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

#highscore-mode-normal,
#highscore-mode-split,
#highscore-mode-pressure,
#highscore-mode-blackhole,
#highscore-mode-upward,
#highscore-close {
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(180deg, #2b4b6d 0%, #203a56 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

#highscore-mode-normal,
#highscore-mode-split,
#highscore-mode-pressure,
#highscore-mode-blackhole,
#highscore-mode-upward {
  background: #fff;
  border: 1px solid #ced9e6;
  min-height: 48px;
  position: relative;
  color: transparent;
}

#highscore-mode-normal::before,
#highscore-mode-split::before,
#highscore-mode-pressure::before,
#highscore-mode-blackhole::before,
#highscore-mode-upward::before {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
}

#highscore-mode-normal::before {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #121212;
}

#highscore-mode-split::before {
  width: 34px;
  height: 16px;
  background:
    radial-gradient(circle, #121212 0 4px, transparent 5px) left center / 14px 14px no-repeat,
    radial-gradient(circle, #121212 0 4px, transparent 5px) right center / 14px 14px no-repeat,
    linear-gradient(#121212, #121212) center / 4px 100% no-repeat;
}

#highscore-mode-pressure::before {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #121212 0 5px, transparent 6px),
    conic-gradient(from 0deg, rgba(0, 0, 0, 0) 0deg 18deg, #121212 18deg 30deg, rgba(0, 0, 0, 0) 30deg 48deg, #121212 48deg 60deg, rgba(0, 0, 0, 0) 60deg 78deg, #121212 78deg 90deg, rgba(0, 0, 0, 0) 90deg 108deg, #121212 108deg 120deg, rgba(0, 0, 0, 0) 120deg 138deg, #121212 138deg 150deg, rgba(0, 0, 0, 0) 150deg 168deg, #121212 168deg 180deg, rgba(0, 0, 0, 0) 180deg 198deg, #121212 198deg 210deg, rgba(0, 0, 0, 0) 210deg 228deg, #121212 228deg 240deg, rgba(0, 0, 0, 0) 240deg 258deg, #121212 258deg 270deg, rgba(0, 0, 0, 0) 270deg 288deg, #121212 288deg 300deg, rgba(0, 0, 0, 0) 300deg 318deg, #121212 318deg 330deg, rgba(0, 0, 0, 0) 330deg 360deg);
}

#highscore-mode-blackhole::before {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #05070e 0 34%, #1c2352 52%, #5b38a4 68%, rgba(91, 56, 164, 0) 100%);
}

#highscore-mode-upward::before {
  width: 30px;
  height: 16px;
  border-radius: 0;
  background:
    linear-gradient(#121212, #121212) center 70% / 26px 3px no-repeat,
    conic-gradient(from 135deg, transparent 0 75%, #121212 0 85%, transparent 0) center 18% / 11px 11px no-repeat;
}

#highscore-close.secondary {
  background: #e9e9e9;
  color: #333;
}

#highscore-mode-normal.active,
#highscore-mode-split.active,
#highscore-mode-pressure.active,
#highscore-mode-blackhole.active {
  outline: 2px solid #d6ae76;
}

#highscore-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.highscore-entry {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f5f9ff;
  border: 1px solid #dce6f2;
}

.highscore-entry.current-user {
  background: #e8f3ff;
  border-color: #8bb4e0;
  box-shadow: inset 0 0 0 1px #6b9acb;
}

.highscore-separator {
  list-style: none;
  text-align: center;
  color: #6f7f90;
  font-weight: 700;
  line-height: 1;
}

.highscore-rank,
.highscore-score {
  font-weight: 700;
}

.highscore-name {
  font-weight: 600;
  color: #25384d;
}

#highscore-empty {
  color: #5a4631;
  font-weight: 600;
}

.rank-1 { color: #b8860b; }
.rank-2 { color: #76808f; }
.rank-3 { color: #a56b3d; }

#split-divider {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 14px;
  transform: translateX(-50%);
  background: #111;
  z-index: 9;
}

#dot,
#dot-split {
  width: 50px;
  height: 50px;
  background-color: #000;
  border-radius: 50%;
  position: absolute;
  top: 43%;
  left: 43%;
  cursor: pointer;
  transition: none;
  z-index: 10;
}

#dot.mode-start-animation,
#dot-split.mode-start-animation {
  animation: modeStartPulse 0.65s ease-out;
}

#dot.mode-preparing,
#dot-split.mode-preparing,
#dot.blackhole-mode,
#dot.upward-mode {
  transition: none;
}

#dot.upward-mode,
#upward-current-band {
  touch-action: none;
}

body.blackhole-mode {
  touch-action: none;
}

#dot.blackhole-captured {
  pointer-events: none;
  transform-origin: center;
}

#dot.upward-mode.mode-start-animation {
  transform-origin: 50% 100%;
}

@keyframes modeStartPulse {
  0% {
    transform: scale(0.25);
    opacity: 0.3;
  }

  55% {
    transform: scale(1.16);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

#blackhole {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  width: 100px;
  height: 100px;
  border-radius: 50%;
  transform: translateX(-50%);
  z-index: 8;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, #030308 0 24%, #161c3d 45%, #532f8a 58%, rgba(145, 90, 255, 0.28) 70%, rgba(145, 90, 255, 0) 78%),
    conic-gradient(from 10deg, rgba(150, 88, 255, 0), rgba(150, 88, 255, 0.95), rgba(68, 205, 255, 0.6), rgba(150, 88, 255, 0));
  box-shadow: 0 0 30px rgba(108, 70, 190, 0.4), 0 10px 20px rgba(10, 10, 25, 0.55);
  animation: blackholeSpin 2.1s linear infinite;
}

#blackhole::before,
#blackhole::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

#blackhole::before {
  background: radial-gradient(circle at 50% 48%, rgba(0, 0, 0, 0.95) 0 26%, rgba(12, 12, 20, 0) 52%);
}

#blackhole::after {
  inset: -8px;
  border: 2px solid rgba(165, 115, 255, 0.28);
  filter: blur(0.2px);
}

@keyframes blackholeSpin {
  from { transform: translateX(-50%) rotate(0deg); }
  to { transform: translateX(-50%) rotate(360deg); }
}

#dot.split-target::after,
#dot-split.split-target::after {
  content: '';
  position: absolute;
  inset: -10px;
  border: 4px solid #d4af37;
  border-radius: 50%;
  pointer-events: none;
  animation: split-target-blink 0.9s ease-in-out infinite;
}

@keyframes split-target-blink {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.55);
  }

  50% {
    opacity: 0.2;
    transform: scale(1.12);
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.2);
  }
}


#dot.pressure-tension-low {
  animation: pressureJitterLow 1s ease-in-out infinite;
}

#dot.pressure-tension-medium {
  animation: pressureJitterMedium .7s ease-in-out infinite;
}

#dot.pressure-tension-high {
  animation: pressureJitterHigh .4s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(255, 106, 74, 0.45);
}

#dot.pressure-explode {
  animation: pressureExplode 0.42s ease-out forwards;
}

#dot.upward-flying {
  transition: none;
  box-shadow: 0 0 0 6px rgba(213, 163, 102, 0.18);
}

.upward-band {
  position: fixed;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2f3d5f 0%, #1a2338 100%);
  box-shadow: 0 3px 8px rgba(10, 14, 25, 0.35);
  z-index: 8;
}

#upward-current-band {
  box-shadow: none;
  background: none;
  border-radius: 0;
  display: block;
  overflow: visible;
}

#upward-current-band .upward-band-path {
  fill: none;
  stroke: #2f4667;
  stroke-width: 5;
  stroke-linecap: round;
}

#upward-current-band.upward-promoted .upward-band-path {
  stroke: #6e4f33;
}

#upward-current-band .upward-anchor {
  fill: #1e2e46;
}

#upward-target-band {
  background: linear-gradient(180deg, #6e4f33 0%, #4a341f 100%);
}

#upward-trajectory {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  fill: #a07148;
  z-index: 7;
}

#dot.upward-releasing {
  transition: none;
  box-shadow: 0 0 0 4px rgba(213, 163, 102, 0.14);
}

@keyframes pressureJitterLow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(213, 146, 69, .12); }
  50% { box-shadow: 0 0 0 5px rgba(213, 146, 69, .28); }
}
@keyframes pressureJitterMedium {
  0%, 100% { box-shadow: 0 0 0 3px rgba(221, 102, 60, .2); }
  50% { box-shadow: 0 0 0 6px rgba(221, 102, 60, .4); }
}
@keyframes pressureJitterHigh {
  0%, 100% { box-shadow: 0 0 0 4px rgba(211, 61, 47, .25); }
  50% { box-shadow: 0 0 0 7px rgba(211, 61, 47, .5); }
}

@keyframes pressureExplode {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1);
  }

  45% {
    transform: scale(1.8);
    opacity: 0.95;
    filter: brightness(1.6);
    box-shadow: 0 0 0 20px rgba(255, 98, 66, 0.5), 0 0 24px rgba(255, 98, 66, 0.7);
  }

  100% {
    transform: scale(0.25);
    opacity: 0;
    filter: brightness(2);
    box-shadow: 0 0 0 42px rgba(255, 145, 110, 0);
  }
}

#counter,
#new-highscore,
#try-again,
#miss-indicator {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  z-index: 15;
}

#counter {
  right: calc(env(safe-area-inset-right, 0px) + 10px);
  min-width: 68px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #2f4a68;
  background: linear-gradient(180deg, #fff7e3 0%, #ffe5b8 100%);
  border: 1px solid #f0c780;
  box-shadow: 0 6px 14px rgba(180, 128, 45, 0.22);
}

#new-highscore {
  right: calc(env(safe-area-inset-right, 0px) + 10px);
  top: calc(env(safe-area-inset-top, 0px) + 110px);
  padding: 6px 12px;
  font-size: 20px;
  font-weight: 800;
  color: #b33b00;
  background: #fff3df;
  border: 1px solid #f0c780;
  border-radius: 999px;
}

#try-again {
  font-size: 18px;
  color: #a53232;
  font-weight: 700;
  background: rgba(255, 238, 238, 0.92);
  border: 1px solid #f3b6b6;
  border-radius: 999px;
  padding: 8px 12px;
}

#miss-indicator {
  position: fixed;
  z-index: 16;
  font-size: 34px;
  line-height: 1;
  pointer-events: none;
  transform: scale(1);
  animation: missPop 0.32s ease-out;
}


@keyframes missPop {
  0% {
    opacity: 0;
    transform: scale(0.55);
  }

  35% {
    opacity: 1;
    transform: scale(1.08);
  }

  100% {
    opacity: 0;
    transform: scale(0.95);
  }
}

@keyframes wobbleHighscore {
  0%,
  100% {
    transform: rotate(0deg);
  }

  20% {
    transform: rotate(-3deg);
  }

  40% {
    transform: rotate(3deg);
  }

  60% {
    transform: rotate(-2deg);
  }

  80% {
    transform: rotate(2deg);
  }
}

#back-to-menu {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: calc(env(safe-area-inset-left, 0px) + 10px);
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #3f4f62;
  color: #fff;
  padding: 0;
  border: none;
  border-radius: 999px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0.88;
  z-index: 15;
}

#back-to-menu:hover {
  opacity: 1;
}

.split-hint-card {
  width: min(520px, calc(100vw - 40px));
  gap: 14px;
}

.split-hint-visual {
  display: grid;
  gap: 10px;
}

.hint-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 12px;
}

.hint-label {
  font-weight: 700;
  color: #33475b;
  font-size: 14px;
}

.hint-lane {
  position: relative;
  height: 62px;
  border-radius: 12px;
  border: 1px solid #cfdeee;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  overflow: hidden;
}

.hint-lane::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 10px;
  bottom: 10px;
  width: 2px;
  transform: translateX(-50%);
  background: #d8e2ef;
}

.hint-dot,
.hint-touch {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.hint-dot {
  width: 20px;
  height: 20px;
  background: #ff7676;
  box-shadow: 0 3px 8px rgba(255, 118, 118, 0.35);
}

.hint-touch {
  width: 26px;
  height: 26px;
  border: 2px solid #2f6db0;
  opacity: 0;
}

.hint-dot.left,
.hint-touch.left {
  left: 25%;
}

.hint-dot.right,
.hint-touch.right {
  left: 75%;
}

.hint-row.success .hint-touch.left,
.hint-row.success .hint-touch.right,
.hint-row.fail .hint-touch.left {
  animation: hintTouchPulse 2.2s ease-in-out infinite;
}

.hint-row.success .hint-touch.right {
  animation-delay: 1.05s;
}

.hint-row.fail .hint-touch.left {
  animation-delay: 1s;
}

.hint-row.success .hint-lane {
  border-color: #c8e5c8;
}

.hint-row.fail .hint-lane {
  border-color: #f1d2d2;
}

.hint-step {
  position: absolute;
  top: 8px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 700;
  color: #ffffff;
  background: #2f6db0;
  opacity: 0;
}

.hint-step.first {
  left: calc(25% - 9px);
  animation: hintStepFlash 2.2s ease-in-out infinite;
}

.hint-step.second {
  left: calc(75% - 9px);
  animation: hintStepFlash 2.2s ease-in-out infinite;
  animation-delay: 1.05s;
}

.hint-step.repeat {
  left: calc(25% + 16px);
  background: #d07a22;
  animation: hintStepFlash 2.2s ease-in-out infinite;
  animation-delay: 1s;
}

#split-hint-close {
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(180deg, #2b4b6d 0%, #203a56 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

@keyframes hintTouchPulse {
  0%, 30% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  42% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(1);
  }
  58%, 100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.35);
  }
}

@keyframes hintStepFlash {
  0%, 30% {
    opacity: 0;
    transform: scale(0.7);
  }
  40%, 58% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}


.pressure-hint-card {
  width: min(520px, calc(100vw - 40px));
  gap: 12px;
}

.pressure-hint-card p {
  margin: 0;
  color: #33475b;
  line-height: 1.45;
}

#pressure-hint-close,
#blackhole-hint-close {
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(180deg, #7a2f2f 0%, #5f1f1f 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}


#profile-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  max-height: 32dvh;
  overflow-y: auto;
}

.profile-option {
  border: 1px solid #c7d7e7;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f5f9ff;
  color: #203a56;
  text-align: left;
  font: inherit;
  cursor: pointer;
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-option[aria-pressed="true"] {
  border-color: #527ca5;
  background: #e1edf9;
  font-weight: 700;
}

#profile-form {
  max-height: 80dvh;
  overflow-y: auto;
}

.danger-button {
  border: 1px solid #b06969;
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
  background: #fff0f0;
  color: #8a2525;
  font: inherit;
  cursor: pointer;
}

#profile-delete-confirmation {
  padding: 12px;
  border: 1px solid #dfb6b6;
  border-radius: 12px;
  background: #fff7f7;
}

#profile-delete-question { font-weight: 600; overflow-wrap: anywhere; }
#profile-delete-detail { font-size: 14px; line-height: 1.4; margin: 8px 0 12px; }
#profile-delete-cancel {
  border: 1px solid #c7d7e7;
  border-radius: 10px;
  padding: 10px;
  background: #edf2f7;
  color: #203a56;
  font: inherit;
  cursor: pointer;
}
#profile-status { color: #285b42; font-size: 14px; overflow-wrap: anywhere; }

.language-button {
  border: 1px solid #bdcddd;
  border-radius: 10px;
  min-height: 40px;
  padding: 8px 12px;
  background: #edf3fa;
  color: #203a56;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

#offline-status { font-size: 13px; line-height: 1.4; }
#update-notice {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid #bdcddd;
  border-radius: 12px;
  background: #f4f8fd;
  font-size: 14px;
}
#update-notice p { margin: 0 0 8px; }
#update-reload {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 8px 14px;
  background: #203a56;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
button:disabled { cursor: default; opacity: 0.55; }

#pause-overlay { z-index: 65; }

body.game-paused > :not(.overlay), body.game-paused > :not(.overlay) *,
body.game-paused #dot::after, body.game-paused #dot-split::after { animation-play-state: paused !important; }

#storage-warning {
  position: fixed;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  padding: 10px 12px;
  border: 1px solid #c9a75b;
  border-radius: 10px;
  background: #fff4d4;
  color: #543d12;
  font-size: 13px;
  line-height: 1.4;
  z-index: 75;
  pointer-events: none;
}

/* Play preferences and accessible, scrollable dialogs. */
.card {
  max-height: calc(100vh - var(--menu-top) - var(--menu-bottom));
  max-height: calc(100dvh - var(--menu-top) - var(--menu-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
}
.card > * { flex-shrink: 0; }
button, select { min-height: 44px; }
button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 3px solid #205d91; outline-offset: 3px;
}
select { width: 100%; padding: 10px; border: 1px solid #8d9dab; border-radius: 10px; background: #fff; color: #1f2a37; font: inherit; }
.settings-group { margin: 0; padding: 12px; border: 1px solid #c8d5e4; border-radius: 12px; display: flex; flex-direction: column; gap: 10px; }
.settings-group legend { padding: 0 5px; font-weight: 600; }
.card .small-note { font-size: 14px; line-height: 1.5; color: #435365; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; line-height: 1.4; }
.check-row input { width: 22px; height: 22px; flex-shrink: 0; accent-color: #203a56; }
.intro-navigation { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
#settings-intro, #settings-history, #backup-export, #backup-import, #profile-import,
#mode-settings, #pause-help, #summary-again, #summary-history, #summary-close,
#history-close, #import-confirm, #import-cancel, #intro-previous, #intro-next {
  padding: 12px; border-radius: 10px; border: 0; color: #fff; background: #203a56;
  font: inherit; font-weight: 600; cursor: pointer;
}
#intro-preview-toggle, #mode-explain-preview-toggle, #vibration-test {
  padding: 10px 12px; border-radius: 10px; border: 0; font: inherit; font-weight: 600; cursor: pointer;
}
button.secondary { background: #e7edf4 !important; color: #24384b !important; }
button:disabled { cursor: default; opacity: .55; }
.metrics-grid { display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; margin: 8px 0; }
.metrics-grid dt { color: #435365; }
.metrics-grid dd { margin: 0; font-weight: 700; text-align: right; }
#history-list { padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
#history-list li { padding: 12px; border: 1px solid #c8d5e4; border-radius: 12px; line-height: 1.5; }
#history-list p { margin-top: 5px; }
body.large-text .card, body.large-text .card button, body.large-text .card select,
body.large-text .card .small-note { font-size: 18px; }
body.large-text .card h2 { font-size: 25px; }
#dot::before, #dot-split::before { content: ''; position: absolute; inset: 0; border: 2px solid #25384a; border-radius: inherit; box-sizing: border-box; pointer-events: none; }
#split-progress, #pressure-progress { position: fixed; right: max(14px, env(safe-area-inset-right, 0px)); top: calc(env(safe-area-inset-top, 0px) + 70px); padding: 6px 12px; border-radius: 20px; color: #203a56; background: #edf3fa; font-size: 16px; font-weight: 600; z-index: 12; pointer-events: none; }
body.reduced-effects #blackhole, body.reduced-effects #miss-indicator, body.reduced-effects #new-highscore,
body.reduced-effects .intro-preview-pulse, body.reduced-effects .intro-preview-timer, body.reduced-effects .intro-preview-blackhole,
body.reduced-effects .mode-explain-timer, body.reduced-effects #dot.mode-start-animation,
body.reduced-effects #dot-split.mode-start-animation, body.reduced-effects .split-target::after,
body.reduced-effects #dot.pressure-tension-low, body.reduced-effects #dot.pressure-tension-medium,
body.reduced-effects #dot.pressure-tension-high, body.reduced-effects #dot.pressure-explode { animation: none; }
body.preview-motion-paused .intro-preview-stage *,
body.preview-motion-paused .mode-explain-animation * { animation-play-state: paused; }
body.reduced-effects #dot, body.reduced-effects #dot-split { transition: none; }
body.reduced-effects .split-target::after { opacity: 1; box-shadow: none; }
body.reduced-effects #blackhole { transform: translateX(-50%); }

.settings-group, .card, select { min-width: 0; }
select { box-sizing: border-box; }
@media (forced-colors: active) {
  #dot, #dot-split, #blackhole { background: CanvasText; }
  .upward-band { background: CanvasText; }
  #upward-current-band .upward-band-path { stroke: CanvasText; }
  #upward-current-band .upward-anchor { fill: CanvasText; }
}

body.reduced-effects #dot.pressure-explode { opacity: .35; }

.profile-option, #import-profiles li, .highscore-name { overflow-wrap: anywhere; }

.metrics-grid { grid-template-columns: minmax(0, 1fr) auto; }
.metrics-grid dt { min-width: 0; overflow-wrap: anywhere; }

/* Compact settings and consistent text-size controls. */
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-heading h2 { min-width: 0; overflow-wrap: anywhere; text-align: left; }
.text-size-controls { display: flex; gap: 2px; flex-shrink: 0; }
.text-size-button { width: 44px; height: 44px; padding: 8px; display: flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #435365; cursor: pointer; }
.text-size-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.text-size-button[data-text-size="large"] svg { width: 26px; height: 26px; }
.text-size-button[aria-pressed="true"] { background: #e7edf4; border-color: #b5c6d7; color: #203a56; }
.settings-card { gap: 12px; }
.settings-menu { display: grid; gap: 10px; }
.settings-menu button, #play-settings-close, #account-settings-close, #help-settings-close {
  padding: 14px; border: 0; border-radius: 10px; background: #203a56; color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.settings-menu button { text-align: left; }
.setting-help { min-width: 0; }
.setting-help summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; list-style: none; cursor: pointer; font-weight: 600; }
.setting-help summary::-webkit-details-marker { display: none; }
.setting-help summary:focus-visible { outline: 3px solid #205d91; outline-offset: 2px; border-radius: 6px; }
.info-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; border: 1.5px solid #667d93; border-radius: 50%; color: #435365; font: 600 13px Georgia, serif; }
.info-button { background: transparent; min-width: 36px; min-height: 36px; cursor: pointer; }
.setting-help[open] > .small-note, .setting-help[open] > p { padding: 6px 0 10px; }
.setting-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.setting-label-row .check-row { flex: 1; }
.settings-options { display: grid; gap: 2px; }
#vibration-help { padding: 4px 0 10px; }
#vibration-test { margin-top: 8px; }
#history-list li { padding: 12px; }
