@font-face {
  font-family: "Velvelyne";
  src: url("./assets/Velvelyne-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Velvelyne";
  src: url("./assets/Velvelyne-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  --corner-size: clamp(32px, 3.8vw, 60px);
  --edge: clamp(18px, 3vw, 50px);
  --paper: #d7d4cf;
  --ink: #141517;
  --signal: #ddff38;
  font-family: "Velvelyne", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

#instrument {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 48% 37%, #e8e5df 0%, var(--paper) 60%, #c7c4bf 100%);
}
#stage { position: absolute; inset: 0; touch-action: none; }
canvas { width: 100%; height: 100%; display: block; cursor: grab; }
canvas.dragging { cursor: grabbing; }
header {
  position: absolute;
  z-index: 2;
  inset: max(clamp(18px, 3.4vh, 34px), env(safe-area-inset-top)) var(--edge) auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}
h1, .project-link {
  margin: 0;
  font-size: var(--corner-size);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 0.93;
}
.project-link {
  pointer-events: auto;
  display: grid;
  place-items: start end;
  min-width: 44px;
  min-height: 44px;
  text-decoration: none;
}
.project-link:hover, .project-link:focus-visible { text-decoration: underline; }
#hover {
  position: fixed;
  z-index: 3;
  pointer-events: none;
  padding: 4px 8px;
  color: #000;
  background: #fff;
  font-size: 1rem;
}
#loading:not(:empty) {
  position: absolute;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

#sound {
  position: absolute;
  z-index: 2;
  right: max(var(--edge), env(safe-area-inset-right));
  bottom: max(clamp(16px, 3.4vh, 32px), env(safe-area-inset-bottom));
  font-size: var(--corner-size);
  width: max(44px, 1em);
  height: max(44px, 1em);
  padding: 0;
  display: grid;
  place-items: end;
}
#sound svg { width: 1em; height: 1em; }
#sound[data-audible="true"] .sound-cross,
#sound[data-audible="false"] .sound-waves { display: none; }

.bottom-line {
  position: absolute;
  left: 50%;
  bottom: max(clamp(16px, 3.4vh, 32px), env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(32rem, calc(100% - 2 * (var(--edge) + max(44px, var(--corner-size)) + 6px)));
  text-align: center;
  font-size: 1rem;
  line-height: 1.4;
}
#intro { margin: 0; font-size: .9375rem; color: var(--source, #464440); pointer-events: none; }
#notice { display: inline; margin: 0; }
#retry { text-decoration: underline; }
#ticker {
  overflow: hidden;
  container-type: inline-size;
  mask-image: linear-gradient(to right, transparent, black 8px, black calc(100% - 8px), transparent);
}
.track, .headlines { display: flex; width: max-content; align-items: center; }
.track { animation: crawl var(--duration, 80s) linear infinite; }
.headlines { min-width: 100cqi; }
.headlines a {
  flex: 0 0 auto;
  padding: 6px 12px;
  white-space: nowrap;
  text-decoration: none;
}
.headlines a::after {
  content: "·";
  display: inline-block;
  padding-left: 24px;
}
.headlines a:hover, .headlines a:focus-visible { text-decoration: underline; }
.source { color: #464440; }
@keyframes crawl { to { transform: translateX(-50%); } }
@media (hover: hover) {
  #ticker:hover .track { animation-play-state: paused; }
}
#ticker:has(:focus-visible) { overflow-x: auto; }
#ticker:has(:focus-visible) .track { animation: none; }
#ticker:has(:focus-visible) .repeat { display: none; }
@media (prefers-reduced-motion: reduce) {
  #ticker { overflow-x: auto; }
  .track { animation: none; }
  .repeat { display: none; }
}

#countryControls {
  position: absolute;
  top: max(78px, 12vh);
  left: clamp(18px, 3vw, 50px);
  display: flex;
  gap: 12px;
}
#countryControls:not(:focus-within):not(.fallback) {
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  overflow: hidden;
}
#countryControls button { padding: 6px 0; text-decoration: underline; }
dialog {
  width: min(365px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid #d6d6cc;
  background: white;
  color: var(--ink);
}
dialog::backdrop { background: #25271d26; }
.picker-head { display: flex; align-items: center; justify-content: space-between; }
.picker-head h2 { margin: 0; font-size: 1.5rem; }
.close { font-size: 1.5rem; min-width: 36px; }
#search { width: 100%; padding: 10px; margin: 16px 0 8px; border: 1px solid #aaa; }
#choices { max-height: min(44vh, 350px); overflow: auto; }
#choices button { width: 100%; display: block; text-align: left; padding: 9px 10px; }
#choices button:hover, #choices button:focus-visible { background: var(--signal); }
#choices button:disabled { opacity: 0.4; }
.credit { font-size: .82rem; line-height: 1.4; color: #575650; margin-bottom: 0; }


#voiceControl {
  position: absolute;
  z-index: 2;
  left: max(var(--edge), env(safe-area-inset-left));
  bottom: max(clamp(16px, 3.4vh, 32px), env(safe-area-inset-bottom));
  display: grid;
  gap: 2px;
  max-width: 13rem;
  font-size: .875rem;
}
#qualityVoice { padding: 0; text-align: left; text-decoration: underline; font-weight: 700; }
#qualityVoice:disabled { cursor: wait; text-decoration: none; }
#voiceStatus { font-size: .75rem; color: #464440; }
@media (max-width: 900px) {
  #voiceControl { bottom: calc(max(clamp(16px, 3.4vh, 32px), env(safe-area-inset-bottom)) + 48px); }
}
