:root {
  --night: #070a13;
  --ink: #edf3ff;
  --muted: #94a2be;
  --line: rgba(198, 218, 255, 0.16);
}
* {
  box-sizing: border-box;
}
html,
body {
  min-height: 100%;
}
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: Arial, "Hiragino Sans", "Yu Gothic UI", sans-serif;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid #dce8ff;
  outline-offset: 4px;
}
button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.breathing-app {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  overflow: clip;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(22px, 4vw, 42px) clamp(20px, 6vw, 64px) 22px;
  color: var(--ink);
  background:
    radial-gradient(ellipse 72% 50% at 50% 43%, #15264a 0%, #0b1225 47%, transparent 76%),
    linear-gradient(180deg, #080c18, var(--night));
}
.atmosphere {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(2px);
}
.atmosphere-one {
  width: min(72vw, 760px);
  height: min(72vw, 760px);
  left: -34%;
  top: 12%;
  background: radial-gradient(circle, rgba(84, 127, 210, 0.12), transparent 68%);
}
.atmosphere-two {
  width: min(60vw, 620px);
  height: min(60vw, 620px);
  right: -24%;
  bottom: -16%;
  background: radial-gradient(circle, rgba(167, 191, 244, 0.08), transparent 68%);
}

.practice-header {
  width: min(100%, 620px);
  min-height: 54px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 80px 1fr 96px;
  align-items: start;
  text-align: center;
}
.practice-header p {
  margin: 0 0 6px;
  color: #91a7d0;
  font-size: 9px;
  letter-spacing: 0.2em;
}
.practice-header h1 {
  margin: 0;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: clamp(24px, 4vw, 33px);
  font-weight: 400;
  letter-spacing: 0.11em;
}
.header-spacer {
  min-width: 1px;
}
.quiet-action {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: #aebbd4;
  padding: 8px 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
}
.quiet-action:first-child {
  text-align: left;
}
.quiet-action:last-child {
  text-align: right;
}
.quiet-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.header-sound-toggle {
  width: 88px;
  min-height: 40px;
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  border: 0;
  background: transparent;
  color: #aebbd4;
  padding: 5px 0 5px 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
}
.header-sound-toggle > i {
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
  display: block;
  border: 1px solid rgba(197, 216, 250, 0.3);
  border-radius: 24px;
  background: #151d2d;
  padding: 2px;
  transition:
    background 0.2s,
    border-color 0.2s;
}
.header-sound-toggle b {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #7c899f;
  transition:
    transform 0.2s,
    background 0.2s,
    box-shadow 0.2s;
}
.header-sound-toggle.is-on {
  color: #eff5ff;
}
.header-sound-toggle.is-on > i {
  border-color: rgba(211, 227, 255, 0.54);
  background: rgba(130, 167, 231, 0.3);
}
.header-sound-toggle.is-on b {
  transform: translateX(18px);
  background: #e3edff;
  box-shadow: 0 0 9px rgba(173, 204, 255, 0.48);
}

.experience {
  width: min(100%, 620px);
  min-height: 0;
  margin: auto;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 20px 0 14px;
}
.remaining {
  min-height: 18px;
  margin: 0 0 clamp(10px, 2vh, 20px);
  color: #aebbd5;
  font-size: 11px;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
}
.orb-stage {
  position: relative;
  width: min(62vw, 330px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  transition: width 0.4s ease;
}
.orb-stage-active {
  width: min(68vw, 390px);
}
.outer-halo,
.breath-guide,
.orb {
  position: absolute;
  border-radius: 50%;
}
.outer-halo {
  width: 92%;
  height: 92%;
  border: 1px solid rgba(187, 211, 255, 0.18);
  box-shadow: 0 0 60px rgba(105, 150, 255, 0.07);
}
.breath-guide {
  z-index: 2;
  pointer-events: none;
  border: 1px solid rgba(220, 234, 255, 0.14);
  opacity: 0.7;
  transition:
    border-color 0.35s ease,
    box-shadow 0.35s ease,
    opacity 0.35s ease;
}
.inhale-guide {
  width: 78%;
  height: 78%;
}
.exhale-guide {
  width: 34%;
  height: 34%;
}
.guide-active {
  border-color: rgba(230, 241, 255, 0.4);
  box-shadow: 0 0 16px rgba(176, 207, 255, 0.12);
  opacity: 1;
}
.orb {
  z-index: 1;
  width: 55%;
  height: 55%;
  background: radial-gradient(
    circle at 36% 29%,
    #f7fbff 0%,
    #c9ddff 13%,
    #779ddd 42%,
    #334b8c 73%,
    #152254 100%
  );
  box-shadow:
    0 0 38px 5px rgba(164, 195, 255, 0.4),
    0 0 120px 20px rgba(72, 112, 207, 0.2),
    inset -15px -22px 42px rgba(5, 13, 53, 0.52);
  transform: scale(0.82);
  transition:
    transform 0.5s ease,
    filter 0.5s ease;
}
.orb.is-active.is-expand,
.orb.is-active.is-back-expand {
  animation: orb-expand var(--phase-duration) cubic-bezier(0.35, 0, 0.25, 1) forwards;
}
.orb.is-active.is-contract,
.orb.is-active.is-back-contract {
  animation: orb-contract var(--phase-duration) cubic-bezier(0.35, 0, 0.25, 1) forwards;
}
.orb.is-active.is-held-full {
  transform: scale(1.42);
  filter: brightness(1.13);
}
.orb.is-active.is-held-small {
  transform: scale(0.62);
  filter: brightness(0.9);
}
.orb.is-paused {
  animation-play-state: paused !important;
}
@keyframes orb-expand {
  from {
    transform: scale(0.62);
  }
  to {
    transform: scale(1.42);
  }
}
@keyframes orb-contract {
  from {
    transform: scale(1.42);
  }
  to {
    transform: scale(0.62);
  }
}
.orb-copy {
  z-index: 3;
  width: 64%;
  display: grid;
  gap: 5px;
  justify-items: center;
  text-align: center;
  pointer-events: none;
}
.orb-copy p {
  margin: 0;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: clamp(21px, 4vw, 31px);
  letter-spacing: 0.1em;
}
.orb-copy strong {
  font-size: clamp(44px, 8vw, 70px);
  font-weight: 300;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.orb-copy span {
  max-width: 210px;
  color: #d7e3f8;
  font-size: 10px;
  line-height: 1.55;
  letter-spacing: 0.05em;
}

.idle-controls,
.active-controls,
.complete-controls {
  width: min(100%, 430px);
  display: grid;
  justify-items: center;
}
.idle-controls {
  gap: 14px;
  margin-top: clamp(10px, 2vh, 20px);
}
.active-controls {
  gap: 18px;
  margin-top: clamp(18px, 3vh, 28px);
}
.complete-controls {
  gap: 12px;
  margin-top: clamp(14px, 2vh, 22px);
}
.complete-controls p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.summary-button {
  width: min(100%, 360px);
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: rgba(151, 180, 234, 0.055);
  color: #e8f0ff;
  padding: 9px 18px;
  display: grid;
  gap: 3px;
}
.summary-button span {
  font-size: 12px;
  letter-spacing: 0.07em;
}
.summary-button small {
  color: #93a3bf;
  font-size: 9px;
}
.primary {
  min-width: 176px;
  min-height: 50px;
  border: 1px solid rgba(231, 240, 255, 0.7);
  border-radius: 100px;
  background: #dce9fd;
  color: #101935;
  padding: 13px 30px;
  font-size: 14px;
  letter-spacing: 0.12em;
  box-shadow: 0 10px 38px rgba(92, 128, 194, 0.15);
  transition:
    transform 0.2s,
    background 0.2s;
}
.primary:hover {
  transform: translateY(-2px);
  background: #f5f8ff;
}
.text-button {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: #9eacc5;
  padding: 8px 12px;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 5px;
}
.pace-adjuster {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}
.pace-adjuster button {
  min-height: 42px;
  border: 1px solid rgba(197, 216, 251, 0.22);
  border-radius: 100px;
  background: rgba(164, 193, 244, 0.06);
  color: #d9e5f9;
  padding: 9px 14px;
  font-size: 10px;
}
.pace-adjuster span {
  color: #8f9eb9;
  text-align: center;
  font-size: 9px;
  line-height: 1.5;
}
.footer-note {
  margin: 0;
  text-align: center;
  color: #6f7f9a;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.app-footer {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: center;
  font-size: 9px;
}

.legal-links a {
  color: #8f9eb9;
  text-decoration: underline;
  text-decoration-color: rgba(143, 158, 185, 0.45);
  text-underline-offset: 4px;
}

.legal-links a:hover,
.legal-links a:focus-visible {
  color: #c5d8fb;
}

.overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  overflow: auto;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 20px 20px 0;
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(12px);
}
.settings-sheet,
.dialog {
  width: min(100%, 560px);
  border: 1px solid rgba(205, 222, 255, 0.24);
  background: linear-gradient(145deg, #162342, #0d1428);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
}
.dialog-wide {
  width: min(100%, 650px);
}
.settings-sheet {
  max-height: calc(100svh - 28px);
  overflow: auto;
  border-radius: 24px 24px 0 0;
  padding: 26px clamp(20px, 5vw, 36px) 28px;
}
.dialog {
  position: relative;
  align-self: center;
  border-radius: 4px;
  padding: clamp(28px, 6vw, 42px);
}
.dialog-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 26px;
}
.dialog-header p {
  margin: 0 0 7px;
  color: #91a7d0;
  font-size: 9px;
  letter-spacing: 0.2em;
}
.dialog-header h2 {
  margin: 0;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 0.08em;
}
.dialog-close {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #cbd7eb;
  font-size: 25px;
}
.dialog-body > p {
  margin: 0 0 12px;
  color: #c2cde2;
  font-size: 12px;
  line-height: 1.8;
}
.dialog-ready {
  display: block;
  margin: 24px 0 0 auto;
}
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.setting-group {
  min-width: 0;
  margin: 0;
  padding: 20px 0;
  border: 0;
  border-top: 1px solid rgba(194, 214, 250, 0.11);
}
.setting-group legend {
  width: 100%;
  margin-bottom: 13px;
  color: #b8c7e3;
  font-size: 11px;
  letter-spacing: 0.1em;
}
.mode-segments,
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.mode-segments button,
.preset-grid button {
  min-height: 48px;
  border: 1px solid transparent;
  background: rgba(156, 184, 235, 0.055);
  color: #98a7c2;
  padding: 10px 7px;
}
.preset-grid button {
  min-height: 62px;
  display: grid;
  gap: 5px;
}
.preset-grid span {
  font-size: 11px;
}
.preset-grid small {
  color: #7f8da7;
  font-size: 8px;
}
.selected {
  border-color: rgba(211, 227, 255, 0.44) !important;
  background: rgba(171, 199, 247, 0.14) !important;
  color: #f0f5ff !important;
}
.selected small {
  color: #bdcae2;
}
.group-note {
  margin: 10px 2px 0;
  color: #8190aa;
  font-size: 10px;
}
.duration-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.duration-choices button {
  width: 48px;
  height: 48px;
  border: 1px solid transparent;
  background: rgba(156, 184, 235, 0.055);
  color: #98a7c2;
  padding: 0;
  display: grid;
  place-content: center;
  gap: 1px;
  font-size: 13px;
}
.duration-choices small {
  color: #7887a1;
  font-size: 8px;
}
.advanced {
  border: 1px solid rgba(196, 216, 255, 0.14);
  background: rgba(147, 175, 225, 0.045);
  padding: 14px;
}
.advanced summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #d9e5f9;
  cursor: pointer;
  font-size: 10px;
  list-style: none;
}
.advanced summary span {
  color: #91a2c1;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.advanced summary::-webkit-details-marker {
  display: none;
}
.range-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 22px;
  margin-top: 22px;
}
.range-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  color: #aebbd4;
  font-size: 10px;
}
.range-control output {
  color: #edf3ff;
  font-size: 16px;
}
.range-control output small {
  margin-left: 2px;
  color: #8492ad;
  font-size: 9px;
}
.range-control input {
  grid-column: 1/-1;
  width: 100%;
  accent-color: #cadcff;
}
.setting-row {
  min-height: 68px;
  border-top: 1px solid rgba(194, 214, 250, 0.11);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.setting-row div {
  display: grid;
  gap: 5px;
}
.setting-row strong {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
}
.setting-row small {
  color: #8190aa;
  font-size: 9px;
}
.sound-switch {
  width: 56px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid rgba(197, 216, 250, 0.25);
  border-radius: 30px;
  background: #151d2d;
  padding: 3px;
}
.sound-switch i {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #74829c;
  transition:
    transform 0.2s,
    background 0.2s;
}
.sound-switch b {
  display: none;
}
.sound-switch.is-on {
  background: rgba(130, 167, 231, 0.28);
}
.sound-switch.is-on i {
  transform: translateX(26px);
  background: #e0ebff;
}
.focus-link,
.sheet-done {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
}
.focus-link {
  border: 0;
  background: transparent;
  color: #a8b7d1;
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 5px;
}
.sheet-done {
  border: 1px solid rgba(231, 240, 255, 0.65);
  background: #dce9fd;
  color: #101935;
  font-size: 12px;
  letter-spacing: 0.1em;
}

.device-steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}
.device-steps article {
  min-width: 0;
  border: 1px solid rgba(196, 216, 255, 0.17);
  background: rgba(143, 168, 218, 0.045);
  padding: 18px;
}
.device-steps h3 {
  margin: 0 0 13px;
  color: #eef4ff;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.08em;
}
.device-steps ol {
  min-height: 96px;
  margin: 0 0 15px;
  padding-left: 20px;
  color: #c2cde2;
  font-size: 11px;
  line-height: 1.75;
}
.device-steps a {
  color: #d7e5ff;
  font-size: 10px;
  text-underline-offset: 4px;
}
.focus-note {
  margin-top: 16px !important;
  color: #93a3bf !important;
  font-size: 10px !important;
}

@media (min-width: 700px) {
  .overlay {
    align-items: center;
    padding: 24px;
  }
  .settings-sheet {
    max-height: calc(100svh - 48px);
    border-radius: 6px;
  }
}
@media (max-width: 520px) {
  .breathing-app {
    padding-inline: 16px;
  }
  .practice-header {
    grid-template-columns: 70px 1fr 88px;
  }
  .orb-stage {
    width: min(76vw, 310px);
  }
  .orb-stage-active {
    width: min(82vw, 350px);
  }
  .pace-adjuster {
    grid-template-columns: 1fr 1fr;
  }
  .pace-adjuster span {
    grid-column: 1/-1;
    grid-row: 2;
  }
  .duration-choices {
    display: grid;
    grid-template-columns: repeat(7, 36px);
    justify-content: center;
    gap: 5px;
  }
  .duration-choices button {
    width: 36px;
    height: 42px;
  }
  .device-steps {
    grid-template-columns: 1fr;
  }
  .device-steps ol {
    min-height: 0;
  }
}
@media (max-height: 720px) {
  .breathing-app {
    padding-top: 18px;
  }
  .experience {
    padding-block: 8px;
  }
  .orb-stage {
    width: min(48vh, 300px);
  }
  .orb-stage-active {
    width: min(52vh, 330px);
  }
  .idle-controls {
    gap: 10px;
    margin-top: 6px;
  }
  .active-controls {
    margin-top: 12px;
  }
}
@media (max-width: 380px) {
  .duration-choices {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  .duration-choices button {
    width: 100%;
  }
  .dialog-actions {
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  .orb,
  .orb-stage,
  .primary,
  .sound-switch i,
  .header-sound-toggle > i,
  .header-sound-toggle b,
  .breath-guide {
    animation: none !important;
    transition: none !important;
  }
  .orb.is-active.is-expand,
  .orb.is-active.is-back-expand,
  .orb.is-active.is-held-full {
    transform: scale(1.42);
  }
  .orb.is-active.is-contract,
  .orb.is-active.is-back-contract,
  .orb.is-active.is-held-small {
    transform: scale(0.62);
  }
}
