/* Pure 16-Bit Stardew & Sci-Fi Pixel Art CSS for MoonLetter: Living Lunar Oasis */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&family=Silkscreen:wght@400;700&display=swap');

:root {
  --bg-space: #070414;
  
  /* Stardew & Bioluminescent Palette */
  --wood-dark: #150a26;
  --wood-mid: #2b1448;
  --wood-light: #52277d;
  --wood-border: #080312;
  
  --paper-bg: #fff8e8;
  --paper-border: #855222;

  --text-main: #2b1704;
  --text-light: #f8fafc;
  --accent-gold: #ffe600;
  --accent-teal: #00f0ff;
  --accent-magenta: #ff2a8d;
  --accent-green: #50fa7b;
  --accent-purple: #c084fc;
  
  /* Dynamic Sky Tokens */
  --sky-top: #05020f;
  --sky-bottom: #180933;
  --glow-color: rgba(0, 240, 255, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -webkit-font-smoothing: none;
}

body {
  font-family: 'VT323', monospace;
  background-color: var(--bg-space);
  color: var(--text-light);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  background-image: 
    radial-gradient(circle at 50% 10%, rgba(0, 240, 255, 0.25), transparent 70%),
    radial-gradient(circle at 85% 85%, rgba(255, 42, 141, 0.2), transparent 60%);
  font-size: 1.25rem;
}

.app-container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

/* Frame Boxes */
.glass-card, .panel, .top-bar, .history-footer {
  background: var(--wood-mid);
  border: 4px solid var(--wood-border);
  outline: 3px solid var(--wood-light);
  border-radius: 0px;
  box-shadow: 
    inset -4px -4px 0px var(--wood-dark),
    inset 4px 4px 0px #441e6e,
    6px 6px 0px rgba(0, 0, 0, 0.75);
  position: relative;
}

/* Header Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1.2rem;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-title {
  font-family: 'Press Start 2P', cursive;
  font-size: 1.05rem;
  color: var(--accent-gold);
  text-shadow: 2px 2px 0px var(--wood-border);
  letter-spacing: 1px;
}

.brand-subtitle {
  font-family: 'Silkscreen', monospace;
  font-size: 0.65rem;
  color: var(--accent-green);
  letter-spacing: 0.5px;
}

.orbit-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--wood-dark);
  padding: 0.35rem 0.7rem;
  border: 2px solid var(--wood-border);
  font-family: 'Silkscreen', monospace;
  font-size: 0.7rem;
  color: var(--accent-teal);
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.demo-state-switcher {
  display: flex;
  gap: 0.3rem;
  background: var(--wood-dark);
  padding: 0.25rem;
  border: 2px solid var(--wood-border);
}

.demo-mode-btn {
  background: var(--wood-mid);
  border: 1px solid var(--wood-light);
  color: var(--text-light);
  padding: 0.3rem 0.6rem;
  font-family: 'VT323', monospace;
  font-size: 1.05rem;
  cursor: pointer;
}

.demo-mode-btn.active {
  background: var(--accent-teal);
  color: var(--wood-dark);
  font-weight: bold;
  border-color: #fff;
}

.oasis-stats-bar {
  display: flex;
  gap: 0.5rem;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--wood-dark);
  border: 2px solid var(--wood-light);
  padding: 0.3rem 0.6rem;
  font-family: 'Silkscreen', monospace;
  font-size: 0.7rem;
  color: #fff;
}

.streak-badge { color: #f97316; }
.water-badge { color: var(--accent-teal); }
.biosphere-badge { color: var(--accent-green); }
.msg-badge { color: var(--accent-magenta); }

/* Main Grid Layout */
.main-content {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 0.9rem;
  min-height: 560px;
}

@media (max-width: 920px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

/* Panel A: Photon iMessage Sandbox */
.panel {
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed var(--wood-light);
  padding-bottom: 0.5rem;
}

.agent-avatar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.avatar-icon {
  font-size: 1.5rem;
  background: var(--wood-dark);
  padding: 0.3rem 0.5rem;
  border: 2px solid var(--accent-teal);
}

.agent-avatar h2 {
  font-family: 'Silkscreen', monospace;
  font-size: 0.85rem;
  color: var(--accent-gold);
}

.agent-status {
  font-size: 0.9rem;
  color: var(--accent-green);
}

/* iMessage Chat Viewport */
.chat-viewport {
  flex: 1;
  height: 250px;
  max-height: 270px;
  background: #0d0718;
  border: 3px solid var(--wood-dark);
  padding: 0.8rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  box-shadow: inset 2px 2px 0px rgba(0, 0, 0, 0.6);
}

.chat-bubble {
  max-width: 85%;
  padding: 0.6rem 0.8rem;
  border: 2px solid var(--wood-border);
  position: relative;
  font-size: 1.15rem;
  line-height: 1.3;
}

.partner-bubble {
  align-self: flex-start;
  background: #1e1b4b;
  color: #c7d2fe;
  border-color: #3730a3;
}

.user-bubble {
  align-self: flex-end;
  background: #0284c7;
  color: #fff;
  border-color: #0369a1;
}

.chat-sender {
  display: block;
  font-family: 'Silkscreen', monospace;
  font-size: 0.65rem;
  opacity: 0.8;
  margin-bottom: 0.2rem;
}

.chat-time {
  display: block;
  font-size: 0.8rem;
  opacity: 0.7;
  text-align: right;
  margin-top: 0.2rem;
}

/* Agent Card Bubble */
.agent-card-bubble {
  align-self: center;
  width: 95%;
  background: #2e1065;
  border: 2px solid var(--accent-magenta);
  color: #f3e8ff;
  padding: 0.6rem 0.8rem;
  box-shadow: 0 0 10px rgba(255, 42, 141, 0.3);
}

.agent-card-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Silkscreen', monospace;
  font-size: 0.7rem;
  color: var(--accent-gold);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 0.3rem;
  margin-bottom: 0.4rem;
}

.card-body {
  font-size: 1.1rem;
}

.card-progress {
  margin-top: 0.4rem;
  font-size: 0.95rem;
  color: var(--accent-teal);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--wood-dark);
  border: 1px solid var(--wood-light);
  margin-top: 0.2rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-teal), var(--accent-magenta));
  transition: width 0.4s ease;
}

/* Simulation Controls */
.simulation-triggers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sim-label {
  font-size: 0.95rem;
  color: var(--accent-gold);
  width: 100%;
}

.sim-btn {
  background: #2a084c;
  border: 2px solid var(--wood-border);
  color: #f3e8ff;
  padding: 0.3rem 0.6rem;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: inset -2px -2px 0px #1c0533;
}

.sim-btn:hover {
  background: var(--accent-teal);
  color: #000;
  font-weight: bold;
}

.burst-btn { background: #15803d; }
.water-btn { background: #0284c7; }
.dry-btn { background: #854d0e; }
.tree-btn { background: #be185d; }
.rain-btn { background: #0f766e; }

/* iMessage Input Container */
.imessage-input-container {
  display: flex;
  gap: 0.5rem;
}

#chat-input {
  flex: 1;
  background: #1e1b4b;
  border: 2px solid var(--wood-light);
  padding: 0.6rem 0.8rem;
  color: #fff;
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  outline: none;
}

.send-message-btn {
  background: var(--accent-teal);
  color: var(--wood-dark);
  border: 2px solid var(--wood-border);
  padding: 0.6rem 0.9rem;
  font-family: 'Silkscreen', monospace;
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
}

.send-message-btn:hover {
  background: var(--accent-gold);
}

/* Panel B: Sky & Moonscape Viewport */
.sky-card {
  padding: 0;
  overflow: hidden;
  border: 4px solid var(--wood-border);
  outline: 3px solid var(--wood-light);
}

.sky-viewport {
  width: 100%;
  height: 100%;
  min-height: 560px;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.8rem;
}

.sky-top-header {
  z-index: 15;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: rgba(10, 5, 20, 0.75);
  border: 2px solid var(--wood-light);
  padding: 0.4rem 0.6rem;
  backdrop-filter: blur(4px);
}

.weather-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Silkscreen', monospace;
  font-size: 0.75rem;
  color: var(--accent-gold);
}

.temporal-week-selector {
  display: flex;
  gap: 0.3rem;
}

.week-tab {
  background: var(--wood-dark);
  border: 1px solid var(--wood-light);
  color: var(--text-light);
  padding: 0.2rem 0.5rem;
  font-family: 'VT323', monospace;
  font-size: 1.05rem;
  cursor: pointer;
}

.week-tab.active, .week-tab:hover {
  background: var(--accent-teal);
  color: var(--wood-dark);
  font-weight: bold;
  border-color: #fff;
}

/* Celestial & Spore Layers */
.pixel-stars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 30px 40px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(3px 3px at 90px 120px, #ffe600, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 180px 50px, #00f0ff, rgba(0,0,0,0)),
    radial-gradient(3px 3px at 280px 190px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 380px 90px, #ff2a8d, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 220px 220px;
}

.cosmic-nebula-glow {
  position: absolute;
  top: 15%;
  left: 30%;
  width: 300px;
  height: 200px;
  background: radial-gradient(ellipse, rgba(192, 132, 252, 0.18), transparent 70%);
  pointer-events: none;
}

.warm-oasis-glow {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 250px;
  background: radial-gradient(ellipse at 50% 100%, rgba(80, 250, 123, 0.25), rgba(0, 240, 255, 0.15), transparent 75%);
  pointer-events: none;
  z-index: 3;
}

.floating-spores-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 40px 300px, #50fa7b, rgba(0,0,0,0)),
    radial-gradient(3px 3px at 140px 250px, #00f0ff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 280px 320px, #ff2a8d, rgba(0,0,0,0)),
    radial-gradient(3px 3px at 380px 280px, #ffe600, rgba(0,0,0,0));
  background-size: 160px 160px;
  animation: floatSpores 6s linear infinite;
  pointer-events: none;
  z-index: 3;
}

@keyframes floatSpores {
  0% { transform: translateY(0); opacity: 0.4; }
  50% { opacity: 0.9; }
  100% { transform: translateY(-40px); opacity: 0.4; }
}

/* Falling Leaves Layer (Inactivity / Leaf Loss Mechanic) */
.falling-leaves-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
  z-index: 6;
}

.falling-leaf {
  position: absolute;
  font-size: 1.2rem;
  opacity: 0.85;
  filter: sepia(0.9) hue-rotate(-20deg) saturate(1.8) brightness(0.9); /* dry brown/amber tone */
  animation: flutterDown 4s ease-in-out infinite;
}

.leaf-1 { top: -10%; left: 15%; animation-delay: 0s; animation-duration: 3.5s; }
.leaf-2 { top: -10%; left: 40%; animation-delay: 1.2s; animation-duration: 4.2s; }
.leaf-3 { top: -10%; left: 65%; animation-delay: 0.5s; animation-duration: 3.8s; }
.leaf-4 { top: -10%; left: 30%; animation-delay: 2.1s; animation-duration: 4.8s; }
.leaf-5 { top: -10%; left: 80%; animation-delay: 1.7s; animation-duration: 3.9s; }
.leaf-6 { top: -10%; left: 55%; animation-delay: 2.8s; animation-duration: 4.5s; }

@keyframes flutterDown {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0.9;
  }
  25% {
    transform: translateY(120px) translateX(25px) rotate(90deg);
  }
  50% {
    transform: translateY(240px) translateX(-20px) rotate(180deg);
  }
  75% {
    transform: translateY(360px) translateX(30px) rotate(270deg);
    opacity: 0.8;
  }
  100% {
    transform: translateY(500px) translateX(5px) rotate(360deg);
    opacity: 0.15;
  }
}

/* Scattered Ground Leaves on Moonscape */
.ground-leaves {
  position: absolute;
  bottom: 6%;
  left: 8%;
  right: 8%;
  height: 50px;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
}

.ground-leaf {
  font-size: 1.1rem;
  opacity: 0.8;
  filter: grayscale(0.5) sepia(0.8) brightness(0.7);
  animation: groundLeafSway 3s ease-in-out infinite alternate;
}

.g-leaf-1 { transform: rotate(-45deg); animation-delay: 0.2s; }
.g-leaf-2 { transform: rotate(20deg); animation-delay: 0.8s; }
.g-leaf-3 { transform: rotate(75deg); animation-delay: 1.5s; }
.g-leaf-4 { transform: rotate(-15deg); animation-delay: 0.4s; }
.g-leaf-5 { transform: rotate(40deg); animation-delay: 1.1s; }

@keyframes groundLeafSway {
  0% { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}

/* Cosmic Rain Layer */
.pixel-rain-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  background-image: radial-gradient(circle, rgba(0, 240, 255, 0.5) 2px, transparent 3px);
  background-size: 24px 24px;
  animation: cosmicRain 0.8s linear infinite;
  pointer-events: none;
  z-index: 2;
}

@keyframes cosmicRain {
  0% { background-position: 0 0; }
  100% { background-position: 12px 48px; }
}

/* Moon Canvas */
.pixel-moon-wrapper {
  position: absolute;
  top: 20%;
  right: 10%;
  width: 110px;
  height: 110px;
  z-index: 3;
}

.pixel-moon-halo {
  position: absolute;
  width: 130px;
  height: 130px;
  top: -10px;
  left: -10px;
  border-radius: 50%;
  background: var(--glow-color);
  filter: blur(14px);
}

.pixel-moon-canvas {
  width: 100%;
  height: 100%;
  filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.6));
}

/* Visiting Space Critters */
.critters-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
}

.critter {
  position: absolute;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.critter:hover {
  transform: scale(1.2) translateY(-4px);
}

.critter-speech-bubble {
  font-family: 'Silkscreen', monospace;
  font-size: 0.65rem;
  background: #1e1b4b;
  color: var(--accent-gold);
  border: 1px solid var(--accent-teal);
  padding: 0.15rem 0.4rem;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.6);
  margin-bottom: 0.2rem;
  white-space: nowrap;
}

.moon-bunny {
  bottom: 135px;
  left: 45px;
  animation: bunnyHop 3s infinite ease-in-out;
}

@keyframes bunnyHop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

.cosmic-bat {
  top: 110px;
  right: 80px;
  animation: batFlutter 6s infinite alternate ease-in-out;
}

@keyframes batFlutter {
  0% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-40px, -20px) scale(1.1) rotate(-8deg); }
  50% { transform: translate(-90px, -5px) scale(0.9) rotate(5deg); }
  75% { transform: translate(-150px, -25px) scale(1.05) rotate(-6deg); }
  100% { transform: translate(-220px, -5px) scale(1) rotate(0deg); }
}

.cosmic-manta {
  top: 75px;
  left: 20px;
  animation: mantaFloat 8s infinite alternate ease-in-out;
}

@keyframes mantaFloat {
  0% { transform: translate(0, 0); }
  100% { transform: translate(140px, -20px); }
}

/* Lunar Oasis Terrain & Glowing Moss Carpet */
.lunar-surface-container {
  width: 100%;
  height: 220px;
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 4;
}

.mountain-range-bg {
  position: absolute;
  top: -35px;
  left: 0;
  width: 100%;
  height: 55px;
  background: #180936;
  clip-path: polygon(0 100%, 15% 40%, 35% 75%, 55% 30%, 80% 65%, 100% 35%, 100% 100%);
  opacity: 0.8;
}

.lunar-crater-soil {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #1b382b, #0d1a15);
  border-top: 4px solid #10b981;
  clip-path: polygon(0 35%, 20% 25%, 45% 40%, 75% 20%, 100% 30%, 100% 100%, 0 100%);
  position: relative;
  transition: background 0.8s ease, border-color 0.8s ease;
}

.barren-mode .lunar-crater-soil {
  background: linear-gradient(180deg, #2c1654, #120726);
  border-top-color: #63339c;
}

.soil-bioluminescence-glow {
  position: absolute;
  top: 15%;
  left: 0;
  width: 100%;
  height: 16px;
  background: linear-gradient(90deg, transparent, rgba(80, 250, 123, 0.5), rgba(0, 240, 255, 0.5), transparent);
  filter: blur(5px);
}

.glowing-moss-carpet {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.moss-patch {
  position: absolute;
  background: radial-gradient(ellipse, rgba(80, 250, 123, 0.7), rgba(16, 185, 129, 0.4), transparent);
  border-radius: 50%;
  filter: blur(4px);
  animation: mossGlow 4s infinite alternate ease-in-out;
}

@keyframes mossGlow {
  0% { opacity: 0.6; }
  100% { opacity: 1; filter: blur(2px); }
}

.p1 { top: 20%; left: 15%; width: 120px; height: 35px; }
.p2 { top: 30%; left: 55%; width: 180px; height: 45px; }
.p3 { top: 15%; left: 75%; width: 100px; height: 30px; }

.pixel-flower, .pixel-shroom {
  position: absolute;
  font-size: 1.1rem;
  filter: drop-shadow(0 0 6px rgba(80, 250, 123, 0.8));
  animation: flowerSway 3s infinite alternate ease-in-out;
}

@keyframes flowerSway {
  0% { transform: translateY(0) rotate(-3deg); }
  100% { transform: translateY(-3px) rotate(3deg); }
}

.f1 { top: 28%; left: 22%; }
.f2 { top: 35%; left: 48%; }
.f3 { top: 25%; left: 68%; }
.f4 { top: 40%; left: 82%; }

.s1 { top: 32%; left: 35%; }
.s2 { top: 22%; left: 60%; }

/* Trees Layout */
.pixel-trees-grid {
  position: absolute;
  bottom: 25px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 0 1.2rem;
  z-index: 5;
  min-height: 110px;
}

.tree-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tree-item:hover {
  transform: scale(1.15) translateY(-4px);
}

.tree-item.thirsty-state {
  filter: grayscale(0.9) desaturate(100%) contrast(0.75) brightness(0.75);
  opacity: 0.7;
}

.tree-item.thirsty-state .tree-aura-glow {
  opacity: 0 !important;
}

.tree-item.thirsty-state .flower-patch {
  filter: grayscale(1) opacity(0.2) !important;
}

/* Thirsty Dry Moss Carpet */
.glowing-moss-carpet.thirsty-moss {
  filter: grayscale(0.95) desaturate(100%) contrast(0.7) brightness(0.6) !important;
  opacity: 0.25 !important;
}

.level-badge {
  position: absolute;
  top: -12px;
  background: var(--accent-magenta);
  color: #fff;
  border: 1px solid #fff;
  padding: 0.05rem 0.35rem;
  font-family: 'Silkscreen', monospace;
  font-size: 0.65rem;
  font-weight: bold;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.6);
  z-index: 10;
}

.tree-svg {
  width: 72px;
  height: 80px;
  filter: drop-shadow(3px 5px 0px rgba(0,0,0,0.7));
  transition: all 0.3s ease;
}

.tree-aura-glow {
  position: absolute;
  width: 80px;
  height: 80px;
  top: -10px;
  border-radius: 50%;
  filter: blur(14px);
  opacity: 0.65;
  transition: opacity 0.3s ease;
}

.purple-aura { background: rgba(192, 132, 252, 0.6); }
.pink-aura { background: rgba(255, 77, 141, 0.6); }
.cyan-aura { background: rgba(0, 240, 255, 0.6); }
.green-aura { background: rgba(80, 250, 123, 0.6); }

.mother-tree-svg {
  width: 100px;
  height: 110px;
}

@keyframes treeEvolve {
  0% { transform: scale(0.7) rotate(-5deg); filter: brightness(2); }
  50% { transform: scale(1.4) rotate(5deg); filter: brightness(3); }
  100% { transform: scale(1.15) rotate(0deg); filter: brightness(1); }
}

.tree-item.evolving {
  animation: treeEvolve 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tree-label {
  font-family: 'Silkscreen', monospace;
  font-size: 0.65rem;
  background: rgba(10, 5, 20, 0.85);
  color: var(--accent-gold);
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--wood-light);
  margin-top: 0.25rem;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.6);
}

/* Time Capsule Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-card {
  width: 90%;
  max-width: 530px;
  padding: 1.2rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed var(--paper-border);
  padding-bottom: 0.6rem;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-icon { font-size: 1.8rem; }

.modal-header h3 {
  font-family: 'Silkscreen', monospace;
  font-size: 0.9rem;
  color: var(--accent-gold);
}

.modal-subtext {
  font-size: 0.95rem;
  color: #fde68a;
}

.modal-close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
}

.modal-level-tabs {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.level-tab-btn {
  background: var(--wood-dark);
  border: 2px solid var(--wood-border);
  color: var(--text-light);
  padding: 0.25rem 0.6rem;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  cursor: pointer;
}

.level-tab-btn.active {
  background: var(--accent-gold);
  color: var(--wood-dark);
  font-weight: bold;
  border-color: #fff;
}

.time-capsule-box {
  background: var(--paper-bg);
  border: 3px solid var(--paper-border);
  padding: 0.8rem;
  color: var(--text-main);
  margin: 0.6rem 0;
}

.capsule-label {
  font-family: 'Silkscreen', monospace;
  font-size: 0.75rem;
  color: #783806;
}

.capsule-text {
  font-size: 1.3rem;
  line-height: 1.3;
  margin: 0.4rem 0;
  color: #3b220c;
}

.capsule-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  color: #783806;
}

.sentiment-pill {
  background: #fef08a;
  border: 1px solid #ca8a04;
  padding: 0.1rem 0.4rem;
  font-size: 0.85rem;
}

.tree-health-status {
  margin-top: 0.6rem;
  font-size: 1rem;
  color: var(--accent-teal);
}

.water-action-btn {
  width: 100%;
  background: #0284c7;
  color: #fff;
  padding: 0.6rem;
  font-family: 'Silkscreen', monospace;
  font-size: 0.75rem;
  cursor: pointer;
  border: 2px solid var(--wood-border);
}

/* Codex Bottom Bar */
.history-footer {
  padding: 0.6rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.history-header h3 {
  font-family: 'Silkscreen', monospace;
  font-size: 0.8rem;
  color: var(--accent-gold);
}

.history-subtext {
  font-size: 1rem;
  color: #fde68a;
}

.codex-chips {
  display: flex;
  gap: 0.4rem;
}

.codex-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--wood-dark);
  border: 2px solid var(--wood-border);
  padding: 0.3rem 0.6rem;
  font-size: 0.95rem;
  color: var(--text-light);
}

.codex-chip.active {
  border-color: var(--accent-teal);
  color: var(--accent-gold);
}

.codex-chip.locked {
  opacity: 0.5;
}
