:root {
  color-scheme: light dark;
  --app: #f3f4f5;
  --work: #fafafb;
  --surface: #fff;
  --secondary: #eceef0;
  --ink: #25282d;
  --muted: #787d85;
  --border: #e2e4e8;
  --brand: #0b6b52;
  --soft: #e8f1ee;
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  font-size: 13px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--app);
  color: var(--ink);
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  padding: 7px 10px;
  transition:
    background 0.14s,
    opacity 0.14s;
  white-space: nowrap;
}
button:hover {
  background: var(--secondary);
}
button:active {
  opacity: 0.7;
}
button:disabled {
  opacity: 0.35;
  cursor: default;
}
button:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
svg {
  width: 17px;
  height: 17px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.spacer {
  flex: 1;
}
.primary {
  background: var(--brand) !important;
  color: #fff !important;
  border-radius: 8px;
  padding: 9px 16px;
}
#app {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100dvh;
  padding: 8px;
  gap: 8px;
}
aside {
  padding: 16px 8px 6px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 24px;
}
.brand img {
  width: 28px;
  height: 28px;
}
.brand button {
  margin-left: auto;
}
.section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 8px;
  padding: 0 8px;
  color: var(--muted);
}
select {
  border: 0;
  background: transparent;
  max-width: 170px;
  cursor: pointer;
}
summary {
  cursor: pointer;
  color: var(--muted);
  padding: 8px;
  list-style-position: inside;
}
#library button,
#steps button {
  display: block;
  width: 100%;
  text-align: left;
  white-space: normal;
  padding: 10px;
  margin: 2px 0;
}
#library small {
  display: block;
  color: var(--muted);
  margin-top: 5px;
  font-size: 11px;
}
.selected {
  background: var(--secondary);
}
#steps button {
  border-left: 2px solid transparent;
}
#steps button.selected {
  border-left-color: var(--brand);
  background: var(--soft);
}
#steps .number {
  display: inline-block;
  width: 32px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.edition {
  display: block;
  color: var(--muted);
  padding: 24px 10px;
}
main {
  background: var(--work);
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 0.5px solid var(--border);
  min-width: 0;
}
header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 0.5px solid var(--border);
}
h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 5px;
}
p {
  margin: 0;
  color: var(--muted);
}
.heading {
  flex: 1;
  min-width: 0;
}
h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#saved {
  font-size: 11px;
  color: var(--muted);
}
#showSidebar {
  display: none;
}
#workspace {
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}
nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 20px;
}
nav button {
  color: var(--muted);
}
nav button.active {
  color: var(--brand);
  background: var(--soft);
}
.segment {
  display: flex;
  background: var(--secondary);
  padding: 3px;
  border-radius: 9px;
  gap: 2px;
}
.segment button {
  flex: 1;
  padding: 6px 13px;
  color: var(--muted);
  border-radius: 7px;
}
.segment button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px #00000008;
}
#view {
  margin-left: 10px;
}
.segment button[data-view='3D'].active {
  background: #1a2522;
  color: white;
}
#pitchArea {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px 60px;
  min-height: 0;
}
#pitch {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  aspect-ratio: 1.55;
  touch-action: none;
  border-radius: 16px;
  outline: none;
}
footer {
  position: relative;
  border-top: 0.5px solid var(--border);
  padding: 8px 20px;
}
.transport {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
}
#stageTitle {
  margin-left: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}
#track {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 20px;
  right: 20px;
  border-radius: 12px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px);
  border: 0.5px solid var(--border);
  display: flex;
  justify-content: space-between;
  box-shadow: 0 3px 10px #0000000a;
  transition:
    opacity 0.21s,
    transform 0.21s;
}
#track:before {
  content: '';
  position: absolute;
  left: 30px;
  right: 30px;
  top: 50%;
  height: 1px;
  background: var(--border);
}
#track button {
  z-index: 1;
  border: 1px solid var(--border);
  border-radius: 50%;
  padding: 0;
  width: 24px;
  height: 24px;
  background: var(--work);
  color: var(--muted);
}
#track button.active {
  background: var(--secondary);
  color: var(--brand);
  font-weight: 600;
}
footer.collapsed #track {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}
.panel {
  position: absolute;
  z-index: 8;
  width: 320px;
  top: 54px;
  right: 22px;
  padding: 18px;
  border-radius: 16px;
  border: 0.5px solid var(--border);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 30px #0f23151a;
  animation: panel-in 0.21s ease-out;
}
.panel .section {
  margin: 0 0 14px;
  padding: 0;
  color: var(--ink);
}
.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.choices button {
  text-align: left;
  padding: 10px;
}
.swatches {
  display: flex;
  gap: 9px;
  margin: 14px 0 20px;
}
.swatches button {
  padding: 0;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  border: 1px solid #80808066;
}
.swatches button.active {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
.slider-label {
  display: flex;
  justify-content: space-between;
  margin: 16px 0 7px;
}
input[type='range'] {
  width: 100%;
  accent-color: var(--brand);
}
input[type='text'],
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--secondary);
  outline-color: var(--brand);
}
textarea {
  min-height: 80px;
  resize: vertical;
}
#drawToolbar {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px;
  border-radius: 12px;
  background: var(--surface);
  border: 0.5px solid var(--border);
}
#drawToolbar button.active {
  background: var(--soft);
  color: var(--brand);
}
[hidden] {
  display: none !important;
}
#modal {
  position: fixed;
  inset: 0;
  background: #111c1926;
  backdrop-filter: blur(3px);
  z-index: 20;
  display: grid;
  place-items: center;
}
.dialog {
  width: min(430px, calc(100vw - 40px));
  padding: 24px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 30px #0000001a;
  animation: panel-in 0.21s ease-out;
}
.dialog h2 {
  font-size: 19px;
  margin: 0 0 14px;
}
.dialog p {
  line-height: 1.7;
  margin-bottom: 20px;
}
.dialog .actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}
.dialog label {
  display: block;
  color: var(--muted);
  margin: 12px 0 6px;
}
#tutorial {
  position: fixed;
  inset: 0;
  z-index: 30;
}
#tutorialInk {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.lesson {
  position: absolute;
  width: 360px;
  max-width: calc(100vw - 32px);
  padding: 22px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 8px 30px #0000001a;
}
.lesson h2 {
  font-size: 21px;
  margin: 18px 0 14px;
}
.lesson p {
  line-height: 1.8;
}
.lesson .top,
.lesson .bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lesson .bottom {
  margin-top: 24px;
}
.lesson .top,
.lesson small {
  color: var(--muted);
}
#app.sidebar-hidden {
  grid-template-columns: 1fr;
}
#app.sidebar-hidden aside {
  display: none;
}
#app.sidebar-hidden #showSidebar {
  display: block;
}
@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-color-scheme: dark) {
  :root {
    --app: #191b1e;
    --work: #202225;
    --surface: #2b2d31;
    --secondary: #25272b;
    --ink: #e9eaed;
    --muted: #a7abb3;
    --border: #36393f;
    --brand: #50b497;
    --soft: #233f34;
  }
}
@media (max-width: 900px) {
  #app {
    grid-template-columns: 190px 1fr;
  }
  header {
    padding: 14px;
  }
  h1 {
    font-size: 18px;
  }
  #saved {
    display: none;
  }
  #stageTitle {
    display: none;
  }
  .segment button {
    padding: 6px 9px;
  }
  nav {
    padding: 8px 12px;
  }
  footer {
    padding: 8px 12px;
  }
}
@media (max-width: 640px) {
  #app {
    grid-template-columns: 1fr;
  }
  aside {
    display: none;
  }
  #showSidebar {
    display: block;
  }
  #app.mobile-library aside {
    display: block;
    position: fixed;
    inset: 8px auto 8px 8px;
    width: 240px;
    background: var(--app);
    z-index: 12;
    border-radius: 16px;
    border: 1px solid var(--border);
  }
  nav button {
    padding: 7px;
  }
  .transport {
    gap: 2px;
  }
  header {
    gap: 8px;
  }
  #pass button {
    font-size: 12px;
  }
  #pitchArea {
    padding: 6px 10px 60px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}

.panel.closing {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}
.formation-preview {
  width: 100%;
  height: 54px;
  display: block;
  margin-bottom: 5px;
}
.choices button:has(.formation-preview) {
  padding: 10px;
}
