:root {
  color-scheme: dark;
  --mg-ink: #f4fbff;
  --mg-muted: #bad4df;
  --mg-cyan: #57f0df;
  --mg-gold: #ffd875;
  --mg-deep: #061525;
  --mg-panel: rgba(10, 35, 55, 0.94);
  --mg-line: rgba(117, 221, 222, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: #04101e;
}

body.mg-page {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--mg-ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(23, 151, 154, 0.19), transparent 28rem),
    radial-gradient(circle at 88% 18%, rgba(39, 87, 151, 0.2), transparent 31rem),
    linear-gradient(155deg, #06182a 0%, #071323 48%, #040d1a 100%);
  line-height: 1.5;
}

button,
a { font: inherit; }

a { color: #88fff2; }

button { color: inherit; }

.mg-skip-link {
  position: absolute;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #071525;
  background: #fff;
  transform: translateY(-180%);
}

.mg-skip-link:focus-visible { transform: translateY(0); }

.mg-site-header {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 20px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.mg-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--mg-ink);
  text-decoration: none;
}

.mg-brand-mark {
  width: 42px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(114, 239, 225, 0.58);
  border-radius: 50%;
  color: #7ff9eb;
  background: rgba(32, 133, 142, 0.26);
  font-weight: 900;
}

.mg-brand span:last-child { display: grid; }
.mg-brand small { color: var(--mg-muted); }

.mg-site-header nav { display: flex; gap: 10px; }
.mg-site-header nav a {
  padding: 9px 13px;
  border: 1px solid rgba(146, 202, 222, 0.24);
  border-radius: 999px;
  color: var(--mg-ink);
  background: rgba(10, 28, 48, 0.76);
  text-decoration: none;
}

main { padding: 20px 18px 40px; }

.mg-game-section,
.mg-info-grid,
.mg-details,
.mg-footer {
  width: min(1120px, 100%);
  margin-inline: auto;
}

.mg-game-card {
  overflow: hidden;
  border: 1px solid var(--mg-line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(14, 43, 65, 0.97), rgba(6, 24, 42, 0.98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.mg-toolbar {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(111, 208, 213, 0.2);
  background: rgba(3, 18, 32, 0.55);
}

.mg-team-label,
.mg-toolbar-actions,
.mg-tool-button,
.mg-progress { display: flex; align-items: center; }

.mg-team-label { gap: 10px; }
.mg-team-label > span:last-child { display: grid; }
.mg-team-label small { color: var(--mg-muted); }
.mg-team-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #58efd5;
  box-shadow: 0 0 0 5px rgba(88, 239, 213, 0.11), 0 0 17px rgba(88, 239, 213, 0.6);
}

.mg-toolbar-actions { gap: 9px; }
.mg-tool-button {
  min-height: 44px;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid rgba(143, 219, 225, 0.3);
  border-radius: 13px;
  color: var(--mg-ink);
  background: rgba(17, 49, 72, 0.9);
  cursor: pointer;
  font-weight: 800;
}

.mg-tool-button:hover { border-color: rgba(116, 244, 229, 0.72); }
.mg-tool-button-warm {
  color: #1d1704;
  border-color: #ffe08a;
  background: linear-gradient(135deg, #ffdc70, #f4b53a);
}

.mg-tool-button:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 3px;
}

.mg-dig-spot:focus-visible {
  outline: 0;
}

.mg-intro {
  padding: clamp(18px, 3vw, 30px) clamp(18px, 3.4vw, 38px) 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
}

.mg-eyebrow {
  margin: 0 0 4px;
  color: #7ff9eb;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mg-intro h1 {
  margin: 0;
  color: #fff7d6;
  font-size: clamp(2rem, 4.1vw, 3.75rem);
  line-height: 1;
  text-wrap: balance;
}

.mg-intro p:last-child {
  max-width: 820px;
  margin: 14px 0 0;
  color: #d5e8ee;
  font-size: clamp(0.98rem, 1.35vw, 1.12rem);
}

.mg-progress {
  flex: 0 0 auto;
  min-width: 265px;
  gap: 13px;
  padding: 11px 16px;
  border: 1px solid rgba(255, 216, 117, 0.34);
  border-radius: 18px;
  background: rgba(3, 18, 31, 0.66);
}

.mg-progress img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 7px 10px rgba(0, 0, 0, 0.35));
}

.mg-progress span { display: grid; }
.mg-progress strong { color: var(--mg-gold); font-size: 1.85rem; line-height: 1; }
.mg-progress small { color: var(--mg-muted); }
.mg-progress b { color: #fff7d6; }

.mg-notice {
  margin: 0 clamp(18px, 3.4vw, 38px) 14px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 210, 91, 0.38);
  border-radius: 14px;
  color: #fff0b8;
  background: rgba(88, 58, 7, 0.27);
}

.mg-beach-frame {
  width: min(1040px, calc(150dvh - 345px), calc(100% - 24px));
  margin: 0 auto;
  padding: clamp(5px, 0.8vw, 11px);
  border: 1px solid rgba(119, 235, 223, 0.46);
  border-radius: clamp(16px, 2.2vw, 28px);
  background: linear-gradient(145deg, rgba(99, 246, 226, 0.2), rgba(6, 19, 34, 0.8));
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.36);
}

.mg-beach {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: clamp(12px, 1.7vw, 21px);
  isolation: isolate;
  background: linear-gradient(#3aafc6 0 34%, #e8ba70 35% 100%);
}

.mg-beach-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.mg-beach.has-image-error::after {
  content: "Das Strandbild konnte nicht geladen werden. Die Grabstellen bleiben bedienbar.";
  position: absolute;
  z-index: 1;
  inset: 20px;
  display: grid;
  place-items: center;
  padding: 20px;
  color: #08202a;
  background: rgba(255, 245, 205, 0.86);
  border-radius: 18px;
  text-align: center;
  font-weight: 800;
}

.mg-dig-spot {
  --spot-width: clamp(44px, 11%, 190px);
  --spot-ratio: 1.55;
  position: absolute;
  z-index: 3;
  left: var(--x);
  top: var(--y);
  width: clamp(44px, var(--spot-width), 190px);
  min-width: 44px;
  min-height: 44px;
  aspect-ratio: var(--spot-ratio) / 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  appearance: none;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: default;
  touch-action: manipulation;
}

.mg-dig-spot::before {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 6%;
  border: 3px solid transparent;
  border-radius: 50%;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.mg-dig-spot:focus-visible::before {
  border-color: rgba(255, 255, 255, 0.96);
  background: rgba(71, 247, 225, 0.12);
  box-shadow: 0 0 0 6px rgba(33, 218, 202, 0.16), 0 0 22px rgba(255, 245, 176, 0.48);
}

.mg-dig-spot.is-locked,
.mg-dig-spot:disabled {
  cursor: default;
}

@media (hover: hover) and (pointer: fine) {
  .mg-beach:not(.is-locked),
  .mg-dig-spot:not(.is-locked):not(.is-dug):not(.is-digging):not(:disabled) {
    cursor: url("assets/muschelgraben-schaufel.svg") 9 55, pointer;
  }

  .mg-dig-spot:not(.is-locked):not(.is-dug):not(.is-digging):not(:disabled):hover::before {
    border-color: rgba(255, 255, 255, 0.92);
    background: rgba(71, 247, 225, 0.11);
    box-shadow: 0 0 0 7px rgba(33, 218, 202, 0.16), 0 0 24px rgba(255, 245, 176, 0.5);
  }
}

.mg-shovel {
  position: absolute;
  z-index: 8;
  left: 53%;
  top: 44%;
  width: clamp(34px, 38%, 66px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-20%, -90%) rotate(-24deg) scale(0.85);
  transform-origin: 50% 85%;
}

.mg-shovel img { display: block; width: 100%; height: auto; }
.mg-dig-spot.is-digging .mg-shovel { animation: mg-dig 620ms cubic-bezier(0.24, 0.76, 0.29, 1) both; }

.mg-reveal {
  position: absolute;
  z-index: 5;
  inset: -18%;
  pointer-events: none;
}

.mg-hole,
.mg-shell {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  object-fit: contain;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.28);
}

.mg-hole {
  width: 116%;
  height: 100%;
  filter: drop-shadow(0 7px 8px rgba(65, 30, 5, 0.35));
}

.mg-shell {
  z-index: 2;
  top: 44%;
  width: 45%;
  height: 64%;
  filter: drop-shadow(0 8px 7px rgba(46, 20, 3, 0.56));
}

.mg-dig-spot.is-dug .mg-hole {
  animation: mg-hole-appear 430ms ease-out both;
}

.mg-dig-spot.is-dug .mg-shell {
  animation: mg-shell-rise 650ms 110ms cubic-bezier(0.2, 0.8, 0.24, 1.18) both;
}

.mg-sparkle,
.mg-sparkle::before,
.mg-sparkle::after {
  position: absolute;
  z-index: 4;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff7bd;
  box-shadow: 0 0 10px 3px rgba(255, 224, 113, 0.78);
  opacity: 0;
}

.mg-sparkle { left: 64%; top: 19%; }
.mg-sparkle::before,
.mg-sparkle::after { content: ""; }
.mg-sparkle::before { left: -38px; top: 7px; }
.mg-sparkle::after { left: -12px; top: -16px; }
.mg-dig-spot.is-dug .mg-sparkle { animation: mg-sparkle 780ms 230ms ease-out both; }

.mg-dig-spot.is-empty .mg-shell,
.mg-dig-spot.is-empty .mg-sparkle {
  display: none;
}

.mg-dig-spot.is-restored .mg-hole,
.mg-dig-spot.is-restored .mg-shell {
  animation: none !important;
  opacity: 1;
}

.mg-dig-spot.is-restored .mg-hole {
  transform: translate(-50%, -50%) scale(1);
}

.mg-dig-spot.is-restored .mg-shell {
  transform: translate(-50%, -52%) scale(1);
}

.mg-reward-badge {
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: -23%;
  min-width: 52px;
  padding: 5px 9px;
  border: 2px solid rgba(255, 245, 194, 0.9);
  border-radius: 999px;
  color: #153448;
  background: linear-gradient(135deg, #fff4ad, #ffc74c);
  box-shadow: 0 7px 18px rgba(30, 16, 0, 0.42);
  font-size: clamp(0.72rem, 1.25vw, 0.92rem);
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
  transform: translateX(-50%);
}

.mg-dig-spot.is-empty .mg-reward-badge {
  color: #eaf7ff;
  border-color: rgba(196, 224, 236, 0.75);
  background: rgba(20, 47, 66, 0.94);
}

.mg-status {
  min-height: 30px;
  margin: 14px 22px 18px;
  color: #e6f7f9;
  text-align: center;
  font-size: clamp(1rem, 1.5vw, 1.16rem);
  font-weight: 750;
}

.mg-status.is-complete { color: #ffe08a; }
.mg-noscript {
  margin: 0 22px 24px;
  padding: 12px;
  border-radius: 12px;
  color: #230c0c;
  background: #ffb4b4;
  text-align: center;
}

.mg-info-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.mg-info-grid article {
  display: flex;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(107, 204, 211, 0.22);
  border-radius: 18px;
  background: rgba(9, 30, 50, 0.74);
}

.mg-info-grid article > span { color: #ffd875; font-size: 1.7rem; }
.mg-info-grid h2 { margin: 0 0 3px; color: #fff7d6; font-size: 1.08rem; }
.mg-info-grid p { margin: 0; color: var(--mg-muted); }

.mg-details {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.mg-details > div {
  padding: 22px;
  border: 1px solid rgba(107, 204, 211, 0.22);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(10, 35, 55, 0.82), rgba(5, 22, 38, 0.86));
}

.mg-details h2 {
  margin: 0 0 8px;
  color: #fff7d6;
  font-size: 1.18rem;
}

.mg-details p {
  margin: 0;
  color: var(--mg-muted);
}

.mg-details .mg-eyebrow {
  margin-bottom: 5px;
  color: #7ff9eb;
}

.mg-footer {
  padding: 10px 18px 34px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--mg-muted);
}

@keyframes mg-dig {
  0% { opacity: 0; transform: translate(30%, -115%) rotate(-30deg) scale(0.82); }
  18% { opacity: 1; }
  43% { opacity: 1; transform: translate(-18%, -50%) rotate(12deg) scale(1); }
  65% { opacity: 1; transform: translate(2%, -86%) rotate(-22deg) scale(0.95); }
  88% { opacity: 1; transform: translate(-28%, -44%) rotate(15deg) scale(1); }
  100% { opacity: 0; transform: translate(-12%, -30%) rotate(18deg) scale(0.9); }
}

@keyframes mg-hole-appear {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.32); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes mg-shell-rise {
  0% { opacity: 0; transform: translate(-50%, -22%) scale(0.25) rotate(-12deg); }
  70% { opacity: 1; transform: translate(-50%, -58%) scale(1.12) rotate(4deg); }
  100% { opacity: 1; transform: translate(-50%, -52%) scale(1) rotate(0); }
}

@keyframes mg-sparkle {
  0% { opacity: 0; transform: scale(0.2); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-12px) scale(1.2); }
}

@media (max-width: 760px) {
  .mg-site-header,
  .mg-toolbar,
  .mg-intro,
  .mg-footer { align-items: stretch; flex-direction: column; }
  .mg-site-header nav,
  .mg-toolbar-actions { width: 100%; }
  .mg-site-header nav a,
  .mg-toolbar-actions .mg-tool-button { flex: 1; justify-content: center; }
  .mg-intro { gap: 18px; }
  .mg-progress { width: 100%; justify-content: center; }
  .mg-info-grid,
  .mg-details { grid-template-columns: 1fr; }
  .mg-footer { gap: 0; }
  .mg-footer p { margin: 5px 0; }
}

@media (max-width: 480px) {
  main { padding-inline: 7px; }
  .mg-game-card { border-radius: 18px; }
  .mg-toolbar { padding: 12px; }
  .mg-tool-button { padding-inline: 10px; }
  .mg-intro { padding: 19px 15px 15px; }
  .mg-notice { margin: 0 12px 14px; }
  .mg-beach-frame { margin-inline: 4px; }
  .mg-status { margin-inline: 12px; }
  .mg-progress img { width: 44px; height: 44px; }
}

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

.mg-page.is-embed .mg-skip-link,
.mg-page.is-embed .mg-site-header,
.mg-page.is-embed .mg-info-grid,
.mg-page.is-embed .mg-details,
.mg-page.is-embed .mg-footer { display: none; }

.mg-page.is-embed main { padding: 0; }
.mg-page.is-embed { min-height: 0; }
.mg-page.is-embed .mg-game-section { width: min(1000px, 100%); }
.mg-page.is-embed .mg-game-card { border-radius: 18px; box-shadow: none; }
.mg-page.is-embed .mg-toolbar { padding: 10px 14px; }
.mg-page.is-embed .mg-intro { padding: 14px 20px 12px; gap: 18px; }
.mg-page.is-embed .mg-intro h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.mg-page.is-embed .mg-intro p:last-child { margin-top: 8px; }
.mg-page.is-embed .mg-progress { padding: 8px 13px; }
.mg-page.is-embed .mg-progress img { width: 42px; height: 42px; }
.mg-page.is-embed .mg-progress strong { font-size: 1.55rem; }
.mg-page.is-embed .mg-notice { margin: 0 20px 10px; padding: 8px 12px; }
.mg-page.is-embed .mg-beach-frame {
  width: min(960px, calc(150dvh - 315px), calc(100% - 24px));
  padding: 6px;
}
.mg-page.is-embed .mg-status { margin: 10px 16px 13px; }
