:root {
  --paper: #fff3e5;
  --paper-soft: rgba(255, 241, 226, 0.92);
  --paper-deep: #f1cb9b;
  --ink: #4f2d22;
  --ink-soft: #77584e;
  --panel: rgba(255, 246, 235, 0.72);
  --panel-strong: rgba(255, 240, 223, 0.84);
  --border: rgba(118, 82, 54, 0.18);
  --orange: #f28b50;
  --pink: #d97ca4;
  --brown: #8a5a3c;
  --teal: #2d8c87;
  --yellow: #f2c84b;
  --button: #391b05;
  --button-text: #fff7ed;
  --cta-height: 56px;
  --cta-radius: 999px;
  --cta-font-size: 1rem;
  --cta-letter-spacing: 0.04em;
  --shadow: 0 24px 80px rgba(114, 70, 36, 0.16);
  --mist-yellow: rgba(242, 200, 75, 0.34);
  --mist-teal: rgba(45, 140, 135, 0.22);
  --mist-orange: rgba(242, 139, 80, 0.22);
  --mist-pink: rgba(217, 124, 164, 0.18);
  --mist-brown: rgba(138, 90, 60, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  min-height: 100vh;
  position: relative;
  background-color: #6b371d;
  background-image:
    radial-gradient(circle at 14% 18%, rgba(189, 102, 62, 0.72) 0, rgba(189, 102, 62, 0.32) 18%, rgba(189, 102, 62, 0) 38%),
    radial-gradient(circle at 82% 28%, rgba(163, 88, 54, 0.34) 0, rgba(163, 88, 54, 0.14) 14%, rgba(163, 88, 54, 0) 34%),
    radial-gradient(circle at 76% 82%, rgba(205, 112, 68, 0.34) 0, rgba(205, 112, 68, 0.14) 13%, rgba(205, 112, 68, 0) 32%),
    linear-gradient(90deg, rgba(129, 64, 39, 0.36) 0 18%, rgba(129, 64, 39, 0) 36%),
    linear-gradient(90deg, rgba(78, 36, 20, 0) 0 38%, rgba(68, 31, 18, 0.52) 50%, rgba(78, 36, 20, 0) 66%),
    radial-gradient(circle at 50% 46%, rgba(89, 43, 24, 0.42) 0, rgba(89, 43, 24, 0.16) 24%, rgba(89, 43, 24, 0) 48%),
    linear-gradient(180deg, #8e5130 0%, #7d4628 22%, #6b371d 56%, #5a2c18 100%);
  font-family: "Bai Jamjuree", sans-serif;
  font-weight: 500;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 22% 24%, rgba(208, 140, 87, 0.2) 0, rgba(208, 140, 87, 0.12) 10%, rgba(208, 140, 87, 0) 22%),
    radial-gradient(circle at 32% 56%, rgba(194, 112, 70, 0.16) 0, rgba(194, 112, 70, 0.08) 11%, rgba(194, 112, 70, 0) 24%),
    radial-gradient(circle at 68% 42%, rgba(144, 74, 47, 0.12) 0, rgba(144, 74, 47, 0.07) 13%, rgba(144, 74, 47, 0) 26%),
    radial-gradient(circle at 62% 76%, rgba(192, 110, 65, 0.15) 0, rgba(192, 110, 65, 0.08) 12%, rgba(192, 110, 65, 0) 26%),
    radial-gradient(circle at 86% 18%, rgba(189, 111, 71, 0.12) 0, rgba(189, 111, 71, 0.06) 10%, rgba(189, 111, 71, 0) 24%);
  filter: blur(28px);
  opacity: 0.95;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 214, 168, 0.2) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(94, 46, 28, 0.22) 0 1px, transparent 1.8px),
    radial-gradient(circle, rgba(255, 193, 134, 0.12) 0 0.8px, transparent 1.4px);
  background-size: 23px 23px, 31px 31px, 17px 17px;
  background-position: 0 0, 9px 14px, 4px 7px;
  mix-blend-mode: soft-light;
  opacity: 0.34;
  z-index: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.shell {
  width: min(1680px, calc(100vw - 64px));
  margin: 0 auto;
  padding: 20px 0 80px;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 20px;
}

.brand {
  font-size: 1rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brown);
  font-weight: 700;
}

.nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 12px;
  margin-left: auto;
}

.nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--cta-height);
  padding: 0 24px;
  border-radius: var(--cta-radius);
  background: #fff4d6;
  border: 1px solid var(--border);
  font-size: var(--cta-font-size);
  letter-spacing: var(--cta-letter-spacing);
  text-transform: uppercase;
  text-align: center;
  font-weight: 700;
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: stretch;
  padding: 8px 0 32px;
}

.hero-copy,
.hero-feed,
.step,
.guide-card {
  backdrop-filter: blur(6px);
  background: #fff4d6;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-copy {
  border-radius: 34px;
  padding: 24px 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 18px;
}

.hero-copy-head {
  display: grid;
  gap: 12px;
}

.eyebrow,
.section-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--teal);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
}

.section-mark::before,
.eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  background: currentColor;
}

.archive-copy .eyebrow {
  color: #79451f;
}

#archive .section-mark {
  color: #fff06a;
}

h1 {
  margin: 0;
  font-weight: 700;
  line-height: 0.98;
  font-size: clamp(2.8rem, 6vw, 5.6rem);
  text-transform: uppercase;
  letter-spacing: 0.035em;
  overflow-wrap: anywhere;
  color: var(--brown);
}

.hero-subtitle {
  margin: 0;
  max-width: none;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink-soft);
  font-weight: 500;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--cta-height);
  padding: 0 26px;
  border-radius: var(--cta-radius);
  border: 1px solid rgba(53, 26, 8, 0.12);
  background: #391b05;
  color: var(--button-text);
  text-transform: uppercase;
  letter-spacing: var(--cta-letter-spacing);
  font-size: var(--cta-font-size);
  text-align: center;
  box-shadow: 0 14px 30px rgba(196, 111, 53, 0.28);
  font-weight: 700;
  cursor: pointer;
}

.button.secondary {
  background: #391b05;
  color: var(--button-text);
  border-color: rgba(53, 26, 8, 0.12);
  box-shadow: 0 14px 30px rgba(57, 27, 5, 0.24);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.status-note {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.65;
  font-size: 0.96rem;
}

.hero-feed {
  border-radius: 36px;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  align-items: stretch;
}

.feed-stage {
  position: relative;
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid rgba(63, 36, 14, 0.16);
  background: linear-gradient(180deg, #3f2a20, #1d1713);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72vh;
}

#webcam,
#pausedFrame,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
  object-fit: contain;
}

#pausedFrame {
  opacity: 0;
  transition: opacity 140ms ease;
  pointer-events: none;
}

#pausedFrame.is-visible {
  opacity: 1;
}

#overlay {
  pointer-events: none;
}

.feed-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.feed-overlay.is-visible {
  opacity: 1;
}

.feed-overlay-icon {
  width: 0;
  height: 0;
  border-top: 28px solid transparent;
  border-bottom: 28px solid transparent;
  border-left: 42px solid rgba(247, 238, 227, 0.92);
  filter: drop-shadow(0 10px 22px rgba(24, 16, 9, 0.24));
}

.feed-status {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 10px;
  margin: 0 4px 0 0;
}

.status-card {
  padding: 13px 14px;
  border-radius: 18px;
  border: 1px solid rgba(82, 51, 24, 0.1);
  background: #fff4d6;
}

.status-card:nth-child(1) {
  border-color: rgba(242, 139, 80, 0.2);
}

.status-card:nth-child(2) {
  border-color: rgba(217, 124, 164, 0.2);
}

.status-card:nth-child(3) {
  border-color: rgba(45, 140, 135, 0.2);
}

.status-label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.status-value {
  font-size: 1.1rem;
  line-height: 1.3;
  font-weight: 500;
}

.section {
  padding: 18px 0 28px;
}

.archive {
  display: grid;
  gap: 24px;
  margin-top: 18px;
}

.archive-card,
.interpretation-frame {
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
}

.archive-card {
  background: #fff4d6;
  border: 1px solid var(--border);
  border-radius: 32px;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 24px;
  align-items: start;
}

.archive-heading {
  grid-column: 1 / -1;
}

.archive-heading h2 {
  margin-top: 12px;
  font-size: clamp(2.2rem, 4.4vw, 3.6rem);
  color: var(--brown);
  line-height: 0.98;
}

.archive-heading p {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-weight: 500;
}

.archive-sketch {
  display: grid;
  gap: 14px;
}

.archive-sketch-box {
  padding: 20px;
  border-radius: 24px;
  min-height: 320px;
  display: grid;
  place-items: center;
}

.archive-sketch-box img {
  width: min(100%, 260px);
  max-height: 320px;
  object-fit: contain;
}

.archive-copy p {
  margin: 14px 0 0;
  color: var(--ink-soft);
  line-height: 1.65;
  font-size: 0.96rem;
  font-weight: 500;
}

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

.chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: #fff4d6;
  border: 1px solid rgba(217, 124, 164, 0.16);
  color: var(--brown);
  font-size: 0.95rem;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
  font-weight: 500;
}

button.chip {
  font: inherit;
}

.chip:hover {
  transform: translateY(-1px);
  border-color: rgba(45, 140, 135, 0.28);
}

.chip.is-active {
  background: #fff06a;
  color: var(--brown);
  border-color: rgba(57, 27, 5, 0.44);
}

.interpretation-frame {
  margin-top: 16px;
  border-radius: 32px;
  padding: 18px;
  background: #fff4d6;
}

.interpretation-media {
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #7c4f35, #50382b);
}

.interpretation-media video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
}

.performer-credit {
  margin: 12px 4px 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.5;
}

.archive-cta {
  margin-top: 18px;
}

.steps {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.step {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border-radius: 28px;
  background: #fff4d6;
}

.step-index {
  width: 64px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 245, 232, 0.92);
  box-shadow: inset 0 0 0 1px rgba(242, 200, 75, 0.28);
  border: 1px solid rgba(45, 140, 135, 0.2);
  font-size: 1.2rem;
  color: var(--brown);
  font-weight: 700;
}

.step p,
.guide-card p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.7;
  font-size: 1rem;
  font-weight: 500;
}

.guide-card {
  margin-top: 18px;
  padding: 24px 26px;
  border-radius: 28px;
  background: #fff4d6;
}

@media (min-width: 1600px) {
  .hero {
    gap: 24px;
  }

  .hero-copy {
    padding: 28px 32px;
  }

  .hero-feed {
    grid-template-columns: minmax(0, 1fr) 320px;
    padding: 20px;
  }
}

@media (max-width: 900px) {
  .feed-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .archive-card {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .hero-feed,
  .archive-card,
  .step,
  .guide-card {
    border-radius: 28px;
  }

  .shell {
    width: min(100vw - 20px, 1120px);
    padding-top: 14px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav {
    width: 100%;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 2.25rem;
    letter-spacing: 0.025em;
  }

  .hero-copy,
  .archive-card,
  .step,
  .guide-card {
    padding: 20px;
  }

  .hero-copy {
    align-items: flex-start;
  }

  .hero-feed {
    grid-template-columns: 1fr;
  }

  .feed-status {
    grid-template-columns: 1fr;
    margin: 0;
  }

  .hero-actions {
    width: 100%;
  }

  .button {
    width: 100%;
    min-height: 54px;
    padding: 12px 20px;
  }

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