:root {
  --ember: #C65A24;
  --charcoal: #11100E;
  --ash: #050505;
  --clay: #8A3F22;
  --sand: #F1D6A8;
  --sage: #78845A;
  --milk: #FFF4D6;
  --phase-glow: rgba(198, 90, 36, 0.42);
  --phase-soil: rgba(138, 63, 34, 0.22);
  --zoom: 0.92;
  --drift: 0px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: #050505; color: #F1D6A8; }

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

.day-shell {
  position: relative;
  min-height: 400vh;
  background:
    radial-gradient(circle at 50% 34%, var(--phase-glow), transparent 26rem),
    radial-gradient(circle at 50% 86%, var(--phase-soil), transparent 34rem),
    linear-gradient(180deg, #050505 0%, #11100E 38%, #11100E 74%, #050505 100%);
  transition: background 900ms ease;
}

.day-shell[data-theme="midday"] { --phase-glow: rgba(198, 90, 36, 0.66); --phase-soil: rgba(241, 214, 168, 0.09); }
.day-shell[data-theme="dusk"] { --phase-glow: rgba(138, 63, 34, 0.58); --phase-soil: rgba(120, 132, 90, 0.18); }
.day-shell[data-theme="star"] { --phase-glow: rgba(255, 244, 214, 0.16); --phase-soil: rgba(198, 90, 36, 0.10); }

.skyfield {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255, 244, 214, 0.55) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 14%, rgba(241, 214, 168, 0.38) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 71%, rgba(198, 90, 36, 0.32) 0 1px, transparent 2px),
    radial-gradient(circle at 31% 78%, rgba(120, 132, 90, 0.36) 0 1px, transparent 2px);
  filter: saturate(0.9);
}

.skyfield::before {
  content: "* .  `  .    +     .  *    .   `   .    +   .";
  position: absolute;
  inset: 10% 4% auto;
  color: rgba(241, 214, 168, 0.17);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: clamp(12px, 2vw, 22px);
  letter-spacing: 1.6vw;
  transform: translateY(calc(var(--drift) * -0.34));
}

.dust { position: absolute; inset: -20%; opacity: 0.28; mix-blend-mode: screen; }
.dust-a { background-image: radial-gradient(rgba(198,90,36,0.55) 0 1px, transparent 1.5px); background-size: 37px 41px; transform: translateY(calc(var(--drift) * -0.15)); }
.dust-b { background-image: radial-gradient(rgba(255,244,214,0.28) 0 1px, transparent 1.5px); background-size: 91px 71px; transform: translateY(calc(var(--drift) * 0.22)); }

.horizon { position: absolute; left: -8%; right: -8%; height: 1px; background: rgba(198, 90, 36, 0.48); transform: rotate(-1deg); }
.horizon-one { top: 68%; box-shadow: 0 0 24px rgba(198,90,36,0.22); }
.horizon-two { top: 72%; background: rgba(120, 132, 90, 0.24); transform: rotate(1.2deg); }

.zoom-rings {
  position: fixed;
  left: 50%; top: 50%;
  width: min(86vw, 920px); aspect-ratio: 1;
  border: 1px solid rgba(198, 90, 36, 0.18);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(calc(var(--zoom) * 1.1));
  box-shadow: inset 0 0 0 58px rgba(198,90,36,0.025), 0 0 0 110px rgba(198,90,36,0.035), 0 0 80px rgba(198,90,36,0.16);
  transition: transform 260ms ease-out;
}

.coordinate-grid {
  position: fixed;
  inset: 8vh 7vw auto;
  display: flex;
  justify-content: space-between;
  color: rgba(241, 214, 168, 0.32);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.grass-bed { position: fixed; left: 0; right: 0; bottom: -2vh; height: 23vh; opacity: 0.62; transform: translateY(calc(var(--drift) * 0.11)); }
.grass-bed i { position: absolute; bottom: 0; width: 2px; background: linear-gradient(#78845A, transparent); transform-origin: bottom; border-radius: 100% 100% 0 0; }
.grass-bed i:nth-child(1){left:7%;height:34%;transform:rotate(-8deg)} .grass-bed i:nth-child(2){left:15%;height:62%;transform:rotate(5deg)} .grass-bed i:nth-child(3){left:24%;height:42%;transform:rotate(-15deg)} .grass-bed i:nth-child(4){left:32%;height:75%;transform:rotate(8deg)} .grass-bed i:nth-child(5){left:43%;height:38%;transform:rotate(-5deg)} .grass-bed i:nth-child(6){left:49%;height:88%;transform:rotate(3deg)} .grass-bed i:nth-child(7){left:57%;height:54%;transform:rotate(-12deg)} .grass-bed i:nth-child(8){left:64%;height:72%;transform:rotate(10deg)} .grass-bed i:nth-child(9){left:71%;height:44%;transform:rotate(-4deg)} .grass-bed i:nth-child(10){left:79%;height:81%;transform:rotate(12deg)} .grass-bed i:nth-child(11){left:86%;height:48%;transform:rotate(-10deg)} .grass-bed i:nth-child(12){left:94%;height:67%;transform:rotate(6deg)}

.moth { position: fixed; color: rgba(241, 214, 168, 0.45); font-family: "IBM Plex Mono", monospace; font-size: 22px; opacity: 0; transition: opacity 600ms ease, transform 600ms ease; }
.moth-one { left: 16vw; top: 54vh; transform: translateY(30px) rotate(-8deg); }
.moth-two { right: 13vw; top: 43vh; transform: translateY(-20px) rotate(12deg); }
.day-shell[data-theme="dusk"] .moth, .day-shell[data-theme="star"] .moth { opacity: 0.8; transform: translateY(0) rotate(0); }

.constellation { position: fixed; right: 5vw; top: 8vh; width: min(42vw, 420px); opacity: 0; transition: opacity 900ms ease; }
.constellation circle { fill: #FFF4D6; filter: drop-shadow(0 0 6px #FFF4D6); }
.star-line { fill: none; stroke: #C65A24; stroke-width: 1.2; stroke-dasharray: 880; stroke-dashoffset: 880; transition: stroke-dashoffset 1600ms ease; }
.day-shell[data-theme="star"] .constellation { opacity: 0.86; }
.day-shell[data-theme="star"] .star-line { stroke-dashoffset: 0; }

.terminal-aperture {
  position: sticky;
  top: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  perspective: 1200px;
}

.terminal-frame {
  width: min(760px, 92vw);
  min-height: min(780px, 84vh);
  border: 1px solid rgba(241, 214, 168, 0.16);
  background:
    linear-gradient(180deg, rgba(17,16,14,0.94), rgba(5,5,5,0.96)),
    repeating-linear-gradient(0deg, rgba(198,90,36,0.04) 0 1px, transparent 1px 5px);
  box-shadow: 0 0 0 1px rgba(198,90,36,0.14), 0 34px 100px rgba(5,5,5,0.82), inset 0 0 80px rgba(198,90,36,0.06);
  transform: scale(var(--zoom));
  transition: transform 220ms ease-out, width 700ms ease, border-color 700ms ease;
  position: relative;
  overflow: hidden;
}

.day-shell[data-theme="star"] .terminal-frame { width: min(590px, 88vw); border-color: rgba(255, 244, 214, 0.28); }
.terminal-frame::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 28%, rgba(198,90,36,0.13), transparent 34%), linear-gradient(90deg, rgba(255,255,255,0.025), transparent 8%, transparent 92%, rgba(255,255,255,0.025)); pointer-events: none; }
.terminal-frame::after { content: "[ )"; position: absolute; right: 24px; top: 58px; color: rgba(255, 244, 214, 0.20); font-family: "IBM Plex Mono", monospace; font-size: 28px; opacity: 0; transition: opacity 700ms ease; }
.day-shell[data-theme="star"] .terminal-frame::after { opacity: 1; }

.terminal-topline, .terminal-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 22px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: rgba(241, 214, 168, 0.72);
  border-bottom: 1px solid rgba(241, 214, 168, 0.11);
}

.terminal-footer { border-bottom: 0; border-top: 1px solid rgba(241, 214, 168, 0.11); justify-content: space-between; color: rgba(120, 132, 90, 0.92); }
.signal-dot { width: 8px; height: 8px; border-radius: 2px; background: #C65A24; box-shadow: 0 0 18px #C65A24; }
.ember-cursor { width: 10px; height: 18px; display: inline-block; background: #C65A24; box-shadow: 0 0 18px #C65A24; animation: blink 900ms steps(2, end) infinite; vertical-align: -3px; }
.phase-readout { margin-left: auto; color: #FFF4D6; opacity: 0.58; text-transform: uppercase; }

.day-core { position: relative; z-index: 1; min-height: calc(min(780px, 84vh) - 108px); padding: clamp(30px, 6vw, 72px); display: grid; align-items: center; }
.phase { grid-area: 1 / 1; opacity: 0; transform: scale(0.94) translateY(24px); filter: blur(6px); pointer-events: none; transition: opacity 620ms ease, transform 620ms ease, filter 620ms ease; }
.phase.active { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); pointer-events: auto; }
.command { margin: 0 0 22px; color: #C65A24; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: clamp(12px, 1.8vw, 14px); letter-spacing: 0.04em; }
h1, h2 { margin: 0; font-family: "Bebas Neue", Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif; font-size: clamp(82px, 16vw, 172px); line-height: 0.78; letter-spacing: 0.015em; color: #F1D6A8; text-transform: uppercase; text-shadow: 0 0 34px rgba(198,90,36,0.32); }
h1 span, h2 span { display: block; opacity: 0.92; }
h1 span:nth-child(2), h2 span:nth-child(2) { color: #C65A24; opacity: 0.82; transform: translateX(0.06em); }
.field-note { max-width: 520px; margin: 28px 0 24px; color: rgba(241, 214, 168, 0.82); font-size: clamp(16px, 2.5vw, 19px); line-height: 1.6; }
.log-lines { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 13px; color: rgba(241, 214, 168, 0.68); }
.log-lines li { position: relative; padding: 12px 12px 12px 22px; border-left: 1px solid rgba(198, 90, 36, 0.42); background: rgba(17, 16, 14, 0.52); transition: transform 260ms ease, color 260ms ease, background 260ms ease, box-shadow 260ms ease; cursor: crosshair; }
.log-lines li::before { content: ""; position: absolute; left: -4px; top: 18px; width: 7px; height: 7px; background: #78845A; border-radius: 50%; box-shadow: 0 0 12px rgba(120,132,90,0.72); }
.log-lines li:hover { transform: scale(1.035) translateX(8px); color: #FFF4D6; background: rgba(138, 63, 34, 0.28); box-shadow: 0 0 32px rgba(198,90,36,0.13); }
.detail-panel { max-width: 300px; text-align: right; color: #F1D6A8; }

.day-shell[data-theme="dusk"] .terminal-frame { box-shadow: 0 0 0 1px rgba(138,63,34,0.42), 0 34px 100px rgba(5,5,5,0.82), inset 0 0 90px rgba(120,132,90,0.07); }
.day-shell[data-theme="dusk"] .day-core::before { content: ""; position: absolute; left: -15%; top: 58%; width: 130%; height: 3px; background: #8A3F22; opacity: 0.5; transform: rotate(-7deg); }
.day-shell[data-theme="midday"] .zoom-rings { box-shadow: inset 0 0 0 58px rgba(198,90,36,0.055), 0 0 0 110px rgba(198,90,36,0.07), 0 0 120px rgba(198,90,36,0.26); }

@keyframes blink { 0%, 44% { opacity: 1; transform: scaleX(1); } 45%, 100% { opacity: 0.16; transform: scaleX(0.72); } }

@media (max-width: 720px) {
  .coordinate-grid { inset: 5vh 5vw auto; flex-wrap: wrap; gap: 12px; }
  .terminal-aperture { padding: 14px; }
  .terminal-topline, .terminal-footer { padding: 0 14px; font-size: 10px; }
  .terminal-footer { align-items: flex-start; flex-direction: column; padding-block: 12px; }
  .day-core { padding: 32px 20px; }
  .constellation { width: 70vw; right: -18vw; }
}
