@layer ui-sdk;

:root {
  --bg: #ffffff;
  --ink: #16171a;
  --muted: #6b6e75;
  --line: #e6e7ea;
  --chip: #f3f4f6;
  --focus: #2f6fde;
  color-scheme: light;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* --- source pill, as on the iPod */
.source-link {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.source-link:hover { background: var(--chip); }

/* --- the watch, alone on the page */
.stage {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  padding: 16px 16px 28px;
}

.viewport {
  position: relative;
  display: block;
  width: 100%;
  height: calc(100dvh - 116px);
  min-height: 360px;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.viewport[data-dragging] { cursor: grabbing; }
.viewport[data-crown-hover] { cursor: ns-resize; }
.viewport canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.nogl { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); }
.nogl[hidden] { display: none; }

/* --- hint line, with the crown chip for keys and screen readers */
.hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  max-width: 680px;
  text-align: center;
}
.hint p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.hint .keys { display: none; }
@media (hover: hover) and (pointer: fine) {
  .hint .keys { display: block; }
}

.crown {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
}
.crown-icon {
  width: 14px;
  height: 18px;
  border-radius: 3px 5px 5px 3px;
  background:
    repeating-linear-gradient(180deg, rgb(0 0 0 / 0.25) 0 1px, transparent 1px 3px),
    linear-gradient(90deg, #8f7034, #e9cd8c 35%, #fff3d2 50%, #c9a258 75%, #7f622a);
  transition: translate 220ms cubic-bezier(0.3, 0.7, 0.2, 1);
}
.crown[data-crown="date"] .crown-icon { translate: 3px 0; }
.crown[data-crown="time"] .crown-icon { translate: 6px 0; }
.crown-pos { display: inline-flex; gap: 6px; color: var(--muted); }
.crown[data-crown="wind"] [data-pos="wind"],
.crown[data-crown="date"] [data-pos="date"],
.crown[data-crown="time"] [data-pos="time"] { color: var(--ink); }

@media (max-width: 600px) {
  .stage { padding-top: 56px; }
  .viewport { height: calc(100dvh - 190px); }
}
