/* Moon Garden game */
.mg { position: relative; max-width: 760px; margin: 0 auto; }
.mg-top { display: flex; align-items: center; gap: 12px 22px; flex-wrap: wrap; margin-bottom: 14px; }
.mg-stat { display: flex; align-items: baseline; gap: 8px; }
.mg-k { font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; color: var(--moon-dim); }
.mg-stat b { font: 500 1.9rem/1 var(--display); font-variation-settings: "SOFT" 100, "WONK" 1; color: var(--glow); min-width: 1.2ch; }
.mg-of { color: var(--moon-dim); font-size: .95rem; }
.mg-dots { display: flex; gap: 5px; margin-left: 6px; align-self: center; }
.mg-dots i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid rgba(244, 238, 223, .35); transition: transform .3s, background .3s; }
.mg-dots i.on { border-color: transparent; transform: scale(1.15); }
.mg-bar { width: 90px; height: 6px; border-radius: 3px; background: rgba(244, 238, 223, .15); overflow: hidden; align-self: center; }
.mg-bar i { display: block; height: 100%; background: var(--glow); transform-origin: left; }
.mg-hurry .mg-clock b { color: #ff9b7a; }
.mg-hurry .mg-bar i { background: #ff9b7a; }
.mg-sound { margin-left: auto; font: 600 .88rem var(--body); color: var(--moon); background: none; border: 1.5px solid var(--line); border-radius: 999px; padding: 10px 16px; min-height: 44px; cursor: pointer; }
.mg-sound[aria-pressed="false"] { color: var(--moon-dim); }

.mg-scene { position: relative; aspect-ratio: 3 / 2; border-radius: 28px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(244, 238, 223, .12); }
@media (max-width: 560px) { .mg-scene { aspect-ratio: 4 / 5; border-radius: 22px; } }
.mg-sky { position: absolute; inset: 0; width: 100%; height: 100%; }
.mg-plots { position: absolute; left: 3%; right: 3%; bottom: 4%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2%; }
.mg-plot { position: relative; padding: 34px 0 0; border: 0; background: none; cursor: pointer; border-radius: 20px; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.mg-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.mg-plot:focus-visible { outline: 3px solid var(--glow); outline-offset: 2px; }
.mg-plot:active svg { transform: scale(.97); }
.mg-plant { transform-box: view-box; transform-origin: 60px 126px; }
.mg-halo { opacity: 0; transition: opacity .4s; }
.is-ready .mg-halo { opacity: 1; }
.is-thirsty .mg-plant { filter: saturate(.45) brightness(.9); transform: rotate(-7deg) scale(.95); transition: transform .5s, filter .5s; }

.mg-cue { position: absolute; top: 0; left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px 7px 10px; border-radius: 999px; font: 700 .88rem/1 var(--body); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .25s; }
.mg-cue svg { width: 18px; height: 18px; }
.mg-cue.is-plant, .mg-cue.is-water, .mg-cue.is-harvest { opacity: 1; }
.mg-cue.is-plant { background: rgba(244, 238, 223, .16); color: var(--moon); border: 1.5px dashed rgba(244, 238, 223, .5); }
.mg-cue.is-water { background: #7cc4ea; color: #0b2a3a; box-shadow: 0 6px 18px rgba(124, 196, 234, .45); }
.mg-cue.is-harvest { background: var(--glow); color: var(--night); box-shadow: 0 6px 22px rgba(243, 211, 107, .55); }
@media (max-width: 560px) { .mg-plot { padding-top: 30px; } .mg-cue { font-size: .74rem; padding: 6px 9px 6px 7px; gap: 4px; } .mg-cue svg { width: 14px; height: 14px; } .mg-stat b { font-size: 1.5rem; } .mg-dots i { width: 9px; height: 9px; } .mg-bar { width: 60px; } }

.mg-fly { position: absolute; z-index: 5; width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255, 255, 255, .25), 0 0 18px rgba(243, 211, 107, .8); pointer-events: none; }
.mg-plot::after { content: ""; position: absolute; left: 50%; top: 62%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; opacity: 0; pointer-events: none; }
.fx-splash::after { border: 3px solid #7cc4ea; animation: mg-ring .6s ease-out; }
.fx-sparkle::after { border: 3px solid var(--glow); animation: mg-ring .6s ease-out; }

.mg-overlay { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 18px; background: rgba(7, 28, 22, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.mg-overlay[hidden] { display: none; }
.mg-card { width: min(100%, 420px); max-height: 100%; overflow: auto; background: var(--moon); color: var(--night); border-radius: 26px; padding: clamp(20px, 4vw, 32px); text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.mg-card h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0 0 12px; }
.mg-card p { margin: 0 0 16px; }
.mg-card .btn { background: var(--night); border-color: var(--night); color: var(--moon); }
.mg-card .btn-line { background: transparent; color: var(--night); }
.mg-how { list-style: none; padding: 0; margin: 4px 0 18px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.mg-how li { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px 8px 10px; border-radius: 999px; background: #fffaf0; border: 1.5px solid var(--ink-line, rgba(16, 54, 44, .15)); font-weight: 700; font-size: .95rem; }
.mg-how li svg { width: 20px; height: 20px; }
.mg-how li:nth-child(1) svg { color: #4f9a4a; }
.mg-how li:nth-child(2) svg { color: #3b97c9; }
.mg-how li:nth-child(3) svg { color: #c99a12; }
.mg-how li + li::before { content: "→"; margin: 0 4px 0 -2px; color: rgba(16, 54, 44, .45); font-weight: 400; }
.mg-code { display: flex; flex-direction: column; gap: 4px; margin: 0 auto 16px; padding: 14px 18px; border: 2px dashed var(--night); border-radius: 16px; max-width: 280px; }
.mg-code span { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: rgba(16, 54, 44, .7); }
.mg-code b { font: 600 1.6rem/1.1 var(--display); letter-spacing: .04em; }
.mg-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.mg-small { font-size: .9rem; color: rgba(16, 54, 44, .72); }
.mg-link { font: 600 .95rem var(--body); color: var(--night); background: none; border: 0; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; min-height: 44px; padding: 8px; }
@media (max-width: 560px) { .mg-card { padding: 18px 16px; border-radius: 20px; } .mg-card p { margin-bottom: 12px; font-size: .95rem; } .mg-card .btn { padding: 12px 20px; } .mg-how li { padding: 6px 10px 6px 8px; font-size: .85rem; } }

@media (prefers-reduced-motion: no-preference) {
  .mg-star { animation: mg-twinkle 3.4s ease-in-out infinite alternate; }
  .mg-flies circle { animation: mg-float 6s ease-in-out infinite alternate; }
  .mg-flies circle:nth-child(2) { animation-delay: -2s; }
  .mg-flies circle:nth-child(3) { animation-delay: -4s; }
  .is-seed .mg-plant { animation: mg-pop .5s cubic-bezier(.3, 1.6, .5, 1); }
  .is-grow .mg-plant { animation: mg-grow 2.2s cubic-bezier(.3, .8, .4, 1) both; }
  .is-ready .mg-plant { animation: mg-pop .5s cubic-bezier(.3, 1.6, .5, 1), mg-sway 3s ease-in-out .5s infinite alternate; }
  .mg-cue.is-water, .mg-cue.is-harvest { animation: mg-bob 1s ease-in-out infinite alternate; }
  .mg-cue.is-plant { animation: mg-breathe 1.6s ease-in-out infinite alternate; }
  .is-empty .mg-hole circle { animation: mg-bob-y 1.2s ease-in-out infinite alternate; }
  .mg-card { animation: mg-card-in .35s cubic-bezier(.3, 1.3, .5, 1); }
}
@keyframes mg-twinkle { from { opacity: .25; } to { opacity: 1; } }
@keyframes mg-float { from { transform: translate(0, 0); opacity: .3; } to { transform: translate(18px, -14px); opacity: 1; } }
@keyframes mg-pop { from { transform: scale(.2); } }
@keyframes mg-grow { from { transform: scale(.55); } to { transform: scale(1); } }
@keyframes mg-sway { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }
@keyframes mg-bob { from { transform: translate(-50%, 0); } to { transform: translate(-50%, -6px); } }
@keyframes mg-breathe { from { opacity: .55; } to { opacity: 1; } }
@keyframes mg-bob-y { from { transform: translateY(0); } to { transform: translateY(-3px); } }
@keyframes mg-ring { 0% { opacity: .9; transform: scale(.4); } 100% { opacity: 0; transform: scale(3.2); } }
@keyframes mg-card-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.mg-form { display: grid; gap: 12px; text-align: left; }
.mg-form input[type="email"] { width: 100%; box-sizing: border-box; font: 1rem var(--body); padding: 14px 16px; border-radius: 14px; border: 2px solid rgba(16, 54, 44, .25); background: #fffaf0; color: var(--night); min-height: 48px; }
.mg-form input[type="email"]:focus { outline: none; border-color: var(--night); }
.mg-form input[aria-invalid="true"] { border-color: #a3321f; }
.mg-check { display: flex; align-items: center; gap: 10px; font-size: .92rem; cursor: pointer; }
.mg-check input { width: 20px; height: 20px; accent-color: var(--night); flex: none; }
.mg-err { margin: 0; color: #a3321f; font-size: .9rem; font-weight: 600; }
.mg-err[hidden] { display: none; }
.mg-form .btn { justify-self: center; }
.mg-form .mg-small { margin: 0; text-align: center; }
.mg-scene { width: 100%; min-height: 520px; }
.mg-card { max-height: none; }
.mg-form { gap: 10px; }
@media (max-width: 560px) { .mg-scene { min-height: 500px; } }
