:root{
  --bg0:#0b0f17;
  --stroke: rgba(255,255,255,0.10);
  --txt: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.65);
  --teal: rgba(34,198,198,.95);
}

body{ margin:0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial; background: radial-gradient(1200px 700px at 50% -10%, rgba(120,180,255,.18), transparent 55%), radial-gradient(900px 520px at 115% 15%, rgba(180,120,255,.12), transparent 55%), var(--bg0); color: var(--txt); }

.wrap{ min-height:100vh; display:flex; flex-direction:column; }

.top{
  padding:22px 24px;
  display:flex; justify-content:space-between; align-items:flex-end; gap:18px; flex-wrap:wrap;
}

h1{ margin:0; font-size:20px; letter-spacing:.2px; }
.sub{ color:var(--muted); font-size:13px; margin-top:6px; max-width: 78ch; line-height:1.4; }

.pills{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.pill{ text-decoration:none; color:var(--txt); background: rgba(255,255,255,.06); border:1px solid var(--stroke); padding:8px 12px; border-radius:999px; font-weight:800; font-size:13px; }
.pill:hover{ background: rgba(255,255,255,.09); }

.grid{
  flex:1;
  display:grid;
  grid-template-columns: 1fr 1fr;
  /* Let corners grow to fit expanded menus (not locked to 4 equal quadrants) */
  grid-template-rows: auto auto;
  gap: 14px;
  padding: 14px;
  overflow: visible;
}

.menuBox{
  position:relative;
  border-radius: 22px;
  border:1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.02));
  /* Allow the expanded menu panel to render outside the card bounds */
  overflow: visible;
  min-height: 240px;
}

/* Bring the active corner above its neighbors so the open menu isn't clipped */
.menuBox.open{ z-index: 6; }

.inner{ position:relative; padding:18px; display:flex; flex-direction:column; overflow: visible; }

.tag{ font-weight:900; font-size:12px; letter-spacing:.3px; color: rgba(255,255,255,.78); }
.title{ font-weight:1000; font-size:20px; margin-top:6px; }
.desc{ color:var(--muted); line-height:1.45; margin-top:8px; font-size:13px; max-width: 62ch; }

.headRow{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:12px; flex-wrap:wrap; }

.mBtn{
  display:inline-flex; align-items:center; gap:8px;
  cursor:pointer; user-select:none;
  color: rgba(231,231,231,.92);

  /* Style #1 (winner): rounded-rect outline */
  border-radius: 10px;
  border:1px solid rgba(255,255,255,.22);
  background: rgba(0,0,0,.18);

  /* tighter */
  padding:5px 8px;
  font-weight:950;
  font-size:13px;
  line-height:1;
}
/* Add underline accent (from prior bottom-right option) */
.mBtn span{ border-bottom: 2px solid rgba(34,198,198,.55); padding-bottom: 2px; }
.mBtn:hover{ background: rgba(0,0,0,.26); border-color: rgba(34,198,198,.40); }
.mBtn:hover span{ border-bottom-color: rgba(34,198,198,.85); }
.mBtn small{ color: rgba(231,231,231,.72); font-weight:900; }

.mPanel{
  margin-top: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.14);
  background: #0a0f1e;
  overflow:hidden;
  /* keep the panel width aligned to its container (no extra wide dead space) */
  width: 100%;

  opacity:0;
  pointer-events:none;
}

.menuBox.open .mPanel{ opacity: 1; pointer-events:auto; }

.mHead{ padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.10); display:flex; justify-content:space-between; align-items:center; }
.mHead .hint{ color: rgba(255,255,255,.60); font-size:12px; }

.mGrid{
  padding: 12px;
  display:grid;
  /* Responsive: more columns when there is room, but never huge empty buttons */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap:8px;
}
@media (max-width: 520px){ .mGrid{ grid-template-columns: 1fr; } }

.mItem{
  display:flex; gap:10px; align-items:center;
  /* Keep all buttons same size, but tighter */
  min-height: 38px;
  padding:8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  text-decoration:none;
  color: rgba(232,238,252,.92);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}
.mItem:hover{ transform: translateY(-1px); background: rgba(255,255,255,0.06); border-color: rgba(34,198,198,.35); }
.dot{ width:8px; height:8px; border-radius:999px; background: rgba(34,198,198,.75); box-shadow: 0 0 0 3px rgba(34,198,198,.12); flex:0 0 auto; }
.lbl{ font-weight: 850; letter-spacing:.2px; font-size: 13px; }

/* === Menu 1: Magnetic Grid expansion (scale+fade+glow) === */
.menu1 .mPanel{
  transform: translateY(-6px) scale(.985);
  transition: opacity 170ms ease, transform 170ms ease;
  background: radial-gradient(520px 240px at var(--mx, 30%) var(--my, 20%), rgba(120,180,255,.22), rgba(10,14,28,.86) 58%);
}
.menu1.open .mPanel{ transform: translateY(0) scale(1); }

/* === Menu 2: Slide-down rail (height reveal) === */
.menu2 .mPanel{
  max-height: 0;
  transform: translateY(-2px);
  transition: max-height 220ms cubic-bezier(.2,.9,.2,1), opacity 160ms ease;
}
.menu2.open .mPanel{ max-height: 380px; }

/* === Menu 3: Ripple reveal (clip-path) === */
.menu3 .mPanel{
  clip-path: circle(0% at 85% 10%);
  transition: clip-path 320ms cubic-bezier(.2,1,.2,1), opacity 120ms ease;
}
.menu3.open .mPanel{ clip-path: circle(140% at 85% 10%); }

/* === Menu 4: Spring pop (overshoot) === */
.menu4 .mPanel{
  transform: translateY(-8px) scale(.92);
  transition: opacity 150ms ease;
}
.menu4.open .mPanel{ animation: pop 320ms cubic-bezier(.2,1.25,.2,1) both; }
@keyframes pop{
  0%{ transform: translateY(-8px) scale(.92); }
  70%{ transform: translateY(0) scale(1.02); }
  100%{ transform: translateY(0) scale(1); }
}

@media (max-width: 980px){
  .grid{ grid-template-columns: 1fr; grid-template-rows: auto; }
}
