:root {
  color-scheme: dark;
  --bg: #354252;
  --bg-soft: #3f4c5b;
  --panel: #475463;
  --panel-soft: #526070;
  --text: #e7e1d5;
  --muted: #bfc7c7;
  --warm: #c6b49b;
  --cool: #aebdbe;
  --shadow: rgba(18, 24, 31, 0.24);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(174, 189, 190, 0.14), transparent 38%),
    linear-gradient(150deg, #303c4b 0%, var(--bg) 52%, #413d4d 100%);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
  letter-spacing: 0;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
  min-height: 100svh;
  position: relative;
  overflow: hidden;
}

.screen {
  min-height: 100vh;
  min-height: 100svh;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 0.55s ease,
    transform 0.55s ease;
}

.screen.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.screen-player {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: max(28px, env(safe-area-inset-top)) 22px max(30px, env(safe-area-inset-bottom));
}

.screen-home {
  display: grid;
  place-items: center;
  padding: 22px;
}

.mode-grid {
  width: min(100%, 560px);
  display: grid;
  grid-template-rows: repeat(2, minmax(210px, 32vh));
  gap: 22px;
}

.mode-card {
  width: 100%;
  min-height: 210px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--panel), #3f4c5d);
  box-shadow: 0 22px 48px var(--shadow);
  display: grid;
  place-items: center;
  padding: 28px;
  transition:
    transform 0.42s ease,
    background-color 0.42s ease,
    box-shadow 0.42s ease,
    opacity 0.42s ease;
}

.mode-card-study {
  background: linear-gradient(145deg, #485464, #424858);
}

.mode-card:active {
  transform: scale(0.985);
  opacity: 0.88;
}

.mode-card:focus-visible,
.back-button:focus-visible,
.play-button:focus-visible,
.secondary-button:focus-visible {
  outline: 2px solid rgba(231, 225, 213, 0.5);
  outline-offset: 4px;
}

.mode-title {
  font-size: clamp(30px, 9vw, 44px);
  font-weight: 500;
  color: var(--text);
}

.back-button {
  justify-self: start;
  min-width: 96px;
  min-height: 48px;
  border-radius: 8px;
  background: rgba(231, 225, 213, 0.08);
  color: var(--muted);
  transition:
    background-color 0.38s ease,
    transform 0.38s ease,
    color 0.38s ease;
}

.back-button:active {
  transform: scale(0.97);
  background: rgba(231, 225, 213, 0.13);
  color: var(--text);
}

.player-center {
  align-self: center;
  justify-self: center;
  width: min(100%, 560px);
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 18px;
  padding: 10px 0 42px;
}

.breath-orb {
  width: min(54vw, 260px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, rgba(231, 225, 213, 0.34), transparent 24%),
    radial-gradient(circle, rgba(174, 189, 190, 0.26), rgba(151, 145, 164, 0.1) 66%, transparent 70%);
  box-shadow:
    0 0 68px rgba(174, 189, 190, 0.16),
    inset 0 0 42px rgba(231, 225, 213, 0.08);
  animation: breathe 7.2s ease-in-out infinite;
  transform-origin: center;
}

.track-label {
  margin: 18px 0 0;
  color: var(--warm);
  font-size: 15px;
}

.track-title {
  width: min(100%, 520px);
  min-height: 72px;
  margin: 0;
  color: var(--text);
  font-size: clamp(24px, 7vw, 36px);
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.player-actions {
  width: min(100%, 520px);
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.play-button {
  width: min(100%, 520px);
  min-height: 78px;
  grid-column: 1 / -1;
  border-radius: 8px;
  background: rgba(198, 180, 155, 0.18);
  color: var(--text);
  font-size: 26px;
  box-shadow: 0 18px 42px rgba(18, 24, 31, 0.2);
  transition:
    transform 0.42s ease,
    background-color 0.42s ease,
    opacity 0.42s ease;
}

.secondary-button {
  min-height: 62px;
  border-radius: 8px;
  background: rgba(231, 225, 213, 0.08);
  color: var(--muted);
  font-size: 18px;
  line-height: 1.2;
  padding: 12px 10px;
  transition:
    transform 0.42s ease,
    background-color 0.42s ease,
    color 0.42s ease,
    opacity 0.42s ease;
}

.play-button:active,
.secondary-button:active {
  transform: scale(0.985);
  opacity: 0.9;
}

.secondary-button:active {
  background: rgba(231, 225, 213, 0.13);
  color: var(--text);
}

.is-paused .breath-orb {
  animation-play-state: paused;
  opacity: 0.68;
  transition: opacity 0.6s ease;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.9);
  }
  50% {
    transform: scale(1.08);
  }
}

@media (min-width: 760px) {
  .screen-home {
    padding: 42px;
  }

  .mode-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    grid-template-rows: minmax(420px, 62vh);
    max-height: 620px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.3s !important;
  }

  .breath-orb {
    transform: scale(1);
  }
}
