:root {
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  color: #17130d;
  background: #d8d0c0;
  font-synthesis: none;
  --ink: #17130d;
  --ink-muted: rgba(23, 19, 13, 0.58);
  --paper: #e4dac8;
  --paper-strong: #eee6d7;
  --vermillion: #8e2f25;
  --line: rgba(38, 31, 22, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #d8d0c0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

button {
  font: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid #17130d;
  outline-offset: 4px;
}

.waterfall-shell {
  display: grid;
  min-height: 100dvh;
  place-items: start center;
  background: #d8d0c0;
}

.ink-scroll {
  position: relative;
  width: 100vw;
  min-height: 100dvh;
  overflow: hidden;
  background: #dfd4c2;
  box-shadow: 0 0 32px rgba(18, 15, 11, 0.14);
  isolation: isolate;
}

.ink-scroll::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  content: "";
  background: rgba(239, 230, 211, 0.16);
  box-shadow: inset 0 0 120px rgba(35, 29, 20, 0.12);
}

.ink-scroll::after {
  position: absolute;
  z-index: 6;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.68' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.24'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.bamboo-scene {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: 0.94;
  pointer-events: none;
  user-select: none;
}

.bamboo-breeze {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.bamboo-echo {
  position: absolute;
  inset: -2px;
  display: block;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  object-fit: cover;
  object-position: center center;
  opacity: 0.17;
  mix-blend-mode: multiply;
  user-select: none;
  will-change: transform;
  -webkit-mask-image: linear-gradient(to bottom, transparent 2%, #000 15%, #000 48%, transparent 70%);
  mask-image: linear-gradient(to bottom, transparent 2%, #000 15%, #000 48%, transparent 70%);
}

.bamboo-echo-left {
  clip-path: polygon(0 3%, 39% 3%, 34% 68%, 0 73%);
  transform-origin: 8% 64%;
  animation: bamboo-breathe-left 9.8s ease-in-out infinite alternate;
}

.bamboo-echo-right {
  clip-path: polygon(61% 3%, 100% 3%, 100% 73%, 66% 68%);
  transform-origin: 92% 64%;
  animation: bamboo-breathe-right 11.4s ease-in-out 1.3s infinite alternate;
}

.ambient-scene {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.sutra-wash {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 22%;
  left: 50%;
  width: min(36vw, 420px);
  pointer-events: none;
  background: rgba(226, 216, 198, 0.82);
  box-shadow: 0 0 52px 54px rgba(226, 216, 198, 0.58);
  transform: translateX(-50%);
}

.site-mark {
  position: absolute;
  z-index: 8;
  top: max(28px, env(safe-area-inset-top));
  left: max(32px, env(safe-area-inset-left));
}

.site-name {
  display: flex;
  align-items: center;
  gap: 11px;
  width: max-content;
}

.site-seal {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(107, 31, 25, 0.74);
  color: #f1dfc6;
  background: rgba(142, 47, 37, 0.92);
  font-family: "Kaiti SC", KaiTi, "STKaiti", serif;
  font-size: 23px;
  line-height: 1;
  box-shadow: inset 0 0 0 2px rgba(241, 223, 198, 0.18);
}

.site-name span:last-child {
  display: grid;
  gap: 4px;
}

.site-name b {
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.site-name small {
  color: var(--ink-muted);
  font-size: 12px;
  letter-spacing: 0.28em;
}

.audio-controls {
  position: absolute;
  z-index: 9;
  top: max(26px, env(safe-area-inset-top));
  left: 50%;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
}

.sound-toggle {
  display: grid;
  grid-template-columns: 18px auto;
  min-width: 66px;
  height: 38px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid rgba(38, 31, 22, 0.28);
  border-radius: 2px;
  padding: 0 10px;
  color: rgba(30, 24, 17, 0.74);
  background: rgba(233, 222, 200, 0.52);
  box-shadow: 0 7px 20px rgba(35, 29, 20, 0.07);
  cursor: pointer;
  transition: background 160ms ease-out, color 160ms ease-out, transform 160ms ease-out;
}

.sound-toggle:hover {
  color: var(--ink);
  background: rgba(238, 230, 215, 0.78);
  transform: translateY(-1px);
}

.sound-toggle[aria-pressed="true"] {
  color: #f1dfc6;
  border-color: rgba(107, 31, 25, 0.76);
  background: rgba(142, 47, 37, 0.9);
}

.sound-glyph {
  font-family: "Kaiti SC", KaiTi, "STKaiti", serif;
  font-size: 17px;
  line-height: 1;
}

.audio-label {
  font-size: 11px;
  letter-spacing: 0.08em;
}

.sutra-quote {
  position: absolute;
  z-index: 7;
  bottom: 42px;
  left: max(40px, 4vw);
  margin: 0;
  color: rgba(23, 19, 13, 0.74);
}

.sutra-quote p {
  margin: 0;
  font-family: "Kaiti SC", KaiTi, "STKaiti", serif;
  font-size: 24px;
  line-height: 1.65;
  letter-spacing: 0.18em;
}

.sutra-quote cite {
  display: block;
  margin-top: 9px;
  color: rgba(23, 19, 13, 0.46);
  font-size: 11px;
  font-style: normal;
  letter-spacing: 0.18em;
}

.practice-rail {
  position: absolute;
  z-index: 8;
  top: 0;
  right: 0;
  display: flex;
  width: clamp(278px, 22vw, 326px);
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
  padding: 94px max(26px, 2.4vw) 54px 48px;
  background: linear-gradient(90deg, rgba(230, 220, 202, 0), rgba(230, 220, 202, 0.72) 28%, rgba(230, 220, 202, 0.9));
}

.practice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

.practice-head p {
  margin: 0;
  color: rgba(23, 19, 13, 0.78);
  font-family: "Kaiti SC", KaiTi, "STKaiti", serif;
  font-size: 18px;
  letter-spacing: 0.22em;
}

.practice-close {
  display: none;
  width: 34px;
  height: 34px;
  border: 0;
  color: var(--ink-muted);
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.practice-close:focus-visible {
  outline: 1px solid rgba(23, 19, 13, 0.62);
  outline-offset: 1px;
}

.practice-list {
  border-bottom: 1px solid var(--line);
}

.practice-link {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr 14px;
  min-height: 61px;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(38, 31, 22, 0.12);
  transition: color 160ms ease-out, padding 160ms ease-out;
}

.practice-link:last-child {
  border-bottom: 0;
}

.practice-link::before {
  position: absolute;
  top: 13px;
  bottom: 13px;
  left: -11px;
  width: 2px;
  background: var(--vermillion);
  content: "";
  opacity: 0;
  transform: scaleY(0.4);
  transition: opacity 160ms ease-out, transform 160ms ease-out;
}

.practice-link:hover,
.practice-link:focus-visible {
  color: var(--vermillion);
  padding-left: 4px;
}

.practice-link:hover::before,
.practice-link:focus-visible::before {
  opacity: 0.78;
  transform: scaleY(1);
}

.practice-link-primary .practice-index {
  color: #f1dfc6;
  border-color: rgba(107, 31, 25, 0.72);
  background: rgba(142, 47, 37, 0.9);
}

.practice-index {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(38, 31, 22, 0.24);
  color: rgba(23, 19, 13, 0.68);
  background: rgba(239, 230, 211, 0.5);
  font-family: "Kaiti SC", KaiTi, "STKaiti", serif;
  font-size: 13px;
}

.practice-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.practice-copy b {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.practice-copy small {
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.practice-arrow {
  color: rgba(23, 19, 13, 0.4);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 22px;
  line-height: 1;
}

.practice-note {
  margin: 14px 0 0;
  color: rgba(23, 19, 13, 0.42);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.04em;
}

.practice-toggle,
.practice-backdrop {
  display: none;
}

.text-waterfall {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: ns-resize;
  touch-action: pan-y;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@keyframes bamboo-breathe-left {
  0% {
    transform: translate3d(-1px, 0, 0) skewX(0.08deg);
  }
  48% {
    transform: translate3d(1px, 0, 0) skewX(-0.12deg);
  }
  100% {
    transform: translate3d(3px, 0, 0) skewX(-0.24deg);
  }
}

@keyframes bamboo-breathe-right {
  0% {
    transform: translate3d(2px, 0, 0) skewX(-0.08deg);
  }
  52% {
    transform: translate3d(0, 0, 0) skewX(0.1deg);
  }
  100% {
    transform: translate3d(-3px, 0, 0) skewX(0.22deg);
  }
}

@media (max-height: 760px) and (min-width: 761px) {
  .practice-rail {
    padding-top: 76px;
    padding-bottom: 28px;
  }

  .practice-link {
    min-height: 52px;
  }

  .practice-note {
    display: none;
  }
}

@media (max-width: 980px) and (min-width: 761px) {
  .practice-rail {
    width: 268px;
    padding-right: 22px;
    padding-left: 38px;
  }

  .sutra-quote {
    left: 28px;
  }
}

@media (max-width: 760px) {
  .ink-scroll {
    box-shadow: none;
  }

  .bamboo-scene {
    object-position: center bottom;
  }

  .bamboo-echo {
    object-position: center bottom;
    opacity: 0.12;
  }

  .sutra-wash {
    bottom: 24%;
    width: min(58vw, 260px);
    box-shadow: 0 0 40px 36px rgba(226, 216, 198, 0.55);
  }

  .site-mark {
    top: max(16px, env(safe-area-inset-top));
    left: max(16px, env(safe-area-inset-left));
  }

  .site-seal {
    width: 32px;
    height: 32px;
    font-size: 19px;
  }

  .site-name {
    gap: 8px;
  }

  .site-name b {
    font-size: 10px;
  }

  .site-name small {
    font-size: 10px;
    letter-spacing: 0.16em;
  }

  .audio-controls {
    top: max(16px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    left: auto;
    gap: 5px;
    transform: none;
  }

  .sound-toggle {
    grid-template-columns: 1fr;
    width: 36px;
    min-width: 36px;
    height: 36px;
    gap: 0;
    padding: 0;
  }

  .audio-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .sutra-quote {
    display: none;
  }

  .practice-rail {
    position: fixed;
    z-index: 14;
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    min-height: 0;
    max-height: min(78dvh, 640px);
    justify-content: flex-start;
    overflow-y: auto;
    padding: 18px max(18px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    border-top: 1px solid rgba(38, 31, 22, 0.24);
    background: rgba(235, 226, 209, 0.97);
    box-shadow: 0 -20px 60px rgba(35, 29, 20, 0.24);
    transform: translateY(105%);
    transition: transform 240ms ease-out;
  }

  .menu-open .practice-rail {
    transform: translateY(0);
  }

  .practice-head {
    position: sticky;
    z-index: 1;
    top: -18px;
    padding: 10px 0 13px;
    background: rgba(235, 226, 209, 0.97);
  }

  .practice-close {
    display: grid;
    place-items: center;
  }

  .practice-link {
    min-height: 57px;
  }

  .practice-copy small {
    white-space: normal;
  }

  .practice-note {
    text-align: center;
  }

  .practice-toggle {
    position: absolute;
    z-index: 9;
    bottom: max(18px, env(safe-area-inset-bottom));
    left: 50%;
    display: grid;
    grid-template-columns: 30px auto;
    height: 46px;
    align-items: center;
    gap: 9px;
    border: 1px solid rgba(38, 31, 22, 0.34);
    border-radius: 2px;
    padding: 0 17px 0 8px;
    color: var(--ink);
    background: rgba(235, 226, 209, 0.88);
    box-shadow: 0 12px 34px rgba(35, 29, 20, 0.22);
    transform: translateX(-50%);
    cursor: pointer;
  }

  .practice-toggle span {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: #f1dfc6;
    background: var(--vermillion);
    font-family: "Kaiti SC", KaiTi, "STKaiti", serif;
    font-size: 16px;
  }

  .practice-toggle b {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.14em;
  }

  .practice-backdrop {
    position: fixed;
    z-index: 13;
    inset: 0;
    display: block;
    border: 0;
    padding: 0;
    background: rgba(22, 18, 13, 0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease-out;
  }

  .menu-open .practice-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 390px) {
  .site-name span:last-child {
    display: none;
  }
}

@media (max-width: 540px) {
  .bamboo-breeze {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bamboo-echo {
    animation: none;
  }

  .sound-toggle,
  .practice-link,
  .practice-link::before,
  .practice-rail,
  .practice-backdrop {
    transition: none;
  }
}
