:root {
  --bg: #f1efea;
  --card: #ffffff;
  --ink: #17181a;
  --soft: rgba(23, 24, 26, 0.5);
  --line: rgba(23, 24, 26, 0.1);
  --accent: #ff5a36;
  --wound: #a98d5f;
  --steel: #9aa0a8;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 10px 16px;
}

.tn {
  width: min(344px, 100%);
  padding: 14px 16px 12px;
  border-radius: 28px;
  background: var(--card);
  box-shadow:
    0 0 0 1px rgba(23, 24, 26, 0.05),
    0 1px 1px rgba(23, 24, 26, 0.04),
    0 12px 24px -10px rgba(60, 40, 20, 0.12),
    0 40px 70px -30px rgba(60, 40, 20, 0.22);
}
.tn__head { display: flex; align-items: baseline; justify-content: space-between; }
.tn__brand { font-size: 15px; font-weight: 680; font-stretch: 108%; letter-spacing: -0.008em; }
.tn__ref { font-size: 12px; font-weight: 480; color: var(--soft); }
.tn__ref b { font-weight: 640; color: var(--ink); }

.tn__gauge { position: relative; margin-top: 2px; }
.tn__gauge svg { display: block; width: 100%; height: auto; max-height: 36vh; overflow: visible; }
.tn__zone { fill: none; stroke: color-mix(in srgb, var(--accent) 16%, transparent); stroke-width: 20; }
.tn__gauge line { stroke: var(--ink); stroke-width: 1.300; stroke-linecap: round; }
.tn__end { font-size: 9.500px; font-weight: 560; letter-spacing: 0.04em; fill: var(--soft); text-anchor: middle; }
.tn__needle { fill: var(--ink); stroke: var(--ink); stroke-width: 1.200; stroke-linejoin: round; transition: fill 0.3s ease, stroke 0.3s ease; }
.tn__needle-shadow { fill: rgba(60, 40, 20, 0.2); transform: translate(2px, 3px); filter: blur(1.5px); }
.tn__ping { fill: none; stroke: var(--accent); stroke-width: 1.500; opacity: 0; }
.tn.is-tuned .tn__needle { fill: var(--accent); stroke: var(--accent); }

/* the note sits in the hollow of the dial; its weight is written by the script */
.tn__note {
  position: absolute;
  left: 50%;
  top: 80%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: flex-start;
  pointer-events: none;
}
.tn__letter { display: block; height: 1em; overflow: hidden; font-size: clamp(34px, 9.500vh, 50px); line-height: 1; }
.tn__letter span { display: block; font-weight: 440; font-stretch: 100%; font-variation-settings: "wght" var(--w, 440), "wdth" var(--wd, 100); transition: color 0.3s ease; }
.tn__note sub { margin: 0.5em 0 0 2px; font-size: 13px; font-weight: 600; color: var(--soft); vertical-align: baseline; }
.tn.is-tuned .tn__letter span { color: var(--accent); }

.tn__read {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 480;
  color: var(--soft);
}
.tn__read b { font-weight: 640; color: var(--ink); }
.tn__cents { text-align: right; }
.tn__say { height: 22px; padding: 0 10px; border-radius: 999px; overflow: hidden; background: rgba(23, 24, 26, 0.055); font-size: 12px; line-height: 22px; font-weight: 600; color: var(--ink); transition: background-color 0.3s ease, color 0.3s ease; }
.tn__say span { display: block; white-space: nowrap; }
.tn.is-tuned .tn__say { background: color-mix(in srgb, var(--accent) 14%, transparent); color: color-mix(in srgb, var(--accent) 86%, #000); }

.tn__strings { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.string {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: clamp(18px, 4.600vh, 22px);
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.string__chip {
  position: relative;
  flex: none;
  width: 26px;
  height: 17px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(23, 24, 26, 0.14);
  font-size: 10.500px;
  line-height: 17px;
  font-weight: 680;
  text-align: center;
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}
.string.is-on .string__chip { box-shadow: inset 0 0 0 1.500px var(--ink); }
.string.is-tuned .string__chip { background: var(--accent); color: #ffffff; box-shadow: none; }
.string > svg:not(.string__tick) { flex: 1; min-width: 0; height: 100%; overflow: visible; }
.string__wire { fill: none; stroke: var(--steel); stroke-linecap: round; vector-effect: non-scaling-stroke; }
.string__blur { fill: none; stroke: var(--steel); stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: 0; }
.string.is-wound .string__wire, .string.is-wound .string__blur { stroke: var(--wound); }
.string__tick { flex: none; width: 12px; height: 12px; fill: none; stroke: var(--accent); stroke-width: 1.800; stroke-linecap: round; stroke-linejoin: round; }
.string__tick path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.string:focus-visible .string__chip { box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--ink); }

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  fill: #17181a;
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
  opacity: 0;
  visibility: hidden;
  z-index: 5;
}

/* larger on a desktop-sized window, so the piece fills the frame; the phone box and the narrow Playground stay as they are */
@media (min-width: 700px) and (min-height: 500px) { .tn { zoom: 1.25; } }
@media (min-width: 1100px) and (min-height: 760px) { .tn { zoom: 1.6; } }
