*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --wood-tone: #e5dccf;
  --wood-tone-deep: #d9cfc0;
  --accent-brown: #8b5a2b;
  --accent-brown-dark: #734a22;
  --cream-text: #fbfbf8;
  --font-lushootseed: "Charis SIL", "Gentium Plus", "Doulos SIL", "Noto Sans", "Noto Sans Display", "Arial Unicode MS", "Segoe UI Symbol", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Accessibility strike targets — mirrored in js/engine.js */
  --strike-target-downbeat-opacity: 1;
  --strike-target-guided-opacity: 1;
  --strike-target-ghost-opacity: 0.25;
  /* Canvas metronome — solitary ring; no DOM/CSS animation loops */
  --strike-beat-flash-ms: 150;
  --strike-target-flash-scale: 1.12;
  /* Vagus breath palette — inhalation cedar, exhalation sage/teal (js/engine.js) */
  --vagus-cedar-r: 176;
  --vagus-cedar-g: 118;
  --vagus-cedar-b: 72;
  --vagus-sage-r: 75;
  --vagus-sage-g: 124;
  --vagus-sage-b: 118;
  --vagus-glow-r: 176;
  --vagus-glow-g: 118;
  --vagus-glow-b: 72;
  --vagus-glow-opacity: 0;
  --drum-art-size: min(85vw, 85dvh);
  --drum-art-max: min(85vw, 85dvh);
  /* Sacred outer edge rhythm ring — aligned just inside rawhide lacing */
  --sacred-edge-ring-radius: 48.25;
  --sacred-edge-ring-base-opacity: 0.22;
  --sacred-edge-ring-progress-opacity: 0.55;
  --sacred-edge-ring-glow-opacity: 0.72;
  --sacred-edge-ring-warm-r: 196;
  --sacred-edge-ring-warm-g: 166;
  --sacred-edge-ring-warm-b: 122;
  --strike-momentum-ratio: 0;
  --strike-momentum-glow-boost: 0;
  /* Bear paw anchor centers — normalized within drum art (js/engine.js) */
  --paw-left-center-x: 0.355;
  --paw-left-center-y: 0.32;
  --paw-right-center-x: 0.645;
  --paw-right-center-y: 0.68;
  --paw-clip-radius-x: 18%;
  --paw-clip-radius-y: 16%;
  --paw-break-opacity: 0.4;
  --paw-break-flash-ms: 500;
  /* Sequential cross-body heartbeat pacing — mirrored in js/engine.js */
  --heartbeat-pulse-ms: 750;
  --heartbeat-rest-ms: 750;
  --heartbeat-cycle-ms: 2250;
  --overlay-dim-color: rgba(0, 0, 0, 0.60);
  --overlay-lit-color: rgba(0, 0, 0, 0.05);
  --overlay-transition: background-color 0.25s ease-in-out;
}

html {
  position: fixed;
  overflow: hidden;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  position: fixed;
  overflow: hidden;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  touch-action: none;
  font-family: var(--font-lushootseed);
  -webkit-overflow-scrolling: auto;
  overscroll-behavior: none;
  background-color: #f4f1ea;
  background: linear-gradient(rgba(244, 241, 234, 0.45), rgba(244, 241, 234, 0.45)), url('../assets/wood-grain-subtle.svg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

body.disclaimer-gate-active {
  background-color: #e2e4e8;
  background-image: none;
}

body.disclaimer-gate-active #app-container {
  visibility: hidden;
  pointer-events: none;
}

#legal-splash.is-dismissed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#app-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #2c2c2c;
  user-select: none;
  background-color: #f4f1ea;
  background: linear-gradient(rgba(244, 241, 234, 0.45), rgba(244, 241, 234, 0.45)), url('../assets/wood-grain-subtle.svg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#workshop-screen {
  position: fixed;
  inset: 0;
  width: 100%;
  min-height: 100dvh;
  height: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  overflow: hidden;
  background: transparent;
  z-index: 10;
  padding:
    max(2.5rem, calc(env(safe-area-inset-top) + 1.5rem))
    1rem
    max(2.5rem, calc(env(safe-area-inset-bottom) + 1.5rem));
}

#workshop-screen.is-visible {
  display: flex;
  opacity: 1;
  background:
    radial-gradient(ellipse 120% 100% at 50% 42%, rgba(196, 166, 122, 0.42) 0%, rgba(139, 105, 60, 0.28) 52%, transparent 78%),
    transparent;
}

#workshop-screen.vagus-active::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    ellipse 120% 120% at 50% 50%,
    transparent 58%,
    rgba(var(--vagus-glow-r) var(--vagus-glow-g) var(--vagus-glow-b) / var(--vagus-glow-opacity)) 100%
  );
  transition: background 0.35s ease;
}

#drum-container {
  position: relative;
  aspect-ratio: 1 / 1;
  width: min(96vw, calc((100dvh - 6rem) * 0.94));
  max-height: min(calc((100dvh - 6rem) * 0.94), 96vw);
  margin: 0 auto;
  flex-shrink: 0;
  isolation: isolate;
  z-index: 20;
  background: transparent !important;
  pointer-events: auto;
  display: none;
  visibility: hidden;
}

#table-mode-bg {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  border: none;
}

#drum-container.cross-body-table-mode #table-mode-bg {
  display: block;
}

#drum-container.cross-body-table-mode #drum-rawhide-bg,
#drum-container.cross-body-table-mode #drum-stages,
#drum-container.cross-body-table-mode #sacred-edge-ring,
#drum-container.cross-body-table-mode #paw-feedback-root {
  display: none !important;
  visibility: hidden !important;
}

#drum-container.cross-body-table-mode #drum-canvas {
  opacity: 0;
  background: transparent;
}

#drum-container.active-journey {
  display: block;
  visibility: visible;
}

#drum-container.cross-body-table-mode::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 100%;
  background: #ffffff;
  z-index: 12;
  pointer-events: none;
}

#drum-rawhide-bg,
#drum-stages,
#drum-canvas,
#sacred-edge-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--drum-art-size);
  max-width: var(--drum-art-max);
  aspect-ratio: 1 / 1;
}

#drum-rawhide-bg {
  object-fit: contain;
  object-position: center;
  z-index: 1;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  background: transparent !important;
  background-color: transparent !important;
  border: none;
  box-shadow: none;
}

#drum-rawhide-bg.is-hidden {
  opacity: 0;
  visibility: hidden;
}

#drum-stages {
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  background: transparent !important;
  background-color: transparent !important;
  isolation: isolate;
}

.drum-stage-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  visibility: hidden;
  overflow: hidden;
  pointer-events: none;
  background: transparent !important;
  background-color: transparent !important;
}

.drum-stage-container.is-active {
  display: block;
  visibility: visible;
}

.drum-stage-layer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  background: transparent !important;
  background-color: transparent !important;
  border: none;
  box-shadow: none;
  mix-blend-mode: normal;
  isolation: isolate;
}

#drum-canvas {
  z-index: 4;
  display: block;
  margin: 0;
  padding: 0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  background: transparent !important;
  background-color: transparent !important;
}

#drum-canvas.is-visible {
  opacity: 1;
}

.paw-feedback-root {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  overflow: hidden;
}

.paw-art-layer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--drum-art-size);
  max-width: var(--drum-art-max);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  transition: none;
}

body.layout-table-landscape .paw-feedback-root {
  display: none !important;
}

body.layout-table-landscape .paw-art-layer {
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: auto;
  object-fit: cover;
}

.bilateral-overlays {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  display: none;
  overflow: hidden;
}

#drum-container.cross-body-table-mode .bilateral-overlays {
  display: block;
}

.bilateral-half-overlay {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  background-color: var(--overlay-dim-color);
  transition: var(--overlay-transition);
  pointer-events: none;
  opacity: 1;
}

.bilateral-half-overlay-left {
  left: 0;
}

.bilateral-half-overlay-right {
  left: 50%;
}

.bilateral-half-overlay.is-lit {
  background-color: var(--overlay-lit-color);
}

.bilateral-overlays.is-paused .bilateral-half-overlay {
  transition: none;
}

#sacred-edge-ring {
  pointer-events: none;
  z-index: 5;
  display: block;
  margin: 0;
  padding: 0;
  background: transparent !important;
  background-color: transparent !important;
}

.sacred-edge-ring-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

.sacred-edge-ring-base,
.sacred-edge-ring-progress {
  fill: none;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.sacred-edge-ring-base {
  stroke: rgba(
    var(--sacred-edge-ring-warm-r),
    var(--sacred-edge-ring-warm-g),
    var(--sacred-edge-ring-warm-b),
    var(--sacred-edge-ring-base-opacity)
  );
  stroke-width: 1.15;
}

.sacred-edge-ring-progress {
  stroke: rgba(
    var(--sacred-edge-ring-warm-r),
    var(--sacred-edge-ring-warm-g),
    var(--sacred-edge-ring-warm-b),
    var(--sacred-edge-ring-progress-opacity)
  );
  stroke-width: 1.65;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  filter: drop-shadow(0 0 2px rgba(196, 166, 122, 0.18));
  transition: opacity 0.45s ease, filter 0.45s ease;
}

#sacred-edge-ring.is-rhythm-active .sacred-edge-ring-progress {
  opacity: calc(1 + var(--strike-momentum-glow-boost) * 0.35);
  stroke: rgba(
    var(--sacred-edge-ring-warm-r),
    var(--sacred-edge-ring-warm-g),
    var(--sacred-edge-ring-warm-b),
    calc(var(--sacred-edge-ring-glow-opacity) * (1 + var(--strike-momentum-glow-boost)))
  );
  filter:
    drop-shadow(
      0 0 calc(4px * (1 + var(--strike-momentum-glow-boost)))
      rgba(196, 166, 122, calc(0.42 * (1 + var(--strike-momentum-glow-boost))))
    )
    drop-shadow(
      0 0 calc(10px * (1 + var(--strike-momentum-glow-boost)))
      rgba(176, 118, 72, calc(0.22 * (1 + var(--strike-momentum-glow-boost))))
    );
}

#sacred-edge-ring.is-reciprocity-listening .sacred-edge-ring-base {
  stroke: rgba(
    var(--sacred-edge-ring-warm-r),
    var(--sacred-edge-ring-warm-g),
    var(--sacred-edge-ring-warm-b),
    0.38
  );
  animation: sacred-edge-reciprocity-listen 2.4s ease-in-out infinite;
}

#sacred-edge-ring.is-reciprocity-responding .sacred-edge-ring-base {
  stroke: rgba(
    var(--sacred-edge-ring-warm-r),
    var(--sacred-edge-ring-warm-g),
    var(--sacred-edge-ring-warm-b),
    0.42
  );
  animation: sacred-edge-reciprocity-respond 1.8s ease-in-out infinite;
}

#sacred-edge-ring.is-reciprocity-listening .sacred-edge-ring-progress,
#sacred-edge-ring.is-reciprocity-responding .sacred-edge-ring-progress {
  opacity: 0.35;
  stroke-dashoffset: 1;
}

@keyframes sacred-edge-reciprocity-listen {
  0%, 100% {
    opacity: 0.55;
    filter: drop-shadow(0 0 2px rgba(196, 166, 122, 0.2));
  }
  50% {
    opacity: 0.95;
    filter: drop-shadow(0 0 6px rgba(196, 166, 122, 0.45));
  }
}

@keyframes sacred-edge-reciprocity-respond {
  0%, 100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

/* Visual haptics — iOS-safe drum compression + strike ripple (js/engine.js) */
@keyframes drumFlex {
  0% { transform: translate(-50%, -50%) scale(1); }
  15% { transform: translate(-50%, -50%) scale(0.97); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

#drum-stages.drumFlex {
  animation: drumFlex 0.35s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

.strike-ripple {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: rippleOut 0.4s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
  z-index: 8;
}

@keyframes rippleOut {
  0% { width: 0px; height: 0px; opacity: 1; }
  100% { width: 140px; height: 140px; opacity: 0; }
}

#anchor-contact-alert {
  position: relative;
  flex-shrink: 0;
  width: min(22rem, calc(100vw - 2rem));
  margin: clamp(0.75rem, 2.5vh, 1.25rem) auto 0;
  padding: 0.625rem 1.125rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.35;
  color: #991b1b;
  background: rgba(254, 242, 242, 0.92);
  box-shadow: 0 0 0 1px rgba(153, 27, 27, 0.15), 0 8px 24px rgba(153, 27, 27, 0.12);
  pointer-events: none;
  z-index: 15;
  animation: anchor-contact-alert-pulse 2.4s ease-in-out infinite;
}

#anchor-contact-alert.hidden {
  display: none !important;
  animation: none;
}

@keyframes anchor-contact-alert-pulse {
  0%, 100% {
    opacity: 0.88;
    box-shadow: 0 0 0 1px rgba(153, 27, 27, 0.15), 0 8px 24px rgba(153, 27, 27, 0.12);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 0 6px rgba(153, 27, 27, 0.12), 0 8px 28px rgba(153, 27, 27, 0.18);
  }
}

.home-style-section {
  width: min(92vw, 22.5rem);
  margin: clamp(0.25rem, 1.5vw, 0.5rem) auto 0;
  padding: clamp(0.75rem, 3vw, 1.125rem) clamp(0.75rem, 3vw, 1rem) clamp(0.875rem, 3vw, 1.25rem);
  border-radius: 1.25rem;
  background: rgba(251, 251, 248, 0.94);
  border: 1px solid rgba(139, 90, 43, 0.1);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 16px 40px rgba(44, 44, 44, 0.1);
  text-align: center;
  min-height: min-content;
  height: auto;
}

.home-style-title {
  margin: 0 0 1rem;
  font-size: clamp(0.6875rem, 2.8vw, 0.8125rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8b5a2b;
}

.home-style-options {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  text-align: left;
}

.home-style-option {
  display: flex;
  flex-direction: column;
}

.home-style-btn {
  width: 100%;
  padding: clamp(0.6875rem, 2.5vw, 0.8125rem) clamp(0.625rem, 2.5vw, 0.875rem);
  border: 2px solid transparent;
  border-radius: 9999px;
  font-size: clamp(0.5625rem, 2.4vw, 0.625rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-transform: uppercase;
  color: #fbfbf8;
  background: #8b5a2b;
  box-shadow: 0 8px 20px rgba(139, 90, 43, 0.16);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.home-style-btn:hover {
  background: #734a22;
  box-shadow: 0 10px 24px rgba(139, 90, 43, 0.2);
}

.home-style-btn:active {
  transform: scale(0.98);
}

.home-style-btn-alt {
  background: #5c4a3a;
  box-shadow: 0 8px 20px rgba(92, 74, 58, 0.16);
}

.home-style-btn-alt:hover {
  background: #4a3b2f;
  box-shadow: 0 10px 24px rgba(92, 74, 58, 0.2);
}

.home-style-btn.is-selected {
  border-color: rgba(251, 251, 248, 0.85);
  box-shadow:
    0 0 0 3px rgba(139, 90, 43, 0.35),
    0 10px 24px rgba(139, 90, 43, 0.22);
}

.home-style-btn-alt.is-selected {
  box-shadow:
    0 0 0 3px rgba(92, 74, 58, 0.4),
    0 10px 24px rgba(92, 74, 58, 0.22);
}


.settings-regulation-style {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  width: 100%;
}

.settings-regulation-btn {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 2px solid transparent;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--cream-text);
  background: var(--accent-brown);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.settings-regulation-btn-alt {
  background: #5c4a3a;
}

.settings-regulation-btn.is-selected {
  border-color: rgba(251, 251, 248, 0.85);
  box-shadow: 0 0 0 3px rgba(139, 90, 43, 0.35);
}

.settings-regulation-btn-alt.is-selected {
  box-shadow: 0 0 0 3px rgba(92, 74, 58, 0.4);
}

.medicine-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 5.5rem;
  padding: 1.5rem 0.75rem;
  background-color: var(--accent-brown);
  color: var(--cream-text);
  border: none;
  border-radius: 1rem;
  box-shadow: 0 10px 15px -3px rgba(44, 44, 44, 0.12), 0 4px 6px -4px rgba(44, 44, 44, 0.08);
  cursor: pointer;
  text-align: center;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.medicine-btn:hover {
  transform: scale(1.02);
  background-color: var(--accent-brown-dark);
}

.medicine-btn:active {
  transform: scale(0.98);
}

.medicine-btn.is-selected {
  background-color: var(--accent-brown-dark);
  box-shadow: 0 0 0 3px rgba(139, 90, 43, 0.35), 0 10px 15px -3px rgba(44, 44, 44, 0.15);
}

.settings-option-btn {
  min-height: auto;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.settings-toggle-switch {
  position: relative;
  width: 3rem;
  height: 1.625rem;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background-color: rgba(139, 90, 43, 0.25);
  cursor: pointer;
  transition: background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.settings-toggle-switch::after {
  content: '';
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--cream-text);
  box-shadow: 0 1px 3px rgba(44, 44, 44, 0.2);
  transition: transform 0.2s ease;
}

.settings-toggle-switch.is-on {
  background-color: var(--accent-brown);
}

.settings-toggle-switch.is-on::after {
  transform: translateX(1.375rem);
}

.theta-freq-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  width: 100%;
}

.theta-freq-btn {
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.6875rem;
  line-height: 1.3;
}

.theta-freq-btn .freq-hz {
  display: block;
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}

.theta-freq-btn .freq-label {
  display: block;
  margin-top: 0.125rem;
  font-size: 0.625rem;
  opacity: 0.75;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.settings-volume-slider {
  width: 100%;
  max-width: 14rem;
  accent-color: var(--accent-brown);
  cursor: pointer;
}

/* Offline shell — layout holds when Tailwind CDN is unreachable */
.hidden { display: none !important; }

#home-screen {
  position: relative;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  width: 100vw;
  min-height: 100dvh;
  margin: 0;
  padding: max(0.75rem, env(safe-area-inset-top)) 1rem max(5.5rem, calc(env(safe-area-inset-bottom) + 4.5rem));
  gap: 0.75rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background-color: #e5dccf;
  background: linear-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.15)), url('../assets/wood-grain-subtle.svg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: local;
  transition: opacity 1s ease;
}

#landing-logo {
  width: auto;
  height: auto;
  max-width: min(58vw, 14rem);
  max-height: min(58vw, 14rem);
  object-fit: contain;
  object-position: center;
  margin: 0 auto;
  display: block;
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
  transition: opacity 0.7s ease;
}

.crisis-link {
  display: inline-block;
  margin: 0 auto;
  font-size: clamp(0.5625rem, 2.4vw, 0.625rem);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: #3d2a1c;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.crisis-link:hover,
.crisis-link:focus-visible {
  color: var(--accent-brown);
}

#start-journey-btn {
  margin-top: 0.25rem;
  padding: clamp(0.875rem, 3vw, 1.125rem) clamp(1.5rem, 6vw, 2.25rem);
  font-size: clamp(0.9375rem, 3.6vw, 1.0625rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream-text);
  background-color: var(--accent-brown);
  border: none;
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(44, 44, 44, 0.15), 0 8px 10px -6px rgba(44, 44, 44, 0.1);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

#start-journey-btn:hover {
  transform: scale(1.02);
  background-color: var(--accent-brown-dark);
}

#start-journey-btn:active {
  transform: scale(0.98);
}

#settings-toggle-btn {
  position: fixed;
  bottom: max(1rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: min(calc(100% - 2rem), 20rem);
  min-height: 3.25rem;
  padding: 0.875rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cream-text);
  background-color: var(--accent-brown);
  border: none;
  border-radius: 1rem;
  box-shadow: 0 10px 15px -3px rgba(44, 44, 44, 0.12), 0 4px 6px -4px rgba(44, 44, 44, 0.08);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

#settings-toggle-btn:hover {
  transform: translateX(-50%) scale(1.02);
  background-color: var(--accent-brown-dark);
}

#settings-toggle-btn:active {
  transform: translateX(-50%) scale(0.98);
}

#settings-panel {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0.3s ease;
}

#settings-panel.is-open {
  pointer-events: auto;
  visibility: visible;
}

#settings-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(44, 44, 44, 0.25);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#settings-panel.is-open #settings-panel-backdrop {
  opacity: 1;
}

#settings-panel-content {
  position: relative;
  width: 100%;
  max-width: 24rem;
  background: var(--wood-tone);
  border-radius: 1rem 1rem 0 0;
  padding: 1.25rem 1.5rem max(1.5rem, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 24px rgba(44, 44, 44, 0.12);
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

#settings-panel.is-open #settings-panel-content {
  transform: translateY(0);
}

#completion-hilu-btn {
  padding: 1rem 2.5rem;
  background-color: #8b5a2b;
  color: #fbfbf8;
  border: none;
  border-radius: 9999px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

#exit-btn {
  position: fixed;
  top: max(1.5rem, env(safe-area-inset-top));
  right: max(1.5rem, env(safe-area-inset-right));
  z-index: 200;
  background-color: #991b1b;
  color: #fff;
  padding: 1rem 2rem;
  border: none;
  border-radius: 9999px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

#exit-btn:hover {
  transform: scale(1.05);
}

#exit-btn:active {
  transform: scale(0.98);
}

.gameplay-top-bar {
  position: relative;
  display: none;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(0.25rem, 1.5vw, 0.5rem);
  padding: clamp(0.2rem, 1vw, 0.25rem);
  border-radius: 9999px;
  background: rgba(251, 251, 248, 0.88);
  border: 1px solid rgba(139, 90, 43, 0.14);
  box-shadow: 0 8px 24px rgba(44, 44, 44, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.session-header {
  position: fixed;
  top: max(0.5rem, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 180;
  display: none;
  flex-direction: column;
  align-items: center;
  width: min(calc(100% - 1rem), 36rem);
  pointer-events: none;
}

#workshop-screen.is-visible .session-header {
  display: flex;
  pointer-events: auto;
}

#workshop-screen.is-visible .gameplay-top-bar {
  display: inline-flex;
}

.gameplay-settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid rgba(139, 90, 43, 0.2);
  border-radius: 9999px;
  background: rgba(251, 251, 248, 0.95);
  color: #8b5a2b;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.gameplay-settings-btn:hover {
  background: rgba(229, 220, 207, 0.95);
  border-color: rgba(139, 90, 43, 0.35);
}

.gameplay-settings-btn:active {
  transform: scale(0.96);
}

.gameplay-settings-icon {
  width: 1.125rem;
  height: 1.125rem;
}

.session-settings-drawer {
  position: absolute;
  top: calc(100% + 0.375rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100vw - 1rem), 22rem);
  z-index: 190;
  pointer-events: none;
  visibility: hidden;
}

.session-settings-drawer.is-open {
  pointer-events: auto;
  visibility: visible;
}

.session-settings-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(44, 44, 44, 0.2);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.session-settings-drawer.is-open .session-settings-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.session-settings-content {
  position: relative;
  width: 100%;
  max-height: min(60dvh, 24rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--wood-tone);
  border: 1px solid rgba(139, 90, 43, 0.14);
  border-radius: 1rem;
  padding: clamp(0.875rem, 3vw, 1.125rem) clamp(0.875rem, 3vw, 1.25rem);
  box-shadow: 0 12px 32px rgba(44, 44, 44, 0.16);
  transform: translateY(-0.5rem) scale(0.98);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.session-settings-drawer.is-open .session-settings-content {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.session-settings-title {
  margin: 0 0 clamp(0.75rem, 2.5vw, 1rem);
  font-size: clamp(0.5625rem, 2.2vw, 0.625rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(139, 90, 43, 0.6);
  text-align: center;
}

.session-settings-regulation {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-bottom: clamp(0.75rem, 2.5vw, 1rem);
}

.session-settings-regulation:last-child {
  margin-bottom: 0;
}

.session-settings-label {
  margin: 0 0 0.5rem;
  font-size: clamp(0.5625rem, 2.2vw, 0.625rem);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(139, 90, 43, 0.6);
}

.session-settings-hint {
  margin: 0.25rem 0 0;
  font-size: clamp(0.5625rem, 2vw, 0.625rem);
  color: rgba(139, 90, 43, 0.4);
}

.gameplay-theta-toggle,
.gameplay-whale-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 9.5rem;
  padding: 0.5rem 0.875rem;
  border: 2px solid rgba(139, 90, 43, 0.35);
  border-radius: 9999px;
  background: rgba(251, 251, 248, 0.92);
  color: #8b5a2b;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.gameplay-theta-toggle.is-on,
.gameplay-whale-toggle.is-on {
  background: #8b5a2b;
  border-color: #734a22;
  color: #fbfbf8;
}

.gameplay-theta-toggle:hover,
.gameplay-whale-toggle:hover {
  transform: scale(1.03);
}

.gameplay-theta-toggle:active,
.gameplay-whale-toggle:active {
  transform: scale(0.97);
}

#legal-splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: max(0.75rem, env(safe-area-inset-top)) 1rem max(0.75rem, env(safe-area-inset-bottom));
  text-align: center;
  background: #e2e4e8;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#legal-splash h1 {
  font-family: var(--font-lushootseed);
  font-size: 1.875rem;
  font-weight: 700;
  color: #8b5a2b;
  margin: 0 0 1rem;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  flex-shrink: 0;
  font-feature-settings: "liga" 1;
}

#legal-splash-card,
#legal-splash > div {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 24rem;
  max-height: none;
  min-height: min-content;
  height: auto;
  flex: 0 1 auto;
  background-color: #f4f5f7;
  padding: clamp(1rem, 3vw, 1.25rem);
  border-radius: 1rem;
  box-shadow: 0 10px 15px -3px rgba(44, 44, 44, 0.1);
  overflow: visible;
}

#legal-splash .splash-label {
  font-size: 0.75rem;
  color: #8b5a2b;
  margin: 0 0 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  flex-shrink: 0;
}

#disclaimer-body,
#legal-splash .splash-scroll {
  flex: 1 1 auto;
  min-height: min-content;
  max-height: none;
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 0.125rem 0.75rem;
  margin: 0 0 0.75rem;
  text-align: left;
}

#disclaimer-body p,
#legal-splash .splash-body {
  font-size: clamp(0.8125rem, 3.2vw, 0.875rem);
  color: #2c2c2c;
  margin: 0 0 0.875rem;
  line-height: 1.65;
}

#disclaimer-body p:last-child {
  margin-bottom: 0;
}

#disclaimer-body .disclaimer-privacy-feature {
  margin: 0 0 0.875rem;
  padding: clamp(0.625rem, 2.5vw, 0.75rem);
  border-radius: 0.625rem;
  background: rgba(139, 90, 43, 0.08);
  border: 1px solid rgba(139, 90, 43, 0.18);
  font-weight: 600;
  color: #5c3d1e;
  line-height: 1.6;
}

.splash-privacy-callout {
  flex-shrink: 0;
  margin: 0 0 0.875rem;
  padding: clamp(0.5rem, 2vw, 0.625rem) clamp(0.625rem, 2.5vw, 0.75rem);
  border-radius: 0.5rem;
  background: rgba(139, 90, 43, 0.1);
  border: 1px solid rgba(139, 90, 43, 0.2);
  font-size: clamp(0.75rem, 2.8vw, 0.8125rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #5c3d1e;
  line-height: 1.5;
}

#consent-btn {
  width: 100%;
  flex-shrink: 0;
  background-color: #8b5a2b;
  color: #fbfbf8;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 0.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

#consent-btn:hover {
  background-color: #734a22;
}

#consent-btn:active {
  transform: scale(0.95);
}

/* Bilateral table mode — edge-to-edge landscape drum surface */
body.layout-table-landscape {
  overflow: hidden;
}

body.layout-table-landscape #workshop-screen {
  padding: 0;
  justify-content: stretch;
  align-items: stretch;
}

body.layout-table-landscape #workshop-screen.is-visible {
  background: transparent;
}

body.layout-table-landscape #drum-container {
  position: fixed;
  inset: 0;
  overflow: hidden;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  margin: 0;
}

body.layout-table-landscape #table-mode-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
}

body.layout-table-landscape .bilateral-overlays {
  position: fixed;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
}

body.layout-table-landscape #drum-container.cross-body-table-mode::after {
  position: fixed;
  inset: 0 auto 0 50%;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  width: 1px;
  background: #ffffff;
}

body.layout-table-landscape #drum-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  aspect-ratio: auto;
  transform: none;
  top: 0;
  left: 0;
}

body.layout-table-landscape #exit-btn {
  top: max(0.375rem, env(safe-area-inset-top));
  right: max(0.5rem, env(safe-area-inset-right));
  padding: 0.4375rem 0.875rem;
  font-size: 0.5625rem;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

body.layout-table-landscape .session-header {
  top: max(0.375rem, env(safe-area-inset-top));
  width: min(calc(100% - 0.75rem), 36rem);
}

body.layout-table-landscape .gameplay-top-bar {
  gap: clamp(0.2rem, 1.2vw, 0.375rem);
  opacity: 0.92;
}

body.layout-table-landscape .gameplay-settings-btn {
  width: 2rem;
  height: 2rem;
}

body.layout-table-landscape .gameplay-theta-toggle,
body.layout-table-landscape .gameplay-whale-toggle {
  min-width: 7.75rem;
  padding: 0.4375rem 0.625rem;
  font-size: 0.5625rem;
  letter-spacing: 0.08em;
}

body.layout-table-landscape #anchor-contact-alert {
  display: none !important;
}

.bilateral-instruction-banner {
  position: absolute;
  top: max(5rem, calc(env(safe-area-inset-top) + 3.75rem));
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  width: min(90vw, 34rem);
  max-width: min(90vw, 34rem);
  text-align: center;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.4);
  padding: clamp(0.5rem, 2vw, 0.625rem) clamp(0.75rem, 3vw, 1.125rem);
  border-radius: 8px;
  font-size: clamp(0.625rem, 2.4vw, 0.8125rem);
  line-height: 1.4;
  transition: opacity 0.6s ease-in-out;
  pointer-events: none;
  opacity: 0;
  overflow-wrap: anywhere;
}

body.layout-table-landscape .bilateral-instruction-banner {
  top: max(4.25rem, calc(env(safe-area-inset-top) + 3rem));
  width: min(86vw, 36rem);
  max-width: min(86vw, 36rem);
  font-size: clamp(0.5625rem, 2.2vw, 0.75rem);
  padding: clamp(0.4375rem, 1.8vw, 0.5625rem) clamp(0.625rem, 2.5vw, 1rem);
}

.home-legal-link {
  display: inline-block;
  font-size: clamp(0.5625rem, 2.2vw, 0.625rem);
  color: rgba(0, 0, 0, 0.28);
  text-decoration: none;
  letter-spacing: 0.06em;
  margin-top: auto;
  padding-top: clamp(0.5rem, 2vw, 0.875rem);
  padding-bottom: max(0.25rem, env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease;
}

.home-legal-link:hover,
.home-legal-link:focus-visible {
  color: rgba(0, 0, 0, 0.45);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
