/* Main menu, styled after Jungle Pong: cartoon ink outlines, hard drop shadows, cream card. */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@600;700;800;900&display=swap');

.menu {
  --ink: #10261d;
  --lime: #b6f046;
  --yellow: #ffe92e;
  --cream: #fffbea;
  --display: 'Lilita One', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif;
  position: fixed; inset: 0; z-index: 2;
  font-family: Nunito, 'Segoe UI', sans-serif; color: var(--ink);
}
.menu button, .menu input { font: inherit; color: inherit; }
.menu button:focus-visible, .menu input:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; }

.menu-vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 60% 55%, transparent 50%, #0e3a1c66); }

/* Foreground leaves framing the screen; clicks pass through. */
.foliage { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.leaves { position: absolute; width: min(30vw, 380px); height: auto; filter: drop-shadow(0 6px 10px #0b3a1a55); animation: sway 7s ease-in-out infinite alternate; will-change: rotate; }
.leaves.bl { left: -3%; bottom: -6%; transform-origin: 0 100%; }
.leaves.br { right: -3%; bottom: -6%; transform-origin: 100% 100%; animation-duration: 8s; }
.leaves.tl { left: -4%; top: -8%; width: min(22vw, 280px); transform-origin: 0 0; animation-duration: 9s; }
.leaves.tr { right: -4%; top: -8%; width: min(22vw, 280px); transform-origin: 100% 0; animation-duration: 10s; }
@keyframes sway { from { rotate: -1.5deg; } to { rotate: 2deg; } }

/* Header: round sound button */
.menu-header { position: absolute; top: 18px; right: 18px; display: flex; gap: 10px; align-items: center; z-index: 3; }
.pill {
  display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px;
  background: #fff; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink);
  font-weight: 900; font-size: 16px;
}
.menu .icon {
  width: 52px; height: 52px; border-radius: 50%; background: #fff; border: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink); display: grid; place-items: center; padding: 0;
}
.menu .icon:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.menu .icon svg { width: 26px; height: 26px; fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.menu .icon svg path:first-child { fill: var(--ink); }
#menu-sound .slash { display: none; }
#menu-sound.off .slash { display: inline; }
#menu-sound.off .wave { display: none; }

/* Left column */
.menu-col { position: absolute; left: 6%; top: 50%; transform: translateY(-50%); width: 380px; z-index: 2; }

.menu .logo {
  margin: 0 0 18px; font: 400 76px/.9 var(--display); letter-spacing: 1px; transform: rotate(-4deg);
  -webkit-text-stroke: 9px var(--ink); paint-order: stroke fill; text-shadow: 0 7px 0 var(--ink);
}
.menu .logo span { display: block; color: var(--yellow); }
.menu .logo span + span { color: var(--lime); margin-left: 58px; }

.menu .card {
  display: block; width: auto; padding: 18px; animation: none;
  background: var(--cream); border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 8px 0 var(--ink);
}

.menu .card-title {
  margin: 16px 0 10px; font: 400 24px var(--display); color: #fff;
  -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink);
}

.field-label { display: block; font-weight: 900; font-size: 14px; margin: 0 0 8px; }
.name-row { display: flex; gap: 8px; }
.name-row input {
  flex: 1; min-width: 0; height: 52px; padding: 0 14px; background: #fff; border: 3px solid var(--ink); border-radius: 14px;
  font-weight: 900; font-size: 18px;
}
.name-row input::placeholder { color: #8a9a88; font-weight: 700; }
#dice {
  width: 52px; flex: none; background: var(--yellow); border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink); font-size: 22px; padding: 0;
}
#dice:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

.color-row { display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.color-row > span { font-weight: 900; font-size: 14px; }
#skin-options { display: flex; flex-wrap: wrap; gap: 8px; }
.skin {
  width: 34px; height: 34px; border-radius: 50%; padding: 0; border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  background: radial-gradient(circle at 35% 30%, #ffffff88 0 10%, var(--head) 38%);
  position: relative; transition: transform .1s;
}
.skin::after { content: ''; position: absolute; left: 4px; right: 4px; bottom: 5px; height: 5px; border-radius: 3px; background: var(--band); }
.skin[aria-pressed="true"] { outline: 3px solid var(--yellow); outline-offset: 2px; transform: translateY(-2px); }

/* Level grid: numbered squares with stars, like Parking School's lessons. */
.levels-head { display: flex; align-items: center; gap: 8px; margin: 16px 0 10px; }
.levels-head .card-title { margin: 0; flex: 1; }
.page-label { font-weight: 900; font-size: 13px; color: #4f6650; }
.page-btn {
  width: 38px; height: 34px; padding: 0; border-radius: 10px; background: #fff; border: 3px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink); font-size: 14px; line-height: 1;
}
.page-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.page-btn:disabled { opacity: .35; cursor: not-allowed; }
.levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.levels button {
  aspect-ratio: 1; padding: 0; background: #fff; border: 3px solid var(--ink); border-radius: 12px;
  box-shadow: 0 4px 0 var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  transition: transform .08s, box-shadow .08s;
}
.levels button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.levels button b { font: 400 22px/1 var(--display); }
.levels button small { font-size: 11px; letter-spacing: -1px; color: #c9cdd6; }
.levels button small i { font-style: normal; color: #ffb400; }
.levels button.selected { background: var(--yellow); }
.levels button:disabled { background: #d9dde5; color: #8a91a0; border-color: #8a91a0; box-shadow: 0 4px 0 #8a91a0; cursor: not-allowed; }
.levels button:disabled b { font-size: 17px; }
.level-name { margin: 10px 0 0; font-weight: 900; font-size: 14px; color: #3f5a45; }
.level-name b { color: var(--ink); }

/* Play button presses down into its shadow. */
.menu .mbtn {
  display: block; width: 100%; margin-top: 18px; padding: 15px 18px;
  font: 400 22px/1 var(--display); letter-spacing: .5px;
  border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 6px 0 var(--ink); background: var(--lime);
  transition: transform .08s, box-shadow .08s, background .15s;
}
.menu .mbtn:hover:not(:disabled) { background: #c8ff5c; }
.menu .mbtn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.menu .mbtn:disabled { background: #e8eed5; color: #8a9a88; cursor: not-allowed; }

.welcome-note { font-weight: 800; font-size: 14px; color: #3f5a45; margin: 14px 0 0; }
.welcome-note b { color: var(--ink); }
.welcome-note:empty { display: none; }
.how { font-size: 14px; font-weight: 700; line-height: 1.45; color: #3f5a45; margin: 10px 0 0; }

#player-label { font-size: 13px; color: #ffe92e; }

@media (max-width: 760px) {
  .menu-header { top: 12px; right: 12px; }
  .menu .icon { width: 46px; height: 46px; }
  .menu-col { left: 16px; right: 16px; width: auto; top: auto; bottom: 20px; transform: none; }
  .menu .logo { font-size: 58px; margin-bottom: 12px; }
  .menu .logo span + span { margin-left: 44px; }
  .menu .card { padding: 14px; }
  .how { font-size: 13px; }
  .menu .card-title { font-size: 20px; }
  .levels-head { margin: 12px 0 8px; }
  .levels button b { font-size: 19px; }
  .leaves { width: 38vw; }
  .leaves.tl, .leaves.tr { width: 28vw; }
}
@media (max-height: 680px) {
  .menu-col { top: 12px; bottom: 12px; transform: none; overflow-y: auto; padding: 4px 4px 12px; }
  .menu .logo { font-size: 52px; }
  .how { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .leaves { animation: none; }
}

/* Phones: keep the menu clear of notches and the home bar. */
.menu-header { top: calc(18px + env(safe-area-inset-top, 0px)); right: calc(18px + env(safe-area-inset-right, 0px)); }
@media (max-width: 760px) {
  .menu-header { top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); }
  .menu-col { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); max-height: calc(100% - 76px - env(safe-area-inset-top, 0px)); overflow-y: auto; }
  .pill { height: 40px; padding: 0 12px; }
}
@media (max-height: 680px) {
  .menu-col { left: calc(12px + env(safe-area-inset-left, 0px)); }
}
/* Phones held sideways: drop the logo and tighten the card so Play stays on screen. */
@media (max-height: 450px) {
  .menu-col { top: calc(8px + env(safe-area-inset-top, 0px)); bottom: 8px; }
  .menu .logo { display: none; }
  .menu .card { padding: 10px 14px; border-radius: 18px; }
  .name-row input, #dice { height: 42px; }
  .levels-head { margin: 8px 0 6px; }
  .levels button { aspect-ratio: 1.35; }
  .color-row { margin-top: 10px; }
  .menu .mbtn { margin-top: 10px; padding: 11px 18px; }
  .welcome-note { display: none; }
}
