:root {
  color-scheme: light;
  --bg: #f6f1e8;
  --paper: #fffaf2;
  --panel: rgba(255, 250, 242, 0.86);
  --panel-strong: rgba(255, 250, 242, 0.94);
  --line: rgba(42, 36, 30, 0.13);
  --text: #26221d;
  --muted: #726a61;
  --soft: #e8dfd2;
  --sun: #c76f2f;
  --earth: #457078;
  --moon: #ece6dc;
  --accent: #8b4b2b;
  --active: #2f5860;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  overflow-x: hidden;
  background:
    linear-gradient(115deg, rgba(255, 250, 242, 0.94), rgba(246, 241, 232, 0.7)),
    radial-gradient(circle at 18% 0%, rgba(199, 111, 47, 0.12), transparent 28rem),
    linear-gradient(180deg, #f8f3eb 0%, #eee5d8 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(42, 36, 30, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 36, 30, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 78%);
  opacity: 0.75;
}

@keyframes panel-drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(0, -4px, 0);
  }
}

@keyframes moon-breathe {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.045);
  }
}

@keyframes shimmer-sweep {
  0% {
    transform: translateX(-140%) rotate(14deg);
  }

  100% {
    transform: translateX(240%) rotate(14deg);
  }
}

@keyframes range-glow {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(47, 88, 96, 0);
  }

  50% {
    box-shadow: 0 0 18px rgba(47, 88, 96, 0.2);
  }
}

.shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 36px;
}

.hero {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-rows: auto minmax(430px, 1fr) auto;
  gap: 14px;
}

.topbar,
.orbit-panel,
.dashboard,
.timeline-panel,
.planner-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(67, 54, 38, 0.08);
  backdrop-filter: blur(16px);
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  animation: panel-drift 8s ease-in-out infinite;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 650;
  text-decoration: none;
}

.brand span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, #fffaf2 0 17%, #e9e1d5 18% 44%, #958a7b 45% 100%);
  box-shadow: inset -8px 0 10px rgba(38, 34, 29, 0.24), 0 8px 18px rgba(67, 54, 38, 0.12);
  animation: moon-breathe 5.8s ease-in-out infinite;
}

.topbar-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 0;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.time {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  text-align: right;
}

.language-toggle,
.site-version {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 7px;
  border: 1px solid rgba(42, 36, 30, 0.1);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.5);
  color: rgba(114, 106, 97, 0.78);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
}

.language-toggle {
  cursor: pointer;
  background: rgba(255, 250, 242, 0.78);
  color: var(--active);
}

.language-toggle:hover {
  background: rgba(255, 255, 255, 0.94);
}

.stage-wrap {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 250, 242, 0.94), transparent 18rem),
    linear-gradient(135deg, rgba(255, 250, 242, 0.72), rgba(232, 223, 210, 0.44));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.78), 0 22px 70px rgba(67, 54, 38, 0.1);
}

.stage-wrap::after {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 18%;
  pointer-events: none;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 250, 242, 0.24), transparent);
  opacity: 0.72;
  animation: shimmer-sweep 9s ease-in-out infinite;
}

.space {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 430px;
  cursor: grab;
}

.control-panel {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  width: min(620px, calc(100% - 36px));
  display: grid;
  grid-template-columns: auto auto minmax(170px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.88);
  box-shadow: 0 18px 46px rgba(67, 54, 38, 0.13);
  backdrop-filter: blur(14px);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.icon-button,
.speed-button,
.live-button {
  min-height: 38px;
  border: 1px solid rgba(42, 36, 30, 0.16);
  border-radius: 7px;
  background: rgba(255, 250, 242, 0.78);
  color: var(--text);
  font-weight: 750;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.icon-button:hover,
.speed-button:hover,
.live-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.94);
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
}

.speed-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(44px, 1fr));
  gap: 6px;
}

.speed-button {
  padding: 0 9px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.speed-button.is-active,
.live-button.is-active {
  border-color: rgba(47, 88, 96, 0.5);
  background: var(--active);
  color: #fffaf2;
}

.date-scrubber {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(58px, auto) minmax(90px, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.date-scrubber span {
  white-space: nowrap;
}

.date-scrubber input {
  width: 100%;
  accent-color: var(--active);
  animation: range-glow 5s ease-in-out infinite;
}

.live-button {
  padding: 0 13px;
}

.phase-card {
  position: absolute;
  right: 22px;
  bottom: 22px;
  width: min(450px, calc(100% - 44px));
  display: grid;
  grid-template-columns: 104px 1fr;
  align-items: center;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 24px 70px rgba(67, 54, 38, 0.16);
  animation: panel-drift 7s ease-in-out infinite;
}

.phase-visual {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: #eee7dc;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(42, 36, 30, 0.08);
}

.moon-disc {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  display: block;
  background: #302a25;
  box-shadow: 0 18px 42px rgba(67, 54, 38, 0.16);
  animation: moon-breathe 6.5s ease-in-out infinite;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 4vw, 3.45rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.phase-card h1 {
  min-height: 1em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-detail {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--line);
  animation: panel-drift 9s ease-in-out infinite;
}

.metric {
  min-height: 100px;
  padding: 18px;
  background: rgba(255, 250, 242, 0.72);
  transition: background-color 180ms ease, transform 180ms ease;
}

.metric:hover {
  background: rgba(255, 250, 242, 0.92);
  transform: translateY(-2px);
}

.metric strong {
  transition: color 180ms ease, transform 180ms ease;
}

.metric.is-updated strong {
  color: var(--active);
  transform: translateY(-1px);
}

.metric-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.metric strong {
  display: block;
  font-size: clamp(1.1rem, 2vw, 1.7rem);
  font-weight: 650;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.timeline-panel {
  padding: 18px;
  border-radius: 8px;
  animation: panel-drift 11s ease-in-out infinite;
}

.timeline-head {
  display: grid;
  grid-template-columns: minmax(190px, auto) minmax(220px, 1fr);
  align-items: end;
  gap: 18px;
  margin-bottom: 16px;
}

.timeline-head h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
}

.cycle-rail {
  min-width: 0;
}

.cycle-track {
  position: relative;
  display: block;
  height: 12px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #302a25 0%, #eee7dc 50%, #302a25 100%);
  box-shadow: inset 0 0 0 1px rgba(42, 36, 30, 0.16);
}

.cycle-dot,
.cycle-track b {
  position: absolute;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.cycle-dot {
  width: 8px;
  height: 8px;
  background: rgba(255, 250, 242, 0.94);
  box-shadow: 0 0 0 1px rgba(42, 36, 30, 0.2);
}

.cycle-new {
  left: 0%;
}

.cycle-quarter {
  left: 25%;
}

.cycle-full {
  left: 50%;
}

.cycle-last {
  left: 75%;
}

.cycle-track b {
  left: calc(var(--cycle-progress, 0) * 100%);
  width: 18px;
  height: 18px;
  border: 3px solid var(--active);
  background: #fffaf2;
  box-shadow: 0 8px 20px rgba(47, 88, 96, 0.24);
  transition: left 220ms ease;
}

.phase-timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.timeline-item {
  min-height: 112px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  padding: 14px;
  background: rgba(255, 250, 242, 0.72);
}

.timeline-item strong,
.timeline-item time,
.timeline-item span {
  display: block;
}

.timeline-item strong {
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 750;
  line-height: 1.15;
  white-space: nowrap;
}

.timeline-item time {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.timeline-item span {
  color: var(--active);
  font-size: 0.8rem;
  font-weight: 800;
}

.planner-panel {
  display: grid;
  grid-template-columns: minmax(250px, 0.78fr) minmax(0, 1.22fr);
  align-items: stretch;
  gap: 1px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--line);
  animation: panel-drift 12s ease-in-out infinite;
}

.planner-head,
.planner-grid article {
  background: rgba(255, 250, 242, 0.76);
}

.planner-head {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 18px;
  padding: 18px;
}

.planner-head h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: 0;
}

.moonlight-meter {
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(42, 36, 30, 0.14);
}

.moonlight-meter span {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--moonlight-level, 0) * 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, #2f5860, #c76f2f);
  transition: width 220ms ease;
}

.planner-grid {
  display: grid;
  grid-template-columns: minmax(120px, 0.82fr) minmax(220px, 1.36fr) minmax(150px, 1fr);
  gap: 1px;
}

.planner-grid article {
  min-height: 108px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  padding: 18px;
}

.planner-grid span {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.planner-grid strong {
  display: block;
  color: var(--text);
  font-size: clamp(1rem, 1.3vw, 1.24rem);
  font-weight: 750;
  line-height: 1.18;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.orbit-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 22px;
  padding: 24px;
  border-radius: 8px;
  animation: panel-drift 10s ease-in-out infinite;
}

.orbit-panel h2 {
  max-width: 640px;
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 3vw, 2.45rem);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: 0;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-weight: 650;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend b {
  font: inherit;
}

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  animation: moon-breathe 4.6s ease-in-out infinite;
}

.sun-dot {
  background: var(--sun);
}

.earth-dot {
  background: var(--earth);
}

.moon-dot {
  background: var(--moon);
}

@media (max-width: 980px) {
  .planner-panel {
    grid-template-columns: 1fr;
  }

  .planner-head {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.46fr);
    grid-template-rows: auto;
    align-items: end;
  }

  .planner-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
  }

  .hero {
    min-height: auto;
    grid-template-rows: auto 540px auto;
    gap: 10px;
  }

  .topbar {
    position: relative;
    align-items: flex-start;
    flex-direction: column;
    padding-right: 156px;
  }

  .brand {
    max-width: min(190px, calc(100vw - 190px));
  }

  .topbar-meta {
    justify-items: start;
  }

  .topbar-actions {
    position: absolute;
    top: 12px;
    right: 12px;
  }

  .stage-wrap,
  .space {
    min-height: 540px;
  }

  .control-panel {
    top: 12px;
    left: 12px;
    width: calc(100% - 24px);
    grid-template-columns: auto 1fr auto;
  }

  .speed-group {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .date-scrubber {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .phase-card {
    right: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
    grid-template-columns: 84px 1fr;
    gap: 14px;
    padding: 14px;
  }

  .phase-visual {
    width: 84px;
    height: 84px;
  }

  .moon-disc {
    width: 68px;
    height: 68px;
  }

  h1 {
    font-size: clamp(1.25rem, 6.2vw, 1.85rem);
  }

  .dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .phase-timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .planner-grid {
    grid-template-columns: 1fr;
  }

  .planner-head {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    align-items: stretch;
  }

  .metric {
    min-height: 88px;
    padding: 14px;
  }

  .orbit-panel {
    align-items: flex-start;
    flex-direction: column;
    margin-top: 10px;
    padding: 18px;
  }

  .legend {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .stage-wrap::after {
    display: none;
  }
}
