/* The valley's menu: a round glass bead top right that grows into a pane like the time dial's, holding the keys, the
   sound and the way back to the main menu. The pane's words are laid out at full size from the start and only
   uncovered as it grows (nothing inside reflows), and the bead's three bars fold into a cross about their middle. */
.help { top: calc(env(safe-area-inset-top, 0px) + 16px); right: 16px; width: 40px; height: 40px; box-sizing: border-box; border-radius: 20px; overflow: hidden; contain: layout paint; }
/* (spelled out in full, and specific enough to beat the entrance's own delay, so a press opens it at once) */
.help, .ready .help.enter { transition: width 0.38s var(--shrink) 0.05s, height 0.42s var(--shrink) 0.05s, border-radius 0.42s var(--shrink) 0.05s, scale 0.35s var(--spring), opacity 0.9s var(--glide) 0.3s, transform 0.9s var(--spring) 0.3s; }
.help.open { width: 292px; height: var(--open-h, 330px); border-radius: 26px; }
.help.open, .ready .help.open.enter { transition: width 0.5s var(--grow), height 0.56s var(--grow), border-radius 0.5s var(--grow), scale 0.35s var(--spring), opacity 0.9s var(--glide) 0.3s, transform 0.9s var(--spring) 0.3s; }
@media (hover: hover) { .help:not(.open):hover { scale: 1.08; } }
.help:not(.open):active { scale: 0.92; }
.help-toggle { all: unset; position: absolute; top: -1px; right: -1px; z-index: 2; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.help-toggle:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.85); outline-offset: -3px; }
.help-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; overflow: visible; filter: drop-shadow(0 1px 1.5px rgba(10, 16, 32, 0.35)); }
/* (each bar turns about the bead's middle; the outer two first slide to it, so they cross exactly there) */
.help-toggle path { transform-box: view-box; transform-origin: 10px 10px; transition: transform 0.5s var(--spring), opacity 0.2s var(--glide); }
.help.open .help-toggle .l1 { transform: rotate(45deg) translateY(4px) scaleX(0.86); }
.help.open .help-toggle .l2 { opacity: 0; transform: scaleX(0.2); }
.help.open .help-toggle .l3 { transform: rotate(-45deg) translateY(-4px) scaleX(0.86); }
.help.open .help-toggle:hover path { stroke-width: 1.9; }
.help-body { position: absolute; top: 0; right: 0; width: 292px; box-sizing: border-box; padding: 0 16px 16px; pointer-events: none; }
.help.open .help-body { pointer-events: auto; }
.help-title { display: flex; align-items: center; height: 40px; margin: 0 0 2px; font: 600 15px/1 var(--ui); letter-spacing: -0.01em; color: var(--ink); }
.help-label { margin: 0 0 10px; font: 600 11.5px/1.35 var(--ui); color: rgba(255, 255, 255, 0.72); }
.help .keys { gap: 8px 12px; color: rgba(255, 255, 255, 0.9); }
.help-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 0.5px solid rgba(255, 255, 255, 0.18); }
.help-actions .pill { flex: 1; }
/* the words come in after the pane has begun to open, one row after another, and all leave at once as it closes */
.help-title, .help-label, .help dt, .help dd, .help-actions { opacity: 0; translate: 0 -4px; transition: opacity 0.14s var(--glide), translate 0.2s var(--glide); }
.help.open :is(.help-title, .help-label, dt, dd, .help-actions) { opacity: 1; translate: 0 0; transition: opacity 0.4s var(--glide), translate 0.5s var(--spring); transition-delay: calc(0.1s + var(--i, 0) * 28ms); }
.help-body { -webkit-user-select: text; user-select: text; }
.help-body button { -webkit-user-select: none; user-select: none; }

/* Esc, with the mouse already free: a small glass card to carry on or go back to the main menu */
.pause { inset: 0; z-index: 7; display: grid; place-items: center; pointer-events: none; background: rgba(6, 12, 28, 0.2); opacity: 0; transition: opacity 0.3s var(--glide); }
.pause[hidden] { display: grid; visibility: hidden; }
.pause.show { opacity: 1; pointer-events: auto; }
.pause-card { display: flex; align-items: center; gap: 18px; max-width: calc(100vw - 32px); box-sizing: border-box; padding: 10px 10px 10px 22px; border-radius: 30px; outline: none;
  transform: translateY(12px) scale(0.94); transition: transform 0.55s var(--spring); }
.pause.show .pause-card { transform: none; }
.pause-actions { display: flex; gap: 8px; }
.pause-card .pill { min-width: 108px; }

/* The sound bead lives inside the menu. */
.menu-sound svg { width: 17px; height: 17px; overflow: visible; stroke: none; }
.menu-sound .w { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; opacity: 0; transform-origin: 4px 8px; transform: scale(0.6); transition: opacity 0.4s var(--glide), transform 0.5s var(--spring); }
.menu-sound .x { stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; transition: opacity 0.3s var(--glide); }
.menu-sound.on .w { opacity: 1; transform: none; }
.menu-sound.on .w2 { transition-delay: 0.08s; }
.menu-sound.on .x { opacity: 0; }
.menu-sound.on .w1 { animation: ripple 2.4s ease-in-out 0.6s infinite; }
.menu-sound.on .w2 { animation: ripple 2.4s ease-in-out 0.9s infinite; }
@keyframes ripple { 50% { opacity: 0.45; } }

/* dock */
.dock { left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); transform: translateX(-50%); width: min(660px, calc(100% - 28px)); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.mobile-switches, .mobile-slot { display: contents; }
.mobile-trigger { display: none; }
/* A display:contents slot has no box, but its glass pseudo-elements would paint across the entire dock. */
@media (min-width: 561px) { .mobile-slot::before, .mobile-slot::after { content: none; } }
.views { position: relative; display: flex; gap: 0; padding: 3px; border-radius: 999px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.views::-webkit-scrollbar { display: none; }
/* the lens wells up under the first view you point at, glides on the compositor (translate) from there, dips when
   pressed (scale), and melts away where it is when you leave */
.lens { position: absolute; top: 3px; bottom: 3px; left: 0; width: var(--lw, 0px); translate: var(--lx, 0px) 0; border-radius: 999px; pointer-events: none; z-index: 0; opacity: 0; scale: 0.86;
  background: var(--lens); box-shadow: var(--lens-shadow);
  transition: translate 0.45s var(--spring), width 0.45s var(--spring), opacity 0.25s var(--glide), scale 0.4s var(--spring); }
.views.lensed .lens { opacity: 1; scale: 1; }
.views.lensed.pressing .lens { scale: 0.95; }
.view { all: unset; position: relative; z-index: 1; display: flex; align-items: center; padding: 5px 11px; border-radius: 999px; font: 500 11.5px var(--ui); color: var(--ink-soft); cursor: pointer; white-space: nowrap; transition: color 0.25s, transform 0.3s var(--spring); }
.view:hover, .view.on { color: var(--ink); }
.view:active { transform: scale(0.94); }
.ready .view { animation: viewIn 0.7s var(--glide) backwards; animation-delay: calc(0.22s + var(--i, 0) * 45ms); }
@keyframes viewIn { from { opacity: 0; transform: translateY(5px); } }
.view.flash { animation: flash 0.7s var(--glide); }
.view.on { text-shadow: 0 0 12px rgba(255, 255, 255, 0.4), var(--edge); }

/* the viewpoint card: a still of the view under the pointer, in a pane of glass that glides along above the bar */
.dock > .viewcard { position: absolute; left: 0; bottom: calc(100% + 12px); width: 188px; margin-left: -94px; padding: 6px 6px 8px; box-sizing: border-box; border-radius: 18px;
  translate: var(--cx, 50%) 0; opacity: 0; transform: translateY(8px) scale(0.92); transform-origin: 50% 100%; pointer-events: none;
  transition: translate 0.5s var(--spring), opacity 0.28s var(--glide), transform 0.45s var(--spring); }
.viewcard.show { opacity: 1; transform: none; }
.viewcard.instant { transition: none; }
.viewcard .shot { position: relative; height: 110px; border-radius: 12px; overflow: hidden; background: rgba(8, 14, 32, 0.4); box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.35); }
.viewcard img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.06); transition: opacity 0.35s var(--glide), transform 0.9s var(--glide); }
.viewcard img.front { opacity: 1; transform: none; }
.viewcard canvas.live { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.35s var(--glide); }
.viewcard canvas.live.on { opacity: 1; }
.viewcard .cap { display: flex; align-items: center; justify-content: space-between; padding: 7px 4px 0; font: 600 12px var(--ui); }
.viewcard .name { font: 600 13px/1.1 var(--ui); letter-spacing: -0.005em; }
.viewcard kbd { min-width: 18px; height: 18px; font-size: 10px; }
@keyframes flash { 0% { color: #fff; transform: scale(1.08); text-shadow: 0 0 12px rgba(255, 255, 255, 0.9); } 100% { transform: none; } }

.dial { width: 100%; box-sizing: border-box; padding: 10px 20px 10px 10px; border-radius: 26px; display: flex; align-items: center; gap: 14px; }
.play { all: unset; flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; position: relative;
  background: rgba(255, 255, 255, 0.16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28); transition: transform 0.35s var(--spring), background 0.25s; }
.play:hover { background: rgba(255, 255, 255, 0.26); transform: scale(1.06); }
.play:active { transform: scale(0.9); }
.play svg { grid-area: 1 / 1; width: 16px; height: 16px; fill: #fff; transition: opacity 0.3s var(--glide), transform 0.45s var(--spring); }
.play .i-play { opacity: 0; transform: scale(0.4) rotate(-90deg); }
.play.paused .i-pause { opacity: 0; transform: scale(0.4) rotate(90deg); }
.play.paused .i-play { opacity: 1; transform: none; }
/* a ring of light rolls outward when the day is paused or set going */
.play::after { content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none; }
.play.pulse::after { animation: ring 0.7s var(--glide); }
@keyframes ring { from { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); } to { box-shadow: 0 0 0 14px rgba(255, 255, 255, 0); } }
.phase { flex: none; width: 108px; }
.phase b { display: block; font: 600 15px/1.2 var(--ui); letter-spacing: -0.01em; white-space: nowrap; transition: color 0.4s; text-shadow: var(--edge), 0 1px 6px rgba(10, 16, 32, 0.3); }
.phase span { font: 500 11.5px var(--ui); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.track { position: relative; flex: 1; min-width: 0; padding-bottom: 18px; }
/* A simple painted timeline keeps the time of day legible and easy to drag at every width. */
#tod { position: relative; height: 32px; touch-action: none; }
.ticks { position: absolute; left: 11px; right: 11px; bottom: 0; height: 14px; font: 500 9.5px var(--ui); color: var(--ink-faint); }
.ticks button { all: unset; position: absolute; top: 0; transform: translateX(-50%); cursor: pointer; white-space: nowrap; transition: color 0.3s, transform 0.35s var(--spring); }
.ticks button:hover { color: var(--ink); transform: translateX(-50%) translateY(-1px); }
.ticks button.on { color: var(--ink); }
.ticks button:first-child { transform: none; } .ticks button:first-child:hover { transform: translateY(-1px); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; margin: 0; cursor: pointer; display: block; }
input[type=range]::-webkit-slider-runnable-track { height: 5px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.36); box-shadow: 0 1px 5px rgba(8, 16, 36, 0.22); background: linear-gradient(90deg, #bdd9e7 0%, #d9d9cb 20%, #e6b985 36%, #b88191 49%, #4c628b 62%, #354a74 79%, #b9c5d9 85%, #d5e2e8 100%); }
input[type=range]::-moz-range-track { height: 5px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.36); background: linear-gradient(90deg, #bdd9e7 0%, #d9d9cb 20%, #e6b985 36%, #b88191 49%, #4c628b 62%, #354a74 79%, #b9c5d9 85%, #d5e2e8 100%); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 19px; height: 19px; margin-top: -8px; border-radius: 50%; background: rgba(250, 251, 253, 0.92); border: 1.5px solid #fff; box-shadow: 0 2px 8px rgba(8, 16, 36, 0.32), 0 0 0 3px rgba(255, 255, 255, 0.18); transition: transform 0.3s var(--spring), box-shadow 0.3s var(--glide); }
input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.08); box-shadow: 0 3px 10px rgba(8, 16, 36, 0.35), 0 0 0 4px rgba(255, 255, 255, 0.2); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.15); box-shadow: 0 4px 12px rgba(8, 16, 36, 0.35), 0 0 0 6px rgba(255, 255, 255, 0.2); }
input[type=range]::-moz-range-thumb { width: 19px; height: 19px; border-radius: 50%; background: rgba(250, 251, 253, 0.92); border: 1.5px solid #fff; box-shadow: 0 2px 8px rgba(8, 16, 36, 0.32); transition: transform 0.3s var(--spring); }
input[type=range]:active::-moz-range-thumb { transform: scale(1.2); }

.toast { left: 50%; top: calc(env(safe-area-inset-top, 0px) + 18px); padding: 8px 16px; border-radius: 999px; font: 600 13px var(--ui); opacity: 0; transform: translate(-50%, -12px) scale(0.92); filter: blur(4px); pointer-events: none;
  transition: opacity 0.35s var(--glide), transform 0.5s var(--spring), filter 0.35s var(--glide); }
.toast.show { opacity: 1; transform: translate(-50%, 0); filter: none; }

/* touch */
.stick { position: fixed; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; pointer-events: none; z-index: 3; display: none; opacity: 0; scale: 0.6;
  transition: opacity 0.25s var(--glide), scale 0.4s var(--spring); }
.is-touch .stick { display: block; }
.stick.on { opacity: 1; scale: 1; }
.stick i { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); }
.stick:not(.on) i { transition: transform 0.4s var(--spring); }
.keys-touch { display: none !important; }
.is-touch .keys-desktop { display: none !important; }
.is-touch .keys-touch { display: grid !important; }

@media (max-width: 560px) {
  .keys-desktop { display: none !important; }
  .keys-touch { display: grid !important; }
  .help { right: 14px; top: calc(env(safe-area-inset-top, 0px) + 14px); }
  .help.open { width: min(292px, calc(100vw - 28px)); }
  .help-body { width: min(292px, calc(100vw - 28px)); }
  .dock { bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); }
  .mobile-switches { display: flex; justify-content: space-between; align-items: flex-end; width: 100%; }
  .mobile-slot { display: block; position: relative; width: 44px; height: 44px; box-sizing: border-box; border-radius: 50%; overflow: hidden;
    transition: width 0.48s var(--glide), height 0.48s var(--glide), border-radius 0.48s var(--glide), opacity 0.25s var(--glide); }
  .mobile-slot.open { width: 100%; height: 100px; border-radius: 20px; }
  .mobile-switches.expanded .mobile-slot:not(.open) { width: 0; opacity: 0; pointer-events: none; }
  .mobile-trigger { all: unset; position: absolute; bottom: 0; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; z-index: 2; border-radius: 50%;
    transition: transform 0.48s var(--glide); }
  .mobile-slot.open .mobile-trigger { transform: translateY(-56px); }
  .mobile-locations .mobile-trigger { left: 0; }
  .mobile-time .mobile-trigger { right: 0; }
  .mobile-trigger svg, .mobile-close { grid-area: 1 / 1; transition: opacity 0.24s var(--glide), transform 0.42s var(--spring); }
  .mobile-trigger svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-close { opacity: 0; transform: rotate(-90deg) scale(0.5); font: 400 22px/1 var(--ui); }
  .mobile-slot.open .mobile-trigger svg { opacity: 0; transform: rotate(90deg) scale(0.5); }
  .mobile-slot.open .mobile-close { opacity: 1; transform: none; }
  .dock .mobile-slot .views, .dock .mobile-slot .dial { position: absolute; top: 7px; bottom: 7px; width: auto; box-sizing: border-box; opacity: 0; visibility: hidden; pointer-events: none;
    background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; transition: opacity 0.24s var(--glide), visibility 0s 0.24s; }
  .mobile-slot .views::before, .mobile-slot .dial::before, .mobile-slot .views::after, .mobile-slot .dial::after { display: none; }
  .dock .mobile-locations .views { left: 48px; right: 7px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: space-between; gap: 2px; overflow: hidden; border-radius: 0; padding: 0; }
  .dock .mobile-time .dial { left: 7px; right: 7px; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-content: center; gap: 2px 8px; padding: 0; border-radius: 0; }
  .dock .mobile-slot.open .views, .dock .mobile-slot.open .dial { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0.12s; }
  .dial .play { width: 34px; height: 34px; }
  .dial .track { grid-column: 1 / -1; width: 100%; }
  .phase { width: auto; align-self: center; }
  .phase b { font-size: 13px; }
  .ticks { font-size: 8.5px; }
  .ticks button:nth-child(1), .ticks button:nth-child(4), .ticks button:nth-child(6) { display: none; }
  .lens { display: none; }
  .view { justify-content: center; min-width: 0; padding: 7px 2px; font-size: 10px; text-align: center; }
  .view.on { background: rgba(255, 255, 255, 0.18); box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.32); }
}
@media (max-width: 360px) {
  .ticks button:nth-child(3) { display: none; }
}
