:root {
  --bg: #0a0716;
  --glass: rgba(22, 14, 44, .72);
  --line: rgba(255, 255, 255, .15);
  --tx: #f3eaff;
  --amb: #ffb45a
}

* {
  box-sizing: border-box;
  margin: 0
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--tx);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  overflow: hidden
}

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%
}

button {
  font: inherit;
  font-size: 14px;
  color: var(--tx);
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 7px 14px
}

button:hover {
  background: rgba(255, 255, 255, .12)
}

button:focus-visible {
  outline: 2px solid #6ee7d8
}

#intro {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  text-align: center;
  padding: 20px;
  background: radial-gradient(circle, rgba(10, 7, 22, .35), rgba(10, 7, 22, .85));
  z-index: 10;
  transition: opacity 1s
}

#intro h1 {
  font-size: clamp(36px, 8vw, 72px);
  line-height: 1;
  font-weight: 700;
  text-shadow: 0 0 28px rgba(255, 180, 90, .5)
}

#intro .tag {
  max-width: 480px;
  font-size: 15px;
  line-height: 1.5;
  opacity: .8
}

#intro .feats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 460px;
  padding: 0
}

#intro .feats li {
  font-size: 12px;
  opacity: .85;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px
}

#start {
  background: var(--amb);
  color: #2a1408;
  font-weight: 700;
  font-size: 18px;
  padding: 12px 30px
}

#intro.gone {
  opacity: 0;
  pointer-events: none
}

#top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  transition: opacity .3s
}

.topRight {
  display: flex;
  align-items: center;
  gap: 8px
}

#support {
  background: transparent;
  color: var(--tx);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  text-decoration: none;
  font-size: 14px;
  transition: opacity .3s
}

#support:hover {
  background: rgba(255, 255, 255, .1)
}

#fsBtn {
  background: transparent;
  color: var(--tx);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 16px
}

#fsBtn:hover {
  background: rgba(255, 255, 255, .1)
}

/* ---------- fullscreen immersive mode: hide everything except the fullscreen button ---------- */
body.fs-mode #bar,
body.fs-mode #overlay,
body.fs-mode #panels,
body.fs-mode .logo,
body.fs-mode #support {
  opacity: 0;
  pointer-events: none
}

#bar {
  transition: opacity .3s
}


#bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  max-width: 94vw;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px
}

.track {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0
}

.track .ic {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .08);
  display: grid;
  place-items: center;
  flex: none
}

.tinfo {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25
}

.tinfo b {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px
}

.tinfo span {
  font-size: 11px;
  opacity: .6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px
}

.pp {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: var(--amb);
  color: #2a1408;
  display: grid;
  place-items: center;
  flex: none
}

#vol {
  width: 70px;
  accent-color: #ff7eb6
}

.barTop {
  display: contents
}

.barctl {
  display: flex;
  align-items: center;
  gap: 10px
}

#muteBtn {
  display: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  place-items: center;
  font-size: 15px;
  padding: 0;
  flex: none
}

.navs {
  display: flex;
  gap: 2px
}

.navs button {
  padding: 8px 12px;
  font-size: 13px
}

.navs .ic {
  display: none
}

#overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 12, .55);
  backdrop-filter: blur(2px);
  z-index: 8;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s
}

#overlay.show {
  opacity: 1;
  pointer-events: auto
}

#panels section {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%);
  width: 640px;
  max-width: 92vw;
  max-height: 78vh;
  overflow-y: auto;
  background: #0d0a1a;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px 26px;
  z-index: 9;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s
}

#panels section.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%)
}

.phead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px
}

.phead h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  margin-bottom: 3px
}

.modebadge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: .03em
}

.modebadge.focus {
  background: rgba(255, 180, 90, .18);
  color: var(--amb)
}

.modebadge.break {
  background: rgba(110, 231, 216, .18);
  color: #6ee7d8
}

.phead p {
  font-size: 13px;
  opacity: .6
}

.pclose {
  background: transparent;
  font-size: 13px;
  opacity: .7;
  padding: 4px 6px
}

#vgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px
}

.vcard {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  display: flex;
  align-items: flex-end;
  padding: 8px
}

.vcard span {
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .6)
}

.vcard.on {
  border-color: var(--amb)
}

.lin1 {
  background: linear-gradient(160deg, #160f33, #43225f)
}

.lin2 {
  background: linear-gradient(160deg, #0b1030, #2a3a6b)
}

.lin3 {
  background: linear-gradient(160deg, #ffe9c4, #ffc98a);
  color: #5a3a1a
}

.lin4 {
  background: linear-gradient(160deg, #12063a, #5a1a7a, #ff5fa2, #ffb27a)
}

.lin5 {
  background: linear-gradient(160deg, #050a1f, #1a2a5a)
}

.lin6 {
  background: linear-gradient(160deg, #3b1d6b, #d1467a, #ff9a5a, #ffd27a)
}

.mrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  cursor: pointer
}

.mrow span {
  font-size: 12px;
  opacity: .55
}

.mrow.on {
  color: var(--amb)
}

.ring {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 16px
}

.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg)
}

.ring circle {
  fill: none;
  stroke-width: 5
}

.ring .b {
  stroke: rgba(255, 255, 255, .12)
}

#prog,
#sleepProg {
  stroke: var(--amb);
  stroke-linecap: round;
  stroke-dasharray: 339.3;
  transition: stroke-dashoffset .4s
}

#timeWrap,
#sleepTimeWrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center
}

#time,
#sleepTime {
  font-size: 32px;
  font-weight: 700;
  line-height: 1
}

#sessionLabel,
.remlabel {
  font-size: 11px;
  opacity: .55;
  margin-top: 4px;
  letter-spacing: .05em
}

.pomactions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 20px
}

.pact {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 16px;
  padding: 0
}

.pact.big {
  width: 64px;
  height: 64px;
  background: var(--amb);
  color: #2a1408;
  border-color: var(--amb);
  font-size: 0
}

.pact.big svg {
  width: 24px;
  height: 24px
}

.durows {
  margin-bottom: 14px
}

.durow {
  display: grid;
  grid-template-columns: 110px 1fr 40px;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px
}

.durow input[type=range] {
  width: 100%;
  accent-color: #ff7eb6
}

.durow b {
  text-align: right;
  font-weight: 600;
  opacity: .85
}

.togrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 10px;
  padding: 4px 0
}

.tog {
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--line);
  font-size: 12px;
  padding: 5px 10px
}

.tog.on {
  background: rgba(110, 231, 216, .18);
  border-color: #6ee7d8;
  color: #6ee7d8
}

.chimebtns {
  display: flex;
  gap: 6px
}

.chime {
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  font-size: 12px;
  padding: 5px 10px
}

.chime.on {
  background: var(--amb);
  color: #2a1408;
  border-color: var(--amb);
  font-weight: 700
}

.row {
  display: flex;
  gap: 8px;
  max-width: 260px;
  margin: 0 auto
}

.statuscard {
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 auto 14px;
  max-width: 420px
}

.statuscard .sc-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  color: #6ee7d8;
  margin-bottom: 4px
}

.statuscard p {
  font-size: 12px;
  opacity: .65;
  line-height: 1.5
}

.sleepBtns {
  max-width: none;
  justify-content: center
}

.sleepBtns button {
  flex: none;
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--line);
  color: var(--tx);
  font-weight: 600
}

#sleepRestart {
  background: rgba(143, 123, 255, .22);
  border-color: #8f7bff;
  color: #cfc6ff
}

.sl {
  display: grid;
  grid-template-columns: 90px 1fr 32px;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px
}

.sl span:last-child {
  color: #b7a9d6;
  text-align: right
}

.sl input[type=range] {
  width: 100%;
  accent-color: #ff7eb6
}

.presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px
}

.spreset {
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: left
}

.spreset b {
  display: block;
  font-size: 16px
}

.spreset span {
  font-size: 11px;
  opacity: .6
}

.customfade {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px
}

.customfade input[type=range] {
  flex: 1;
  accent-color: #ff7eb6
}

#sleepGo {
  background: var(--amb);
  color: #2a1408;
  font-weight: 700
}

#sleepStatus {
  font-size: 12px;
  opacity: .65;
  margin-top: 10px
}

#sleepCancel {
  background: transparent;
  border: 1px solid var(--line);
  font-size: 12px;
  margin-top: 6px
}

@media(max-width:700px) {

  .ctl-extra,
  #vol {
    display: none
  }

  #bar {
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    max-width: 100%;
    width: 100%;
    border-radius: 16px 16px 0 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 10px 14px 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px))
  }

  .barTop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px
  }

  #muteBtn {
    display: grid
  }

  .navs {
    justify-content: space-between;
    gap: 2px
  }

  .navs button {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: grid;
    place-items: center
  }

  .navs .lbl {
    display: none
  }

  .navs .ic {
    display: inline;
    font-size: 17px
  }

  .tinfo b,
  .tinfo span {
    max-width: 140px
  }

  #panels section {
    padding: 18px 16px 20px
  }

  #vgrid {
    grid-template-columns: repeat(2, 1fr)
  }
}