@layer ui-sdk;

:root {
  --ink: #6b7079;
  --ui: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
@media (pointer: fine) {
  html { overscroll-behavior: none; }
}
body {
  background: #fff;
  font-family: var(--ui);
  color: var(--ink);
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.stage {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

music-player {
  display: block;
  width: calc(340px * var(--s, 1));
  height: calc(566px * var(--s, 1));
  flex: none;
}

/* ---------------- the body ---------------- */

.device {
  --face: linear-gradient(165deg, #f1f2f4 0%, #d6dae0 38%, #e5e7eb 58%, #b9bec7 100%);
  --edge: #a9aeb6;
  --wheel: linear-gradient(#ffffff, #eceef1);
  --wheel-line: rgba(0, 0, 0, 0.12);
  --label: #9a9ea6;
  --center: linear-gradient(#f4f5f7, #dcdfe3);
  --shine: rgba(255, 255, 255, 0.75);
  --bezel-shine: rgba(255, 255, 255, 0.45);
  --thumb: linear-gradient(#fafafa, #c5c9cf);
  --thumb-line: rgba(0, 0, 0, 0.3);
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .45 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.28'/%3E%3C/svg%3E");
  position: relative;
  width: 340px;
  height: 566px;
  transform: scale(var(--s, 1));
  transform-origin: 0 0;
  border-radius: 36px;
  background: var(--texture), var(--face);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 3px 1px var(--shine),
    inset 0 -3px 4px rgba(0, 0, 0, 0.08),
    0 36px 60px -22px rgba(0, 0, 0, 0.55),
    0 12px 22px -12px rgba(0, 0, 0, 0.35);
}
.device[data-body="black"] {
  --face: linear-gradient(160deg, #3d3e42 0%, #18191b 46%, #2b2c30 62%, #111214 100%);
  --edge: #050506;
  --wheel: linear-gradient(#2c2d31, #1a1b1e);
  --wheel-line: rgba(255, 255, 255, 0.06);
  --label: #8b8f97;
  --center: linear-gradient(#26272a, #17181a);
  --shine: rgba(255, 255, 255, 0.13);
  --bezel-shine: rgba(255, 255, 255, 0.07);
  --thumb: linear-gradient(#6a6b70, #34353a);
  --thumb-line: rgba(0, 0, 0, 0.6);
}
.device[data-body="white"] {
  --face: linear-gradient(170deg, #ffffff 0%, #f3f4f6 60%, #e6e8eb 100%);
  --edge: #c9ccd1;
  --texture: linear-gradient(transparent, transparent);
  --label: #b2b5ba;
}
.device[data-body="red"] {
  --face: linear-gradient(160deg, #ec4b4b 0%, #b0141c 50%, #d22a31 64%, #8c0d14 100%);
  --edge: #6d070c;
  --label: #a9acb2;
  --shine: rgba(255, 255, 255, 0.32);
  --bezel-shine: rgba(255, 255, 255, 0.2);
}

/* The hold switch slides over an orange patch: orange showing means locked. */
.hold {
  position: absolute;
  top: -5px;
  left: 56px;
  display: block;
  width: 36px;
  height: 6px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, #ff8a2a 50%, #26272a 50%);
  box-shadow: inset 0 0 0 1px var(--edge), inset 0 2px 2px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
/* A finger-sized target around a switch that's only 6px tall. */
.hold::before {
  content: "";
  position: absolute;
  inset: -18px -8px -14px;
}
.hold ui-switch-thumb {
  position: absolute;
  inset: 0 50% 0 0;
  display: block;
  border-radius: 3px 0 0 0;
  background:
    repeating-linear-gradient(90deg, var(--thumb-line) 0 1px, transparent 1px 3px) center / 7px 60% no-repeat,
    var(--thumb);
  box-shadow: inset 0 0 0 1px var(--edge), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: translate 0.16s cubic-bezier(0.3, 0.7, 0.3, 1), border-radius 0.16s;
}
.hold[data-checked] ui-switch-thumb { translate: 100% 0; border-radius: 0 3px 0 0; }
@media (hover: hover) {
  .hold:hover ui-switch-thumb { filter: brightness(1.08); }
}
.hold:focus-visible { outline: 2px solid #3383e0; outline-offset: 3px; }

/* ---------------- the screen ---------------- */

.bezel {
  position: absolute;
  top: 24px;
  left: 22px;
  width: 296px;
  height: 225px;
  padding: 6px;
  border-radius: 9px;
  background: #0a0a0b;
  box-shadow: 0 1px 0 var(--bezel-shine), inset 0 0 0 1px #000;
}
.screen {
  position: relative;
  width: 284px;
  height: 213px;
  overflow: hidden;
  border-radius: 2px;
  background: #fff;
  color: #000;
  font-family: var(--ui);
}
.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: #000;
  opacity: 0;
  transition: opacity 0.6s;
}
.screen.dim::after { opacity: 0.42; }
.screen.off::after { opacity: 0.97; transition-duration: 0.3s; }
.glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(158deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04) 30%, transparent 46%);
}

.status {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  background: linear-gradient(#fdfdfd, #e3e5e8 55%, #cfd2d7);
  border-bottom: 1px solid #8e939b;
  font: 600 12px/1 var(--ui);
}
.st-left { width: 22px; display: flex; align-items: center; color: #1f6ad0; }
.st-title {
  position: absolute;
  left: 34px;
  right: 34px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flash-lock .st-left { animation: lockflash 0.9s; }
@keyframes lockflash {
  0%, 50% { transform: scale(1.6); color: #e0661a; }
}

.batt { position: relative; display: block; width: 22px; height: 10px; }
.batt::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 3px;
  width: 2px;
  height: 4px;
  background: #5c6068;
  border-radius: 0 1px 1px 0;
}
.batt ui-meter-track {
  display: block;
  height: 100%;
  border: 1px solid #5c6068;
  border-radius: 2px;
  padding: 1px;
  background: #fff;
}
.batt ui-meter-indicator {
  display: block;
  height: 100%;
  border-radius: 1px;
  background: linear-gradient(#a6e98a, #3fae2a);
}
.batt[data-low] ui-meter-indicator { background: linear-gradient(#ff9a8a, #d8311e); }
.batt[data-charging] ui-meter-indicator { background: linear-gradient(#ffe48a, #e6b51c); }

.panes {
  position: absolute;
  top: 21px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}
.pane {
  position: absolute;
  inset: 0;
  background: #fff;
}

/* menus */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  height: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px 0 8px;
  font: 600 13.5px/1 var(--ui);
  white-space: nowrap;
}
.list li .l { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.list li .v { color: #6b7079; font-weight: 500; }
.list li .arr { font-size: 17px; line-height: 0; margin-top: -2px; color: #333; }
.list li.on {
  color: #fff;
  background: linear-gradient(#64a8f4, #3383e0 50%, #1f68cc 51%, #2c78da);
}
.list li.on .v { color: #e4edff; }
.list li.on .arr { color: #fff; }
.list li.empty { color: #888; font-weight: 500; }
.split .list { width: 50%; }
.sb {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 8px;
  border-left: 1px solid #9aa0a8;
  background: linear-gradient(90deg, #d9dce1, #f5f6f7);
}
.sb i {
  position: absolute;
  left: 1px;
  right: 1px;
  border-radius: 3px;
  background: linear-gradient(90deg, #5d9ce9, #2a6fd0);
}
.split .list li.on { margin-right: 0; }
.preview {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50%;
  overflow: hidden;
  background: #000;
  box-shadow: -1px 0 3px rgba(0, 0, 0, 0.35);
}
.pv { position: absolute; inset: 0; opacity: 0; transition: opacity 1.1s; }
.pv.show { opacity: 1; }
.pv svg { display: block; width: 100%; height: 100%; }
.pv-bg { position: absolute; inset: -18%; filter: blur(12px) saturate(1.25) brightness(0.72); }
.pv-cover {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 112px;
  height: 112px;
  margin: -56px 0 0 -56px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45), 0 0 0 0.5px rgba(255, 255, 255, 0.25);
}
.pv.show .pv-cover { animation: drift 5.2s ease-out both; }
@keyframes drift {
  from { transform: scale(0.94); }
  to { transform: scale(1.04); }
}

/* now playing */
.now { padding: 5px 13px 0; }
.np-count { height: 14px; text-align: center; font: 600 11px/14px var(--ui); color: #333; }
.np-main { display: flex; gap: 14px; margin-top: 7px; }
.np-art {
  width: 92px;
  flex: none;
  transform: perspective(360px) rotateY(16deg);
  transform-origin: left center;
}
.cover { width: 92px; height: 92px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); background: #ddd; }
.cover svg, .refl svg { display: block; width: 92px; height: 92px; }
.refl {
  height: 26px;
  overflow: hidden;
  margin-top: 1px;
  transform: scaleY(-1);
  opacity: 0.35;
  -webkit-mask-image: linear-gradient(to top, #000, transparent 70%);
  mask-image: linear-gradient(to top, #000, transparent 70%);
}
.refl svg { margin-top: -66px; }
.np-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 14px;
  font: 500 12.5px/1.15 var(--ui);
  color: #222;
}
.np-meta > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-meta b { font-size: 13.5px; font-weight: 700; color: #000; }
.np-bar, .np-vol { position: absolute; left: 14px; right: 14px; bottom: 9px; }
.bar { display: block; }
.bar [data-slot$="-track"] {
  position: relative;
  display: block;
  height: 9px;
  border: 1px solid #6d7178;
  background: linear-gradient(#ffffff, #dfe2e6);
}
.bar [data-slot$="-indicator"] {
  display: block;
  height: 100%;
  background: linear-gradient(#9fcbff, #3a83e0 55%, #1d61c3);
}
.np-bar [data-slot="progress-indicator"] { transition: width 0.2s linear; }
.knob {
  display: none;
  position: absolute;
  top: 50%;
  left: var(--progress-value, 0%);
  width: 9px;
  height: 9px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: #fff;
  border: 1px solid #333;
  transition: left 0.2s linear;
}
.scrub .knob { display: block; }
.scrub .np-bar [data-slot="progress-indicator"] { background: linear-gradient(#e9ecf0, #c9cdd3); }
.times {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font: 600 11px/1 var(--ui);
  font-variant-numeric: tabular-nums;
}
.np-vol { display: none; align-items: center; gap: 6px; bottom: 22px; color: #333; }
.np-vol .bar { flex: 1; }
.now.vol .np-bar { display: none; }
.now.vol .np-vol { display: flex; }

/* extras */
.clock { display: grid; place-content: center; text-align: center; gap: 4px; }
.clock .city { font: 600 12px var(--ui); color: #555; }
.clock .time { font: 700 50px/1 var(--ui); letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.clock .time small { font-size: 15px; margin-left: 4px; letter-spacing: 0; }
.clock .date { font: 500 12px var(--ui); color: #333; }
.stopwatch { padding: 14px 16px 0; }
.sw-time { text-align: center; font: 700 36px/1 var(--ui); font-variant-numeric: tabular-nums; }
.laps { list-style: none; margin: 10px 0 0; padding: 0; font: 500 12px/1.6 var(--ui); font-variant-numeric: tabular-nums; }
.laps li { display: flex; justify-content: space-between; border-bottom: 1px solid #eee; }
.stopwatch .hint { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font: 500 10.5px var(--ui); color: #888; }
.game canvas { display: block; width: 100%; height: 100%; }
.about { padding: 12px 18px; }
.about-name { font: 700 17px var(--ui); text-align: center; margin-bottom: 8px; }
.about dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font: 500 12px var(--ui); }
.about dt { color: #555; }
.about dd { margin: 0; text-align: right; font-weight: 600; }

/* ---------------- the wheel ---------------- */

click-wheel {
  position: absolute;
  left: 64px;
  top: 300px;
  width: 212px;
  height: 212px;
  display: block;
}
.wheel {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 50%;
  background: var(--wheel);
  box-shadow:
    0 0 0 1px var(--wheel-line),
    inset 0 1px 1px rgba(255, 255, 255, 0.85),
    inset 0 -2px 4px rgba(0, 0, 0, 0.07),
    0 1px 0 rgba(255, 255, 255, 0.5);
  touch-action: none;
  cursor: grab;
}
click-wheel[data-turning] .wheel { cursor: grabbing; }
.wheel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.08s;
}
click-wheel[data-pressed] .wheel::after { opacity: 1; }
click-wheel[data-pressed="menu"] .wheel::after { background: radial-gradient(circle at 50% 10%, rgba(0, 0, 0, 0.1), transparent 32%); }
click-wheel[data-pressed="next"] .wheel::after { background: radial-gradient(circle at 90% 50%, rgba(0, 0, 0, 0.1), transparent 32%); }
click-wheel[data-pressed="play"] .wheel::after { background: radial-gradient(circle at 50% 90%, rgba(0, 0, 0, 0.1), transparent 32%); }
click-wheel[data-pressed="prev"] .wheel::after { background: radial-gradient(circle at 10% 50%, rgba(0, 0, 0, 0.1), transparent 32%); }

.lbl {
  position: absolute;
  display: grid;
  place-items: center;
  width: 54px;
  height: 30px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--label);
  font: 700 13px/1 var(--ui);
  letter-spacing: 0.08em;
  cursor: inherit;
  touch-action: none;
  -webkit-touch-callout: none;
}
.lbl svg { fill: currentColor; }
.lbl-menu { top: 10px; left: 79px; }
.lbl-play { bottom: 10px; left: 79px; }
.lbl-next { right: 2px; top: 91px; }
.lbl-prev { left: 2px; top: 91px; }
.lbl:focus-visible { outline: 2px solid #3383e0; outline-offset: 2px; border-radius: 6px; }
.center:focus-visible { outline: 2px solid #3383e0; outline-offset: 2px; }

.center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 82px;
  height: 82px;
  margin: -41px 0 0 -41px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--center);
  box-shadow:
    0 0 0 1px var(--wheel-line),
    inset 0 1px 1px rgba(255, 255, 255, 0.8),
    0 1px 2px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  touch-action: none;
}
.center:active,
click-wheel[data-pressed="select"] .center { filter: brightness(0.93); }
@media (hover: hover) {
  .lbl { transition: color 0.12s; }
  .lbl:hover { color: color-mix(in srgb, var(--label) 70%, #000); }
}

/* ---------------- page ---------------- */

.stage > .hint {
  margin: 16px 0 0;
  text-align: center;
  font: 500 12.5px/1.5 var(--ui);
  text-wrap: balance;
}
.stage > .hint span { display: block; }
@media (hover: none) { .stage > .hint .keys { display: none; } }
@media (hover: hover) { .stage > .hint .touch { display: none; } }
@media (max-height: 699px) {
  .stage > .hint { display: none; }
}

.source-link {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #3f3f46;
  font: 500 13px/1.2 var(--ui);
  text-decoration: none;
  transition: color 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}
.source-link:hover { color: #09090b; border-color: rgba(15, 23, 42, 0.24); background: #fff; }
.source-link:focus-visible { outline: 2px solid #3383e0; outline-offset: 3px; }
/* On a phone the pill would sit on the player, so the player starts below it. */
@media (max-width: 700px) {
  .stage { padding-top: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  .pv.show .pv-cover { animation: none; }
  .np-bar [data-slot="progress-indicator"], .knob, .hold ui-switch-thumb, .source-link { transition: none; }
}
