/* ==========================================================================
   Momentum Mayhem — Glass/Orbs Theme (harmonized with theme.css + glass.css)
   Safe to drop in: preserves existing IDs used by your JS.
   ========================================================================== */

/* ---- Page tokens -------------------------------------------------------- */
:root {
  --mm-max: 980px;                 /* max width for main app content */
  --mm-card-w: 680px;              /* max width for info + lists */
  --mm-game-aspect: 4 / 3;         /* keep your 800 x 600 feel */
  --mm-radius: 16px;               /* shared radius for containers */
  --mm-border: 6px;                /* game container rim */
  --header-h: var(--app-header-offset, 110px);
}

/* Smooth anchor/nav offset under sticky header */
html { scroll-padding-top: calc(var(--header-h) + 12px); }



main.main-container {
  width: min(100%, var(--mm-max));
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 28px) 56px;
  box-sizing: border-box;
}

h1 {
  font-size: clamp(1.9rem, 3.2vw, 2.6rem);
  color: var(--brand-accent, #3498db);
  font-weight: 800;
  text-align: center;
}

p {
  margin: 0 0 18px;
  color: var(--brand-text, #34495e);
  text-align: center;
}

/* ---- Buttons (glassy primary, with variants) --------------------------- */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(
    to bottom right,
    rgba(52, 152, 219, 0.92),
    rgba(41, 128, 185, 0.92)
  );
  box-shadow: 0 10px 22px rgba(0,0,0,0.12);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
  margin: 6px;
}
button:hover,
button:focus-visible {
  outline: none;
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0,0,0,0.16);
  filter: saturate(1.05);
}
button:disabled {
  background: rgba(149,165,166,0.75);
  cursor: not-allowed;
  box-shadow: none;
}

/* Variants */
#startGameBtn, #restartGameBtn {
  background: linear-gradient(to bottom right, rgba(46,204,113,0.95), rgba(39,174,96,0.95));
}
#copySessionUrlBtn {
  background: linear-gradient(to bottom right, rgba(155,89,182,0.95), rgba(142,68,173,0.95));
  font-size: .95rem;
  padding: 8px 14px;
}
#howToPlayBtn {
  background: linear-gradient(to bottom right, rgba(155,89,182,0.95), rgba(142,68,173,0.95));
}

/* PiP affordance matches other apps */
.pip-trigger { font-size: 1.05rem; padding-inline: 18px; }
.pip-trigger::before { content: '🪟'; }

/* ---- Session info + captured list (glass cards) ------------------------ */
#sessionInfo,
#captured-list-container {
  position: relative;
  background: var(--glass-bg, rgba(255,255,255,0.12));
  backdrop-filter: blur(var(--glass-blur, 14px)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur, 14px)) saturate(160%);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.38));
  box-shadow: var(--glass-shadow, 0 8px 30px rgba(0,0,0,0.15));
  border-radius: var(--mm-radius);
  width: min(92%, var(--mm-card-w));
  margin: 14px auto;
  padding: 18px 20px;
  text-align: left;
}
#sessionInfo {
  display: none; /* JS toggles to block when needed */
  text-align: center;
  color: var(--brand-heading, #2d3e50);
}
#sessionInfo span {
  font-weight: 800;
  color: var(--brand-accent, #3498db);
  word-break: break-word;
}

#captured-list-container h2 {
  color: var(--brand-accent, #3498db);
  margin: 0 0 10px;
  text-align: left;
}
#captured-list {
  list-style: none;
  padding: 10px 0 0;
  margin: 0;
  max-height: 180px;
  overflow-y: auto;
  border-top: 1px solid rgba(255,255,255,0.24);
}
#captured-list li {
  background: rgba(255,255,255,0.86);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.38));
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
  font-weight: 700;
  color: #2980b9;
}

/* Hidden by default; let JS reveal when the first capture happens */
#captured-list-container { display: none; }

/* ---- Game container (glass frame + dark playfield) --------------------- */
#game-container {
  position: relative;
  width: min(96%, var(--mm-max));
  aspect-ratio: var(--mm-game-aspect);
  background: var(--glass-bg-strong, rgba(255,255,255,0.18));
  backdrop-filter: blur(var(--glass-blur, 14px)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur, 14px)) saturate(160%);
  border: var(--mm-border) solid #2c3e50;             /* steel rim */
  border-radius: calc(var(--mm-radius) + 4px);
  box-shadow: 0 14px 36px rgba(0,0,0,0.18);
  overflow: hidden;
  margin: 16px auto 8px;
}
canvas#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- Count-in + Game Over overlays ------------------------------------ */
#countdown-overlay,
#game-over-overlay {
  position: absolute;
  inset: 0;
  display: none;                       /* JS toggles to flex */
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: calc(var(--mm-radius) - 2px);
  z-index: 10;
}

#countdown-overlay {
  background: rgba(44,62,80,0.88);
}
#countdown {
  font-size: clamp(3rem, 12vw, 8rem);
  font-weight: 900;
  color: #f1c40f;
  text-shadow: 4px 4px 8px rgba(0,0,0,0.4);
  animation: mm-pulse 1s infinite alternate;
}

#game-over-overlay {
  background: rgba(44,62,80,0.95);
  color: #ecf0f1;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}
#game-over-overlay h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  margin: 0 0 4px;
  color: #f1c40f;
}
#game-over-overlay p { margin: 0; }
#game-over-overlay ol {
  list-style: decimal inside;
  margin: 8px 0 14px;
  padding: 0;
}
#game-over-overlay li { margin-bottom: 4px; }

/* ---- Effect toast ------------------------------------------------------ */
.effect-notification {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  background: rgba(241,196,15,0.92);
  color: #2c3e50;
  padding: 18px 24px;
  border-radius: 14px;
  font-size: clamp(1.2rem, 4vw, 2.2rem);
  font-weight: 900;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
  z-index: 100;
  animation: mm-fadeInOut 2.5s forwards;
  box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

/* ---- How-to modal (glass card inside a dim layer) ---------------------- */
.hidden { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 6vh;
}
.modal-content {
  position: relative;
  width: min(92vw, 700px);
  background: var(--glass-bg-strong, rgba(255,255,255,0.18));
  backdrop-filter: blur(var(--glass-blur, 14px)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur, 14px)) saturate(160%);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.38));
  box-shadow: var(--glass-shadow, 0 8px 30px rgba(0,0,0,0.15));
  border-radius: var(--mm-radius);
  padding: 26px 28px;
  color: var(--brand-text, #34495e);
  animation: mm-slideIn .4s ease-out both;
  max-height: 75vh;
  overflow-y: auto;
}
.close-btn {
  color: #6b7280;
  position: absolute;
  top: 12px; right: 18px;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}
.close-btn:hover, .close-btn:focus { color: #111; }

.modal h2 {
  margin: 0 0 10px;
  text-align: center;
  color: var(--brand-accent, #3498db);
}
.guide-section { margin-bottom: 16px; }
.guide-section h3 {
  color: #2c3e50;
  border-bottom: 2px solid rgba(255,255,255,0.35);
  padding-bottom: 6px;
  margin: 0 0 8px;
}
.guide-section p,
.guide-section ul {
  text-align: left;
  line-height: 1.65;
}
.guide-section ul {
  list-style-position: inside;
  padding-left: 10px;
  margin: 0;
}
.guide-section li { margin-bottom: 6px; }

/* ---- SEO content block (shared glass card look) ------------------------ */
.seo-content-area {
  background: var(--glass-bg, rgba(255,255,255,0.12));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.38));
  border-radius: var(--mm-radius);
  box-shadow: var(--glass-shadow, 0 8px 30px rgba(0,0,0,0.15));
  padding: 24px 28px;
  width: min(92%, 780px);
  margin: 28px auto 0;
  text-align: left;
  line-height: 1.7;
}
.seo-content-area h1,
.seo-content-area h2 { 
  color: var(--brand-accent, #3498db);
  margin: 0 0 12px;
}
.seo-content-area h3 {
  color: var(--brand-accent-strong, #2980b9);
  margin: 18px 0 8px;
  font-size: 1.25rem;
}
.seo-content-area a {
  color: var(--brand-accent-strong, #2980b9);
  font-weight: 700;
  text-decoration: none;
}
.seo-content-area a:hover { text-decoration: underline; }

.button-group {
    text-align: center;
    margin: 1rem 0;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* ---- Animations + accessibility --------------------------------------- */
@keyframes mm-pulse {
  from { transform: scale(1); opacity: 1; }
  to   { transform: scale(1.08); opacity: .85; }
}
@keyframes mm-slideIn {
  from { transform: translateY(-14px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes mm-fadeInOut {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.9); }
  10% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  90% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.06); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Backdrop-filter fallback */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  #sessionInfo, #captured-list-container,
  .modal-content, .seo-content-area, #game-container {
    background: rgba(255,255,255,0.92);
    border-color: rgba(0,0,0,0.06);
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  }
}

/* High-contrast/forced colors */
@media (forced-colors: active) {
  #sessionInfo, #captured-list-container,
  .modal-content, .seo-content-area, #game-container {
    background: Canvas;
    border: 1px solid CanvasText;
    box-shadow: none;
  }
  .bg-orbs { display: none; }
}

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 960px) {
  :root { --mm-card-w: 640px; }
}

@media (max-width: 820px) {
  #game-container { width: 96%; }
}

@media (max-width: 520px) {
  h1 { margin-top: calc(var(--header-h) + 6px); font-size: 1.9rem; }
  .effect-notification { font-size: 1.5rem; padding: 12px 18px; }
}
