:root {
  color-scheme: light;
  --ink: #171719;
  --muted: #56565e;
  --line: #dadadd;
  --paper: #fff;
  --wash: #f5f5f6;
  --piano: linear-gradient(165deg, #353538, #101011 70%);
  font: 1rem/1.5 system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--wash); color: var(--ink); }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
.shell { width: min(100%, 92rem); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 3rem); }
.masthead { background: var(--piano); color: white; border-bottom: 1px solid #000; }
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  padding-block: 1.3rem;
}
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.12; letter-spacing: -.045em; }
.eyebrow { margin-bottom: .4rem; font-size: .73rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.masthead .eyebrow { color: #d0d0d5; }

.file, button, select {
  border: 1px solid var(--line);
  border-radius: .65rem;
  padding: .55rem .8rem;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.file { position: relative; font-weight: 700; box-shadow: 0 2px 10px #0005; }
.file:hover, button:hover { background: #ededee; }
.file input, .view-options input { position: absolute; width: 1px; height: 1px; opacity: 0; }
:focus-visible, .file:focus-within, .view-options input:focus-visible + span { outline: 2px solid #4b61d1; outline-offset: 3px; }
.file:focus-within { outline-color: white; }

main { padding-block: 1.5rem 3rem; }
.status { margin-bottom: .9rem; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.error { color: #a51e22; }
#empty, .toolbar, .view, .note {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--paper);
}
#empty {
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 1.4rem;
  min-height: min(31rem, 65vh);
  padding: clamp(1.5rem, 6vw, 5rem);
}
.format-mark {
  display: grid;
  place-items: center;
  width: 4rem;
  aspect-ratio: 1;
  border-radius: .9rem;
  background: var(--piano);
  color: white;
  font: 700 1rem ui-monospace, monospace;
}
.welcome-copy h2 { margin-bottom: .5rem; font-size: clamp(2.1rem, 6vw, 4rem); line-height: 1; letter-spacing: -.055em; }
.welcome-copy p, .privacy, .hint, .note { color: var(--muted); }
.privacy { border-top: 1px solid var(--line); padding-top: 1rem; font-size: .9rem; }

.toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: .75rem 1.5rem;
  margin-bottom: 1rem;
  padding: .9rem 1rem;
}
.toolbar label, .view > label { font-size: .9rem; font-weight: 650; }
select, input[type=range] { display: block; width: 100%; margin: .3rem 0 0; }
input[type=range] { min-height: 1.5rem; accent-color: var(--ink); }
.view-picker { display: none; }
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, .85fr);
  gap: 1rem;
  align-items: start;
}
.view { display: grid; gap: .85rem; padding: .9rem; }
.title, .actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.title { justify-content: space-between; }
.title h2 { font-size: 1.125rem; }
button { font-size: .85rem; font-weight: 650; }
.title button, button[aria-pressed=true], .view-options input:checked + span {
  background: var(--piano);
  color: white;
  border-color: #171719;
}
canvas { display: block; width: 100%; height: auto; background: #000; }
#edit[aria-pressed=true] { box-shadow: inset 0 0 0 1px #85858b; }
.view:has(#edit[aria-pressed=true]) #axial { touch-action: none; cursor: move; }
#pano { cursor: crosshair; }
output { margin-left: .3rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.hint, .note { font-size: .85rem; }
.note { margin-top: 1rem; padding: .85rem 1rem; }

@media (max-width: 52rem) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .view-picker { display: block; min-width: 0; margin: 0 0 .9rem; padding: 0; border: 0; }
  .view-picker legend { margin-bottom: .35rem; padding: 0; font-size: .85rem; font-weight: 650; }
  .view-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; }
  .view-options label { position: relative; cursor: pointer; }
  .view-options span {
    display: block;
    padding: .6rem .15rem;
    border: 1px solid var(--line);
    border-radius: .55rem;
    background: white;
    text-align: center;
    font-size: .82rem;
    font-weight: 650;
  }
  #viewer:not(:has([value=axial]:checked)) [data-view=axial],
  #viewer:not(:has([value=pano]:checked)) [data-view=pano],
  #viewer:not(:has([value=cross]:checked)) [data-view=cross] { display: none; }
}

@media (max-width: 32rem) {
  .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar label:first-child { grid-column: 1 / -1; }
}
