/* ═══════════════════════════════════════════
   VERSES — Personal Poetry Collection
   Premium Minimalist Design System & Layout
   ═══════════════════════════════════════════ */

/* ── Reset & Foundation ────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'Cormorant Garamond', 'Georgia', serif;
  background: #f5f5f7;
  color: #000000;
  overflow: hidden; /* Prevent body scroll, scrolling happens in device screen or main container */
  height: 100vh;
  width: 100vw;
  transition: background 0.5s ease, color 0.5s ease;
  --ui-font: 'Inter', sans-serif;
  --poem-font: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'Cormorant Garamond', 'Georgia', serif;
}

::selection {
  background: #000000;
  color: #ffffff;
}

/* ── Dynamic Typography Fonts ────────────── */
body.font-noto-serif {
  --ui-font: 'Noto Serif SC', sans-serif;
  --poem-font: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'Cormorant Garamond', 'Georgia', serif;
}
body.font-lxgw-wenkai {
  --ui-font: 'LXGW WenKai', sans-serif;
  --poem-font: 'LXGW WenKai', 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', serif;
}
body.font-long-cang {
  --ui-font: 'Long Cang', sans-serif;
  --poem-font: 'Long Cang', 'Noto Serif SC', cursive, serif;
}
body.font-ma-shan-zheng {
  --ui-font: 'Ma Shan Zheng', sans-serif;
  --poem-font: 'Ma Shan Zheng', 'Noto Serif SC', cursive, serif;
}
body.font-zhi-mang-xing {
  --ui-font: 'Zhi Mang Xing', sans-serif;
  --poem-font: 'Zhi Mang Xing', 'Noto Serif SC', cursive, serif;
}
body.font-zcool-xiaowei {
  --ui-font: 'ZCOOL XiaoWei', sans-serif;
  --poem-font: 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
}
body.font-noto-sans-sc {
  --ui-font: 'Noto Sans SC', sans-serif;
  --poem-font: 'Noto Sans SC', 'Noto Serif SC', sans-serif;
}
body.font-liu-jian-mao-cao {
  --ui-font: 'Liu Jian Mao Cao', cursive;
  --poem-font: 'Liu Jian Mao Cao', 'Noto Serif SC', cursive, serif;
}
body.font-zcool-kuaile {
  --ui-font: 'ZCOOL KuaiLe', sans-serif;
  --poem-font: 'ZCOOL KuaiLe', 'Noto Serif SC', sans-serif;
}
body.font-cormorant-garamond {
  --ui-font: 'Cormorant Garamond', serif;
  --poem-font: 'Cormorant Garamond', 'Noto Serif SC', serif;
}
body.font-playfair-display {
  --ui-font: 'Playfair Display', serif;
  --poem-font: 'Playfair Display', 'Noto Serif SC', serif;
}

/* ── App Layout ────────────────────────── */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ── Presentation & Control Panel ──────── */
.lab-panel {
  width: 380px;
  height: 100%;
  background: #fbfbfd;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  padding: 40px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 10;
  transition: background 0.5s ease, border-color 0.5s ease;
}

.lab-panel__header {
  margin-bottom: 48px;
}

.lab-panel__logo {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  font-weight: 500;
  line-height: 1;
  margin-bottom: 12px;
  border-bottom: 1px solid #000000;
  display: inline-block;
  padding-bottom: 4px;
}

.lab-panel__title {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.25em;
  color: #000000;
}

.lab-panel__subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: rgba(0, 0, 0, 0.4);
  margin-top: 4px;
}

.lab-panel__section {
  margin-bottom: 40px;
}

.lab-panel__sec-title {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.4);
  margin-bottom: 16px;
}

.lab-panel__text {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-size: 0.85rem;
  line-height: 1.6;
  color: rgba(0, 0, 0, 0.6);
  font-weight: 300;
}

/* Interaction Mode Selectors */
.lab-modes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lab-mode-btn {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  gap: 16px;
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  color: inherit;
}

.lab-mode-btn:hover {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.2);
}

.lab-mode-btn.active {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.15);
}

.mode-num {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.5;
  margin-top: 2px;
}

.mode-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mode-name {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.mode-desc {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-size: 0.72rem;
  line-height: 1.4;
  opacity: 0.7;
  font-weight: 300;
}

/* Lab Panel Footer & Stats */
.lab-panel__footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.stat-group {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.35);
}

.stat-val {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-size: 0.75rem;
  font-weight: 400;
  color: #000000;
}

/* ── Mobile Device Mockup ──────────────── */
.device-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  height: 100%;
  overflow: hidden;
}

.device-mockup {
  position: relative;
  width: 390px;
  height: 820px;
  border-radius: 54px;
  background: #1c1c1e; /* Solid phone edge */
  padding: 12px;
  box-shadow: 
    0 30px 70px rgba(0, 0, 0, 0.18),
    0 10px 30px rgba(0, 0, 0, 0.08),
    inset 0 0 3px rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  transition: transform 0.5s ease;
}

.device-bezel-line {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 54px;
  pointer-events: none;
}

.device-speaker {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 4px;
  background: #2c2c2e;
  border-radius: 2px;
  z-index: 102;
}

.device-status-bar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  height: 38px;
  padding: 0 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 101;
  pointer-events: none;
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-size: 0.72rem;
  font-weight: 500;
  color: #000000;
  transition: color 0.5s ease;
}

.status-notch {
  width: 100px;
  height: 22px;
  background: #1c1c1e;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
  margin-top: -12px;
}

.status-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-icons::before {
  content: '📶';
  font-size: 0.7rem;
  opacity: 0.75;
}

.status-icons::after {
  content: '🔋';
  font-size: 0.85rem;
  opacity: 0.75;
}

.device-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 42px;
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  scroll-behavior: smooth;
  transition: background 0.5s ease;
}

.device-screen::-webkit-scrollbar {
  display: none;
}

.device-home-bar {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 4px;
  background: #2c2c2e;
  border-radius: 2px;
  z-index: 102;
  pointer-events: none;
}

.device-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 42px;
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  scroll-behavior: smooth;
  transition: background 0.5s ease;
  transform: translate3d(0, 0, 0); /* Creates containing block for fixed child elements */
}

.device-screen::-webkit-scrollbar {
  display: none;
}

.device-home-bar {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 4px;
  background: #2c2c2e;
  border-radius: 2px;
  z-index: 102;
  pointer-events: none;
}

/* ── Glassmorphism Background Engine ──────── */
.glass-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh; /* Prevents background resize zoom on mobile when address bar hides */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  pointer-events: none;
  transition: background-image 0.8s ease, filter 0.8s ease;
  will-change: transform; /* For parallax */
}

.glass-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: 1; /* Sits over the background but under the text */
  pointer-events: none;
  /* Base frosted glass blur */
  backdrop-filter: blur(8px) saturate(1.2);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  /* Gentle tint to ensure text readability */
  background: rgba(255, 255, 255, 0.35);
  transition: background 0.8s ease, backdrop-filter 0.8s ease;
}

/* ── Dynamic Animation Layer ────────────── */
.animation-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: 0; /* Between glass-background (0) and glass-overlay (1) */
  pointer-events: none;
  overflow: hidden;
}

/* Sakura Petal */
.anim-petal {
  position: absolute;
  background: rgba(255, 235, 245, 0.7);
  border-radius: 80% 0 55% 50% / 55% 0 80% 50%;
  box-shadow: 1px 1px 2px rgba(0,0,0,0.1);
  pointer-events: none;
}

/* Desktop: full 3D with GPU compositing */
@media (min-width: 801px) {
  .anim-petal {
    will-change: transform, opacity;
  }
}

/* Mobile: no will-change to save GPU memory */

@keyframes petalFall {
  0% {
    transform: translate3d(0, -10vh, 0) rotate(0deg) rotateX(0deg);
    opacity: 0;
  }
  10% {
    opacity: var(--peak-opacity, 0.7);
  }
  90% {
    opacity: var(--peak-opacity, 0.7);
  }
  100% {
    transform: translate3d(var(--drift, 0), 110vh, 0) rotate(var(--rot, 180deg)) rotateX(var(--rotX, 180deg));
    opacity: 0;
  }
}

/* Mobile: 2D only, no rotateX, no translate3d */
@keyframes petalFall2D {
  0% {
    transform: translate(0, -10vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: var(--peak-opacity, 0.7);
  }
  90% {
    opacity: var(--peak-opacity, 0.7);
  }
  100% {
    transform: translate(var(--drift, 0), 110vh) rotate(var(--rot, 180deg));
    opacity: 0;
  }
}

/* Rain Drop */
.anim-rain {
  position: absolute;
  width: 1.5px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.7));
  will-change: transform, opacity;
}

/* Ripple */
.anim-ripple {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.1);
  will-change: transform, opacity;
}

/* Snow Flake */
.anim-snow {
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.6);
  pointer-events: none;
}

/* Autumn Leaf */
.anim-leaf {
  position: absolute;
  border-radius: 0 80% 0 80%;
  pointer-events: none;
}

/* Mist Cloud */
.anim-mist {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0.1) 60%, transparent 100%);
  filter: blur(20px);
  pointer-events: none;
  will-change: transform, opacity;
}

/* ── Scroll Progress Indicator ─────────── */
.scroll-track {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 100px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 1px;
  z-index: 99;
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.scroll-track.visible {
  opacity: 1;
}

.scroll-thumb {
  width: 2px;
  height: 28px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 1px;
  transition: transform 0.1s ease-out;
}

/* ── Main Content Container ────────────── */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 0 36px;
}

/* ── Personalized Header ───────────────── */
.hero {
  padding: 120px 0 100px;
  text-align: left;
  opacity: 0;
  transform: translateY(15px);
  animation: fadeInUp 1.2s cubic-bezier(0.25, 1, 0.5, 1) 0.2s forwards;
}

.hero__greeting {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  color: rgba(0, 0, 0, 0.6);
  margin-bottom: 12px;
}

.hero__name {
  font-family: var(--poem-font);
  font-weight: 400;
  font-size: 3.4rem;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #000000;
  margin-bottom: 24px;
  transition: color 0.5s ease;
}

.hero__tagline {
  font-family: var(--ui-font, 'Cormorant Garamond', serif);
  font-weight: 400;
  font-style: italic;
  font-size: 1.25rem;
  color: rgba(0, 0, 0, 0.7);
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.hero__date {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.5);
  margin-top: 36px;
}

/* ── Sections & Typography ─────────────── */
.section {
  padding: 40px 0 80px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1),
              transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.section.visible {
  opacity: 1;
  transform: translateY(0);
}

.section__label {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.5);
  margin-bottom: 56px;
  padding-left: 2px;
}

/* Poem Typography Layout */
.poem {
  margin-bottom: 88px;
  position: relative;
}

.poem--featured {
  margin-bottom: 0;
}

.poem--reflection {
  padding: 56px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  transition: border-color 0.5s ease;
}

.poem__title {
  font-family: var(--poem-font);
  font-weight: 500;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  color: #000000;
  margin-bottom: 8px;
  transition: color 0.5s ease;
}

.poem__author {
  font-family: var(--poem-font);
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: rgba(0, 0, 0, 0.7);
  margin-top: 20px;
  margin-bottom: 0;
}

.poem__divider {
  width: 28px;
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
  margin-bottom: 36px;
  transition: background-color 0.5s ease;
}

/* Poem context & personal note (subtitle-free sections) */
.poem__original-text {
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  font-size: 1.05rem;
  font-style: italic;
  line-height: 1.8;
  color: rgba(0, 0, 0, 0.55);
  margin-top: 32px;
  letter-spacing: 0.03em;
  transition: color 0.5s ease;
  white-space: pre-wrap;
}

.poem__context {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-weight: 400;
  font-size: 0.9rem;
  line-height: 1.7;
  color: rgba(0, 0, 0, 0.8);
  margin-top: 40px;
  letter-spacing: 0.01em;
  transition: color 0.5s ease;
}

.poem__note-personal {
  font-family: var(--ui-font, 'Cormorant Garamond', serif);
  font-weight: 400;
  font-style: italic;
  font-size: 1rem;
  line-height: 1.8;
  color: rgba(0, 0, 0, 0.65);
  margin-top: 28px;
  letter-spacing: 0.01em;
  transition: color 0.5s ease;
}

.poem__body {
  padding: 0 2px;
}

/* Verses */
.verse {
  font-family: var(--poem-font);
  font-weight: 400;
  font-size: 1.3rem;
  line-height: 2.1;
  color: #000000;
  letter-spacing: 0.01em;
  position: relative;
  transition: color 0.5s ease, opacity 0.5s ease, filter 0.5s ease;
}

.verse-text {
  position: relative;
  display: inline-block;
}

.verse--break {
  line-height: 1;
  font-size: 0.8rem;
}

.verse--reflection {
  font-weight: 300;
  font-style: italic;
  font-size: 1.15rem;
  color: rgba(0, 0, 0, 0.6);
  line-height: 2.3;
}

.poem__note {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-weight: 300;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: rgba(0, 0, 0, 0.25);
  margin-top: 44px;
  padding-left: 2px;
}

.poem__note-mark {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 0.95rem;
  color: rgba(0, 0, 0, 0.2);
  margin-right: 4px;
}

.poem-spacer {
  height: 64px;
  position: relative;
}

.poem-spacer::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 0, 0, 0.05) 20%,
    rgba(0, 0, 0, 0.05) 80%,
    transparent 100%
  );
  transition: background 0.5s ease;
}

/* ── Footer ────────────────────────────── */
.footer {
  padding: 100px 0 140px;
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1s ease, transform 1s ease;
}

.footer.visible {
  opacity: 1;
  transform: translateY(0);
}

.footer__mark {
  font-family: 'Playfair Display', serif;
  font-weight: 400;
  font-size: 2rem;
  color: rgba(0, 0, 0, 0.08);
  margin-bottom: 16px;
}

.footer__text {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-weight: 400;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.2);
  margin-bottom: 8px;
}

.footer__sub {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-style: italic;
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.16);
}

.footer__editor-link {
  display: inline-block;
  margin-top: 20px;
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.15);
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 20px;
  transition: all 0.3s ease;
}

.footer__editor-link:hover {
  color: rgba(0, 0, 0, 0.4);
  border-color: rgba(0, 0, 0, 0.15);
}

/* ── 备案号（ICP + 公安）── */
.footer__icp,
.footer__mps {
  margin-top: 12px;
}
.footer__icp a,
.footer__mps a {
  font-family: 'Noto Serif SC', serif;
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: #fff;
  text-decoration: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transition: opacity 0.3s ease;
}
.footer__icp a:hover,
.footer__mps a:hover {
  opacity: 0.8;
}
/* 公安号未填时隐藏空链接占位 */
.footer__mps a:empty {
  display: none;
}

/* ── Text-Light Interaction Physics ───── */

/* [MODEL 01] Luminance Contrast (Default) */
.mode-luminance .light-canvas {
  mix-blend-mode: normal;
}
.mode-luminance .light-willow,
.mode-luminance .light-petal,
.mode-luminance .light-dapple {
  background-color: transparent; /* Rely on gradient colors */
}
/* Reduce text contrast softly inside shadow zone */
.mode-luminance .verse.in-shadow {
  color: rgba(0, 0, 0, 0.45);
}

/* [MODEL 02] Backdrop Refraction (Focus Blur) */
.mode-refraction .light-canvas {
  mix-blend-mode: normal;
}
.mode-refraction .light-willow,
.mode-refraction .light-petal,
.mode-refraction .light-dapple {
  backdrop-filter: blur(2.5px) contrast(0.9);
  background-color: rgba(0, 0, 0, 0.015);
  box-shadow: inset 0 0 10px rgba(0,0,0,0.02);
}
.mode-refraction .verse.in-shadow {
  filter: blur(0.5px);
  color: rgba(0, 0, 0, 0.7);
}

/* [MODEL 03] Silhouette Inversion (Difference) */
.mode-silhouette .light-canvas {
  mix-blend-mode: difference;
  z-index: 5;
}
/* Use white/light grey shadow shapes so difference blend inverts text to white */
.mode-silhouette .light-willow--1 {
  background: linear-gradient(165deg, transparent 0%, transparent 15%, rgba(255, 255, 255, 0.6) 17%, rgba(255, 255, 255, 0.8) 20%, transparent 23%, transparent 100%);
}
.mode-silhouette .light-willow--2 {
  background: linear-gradient(172deg, transparent 0%, transparent 32%, rgba(255, 255, 255, 0.5) 34%, rgba(255, 255, 255, 0.7) 37%, transparent 40%, transparent 100%);
}
.mode-silhouette .light-willow--3 {
  background: linear-gradient(158deg, transparent 0%, transparent 8%, rgba(255, 255, 255, 0.6) 10%, rgba(255, 255, 255, 0.85) 12%, transparent 15%, transparent 100%);
}
.mode-silhouette .light-petal {
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.85) 0%, transparent 70%);
}
.mode-silhouette .light-dapple {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 80%);
}
.mode-silhouette .verse.in-shadow {
  /* Dynamic inversion handles this natively via difference blend mode */
}

/* [MODEL 04] Chiaroscuro Reveal */
.mode-reveal .device-screen {
  background: #000000;
}
.mode-reveal .hero__name,
.mode-reveal .poem__title,
.mode-reveal .verse {
  color: #ffffff;
}
.mode-reveal .hero__greeting,
.mode-reveal .hero__tagline,
.mode-reveal .poem__author,
.mode-reveal .section__label {
  color: rgba(255, 255, 255, 0.65);
}

.mode-reveal .poem__context {
  color: rgba(255, 255, 255, 0.75);
}

.mode-reveal .poem__original-text {
  color: rgba(255, 255, 255, 0.6);
}

.mode-reveal .poem__note-personal {
  color: rgba(255, 255, 255, 0.6);
}
.mode-reveal .verse {
  opacity: 0.08; /* Almost invisible by default in the dark */
  transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}
.mode-reveal .verse.in-light {
  opacity: 1; /* Fully illuminated when scrolled into the center reading band */
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
}
.mode-reveal .light-canvas {
  mix-blend-mode: screen; /* Light overlay in dark mode */
}
/* Use soft white light projections instead of shadows */
.mode-reveal .light-willow--1 {
  background: linear-gradient(165deg, transparent 0%, transparent 15%, rgba(255, 255, 255, 0.08) 17%, rgba(255, 255, 255, 0.12) 20%, transparent 23%, transparent 100%);
}
.mode-reveal .light-willow--2 {
  background: linear-gradient(172deg, transparent 0%, transparent 32%, rgba(255, 255, 255, 0.06) 34%, rgba(255, 255, 255, 0.1) 37%, transparent 40%, transparent 100%);
}
.mode-reveal .light-willow--3 {
  background: linear-gradient(158deg, transparent 0%, transparent 8%, rgba(255, 255, 255, 0.08) 10%, rgba(255, 255, 255, 0.14) 12%, transparent 15%, transparent 100%);
}
.mode-reveal .light-petal {
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
}
.mode-reveal .light-dapple {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, transparent 80%);
}

/* ── Mobile Layout Trigger & Bottom Drawer ── */
.mobile-lab-trigger {
  display: none; /* Desktop hidden */
}

.mobile-drawer-overlay {
  display: none;
}

.mobile-drawer {
  display: none;
}

/* ── Animations ────────────────────────── */
@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Dark Mode Preference (Global System) ─ */
@media all {
  body:not(.mode-reveal) {
    background: #121212;
    color: #ffffff;
  }
  
  body:not(.mode-reveal) .lab-panel {
    background: #1a1a1c;
    border-color: rgba(255, 255, 255, 0.08);
  }

  body:not(.mode-reveal) .lab-panel__logo {
    border-color: #ffffff;
  }

  body:not(.mode-reveal) .lab-panel__title,
  body:not(.mode-reveal) .lab-panel__logo,
  body:not(.mode-reveal) .stat-val,
  body:not(.mode-reveal) .hero__name,
  body:not(.mode-reveal) .poem__title,
  body:not(.mode-reveal) .verse {
    color: #ffffff;
  }

  body:not(.mode-reveal) .lab-panel__subtitle,
  body:not(.mode-reveal) .lab-panel__text,
  body:not(.mode-reveal) .hero__greeting,
  body:not(.mode-reveal) .hero__tagline,
  body:not(.mode-reveal) .poem__author,
  body:not(.mode-reveal) .section__label,
  body:not(.mode-reveal) .stat-label {
    color: rgba(255, 255, 255, 0.4);
  }

  body:not(.mode-reveal) .lab-mode-btn {
    border-color: rgba(255, 255, 255, 0.08);
  }

  body:not(.mode-reveal) .lab-mode-btn:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.2);
  }

  body:not(.mode-reveal) .lab-mode-btn.active {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
    box-shadow: 0 10px 20px -5px rgba(255, 255, 255, 0.05);
  }

  body:not(.mode-reveal) .device-container {
    background: #121212;
  }

  body:not(.mode-reveal) .device-mockup {
    background: #08080a;
    box-shadow: 
      0 30px 70px rgba(0, 0, 0, 0.4),
      0 10px 30px rgba(0, 0, 0, 0.2),
      inset 0 0 3px rgba(255, 255, 255, 0.08);
  }

  body:not(.mode-reveal) .device-bezel-line {
    border-color: rgba(255, 255, 255, 0.02);
  }

  body:not(.mode-reveal) .device-screen {
    background: #0d0d0d;
  }

  body:not(.mode-reveal) .device-status-bar {
    color: #ffffff;
  }

  body:not(.mode-reveal) .scroll-track {
    background: rgba(255, 255, 255, 0.05);
  }

  body:not(.mode-reveal) .scroll-thumb {
    background: rgba(255, 255, 255, 0.2);
  }

  body:not(.mode-reveal) .poem--reflection {
    border-color: rgba(255, 255, 255, 0.08);
  }

  body:not(.mode-reveal) .poem__context {
    color: rgba(255, 255, 255, 0.3);
  }

  body:not(.mode-reveal) .poem__note-personal {
    color: rgba(255, 255, 255, 0.18);
  }

  body:not(.mode-reveal) .footer__editor-link {
    color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.06);
  }

  body:not(.mode-reveal) .footer__editor-link:hover {
    color: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
  }

  body:not(.mode-reveal) .poem-spacer::before {
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.05) 20%,
      rgba(255, 255, 255, 0.05) 80%,
      transparent 100%
    );
  }

  /* Adjust light overlay patterns to invert shadows in dark mode */
  body:not(.mode-reveal):not(.mode-silhouette) .light-willow--1 {
    background: linear-gradient(165deg, transparent 0%, transparent 15%, rgba(255, 255, 255, 0.08) 17%, rgba(255, 255, 255, 0.12) 20%, transparent 23%, transparent 100%);
  }
  body:not(.mode-reveal):not(.mode-silhouette) .light-willow--2 {
    background: linear-gradient(172deg, transparent 0%, transparent 32%, rgba(255, 255, 255, 0.06) 34%, rgba(255, 255, 255, 0.1) 37%, transparent 40%, transparent 100%);
  }
  body:not(.mode-reveal):not(.mode-silhouette) .light-willow--3 {
    background: linear-gradient(158deg, transparent 0%, transparent 8%, rgba(255, 255, 255, 0.08) 10%, rgba(255, 255, 255, 0.14) 12%, transparent 15%, transparent 100%);
  }
  body:not(.mode-reveal):not(.mode-silhouette) .light-petal {
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
  }
  body:not(.mode-reveal):not(.mode-silhouette) .light-dapple {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, transparent 80%);
  }

  /* [MODEL 01] Dark mode contrast drop */
  body.mode-luminance:not(.mode-reveal) .verse.in-shadow {
    color: rgba(255, 255, 255, 0.45);
  }
  
  /* [MODEL 02] Dark mode refraction */
  body.mode-refraction:not(.mode-reveal) .light-willow,
  body.mode-refraction:not(.mode-reveal) .light-petal,
  body.mode-refraction:not(.mode-reveal) .light-dapple {
    backdrop-filter: blur(2.5px) contrast(1.1);
    background-color: rgba(255, 255, 255, 0.005);
    box-shadow: inset 0 0 10px rgba(255,255,255,0.01);
  }
  body.mode-refraction:not(.mode-reveal) .verse.in-shadow {
    filter: blur(0.5px);
    color: rgba(255, 255, 255, 0.7);
  }
}

/* ── Responsive Adaptations (Tablet & Mobile) ─ */

@media (max-width: 960px) {
  .lab-panel {
    width: 320px;
    padding: 30px 24px;
  }
  .lab-panel__header {
    margin-bottom: 32px;
  }
  .lab-panel__logo {
    font-size: 1.8rem;
  }
}

/* Fullscreen layout for ALL screen sizes (no phone mockup frame on desktop) */
@media all {
  body {
    overflow: auto; /* Enable normal body scroll */
  }

  .app-layout {
    display: block;
    height: auto;
    width: 100%;
    overflow: visible;
  }

  /* Hide desktop control deck */
  .lab-panel {
    display: none;
  }

  /* Make device container normal fullscreen */
  .device-container {
    padding: 0;
    height: auto;
    width: 100%;
    overflow: visible;
    background: #ffffff;
  }

  @media all {
    .device-container {
      background: #0d0d0d;
    }
  }

  .device-mockup {
    width: 100%;
    height: auto;
    border-radius: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
    overflow: visible;
  }

  .device-bezel-line,
  .device-speaker,
  .device-home-bar,
  .device-status-bar {
    display: none; /* Hide device frames */
  }

  .device-screen {
    border-radius: 0;
    height: auto;
    width: 100%;
    overflow: visible;
    background: transparent;
    transform: none; /* Disable containing block to make fixed canvas relative to window */
  }

  /* Container & padding adjustments */
  .container {
    padding: 0 24px;
  }

  .hero {
    padding: 100px 0 60px;
  }

  .hero__name {
    font-size: 2.8rem;
  }

  .verse {
    font-size: 1.15rem;
  }

  /* Mobile floating action trigger */
  .mobile-lab-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #000000;
    color: #ffffff;
    border: none;
    border-radius: 30px;
    padding: 12px 20px;
    font-family: var(--ui-font, 'Inter', sans-serif);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.3s ease;
  }

  .mobile-lab-trigger:active {
    transform: translateX(-50%) scale(0.95);
  }

  .trigger-dot {
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
    animation: pulseGlow 2s infinite;
  }

  @keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.4); opacity: 1; }
  }

  /* Mobile bottom drawer */
  .mobile-drawer-overlay {
    display: block;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    z-index: 1001;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(2px);
  }

  .mobile-drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 70%;
    background: #ffffff;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 1002;
    padding: 24px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
  }

  .mobile-drawer.active {
    transform: translateY(0);
  }

  .mobile-drawer__handle {
    width: 40px;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    margin: 0 auto 20px;
  }

  .mobile-drawer__header {
    margin-bottom: 24px;
  }

  .mobile-drawer__title {
    font-family: var(--ui-font, 'Inter', sans-serif);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: #000000;
  }

  .mobile-drawer__subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: rgba(0, 0, 0, 0.4);
    margin-top: 2px;
  }

  .mobile-drawer__content {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 40px;
  }

  .lab-modes--mobile .lab-mode-btn {
    border-color: rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.02);
  }

  .lab-modes--mobile .lab-mode-btn.active {
    background: #000000;
    color: #ffffff;
    border-color: #000000;
  }

  /* Dark mode drawer settings */
  @media all {
    .mobile-drawer {
      background: #161618;
      box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.4);
    }
    .mobile-drawer__handle {
      background: rgba(255, 255, 255, 0.1);
    }
    .mobile-drawer__title {
      color: #ffffff;
    }
    .mobile-drawer__subtitle {
      color: rgba(255, 255, 255, 0.4);
    }
    .lab-modes--mobile .lab-mode-btn {
      border-color: rgba(255, 255, 255, 0.04);
      background: rgba(255, 255, 255, 0.02);
    }
    .lab-modes--mobile .lab-mode-btn.active {
      background: #ffffff;
      color: #000000;
      border-color: #ffffff;
    }
    .mobile-lab-trigger {
      background: #ffffff;
      color: #000000;
    }
    .trigger-dot {
      background: #000000;
    }
  }
}

/* ── Theme Panel & Button Styles ───────── */
.lab-themes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lab-theme-btn {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 8px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  color: inherit;
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-size: 0.75rem;
  font-weight: 500;
}

.lab-theme-btn:hover {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.15);
}

.lab-theme-btn.active {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}

.theme-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

.lab-theme-btn.active .theme-dot {
  opacity: 1;
}

.mobile-section-title {
  font-family: var(--ui-font, 'Inter', sans-serif);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.4);
  margin-bottom: 12px;
}

/* ── Theme Styles & Layouts (Background Images) ────────────── */

.theme-willow .glass-background {
  background-image: url('bg_willow.jpg');
}

.theme-sakura .glass-background {
  background-image: url('bg_sakura.jpg');
}

.theme-blinds .glass-background {
  background-image: url('bg_blinds.jpg');
}

.theme-bamboo .glass-background {
  background-image: url('bg_bamboo.jpg');
}

.theme-ripples .glass-background {
  background-image: url('bg_ripples.jpg');
}

.theme-snow .glass-background {
  background-image: url('bg_snow.jpg');
}

.theme-autumn .glass-background {
  background-image: url('bg_autumn.jpg');
}

.theme-misty .glass-background {
  background-image: url('bg_misty.jpg');
}

/* Misty theme: no glass blur, dark gradient overlay for text readability */
.theme-misty .glass-overlay {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: linear-gradient(to bottom, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.35) 50%, rgba(0,0,0,0.5) 100%) !important;
}

/* ── Theme Dark Mode Preferences ───────── */
@media all {
  body:not(.mode-reveal) .lab-theme-btn {
    border-color: rgba(255, 255, 255, 0.08);
  }
  
  body:not(.mode-reveal) .lab-theme-btn:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.2);
  }
  
  body:not(.mode-reveal) .lab-theme-btn.active {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
  }
}

/* ── Mode specific glass overlay overrides ───────── */
.mode-luminance .glass-overlay {
  /* Default tint handled by light/dark mode */
}
.mode-refraction .glass-overlay {
  backdrop-filter: blur(3px) saturate(1.5); /* Heavier blur for refraction mode */
  -webkit-backdrop-filter: blur(3px) saturate(1.5);
}
.mode-silhouette .glass-overlay {
  /* Text naturally inverts via CSS difference */
}
.mode-reveal .glass-overlay {
  background: rgba(0, 0, 0, 0.88); /* Very dark glass to hide text */
}

@media all {
  body:not(.mode-reveal) .glass-overlay {
    background: rgba(18, 18, 18, 0.45); /* Protect white text in dark mode */
  }
}

/* ── Mobile Drawer Settings ── */
@media (max-width: 800px) {
  .lab-themes--mobile .lab-theme-btn {
    border-color: rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.02);
  }
  
  .lab-themes--mobile .lab-theme-btn.active {
    background: #000000;
    color: #ffffff;
    border-color: #000000;
  }
  
  @media all {
    .lab-themes--mobile .lab-theme-btn {
      border-color: rgba(255, 255, 255, 0.04);
      background: rgba(255, 255, 255, 0.02);
    }
    .lab-themes--mobile .lab-theme-btn.active {
      background: #ffffff;
      color: #000000;
      border-color: #ffffff;
    }
  }
}
