.moon-app { max-width: 1180px; margin: 0 auto; overflow: hidden; background: #fff; }
.tool-heading, .tool-heading > div { min-width: 0; }
.tool-heading h1, .tool-heading > div:first-child > p:last-child { overflow-wrap: anywhere; }
.moon-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(360px, .88fr); min-height: 620px; }
.moon-stage { display: flex; min-width: 0; align-items: center; flex-direction: column; justify-content: center; padding: clamp(28px, 5vw, 56px); overflow: hidden; color: #f6f1df; background: radial-gradient(circle at 50% 38%, #24354a 0, #101b2b 43%, #07101d 78%, #040a12 100%); text-align: center; }
.night-sky { position: relative; width: min(100%, 490px); aspect-ratio: 1; display: grid; place-items: center; }
.night-sky::before, .night-sky::after { position: absolute; inset: 0; border-radius: 50%; content: ""; background-image: radial-gradient(circle, #fff 0 1px, transparent 1.4px), radial-gradient(circle, #bad8ff 0 1px, transparent 1.5px); background-position: 17px 31px, 73px 111px; background-size: 93px 89px, 141px 127px; opacity: .32; }
.night-sky::after { transform: rotate(23deg) scale(.88); opacity: .18; }
.moon-halo { position: absolute; width: 82%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(255,247,210,.22), rgba(170,202,237,.08) 45%, transparent 70%); filter: blur(9px); }
[data-moon-canvas] { position: relative; z-index: 2; display: block; width: 82%; height: 82%; filter: drop-shadow(0 0 23px rgba(238,241,220,.28)); transition: opacity .18s ease; }
.star { position: absolute; z-index: 1; width: 3px; height: 3px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px #bcd9ff; }
.star-a { top: 13%; left: 15%; }
.star-b { top: 24%; right: 12%; width: 2px; height: 2px; }
.star-c { right: 19%; bottom: 20%; }
.star-d { bottom: 12%; left: 23%; width: 2px; height: 2px; }
.moon-date-label { margin-top: 6px; color: #aebed0; font-size: .82rem; font-weight: 750; letter-spacing: .06em; }
.moon-stage h2 { margin-top: 7px; font-size: clamp(1.7rem, 4vw, 2.45rem); letter-spacing: .02em; }
.phase-note { margin-top: 7px; color: #c9d4df; font-size: .9rem; }
.moon-controls { min-width: 0; padding: clamp(24px, 4vw, 40px); border-left: 1px solid #dce5e2; background: #fbfdfc; }
.jst-badge { padding: 6px 10px; border-radius: 999px; background: #e7f4ef; color: #176b5b; font-size: .72rem; font-weight: 850; }
.date-picker-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) 70px; align-items: end; gap: 9px; margin-top: 24px; }
.date-picker-row > button, .today-button, .share-buttons button, .share-buttons a { min-height: 48px; border: 1px solid #c5d6d1; border-radius: 12px; background: #fff; color: #176b5b; font: inherit; font-size: .78rem; font-weight: 850; cursor: pointer; }
.date-picker-row label { display: grid; min-width: 0; gap: 6px; color: #29453f; font-size: .76rem; font-weight: 800; }
.date-picker-row input { width: 100%; min-width: 0; min-height: 48px; padding: 8px 10px; border: 1px solid #bfd2cc; border-radius: 12px; background: #fff; color: #173a33; font: inherit; font-weight: 750; }
.today-button { width: 100%; margin-top: 10px; border-color: #176b5b; background: #176b5b; color: #fff; }
.moon-facts { display: grid; min-width: 0; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0 0; }
.moon-facts > div { min-width: 0; padding: 15px; border: 1px solid #dbe5e2; border-radius: 14px; background: #fff; }
.moon-facts dt { color: #6a7f79; font-size: .72rem; font-weight: 750; }
.moon-facts dd { display: flex; min-width: 0; align-items: baseline; gap: 3px; margin: 4px 0 0; color: #173d35; }
.moon-facts strong { min-width: 0; overflow-wrap: anywhere; font-size: 1.25rem; }
.moon-facts small { font-size: .72rem; }
.next-phases { display: grid; min-width: 0; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.next-phases article { min-width: 0; padding: 13px 14px; border-radius: 14px; background: #eaf5f2; color: #30534b; }
.next-phases span, .next-phases strong { display: block; }
.next-phases span { font-size: .7rem; }
.next-phases strong { margin-top: 2px; font-size: .95rem; }
.share-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid #dce6e3; }
.share-label { color: #29453f; font-size: .76rem; font-weight: 850; }
.share-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 9px; }
.share-buttons button, .share-buttons a { display: flex; min-width: 0; align-items: center; justify-content: center; gap: 7px; padding: 7px 9px; text-align: center; text-decoration: none; }
.share-buttons span { display: grid; place-items: center; flex: 0 0 auto; min-width: 24px; height: 24px; padding-inline: 4px; border-radius: 7px; background: #e7f4ef; color: #176b5b; font-size: .68rem; font-weight: 900; }
.share-buttons .share-line { border-color: #06c755; background: #06c755; color: #fff; }
.share-buttons .share-line span { background: #fff; color: #06a947; font-size: .52rem; }
.share-buttons .share-x { border-color: #151515; background: #151515; color: #fff; }
.share-buttons .share-x span { background: #fff; color: #151515; font-size: .88rem; }
.share-buttons .share-native { border-color: #176b5b; background: #176b5b; color: #fff; }
.share-buttons .share-native span { background: rgba(255,255,255,.18); color: #fff; font-size: .9rem; }
.share-native[hidden] ~ .share-copy { grid-column: 1 / -1; }
.share-section > p:last-child { min-height: 18px; margin: 7px 0 0; color: #55736c; font-size: .72rem; }
.calculation-note { margin-top: 17px; padding-top: 15px; border-top: 1px solid #dce6e3; color: #6c7f7b; font-size: .76rem; }
.nearby-section { padding: 24px clamp(20px, 4vw, 38px) 30px; border-top: 1px solid #dce5e2; background: #f8fbfa; }
.nearby-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.nearby-heading h2 { margin-top: 3px; font-size: 1.18rem; }
.nearby-heading > p { color: #6b7f7a; font-size: .78rem; }
.nearby-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 16px; }
.nearby-day { min-width: 0; min-height: 92px; padding: 9px 4px; border: 1px solid #d5e1dd; border-radius: 13px; background: #fff; color: #29473f; font: inherit; cursor: pointer; }
.nearby-day:hover, .nearby-day.is-selected { border-color: #176b5b; background: #e7f4ef; }
.nearby-day span, .nearby-day strong, .nearby-day small { display: block; }
.nearby-day span { color: #71837f; font-size: .68rem; }
.nearby-day strong { margin-top: 2px; font-size: 1.45rem; line-height: 1.3; }
.nearby-day small { font-size: .68rem; font-weight: 750; }
.moon-app button:focus-visible, .moon-app input:focus-visible, .moon-app a:focus-visible { outline: 3px solid rgba(35,130,111,.3); outline-offset: 2px; }

@media (max-width: 860px) {
  .moon-grid { grid-template-columns: minmax(0, 1fr); }
  .moon-stage { min-height: 520px; }
  .night-sky { width: min(88vw, 460px); }
  .moon-controls { border-top: 1px solid #dce5e2; border-left: 0; }
  .nearby-days { overflow-x: auto; grid-template-columns: repeat(7, minmax(76px, 1fr)); padding-bottom: 5px; scroll-snap-type: x proximity; }
  .nearby-day { scroll-snap-align: center; }
}

@media (max-width: 520px) {
  .moon-stage { min-height: 430px; padding: 24px 14px; }
  .night-sky { width: min(94vw, 380px); }
  [data-moon-canvas] { width: 86%; height: 86%; }
  .moon-controls { padding: 22px 16px; }
  .date-picker-row { grid-template-columns: 1fr 1fr; gap: 7px; }
  .date-picker-row label { grid-column: 1 / -1; grid-row: 1; }
  .date-picker-row > button:first-child { grid-column: 1; grid-row: 2; }
  .date-picker-row > button:last-child { grid-column: 2; grid-row: 2; }
  .date-picker-row > button { padding: 4px; font-size: .75rem; }
  .moon-facts { gap: 8px; }
  .moon-facts > div { padding: 13px 11px; }
  .moon-facts strong { font-size: 1.08rem; }
  .next-phases { gap: 8px; }
  .nearby-section { padding-inline: 16px; }
  .nearby-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
}

@media (max-width: 360px) {
  .share-buttons { grid-template-columns: 1fr; }
  .share-native[hidden] ~ .share-copy { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  [data-moon-canvas] { transition: none; }
}
