:root {
  color-scheme: dark;
  --ink: #fff8e8;
  --ink-dark: #0c1214;
  --muted: #bdc9c2;
  --soft: #81978e;
  --paper: #071015;
  --paper-strong: #fff8e8;
  --panel: rgba(9, 20, 25, 0.66);
  --panel-strong: rgba(255, 248, 232, 0.09);
  --line: rgba(255, 248, 232, 0.16);
  --line-strong: rgba(255, 248, 232, 0.34);
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
  --amber: #d89c63;
  --green: #75b896;
  --blue: #88a8d6;
  --rose: #d28a9d;
  --focus: #fff8e8;
  --field-intensity: 0;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 52% 18%, rgba(255, 248, 232, 0.23), rgba(117, 184, 150, 0.12) 28%, rgba(7, 16, 21, 0) 57%),
    radial-gradient(circle at 16% 86%, rgba(216, 156, 99, 0.14), rgba(7, 16, 21, 0) 42%),
    radial-gradient(circle at 88% 76%, rgba(136, 168, 214, 0.12), rgba(7, 16, 21, 0) 40%),
    linear-gradient(145deg, #05090d, #0a151b 48%, #0f1b1e);
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.48;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.field-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.98;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 248, 232, 0.24);
  border-radius: 10px;
  background: url("/i-sense_observatory/icon.png") center / cover no-repeat;
  box-shadow: 0 0 34px rgba(255, 248, 232, 0.18), 0 12px 30px rgba(0, 0, 0, 0.32);
  flex: 0 0 auto;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1;
}

.brand strong {
  font-size: 1rem;
  font-weight: 700;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(6, 13, 17, 0.58);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
}

.tab {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.tab.is-active {
  color: var(--ink-dark);
  background: var(--paper-strong);
  box-shadow: 0 6px 22px rgba(255, 248, 232, 0.12);
}

main {
  flex: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0 44px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.observatory-layout {
  min-height: calc(100vh - 132px);
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: stretch;
}

.session-rail,
.live-summary,
.experiment-surface,
.page-panel {
  border: 1px solid var(--line);
  background: linear-gradient(155deg, rgba(255, 248, 232, 0.105), rgba(7, 16, 21, 0.58) 42%, rgba(255, 248, 232, 0.055));
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}

.session-rail,
.live-summary {
  border-radius: var(--radius);
  padding: 18px;
}

.experiment-surface,
.page-panel {
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 48px);
}

.experiment-surface {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: clamp(540px, calc(100vh - 132px), 620px);
}

.experiment-surface > *:not(.surface-aperture) {
  position: relative;
  z-index: 1;
}

.surface-aperture {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.8;
}

.surface-aperture::before,
.surface-aperture::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.surface-aperture::before {
  left: 52%;
  top: 43%;
  width: min(58vw, 640px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 248, 232, 0.11);
  background: radial-gradient(circle, rgba(255, 248, 232, 0.12), rgba(255, 248, 232, 0.03) 37%, rgba(255, 248, 232, 0) 68%);
  animation: aperture-breathe 7s ease-in-out infinite;
}

.surface-aperture::after {
  left: 56%;
  top: 47%;
  width: min(39vw, 420px);
  aspect-ratio: 1;
  border: 1px solid rgba(117, 184, 150, 0.11);
  animation: aperture-drift 11s ease-in-out infinite;
}

.rail-label,
.stage-kicker {
  margin: 0 0 12px;
  color: var(--amber);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.3rem, 4.6vw, 4.75rem);
  line-height: 0.98;
  font-weight: 500;
}

.stage-prompt {
  max-width: 740px;
  margin-bottom: 22px;
  color: var(--ink);
  font-size: clamp(1.18rem, 2vw, 1.65rem);
  line-height: 1.42;
}

.experiment-surface.is-entering .stage-kicker,
.experiment-surface.is-entering h1,
.experiment-surface.is-entering .stage-prompt,
.experiment-surface.is-entering .stage-body,
.experiment-surface.is-entering .stage-actions {
  animation: stage-rise 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.experiment-surface.is-entering h1 { animation-delay: 35ms; }
.experiment-surface.is-entering .stage-prompt { animation-delay: 70ms; }
.experiment-surface.is-entering .stage-body { animation-delay: 105ms; }
.experiment-surface.is-entering .stage-actions { animation-delay: 140ms; }

.stage-body {
  width: 100%;
}

.stage-actions,
.toolbar,
.choice-grid,
.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stage-actions {
  margin-top: 28px;
  align-items: center;
}

.primary-button,
.secondary-button,
.quiet-button,
.choice-button,
.chip-button {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: rgba(255, 248, 232, 0.08);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.primary-button,
.secondary-button,
.quiet-button {
  padding: 0 18px;
}

.primary-button {
  color: var(--ink-dark);
  border-color: rgba(255, 248, 232, 0.92);
  background: linear-gradient(180deg, #fffaf0, #ded5bd);
  box-shadow: 0 0 28px rgba(255, 248, 232, 0.12), 0 18px 38px rgba(0, 0, 0, 0.28);
}

.secondary-button {
  background: rgba(255, 248, 232, 0.06);
}

.quiet-button {
  color: var(--muted);
  border-color: var(--line);
}

.quiet-button.danger {
  color: #7d2f28;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-button,
.chip-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 11px 14px;
  line-height: 1.2;
}

.primary-button:hover,
.secondary-button:hover,
.quiet-button:hover,
.choice-button:hover,
.chip-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 248, 232, 0.54);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.24);
}

.choice-button {
  border-radius: var(--radius);
  min-height: 58px;
}

.chip-button.is-selected,
.choice-button.is-selected {
  color: var(--ink-dark);
  border-color: rgba(255, 248, 232, 0.96);
  background: linear-gradient(180deg, #fffaf0, #d8d0bd);
}

.quiet-chip {
  color: rgba(255, 248, 232, 0.76);
  border-color: rgba(255, 248, 232, 0.2);
  background: rgba(255, 248, 232, 0.04);
}

.step-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-list li {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  align-items: center;
  color: var(--soft);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  transition: color 220ms ease, transform 220ms ease;
}

.step-list li::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.step-list li.is-current {
  color: var(--ink);
  transform: translateX(2px);
}

.step-list li.is-complete {
  color: var(--green);
}

.step-list li.is-complete::before,
.step-list li.is-current::before {
  background: currentColor;
}

.summary-lines {
  display: grid;
  gap: 13px;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.88rem;
  line-height: 1.35;
}

.summary-lines strong {
  display: block;
  color: var(--ink);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  font-size: 1rem;
  font-weight: 600;
}

.summary-lines div {
  padding-bottom: 11px;
  border-bottom: 1px solid rgba(255, 248, 232, 0.09);
}

.summary-lines div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.arrival-instrument {
  display: grid;
  gap: 14px;
  align-items: start;
}

.signal-mark {
  width: min(300px, 66vw);
  height: auto;
  filter: drop-shadow(0 0 28px rgba(255, 248, 232, 0.18));
  overflow: visible;
}

.mark-head,
.mark-face,
.mark-ear,
.mark-throat,
.mark-ray {
  fill: none;
  stroke: #fff8e8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mark-head {
  stroke-width: 15;
}

.mark-face {
  stroke-width: 8;
}

.mark-ear {
  stroke-width: 8;
}

.mark-throat {
  stroke-width: 8;
}

.mark-ray {
  stroke-width: 8;
  opacity: 0.92;
}

.mark-head-image {
  width: 100%;
  height: 100%;
}

.mark-ripple {
  fill: none;
  stroke: rgba(255, 248, 232, 0.42);
  stroke-width: 2;
  opacity: 0;
  transform-origin: 320px 246px;
}

.signal-mark .mark-rays {
  transform-box: view-box;
  transform-origin: 320px 246px;
}

.signal-mark .mark-ray {
  opacity: 0;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: ray-extend 8.4s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.signal-mark .mark-figure {
  transform-box: fill-box;
  transform-origin: 315px 405px;
  animation: head-recoil 8.4s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.signal-mark .mark-ripple {
  animation: crown-ripple 8.4s ease-out infinite;
}

.signal-mark .mark-ray:nth-child(2) { animation-delay: 70ms; }
.signal-mark .mark-ray:nth-child(3) { animation-delay: 120ms; }
.signal-mark .mark-ray:nth-child(4) { animation-delay: 170ms; }

.timer-mark .mark-rays,
.timer-mark .mark-figure,
.timer-mark .mark-ripple {
  animation: none;
}

.body-map {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.body-figure {
  position: relative;
  width: 144px;
  height: 300px;
  margin: 0 auto;
}

.body-figure::before,
.body-figure::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 248, 232, 0.24);
  background: rgba(255, 248, 232, 0.035);
}

.body-figure::before {
  top: 7px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
}

.body-figure::after {
  top: 78px;
  width: 92px;
  height: 176px;
  border-radius: 46px 46px 38px 38px;
}

.body-point {
  position: absolute;
  left: 50%;
  z-index: 1;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border: 1px solid rgba(255, 248, 232, 0.42);
  border-radius: 50%;
  background: rgba(255, 248, 232, 0.86);
  box-shadow: 0 0 22px rgba(255, 248, 232, 0.58);
}

.body-point.eyes { top: 30px; }
.body-point.throat { top: 86px; }
.body-point.chest { top: 132px; }
.body-point.abdomen { top: 190px; }

.observe-field {
  display: grid;
  place-items: center;
  min-height: 330px;
}

.timer-disc {
  width: min(320px, 70vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 248, 232, 0.22);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 248, 232, 0.18) 0 20%, rgba(117, 184, 150, 0.08) 21% 41%, rgba(255, 248, 232, 0.025) 42%),
    conic-gradient(from var(--angle), rgba(216, 156, 99, 0.48), rgba(117, 184, 150, 0.22), rgba(136, 168, 214, 0.26), rgba(210, 138, 157, 0.22), rgba(216, 156, 99, 0.48));
  box-shadow:
    0 0 54px rgba(255, 248, 232, 0.16),
    inset 0 0 54px rgba(255, 248, 232, 0.08),
    0 26px 80px rgba(0, 0, 0, 0.34);
  animation: timer-breathe 5.5s ease-in-out infinite;
}

.timer-disc strong {
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 3.4rem;
  font-weight: 300;
  z-index: 2;
}

.timer-disc span {
  position: absolute;
  left: 50%;
  bottom: 66px;
  z-index: 2;
  transform: translateX(-50%);
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.timer-mark {
  position: absolute;
  inset: 16%;
  width: 68%;
  height: 68%;
  opacity: 0.22;
  transform: translateY(-12px);
  filter: drop-shadow(0 0 22px rgba(255, 248, 232, 0.24));
}

.timer-disc.is-active {
  animation-duration: 3.6s;
}

.textarea-wrap {
  display: grid;
  gap: 10px;
}

textarea {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--ink);
  background: rgba(4, 9, 13, 0.42);
  line-height: 1.45;
}

.section-head {
  max-width: 740px;
}

.section-head h1 {
  margin-bottom: 12px;
}

.section-head p,
.about-copy p {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.toolbar {
  margin: 20px 0;
}

.notes-list,
.pattern-grid,
.principle-grid {
  display: grid;
  gap: 14px;
}

.notes-list {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.note-item,
.pattern-item,
.principle-grid div,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 248, 232, 0.055);
}

.note-item {
  display: grid;
  gap: 12px;
}

.note-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.note-item time,
.note-meta,
.pattern-item span,
.empty-state span,
.principle-grid span {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.86rem;
  line-height: 1.45;
}

.note-item h3,
.pattern-item strong,
.principle-grid strong,
.empty-state strong {
  display: block;
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 600;
}

.note-item p {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.note-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
}

@keyframes stage-rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.992);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes aperture-breathe {
  0%, 100% {
    opacity: 0.55;
    transform: translate(-50%, -50%) scale(0.96);
  }
  50% {
    opacity: 0.92;
    transform: translate(-50%, -50%) scale(1.04);
  }
}

@keyframes aperture-drift {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
  50% {
    transform: translate(-48%, -52%) scale(1.06) rotate(8deg);
  }
}

@keyframes ray-extend {
  0%, 58%, 100% {
    opacity: 0;
    stroke-dashoffset: 1;
  }
  64% {
    opacity: 0.72;
    stroke-dashoffset: 0.36;
  }
  72%, 84% {
    opacity: 1;
    stroke-dashoffset: 0;
  }
  91% {
    opacity: 0.18;
    stroke-dashoffset: 0;
  }
}

@keyframes head-recoil {
  0%, 58%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  66%, 78% {
    transform: translate(-10px, -5px) rotate(-1.4deg);
  }
  90% {
    transform: translate(-2px, -1px) rotate(-0.25deg);
  }
}

@keyframes crown-ripple {
  0%, 58%, 100% {
    opacity: 0;
    transform: scale(0.25);
  }
  66% {
    opacity: 0.42;
    transform: scale(0.45);
  }
  86% {
    opacity: 0;
    transform: scale(4.2);
  }
}

@keyframes timer-breathe {
  0%, 100% {
    transform: scale(0.985);
  }
  50% {
    transform: scale(1.015);
  }
}

.pattern-grid,
.principle-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pattern-item {
  min-height: 138px;
}

.pattern-item b {
  display: block;
  margin-top: 12px;
  font-size: 2.2rem;
  font-weight: 400;
}

.grounding-note {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 3;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--paper-strong);
}

@media (max-width: 980px) {
  .observatory-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .session-rail,
  .live-summary {
    min-height: 0;
  }

  .step-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .body-map,
  .pattern-grid,
  .principle-grid {
    grid-template-columns: 1fr;
  }

  .body-figure {
    height: 250px;
  }

  .experiment-surface {
    min-height: 540px;
  }
}

@media (max-width: 720px) {
  .topbar {
    width: min(100% - 24px, 1180px);
    flex-direction: column;
    align-items: stretch;
    padding: 14px 0;
  }

  .brand {
    justify-content: center;
  }

  .view-tabs {
    width: 100%;
    justify-content: space-between;
    overflow-x: auto;
  }

  .tab {
    flex: 1 0 auto;
    padding: 0 11px;
  }

  main {
    width: min(100% - 24px, 1180px);
    padding-top: 4px;
  }

  .experiment-surface,
  .page-panel,
  .session-rail,
  .live-summary {
    padding: 18px;
  }

  .observatory-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .experiment-surface {
    order: 1;
  }

  .session-rail,
  .live-summary {
    display: none;
  }

  .experiment-surface {
    min-height: calc(100svh - 154px);
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    justify-content: flex-start;
    padding: 22px 18px 96px;
  }

  .arrival-instrument {
    gap: 12px;
  }

  .signal-mark {
    width: min(306px, 78vw);
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .step-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    font-size: clamp(2.34rem, 12vw, 3.15rem);
  }

  .stage-prompt {
    font-size: 1.12rem;
    max-width: 25rem;
  }

  .timer-disc strong {
    font-size: 2.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
