@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Raleway:wght@300;400;600&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #0b0e2d 0%, #05071a 42%, #020310 100%);
  color: #c8cee0;
  font-family: 'Raleway', sans-serif;
  overflow-x: hidden;
}
button { font: inherit; }
#stars-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.container { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 40px 20px 60px; }
header { text-align: center; margin-bottom: 42px; }
header h1 {
  font-family: 'Cinzel', serif; font-size: 2.8rem; font-weight: 700;
  color: #e8e6f0; letter-spacing: 4px; text-transform: uppercase;
  text-shadow: 0 0 30px rgba(180, 180, 255, 0.3);
}
header .subtitle { margin-top: 8px; font-size: 1rem; color: #7a7fa0; letter-spacing: 2px; }
.moon-hero { display: flex; flex-direction: column; align-items: center; margin-bottom: 46px; text-align: center; }
.moon-visual { width: 360px; height: 360px; position: relative; margin-bottom: 22px; }
#moon-canvas { position: absolute; inset: 0; width: 360px; height: 360px; }
.phase-name {
  font-family: 'Cinzel', serif; font-size: 2.2rem; color: #e0deed;
  text-shadow: 0 0 20px rgba(190, 190, 255, 0.4); margin-bottom: 8px;
}
.illumination { font-size: 1.3rem; color: #aab0cd; margin-bottom: 6px; }
.age-info { font-size: 0.95rem; color: #6b7094; letter-spacing: 1px; }
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px; margin-bottom: 54px;
}
.observer-section {
  margin-bottom: 54px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
}
.observer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.observer-header h2, .observer-panel h3 {
  font-family: 'Cinzel', serif;
  color: #d7dcf2;
  letter-spacing: 1px;
}
.observer-header h2 { font-size: 1.3rem; }
.observer-header button {
  background: rgba(140, 160, 255, 0.14);
  border: 1px solid rgba(160, 178, 255, 0.32);
  color: #d7dcf2;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
.observer-location {
  color: #98a3c7;
  margin-bottom: 14px;
  font-size: 0.9rem;
}
.observer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.observer-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(5, 10, 28, 0.35);
}
.observer-card .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7380aa;
}
.observer-card .value {
  margin-top: 4px;
  color: #d7dcf2;
  font-size: 0.95rem;
}
.observer-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.observer-panel {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  background: rgba(5, 10, 28, 0.28);
}
.observer-panel h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.observer-panel ul {
  margin: 0 0 12px 18px;
  color: #aeb9dd;
  line-height: 1.4;
}
.countdowns { display: grid; gap: 6px; margin-bottom: 12px; }
.count-item {
  display: flex;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 6px 8px;
  color: #cfd6ee;
  font-size: 0.86rem;
}
.astro-links {
  display: grid;
  gap: 6px;
}
.astro-links a {
  color: #bad0ff;
  text-decoration: none;
}
.astro-links a:hover { text-decoration: underline; }
.stat-card {
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px; padding: 22px; text-align: center; transition: transform 0.3s, box-shadow 0.3s;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(100, 110, 200, 0.15);
  border-color: rgba(255, 255, 255, 0.1);
}
.stat-card .icon { font-family: 'Cinzel', serif; font-size: 1rem; color: #aeb6d8; margin-bottom: 8px; }
.stat-card .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 2px; color: #6b7094; margin-bottom: 6px; }
.stat-card .value { font-family: 'Cinzel', serif; font-size: 1.05rem; color: #d4d2e8; line-height: 1.35; }
.calendar-section h2 {
  font-family: 'Cinzel', serif; font-size: 1.6rem; color: #d0cee4;
  text-align: center; margin-bottom: 30px; letter-spacing: 2px;
}
.month-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; }
.month-nav button, .modal-close {
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
  color: #c8cee0; padding: 8px 16px; border-radius: 8px; cursor: pointer;
  transition: all 0.2s;
}
.month-nav button:hover, .modal-close:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); }
.month-name { font-family: 'Cinzel', serif; font-size: 1.3rem; color: #d4d2e8; letter-spacing: 2px; text-align: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day-header {
  text-align: center; font-size: 0.7rem; color: #5a5f82;
  text-transform: uppercase; letter-spacing: 1px; padding: 8px 0; font-weight: 600;
}
.day-cell {
  min-height: 132px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 8px; background: rgba(255, 255, 255, 0.02); border: 1px solid transparent;
  cursor: pointer; transition: all 0.2s; position: relative; color: #9a9fbd; gap: 5px; padding: 8px 4px;
}
.day-cell:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(180, 190, 255, 0.2); }
.day-cell.today { border-color: rgba(140, 160, 255, 0.35); background: rgba(140, 160, 255, 0.08); color: #e0deed; font-weight: 600; }
.day-cell canvas { display: block; width: 70px; height: 70px; }
.day-number { font-size: 0.82rem; line-height: 1; }
.day-illumination { font-size: 0.66rem; color: #687093; line-height: 1; }
.event-chip {
  width: calc(100% - 8px); height: 17px; padding: 2px 5px; border-radius: 999px;
  background: rgba(190, 200, 255, 0.08); color: #aeb6d8; font-size: 0.55rem;
  letter-spacing: 0.5px; line-height: 13px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 0 0 17px;
}
.event-chip.empty {
  visibility: hidden;
}
.event-chip.eclipse { background: rgba(190, 75, 85, 0.22); color: #ffc8c8; }
.event-chip.apsis { background: rgba(120, 180, 255, 0.14); color: #c4d8ff; }
.event-chip.full { background: rgba(255, 255, 255, 0.12); color: #ffffff; }
.legend {
  display: flex; justify-content: center; gap: 22px; flex-wrap: wrap;
  margin-top: 30px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: #7a7fa0; }
.legend-dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.legend-dot.new { background: #161a2b; }
.legend-dot.quarter { background: linear-gradient(to right, #161a2b 50%, #d8d6e6 50%); }
.legend-dot.full { background: #fff; }
.legend-dot.apsis { background: #79a9ff; }
.legend-dot.eclipse { background: #a13b45; }
footer {
  text-align: center; margin-top: 60px; padding-top: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.04); font-size: 0.8rem; color: #4a4f70; letter-spacing: 1px;
}
.moon-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(920px, calc(100vw - 28px)); border: 1px solid rgba(210, 220, 255, 0.2);
  background: #070a1c; color: #c8cee0; border-radius: 8px; padding: 24px;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.65);
  max-height: min(760px, calc(100vh - 28px));
  overflow: auto;
}
.moon-modal::backdrop { background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(3px); }
.modal-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; padding: 0; font-size: 1.4rem; }
.modal-layout { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 28px; align-items: center; }
#modalMoon { width: 100%; height: auto; }
.detail-title {
  font-family: 'Cinzel', serif; color: #e0deed; font-size: 1.45rem;
  letter-spacing: 1px; margin-bottom: 6px;
}
.detail-subtitle { color: #8d94b4; margin-bottom: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; }
.detail-item { border-left: 1px solid rgba(180, 190, 255, 0.16); padding-left: 12px; }
.detail-label { color: #687093; font-size: 0.68rem; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 4px; }
.detail-value { color: #d4d2e8; font-size: 0.95rem; }
.event-list { margin-top: 16px; color: #aeb6d8; font-size: 0.9rem; line-height: 1.5; }
.moon-notes p { margin: 0 0 11px; }
.moon-notes strong { color: #e0deed; font-weight: 600; }
.precision-note { margin-top: 16px; color: #59607e; font-size: 0.75rem; line-height: 1.45; }
@media (max-width: 760px) {
  .container { padding: 30px 12px 50px; }
  header h1 { font-size: 1.8rem; }
  header .subtitle { font-size: 0.82rem; }
  .moon-visual { width: 240px; height: 240px; }
  #moon-canvas { width: 240px; height: 240px; }
  .phase-name { font-size: 1.55rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .observer-columns { grid-template-columns: 1fr; }
  .observer-header { flex-direction: column; align-items: flex-start; }
  .stat-card { padding: 16px 10px; }
  .calendar-grid { gap: 3px; }
  .day-cell { min-height: 86px; padding: 5px 1px; }
  .day-cell canvas { width: 40px; height: 40px; }
  .day-illumination { display: none; }
  .event-chip { font-size: 0.48rem; padding: 1px 4px; }
  .modal-layout { grid-template-columns: 1fr; }
  #modalMoon { width: min(230px, 80vw); justify-self: center; }
}
