:root {
  --ink: #0a0a0a;
  --paper: #ffffff;
  --orange: #fe4600;
  --pink: #ff41e7;
  --tab: 22px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* === Nav === */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 20; height: 56px;
  display: flex; align-items: center; padding: 8px 20px 0;
  pointer-events: none;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  color: var(--ink); text-decoration: none; pointer-events: auto;
}
.brand svg { fill: var(--ink); display: block; }
.brand span { font-weight: 700; font-size: 0.9rem; letter-spacing: 0.22em; }

/* === Stage: JS sets width; canvas stays full-viewport and is clipped === */
.stage {
  position: fixed; top: 0; left: 0; height: 100vh;
  width: calc(100% - var(--tab));
  overflow: hidden; z-index: 1; will-change: width;
}
.stage canvas {
  position: absolute; top: 0; left: 0;
  width: 100vw; height: 100vh; display: block; touch-action: none;
}

/* === Panel (desktop: right side; JS sets `right`) === */
.panel {
  position: fixed; top: 0; height: 100vh; z-index: 30;
  width: 21%; right: calc(var(--tab) - 21%);
  overflow: hidden; will-change: right;
}

.tab {
  position: absolute; left: 0; top: 0; z-index: 2;
  width: var(--tab); height: 100%;
  display: flex; flex-direction: column;
  border: 0; background: transparent; cursor: pointer; padding: 0;
}
.tab-top { flex: 0 0 56px; background: var(--orange); }
.tab-label {
  flex: 0 0 calc(67vh - 56px); background: var(--orange);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 7px; padding-bottom: 8px;
}
.tab-text {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-size: 0.9rem; letter-spacing: 0.04em; color: var(--ink);
}
.tab-label > * { transition: opacity 0.25s; }
body.open .tab-label > * { opacity: 0; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--ink); flex-shrink: 0; }
.tab-mid { flex: 1; background: var(--pink); }
.tab-foot { flex: 0 0 56px; background: var(--ink); }

.panel-body { height: 100%; display: flex; flex-direction: column; }
.block { padding: 0 24px; }
.block-top { flex: 0 0 56px; background: var(--orange); position: relative; }
.peek { display: none; }
.close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: 0; cursor: pointer;
  opacity: 0; transition: opacity 0.3s;
}
body.open .close { opacity: 1; transition-delay: 0.4s; }
.close line { stroke: var(--ink); stroke-width: 1.2; }

.block-orange {
  flex: 0 0 calc(67vh - 112px); background: var(--orange);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding-bottom: 24px;
}
.block-orange h2 {
  font-weight: 700; font-size: clamp(2.4rem, 3.4vw, 5rem);
  line-height: 0.95; letter-spacing: -0.03em; margin-bottom: 16px;
}
.block-orange p { font-weight: 500; line-height: 1.3; opacity: 0.75; }

.block-orange > *, .block-pink form {
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.35s, transform 0.35s;
}
body.open .block-orange > *, body.open .block-pink form {
  opacity: 1; transform: none;
  transition: opacity 0.6s 0.35s, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.35s;
}
body.open .block-pink form { transition-delay: 0.45s; }

.block-pink {
  flex: 1; background: var(--pink);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding-bottom: 28px;
}
form { display: flex; flex-direction: column; gap: 12px; }
.field {
  display: flex; border-bottom: 2px solid rgba(0, 0, 0, 0.35);
  transition: border-color 0.3s;
}
.field:focus-within { border-color: var(--ink); }
.field input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0;
  font: inherit; font-size: 16px; padding: 10px 0; letter-spacing: 0.02em; color: var(--ink);
}
.field input::placeholder { color: rgba(0, 0, 0, 0.4); }
.field button {
  background: none; border: 0; cursor: pointer; white-space: nowrap;
  font: inherit; font-size: 0.9rem; font-weight: 600; padding: 10px 0 10px 16px;
  color: rgba(0, 0, 0, 0.6); transition: color 0.2s, transform 0.2s;
}
.field button:hover { color: var(--ink); transform: translateX(3px); }
.field button:disabled { cursor: wait; opacity: 0.5; }
.consent {
  display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  font-size: 0.95rem; font-weight: 500; line-height: 1.5; color: rgba(0, 0, 0, 0.7);
}
.consent input { margin-top: 5px; width: 13px; height: 13px; accent-color: var(--ink); flex-shrink: 0; }
.status { min-height: 1.3em; font-size: 0.9rem; font-weight: 600; }

.block-foot {
  flex: 0 0 56px; background: var(--ink);
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  font-size: 0.72rem; font-weight: 500; letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.6);
}
.block-foot a { color: inherit; text-decoration: none; }
.block-foot a:hover { color: #fff; }

/* === Touch / narrow: bottom sheet with a 30px peek bar (JS sets `bottom`) === */
@media (max-width: 1023px), (hover: none) {
  .stage { width: 100%; }
  .panel {
    top: auto; left: 0; right: auto; width: 100%;
    height: min(440px, 72vh); bottom: calc(30px - min(440px, 72vh));
    will-change: bottom;
  }
  .tab { display: none; }
  .block-top { flex: 0 0 30px; }
  .peek {
    display: flex; align-items: center; gap: 8px; height: 30px;
    background: none; border: 0; font: inherit; font-size: 0.85rem;
    letter-spacing: 0.04em; color: var(--ink); cursor: pointer;
  }
  .peek .dot { width: 9px; height: 9px; }
  .close { top: 0; right: 8px; }
  .close svg { width: 30px; height: 30px; }
  .block-orange { flex: 0 0 auto; padding-top: 18px; }
  .block-orange h2 { font-size: 2.6rem; }
  .block-pink { padding-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .block-orange > *, .block-pink form { transition: none !important; }
}
