:root {
  color-scheme: dark;
  --bg: #0e1014;
  --panel: #161a22;
  --line: #2c3344;
  --text: #f3f1ec;
  --muted: #8e96a8;
  --accent: #ff4d3a;
  --ink: #1a0c0a;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
}
.brand img { height: 34px; width: auto; display: block; }
.product {
  margin: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 650;
}
.bar-tools { display: flex; align-items: center; gap: 0.65rem; }
.menu {
  width: 2.15rem;
  height: 2.15rem;
  display: grid;
  gap: 0.22rem;
  place-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.menu span { display: block; width: 0.95rem; height: 1.5px; background: var(--text); }
.catalog {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(24rem, 100%);
  overflow: auto;
  z-index: 5;
  background: #12151c;
  border-left: 1px solid var(--line);
  padding: 0.85rem 0.85rem 1.5rem;
}
body:has(#catalog:not([hidden]))::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 4;
}
.catalog-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.catalog-head h2 { margin: 0; font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; }
#catalog-find {
  width: 100%;
  margin: 0.65rem 0 0.15rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0e1014;
  font-size: 0.84rem;
}
.lift-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.45rem;
  padding: 0.35rem 0.15rem;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 0;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.lift-toggle::after { content: "▸"; color: var(--muted); letter-spacing: 0; }
.lift-toggle[aria-expanded="true"]::after { content: "▾"; }
.lift-item { border-top: 1px solid var(--line); }
.lift-line {
  width: 100%;
  display: grid;
  grid-template-columns: 1.85rem minmax(0, 1fr);
  gap: 0.45rem;
  align-items: center;
  padding: 0.38rem 0.05rem;
  background: transparent;
  color: var(--text);
  border: 0;
  border-radius: 0;
  text-align: left;
  font-weight: 550;
}
.lift-line:hover { background: rgba(255, 255, 255, 0.03); }
.lift-line.is-on { background: rgba(255, 77, 58, 0.12); }
.lift-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}
.lift-meta { display: block; color: var(--muted); font-size: 0.68rem; font-weight: 500; }
.lift-detail { display: grid; gap: 0.4rem; padding: 0.15rem 0 0.6rem; }
.fold {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  background: transparent;
  color: var(--text);
  border: 0;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-align: left;
}
.fold::after { content: "▸"; color: var(--muted); font-size: 0.75rem; }
.fold[aria-expanded="true"]::after { content: "▾"; }
.clip { display: grid; gap: 0.4rem; }
.when { margin: 0; color: var(--muted); font-size: 0.78rem; }
.thumb {
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  overflow: hidden;
  border-radius: 4px;
  background: #0e1014;
  border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stage { position: relative; }
.stage video { width: 100%; display: block; border-radius: 8px; background: #0e1014; }
.stage canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.stage canvas.marking { pointer-events: auto; cursor: crosshair; }
.speeds { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.speeds button {
  padding: 0.28rem 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.speeds button[aria-pressed="true"] { background: #1f8a45; color: #04140a; border-color: transparent; }
.mark-hint {
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  bottom: 2.2rem;
  margin: 0;
  color: #3dff7a;
  font-size: 0.82rem;
  font-weight: 650;
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}
.stamp {
  position: absolute;
  left: 0.45rem;
  bottom: 0.45rem;
  margin: 0;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(14, 16, 20, 0.88);
  color: var(--text);
  font-size: 0.75rem;
}

main {
  width: min(36rem, calc(100% - 1.5rem));
  margin: 0 auto 3rem;
}
.eyebrow {
  margin: 1.1rem 0 0.3rem;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.68rem;
  font-weight: 650;
}
h1 {
  margin: 0 0 0.4rem;
  font-size: 1.65rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 650;
}
.lead, .note, .hint, .fine { color: var(--muted); line-height: 1.4; }
.lead { margin: 0 0 0.7rem; font-size: 0.92rem; }
.note {
  margin: 0.45rem 0;
  border-left: 2px solid var(--accent);
  padding-left: 0.55rem;
  font-size: 0.8rem;
}
.panel .note { border-left: 0; padding-left: 0; margin: 0; }
.fine {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
}
.screen { display: grid; gap: 0.45rem; margin: 0.2rem 0 0.9rem; }
.floor {
  display: grid;
  gap: 0.28rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #12151c;
}
.floor h3 {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.floor p { margin: 0; font-size: 0.92rem; }
.floor-line {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}
.floor-line span { flex: 1; min-width: 0; }
.floor .info {
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.05rem;
  padding: 0;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  font-family: Georgia, "Iowan Old Style", serif;
  font-style: italic;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1;
  flex: none;
}
.floor-note {
  width: min(28rem, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem 1.15rem;
}
.floor-note::backdrop { background: rgba(8, 10, 14, 0.72); }
.floor-note h2 { margin: 0; font-size: 1rem; letter-spacing: 0; text-transform: none; }
.floor-note p { margin: 0.7rem 0 0; line-height: 1.45; }
.floor .row { align-items: end; }
.floor label { flex: 1; }

.switch {
  display: flex;
  gap: 0;
  margin: 0.8rem 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}
.switch button, button {
  border: 0;
  border-radius: 6px;
  padding: 0.42rem 0.72rem;
  background: var(--accent);
  color: var(--ink);
  font-weight: 650;
  font-size: 0.82rem;
  cursor: pointer;
}
.switch button {
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}
.switch button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--ink);
}
.switch button[aria-pressed="false"] {
  background: transparent;
  color: var(--muted);
  border: 0;
}
.panel {
  display: grid;
  gap: 0.55rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem;
  margin-bottom: 0.7rem;
}
.panel h2 { margin: 0; font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; }
label { display: grid; gap: 0.22rem; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.04em; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0e1014;
  padding: 0.48rem 0.55rem;
  font-size: 0.9rem;
}
textarea { resize: vertical; }
.run-progress { margin: 0.15rem 0 0; }
.run-track {
  height: 4px;
  border-radius: 999px;
  background: #1a2e22;
  overflow: hidden;
}
.run-fill {
  height: 100%;
  width: 38%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f8a45 0%, #7dff9a 100%);
  transform: translateX(-120%);
  animation: run-slide 1.15s ease-in-out infinite;
}
.run-progress.done .run-fill {
  width: 100%;
  transform: none;
  animation: none;
  transition: width 0.45s ease;
}
.run-word {
  min-height: 1em;
  margin: 0.3rem 0 0;
  color: #7dff9a;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
@keyframes run-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}
.form-error { min-height: 1rem; margin: 0; color: #ffb0a4; font-size: 0.8rem; }
.form-error.ok { color: #d7d2c6; }
.saved { min-height: 1rem; margin: 0; color: #d7d2c6; font-size: 0.8rem; }
.row { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.quiet { background: transparent; color: var(--text); border: 1px solid var(--line); }
a.quiet {
  display: inline-block;
  border-radius: 6px;
  padding: 0.42rem 0.72rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 650;
  font-size: 0.82rem;
  text-decoration: none;
}
video, #library img { width: 100%; border-radius: 8px; background: #0e1014; }
#library img { max-height: 12rem; object-fit: cover; }
.danger { background: #8c3b32; color: #fff; }

.beta {
  position: fixed;
  right: max(0.7rem, env(safe-area-inset-right));
  bottom: max(0.7rem, env(safe-area-inset-bottom));
  z-index: 30;
  width: min(24rem, calc(100% - 1.4rem));
  max-width: calc(100% - 1.4rem);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
}
button.beta-open {
  border-radius: 999px;
  max-width: 100%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.beta-panel {
  width: 100%;
  max-width: 100%;
  max-height: min(70vh, 36rem);
  overflow: auto;
  overflow-wrap: break-word;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 0.85rem 0.9rem 1rem;
}
.beta-panel h2 { margin: 0; font-size: 1rem; }
.beta-panel .quiet { margin: 0.45rem 0 0; }
.beta-panel textarea { min-height: 5.5rem; }
.beta-panel input[type="file"] { font-size: 0.85rem; }
@media (max-width: 720px) {
  .beta-panel { max-height: min(62vh, 32rem); }
}
.beta-note { border-top: 1px solid var(--line); margin-top: 0.75rem; padding-top: 0.6rem; }
.beta-note p { margin: 0.2rem 0 0; white-space: pre-wrap; }
.beta-note video { width: 100%; border-radius: 8px; margin-top: 0.4rem; background: #0e1014; }
.beta-ref { color: var(--accent); font-weight: 700; letter-spacing: 0.04em; }
