:root {
  color-scheme: dark;
  --bone: #f3ead5;
  --muted: rgba(243, 234, 213, 0.72);
  --ink: #080a08;
  --moss: #7f9d72;
  --mineral: #c49a57;
  --glass: rgba(12, 19, 15, 0.42);
  --line: rgba(243, 234, 213, 0.2);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #080a08;
  color: var(--bone);
}

body {
  min-height: 100dvh;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

body::before {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.56), rgba(0, 0, 0, 0.08) 48%, rgba(0, 0, 0, 0.48)),
    radial-gradient(circle at 52% 44%, rgba(221, 180, 93, 0.18), transparent 26%),
    radial-gradient(circle at 72% 34%, rgba(119, 151, 124, 0.16), transparent 20%);
}

body::after {
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 84px 84px;
  mask-image: radial-gradient(circle at center, black 0 42%, transparent 73%);
  opacity: 0.4;
}

#portal-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: block;
  z-index: 0;
}

.topline,
.progress {
  position: fixed;
  left: clamp(18px, 4vw, 56px);
  right: clamp(18px, 4vw, 56px);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: rgba(243, 234, 213, 0.78);
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topline {
  top: max(16px, env(safe-area-inset-top));
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.progress {
  bottom: max(16px, env(safe-area-inset-bottom));
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.dots {
  display: flex;
  gap: 9px;
  align-items: center;
}

.dots span {
  width: 7px;
  height: 7px;
  border: 1px solid rgba(243, 234, 213, 0.55);
  border-radius: 999px;
  background: transparent;
  transition: width 250ms ease, background 250ms ease;
}

.dots span.active {
  width: 28px;
  background: var(--bone);
}

.deck {
  position: relative;
  z-index: 2;
  width: 100vw;
  height: 100dvh;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  touch-action: pan-x pan-y;
}

.deck::-webkit-scrollbar {
  display: none;
}

.slide {
  position: relative;
  flex: 0 0 100vw;
  height: 100dvh;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.44fr);
  gap: clamp(18px, 3vw, 52px);
  padding: clamp(76px, 10vh, 112px) clamp(18px, 5vw, 76px) clamp(74px, 11vh, 112px);
  isolation: isolate;
}

.slide::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.28;
  background: linear-gradient(110deg, rgba(21, 38, 25, 0.56), transparent 45%, rgba(4, 8, 7, 0.5));
}

.slide-copy {
  align-self: center;
  max-width: min(780px, 72vw);
}

.kicker,
.label,
.card-num,
.course-card span {
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
}

.kicker {
  margin: 0 0 14px;
  color: rgba(243, 234, 213, 0.74);
  font-size: clamp(11px, 1.4vw, 13px);
}

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

h1,
.slide-copy > h2 {
  max-width: 12ch;
  margin-bottom: clamp(18px, 3.4vh, 32px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: 0;
  text-wrap: balance;
  text-shadow: 0 10px 46px rgba(0, 0, 0, 0.55);
}

h1 {
  font-size: clamp(48px, 8vw, 118px);
}

h1 span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.26em;
  line-height: 1.1;
  color: rgba(243, 234, 213, 0.8);
}

.slide-copy > h2 {
  font-size: clamp(34px, 6.2vw, 88px);
}

.copy-panel {
  max-width: 760px;
  padding: clamp(18px, 2.4vw, 28px);
  border: 1px solid rgba(243, 234, 213, 0.16);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(13, 19, 16, 0.58), rgba(13, 21, 22, 0.28));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.compact {
  max-height: min(42dvh, 390px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.copy-panel p,
.copy-panel li,
.course-card p,
.ritual-image p,
.float-card p {
  color: var(--muted);
  font-family: "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
  font-size: clamp(13px, 1.18vw, 16px);
  line-height: 1.82;
  letter-spacing: 0;
}

.copy-panel p {
  margin-bottom: 0.72em;
}

.copy-panel ul {
  margin: 0.2em 0 0.9em;
  padding-left: 1.25em;
}

.label {
  color: var(--bone) !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
}

.device-name {
  color: var(--bone) !important;
  font-size: clamp(22px, 2.5vw, 34px) !important;
  line-height: 1.1 !important;
}

.float-stack {
  align-self: center;
  justify-self: end;
  width: min(310px, 100%);
  display: grid;
  gap: 14px;
  perspective: 900px;
}

.float-card,
.course-card,
.ritual-image {
  border: 1px solid rgba(243, 234, 213, 0.17);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(243, 234, 213, 0.13), rgba(9, 17, 13, 0.48));
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(20px);
}

.float-card {
  min-height: 122px;
  padding: 18px;
  transform: rotateY(-8deg) translateZ(0);
  transition: transform 280ms ease, border-color 280ms ease;
}

.float-card:nth-child(2) {
  margin-left: 28px;
}

.float-card:nth-child(3) {
  margin-left: -12px;
}

.float-card:hover {
  border-color: rgba(243, 234, 213, 0.42);
  transform: rotateY(0deg) translateY(-4px);
}

.float-card h2 {
  margin: 8px 0 6px;
  font-size: 24px;
  line-height: 1;
}

.card-num,
.course-card span {
  color: var(--mineral);
  font-size: 12px;
}

.long-form {
  max-height: min(46dvh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: clamp(18px, 2.8vw, 32px);
}

.long-form::-webkit-scrollbar,
.compact::-webkit-scrollbar {
  width: 4px;
}

.long-form::-webkit-scrollbar-thumb,
.compact::-webkit-scrollbar-thumb {
  background: rgba(243, 234, 213, 0.36);
  border-radius: 999px;
}

.resonance {
  width: min(286px, 100%);
}

.course-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: min(1020px, 78vw);
}

.course-card {
  min-height: 260px;
  padding: clamp(16px, 2vw, 24px);
}

.course-card h3 {
  margin: 10px 0 12px;
  font-size: clamp(19px, 2vw, 28px);
  line-height: 1.22;
  letter-spacing: 0;
}

.ritual-image {
  align-self: end;
  justify-self: end;
  width: min(340px, 100%);
  overflow: hidden;
}

.ritual-image img {
  width: 100%;
  aspect-ratio: 4 / 5;
  display: block;
  object-fit: cover;
}

.ritual-image p {
  padding: 16px 18px 18px;
  margin: 0;
}

.source-copy {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: pre-wrap;
  clip-path: inset(50%);
}

@media (max-width: 900px) {
  .topline span:nth-child(2) {
    display: none;
  }

  .progress {
    align-items: flex-end;
  }

  .gesture {
    max-width: 130px;
    text-align: right;
    line-height: 1.35;
  }

  .slide {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 16px;
    padding: calc(62px + env(safe-area-inset-top)) 18px calc(70px + env(safe-area-inset-bottom));
  }

  .slide-copy {
    align-self: start;
    max-width: none;
  }

  h1,
  .slide-copy > h2 {
    max-width: 10ch;
    margin-bottom: 14px;
  }

  h1 {
    font-size: clamp(42px, 14vw, 68px);
  }

  .slide-copy > h2 {
    font-size: clamp(34px, 11vw, 54px);
  }

  .copy-panel {
    padding: 15px;
  }

  .copy-panel p,
  .copy-panel li,
  .course-card p,
  .ritual-image p,
  .float-card p {
    font-size: 12.5px;
    line-height: 1.68;
  }

  .compact,
  .long-form {
    max-height: 39dvh;
  }

  .float-stack {
    align-self: end;
    justify-self: stretch;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

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

  .float-card {
    min-height: 96px;
    padding: 12px;
    transform: none;
  }

  .float-card:nth-child(2),
  .float-card:nth-child(3) {
    margin-left: 0;
  }

  .float-card h2 {
    font-size: 16px;
    margin: 5px 0 4px;
  }

  .course-list {
    grid-template-columns: 1fr;
    max-width: none;
    gap: 9px;
  }

  .course-card {
    min-height: auto;
    padding: 13px 14px;
  }

  .course-card h3 {
    margin: 5px 0 7px;
    font-size: 18px;
  }

  .ritual-image {
    display: none;
  }
}

@media (max-width: 370px) {
  .topline,
  .progress {
    left: 14px;
    right: 14px;
  }

  .slide {
    padding-left: 14px;
    padding-right: 14px;
  }

  h1 {
    font-size: 40px;
  }

  .slide-copy > h2 {
    font-size: 31px;
  }

  .copy-panel p,
  .copy-panel li,
  .course-card p,
  .ritual-image p,
  .float-card p {
    font-size: 12px;
    line-height: 1.58;
  }

  .float-stack {
    gap: 6px;
  }

  .float-card {
    padding: 10px;
    min-height: 86px;
  }

  .float-card h2 {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .deck {
    scroll-behavior: auto;
  }

  .float-card {
    transition: none;
  }
}
