/* Mango Mash — tropical lux shell (layout chrome). No glow theme. */

:root {
  --mm-ink: #3a1f12;
  --mm-label: #e07a12;
  --mm-glass-fill: rgba(255, 248, 230, 0.18);
  --mm-glass-border: rgba(255, 255, 255, 0.72);
  --mm-glass-blur: 22px;
  --mm-gold: rgba(255, 196, 90, 0.9);
  --mm-board-top: #cfe9ff;
  --mm-board-bot: #fff6c8;
  --mm-shadow: 0 18px 48px rgba(18, 40, 70, 0.28);
  --mm-font: "Trebuchet MS", "Avenir Next", "Segoe UI", ui-sans-serif, sans-serif;
  --lmp-accent: #e07a12;
  --lmp-track: rgba(58, 31, 18, 0.18);
  /* Tall LMP needs room for seek + art + controls; Latis default --eh (~34–84px) crushes it. */
  --mm-tall-eh: clamp(136px, 34vmin, 172px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  color: var(--mm-ink);
  font-family: var(--mm-font);
  user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}

/* One scene plane on html only — body stays clear so Latis side/top pad
   cannot seam a second cover-sized background (top-right cyan/white strip). */
html {
  background-color: #4aa3e8;
  background-image: var(--mm-scene, none);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

body {
  background: transparent !important;
}

/* Tall: kill the empty sand band under ionic.games (Latis 1% bottom pad + foot pad).
   Also drop Latis’s 4px side pad that drew a light strip on the right edge. */
html[data-o="t"] {
  padding-top: max(0px, env(safe-area-inset-top, 0px)) !important;
  padding-bottom: max(2px, env(safe-area-inset-bottom, 0px)) !important;
  padding-left: max(0px, env(safe-area-inset-left, 0px)) !important;
  padding-right: max(0px, env(safe-area-inset-right, 0px)) !important;
  /* Inline --eh from Latis is not !important; this wins and sizes the player. */
  --eh: var(--mm-tall-eh) !important;
}

html[data-o="w"] {
  padding-left: max(0px, env(safe-area-inset-left, 0px)) !important;
  padding-right: max(0px, env(safe-area-inset-right, 0px)) !important;
  padding-top: max(0px, env(safe-area-inset-top, 0px)) !important;
  padding-bottom: max(0px, env(safe-area-inset-bottom, 0px)) !important;
}

/* Hold landscape until lux packs — same CLS guard as TTG. */
@media (orientation: landscape) {
  html[data-lux-shell]:not([data-r]) body {
    display: none;
  }
}

/* ——— Mash glass ———
   Blur on ::before; rim via inset shadow (avoids Chromium border-radius +
   border flecks at the top-right of frosted panels). */
.mm-glass,
.mm-panel,
lmp-player,
.mm-board {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 28px;
  border: 0;
  background: transparent;
  box-shadow:
    var(--mm-shadow),
    inset 0 0 0 3px var(--mm-glass-border);
}

.mm-glass::before,
.mm-panel::before,
lmp-player::before,
.mm-board::before {
  content: "";
  position: absolute;
  inset: 0;
  /* Behind in-flow content (z-index:0 would cover art/controls). */
  z-index: -1;
  border-radius: inherit;
  background: var(--mm-glass-fill);
  backdrop-filter: blur(var(--mm-glass-blur)) saturate(1.35);
  -webkit-backdrop-filter: blur(var(--mm-glass-blur)) saturate(1.35);
  pointer-events: none;
}

.mm-board {
  box-shadow:
    var(--mm-shadow),
    inset 0 0 0 3px var(--mm-gold),
    inset 0 0 0 4px rgba(255, 255, 255, 0.28);
}

/* Mockup score cards: gold rim, compact (not stretched chrome columns). */
.mm-panel {
  box-shadow:
    var(--mm-shadow),
    inset 0 0 0 3px var(--mm-gold);
}

/* ——— hat / title ——— */
html[data-o="w"] lux-hat {
  /* Ensure the mockup wordmark has room in the left rail */
  min-height: max(var(--hat, 0px), 72px);
}

.mm-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: 100%;
  padding: 0.25em 0.45em 0.15em;
  overflow: visible;
  background: none;
  border: 0;
  box-shadow: none;
  isolation: auto;
}

.mm-logo::before {
  content: none;
}

.mm-logo img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(100%, 96px);
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 10px 18px rgba(12, 40, 18, 0.28));
  pointer-events: none;
}

html[data-o="t"] .mm-logo {
  justify-content: center;
}
html[data-o="t"] .mm-logo img {
  max-height: min(100%, 72px);
  object-position: center;
}

/* ——— left rail: player + brand ——— */
html[data-o="w"] lux-head > lux.mm-rail {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 14px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 8px 10px 14px;
  overflow: hidden;
  place-self: stretch;
}

html[data-o="t"] lux-head > lux.mm-rail {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: stretch;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 4px 8px;
  overflow: hidden;
}

lmp-player {
  --lmp-btn-size: 40px;
  --lmp-rail: 5px;
  --lmp-btn-bg: transparent;
  --lmp-btn-hover: rgba(224, 122, 18, 0.12);
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  /* Mockup stack: art → title/eq → controls → seek → vol */
  grid-template-areas: "art" "title" "controls" "seek" "vol";
  gap: 8px;
  padding: 14px;
  color: var(--mm-ink);
  z-index: 1;
}

/* lux-tall is display:contents — promote grandchildren above the glass fill. */
lmp-player > *,
lmp-player lux-tall > *,
lmp-player lux-wide > * {
  position: relative;
  z-index: 1;
}

html[data-o="w"] lmp-player {
  grid-template-areas: "art" "title" "controls" "seek" "vol";
}

lmp-art {
  grid-area: art;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: min(42vh, 280px);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(18, 40, 70, 0.22);
  justify-self: center;
}

/* EQ behind the title (store composition) — green bars read through the name. */
lmp-title {
  grid-area: title;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  font-weight: 800;
  font-size: clamp(14px, 1.6vmin, 18px);
  color: var(--mm-ink);
  text-align: center;
  text-shadow: 0 1px 8px rgba(255, 248, 230, 0.85);
}

lmp-eq {
  grid-area: title;
  align-self: center;
  justify-self: stretch;
  z-index: 0;
  height: 48px;
  margin: 0;
  opacity: 0.7;
  pointer-events: none;
}

/* Store gate: hide synthetic sine until a live analyser is marked. */
lmp-player:not(.has-analyser) lmp-eq {
  visibility: hidden;
  opacity: 0;
}
/* While playing but analyser not up yet, still show LMP's sine (Mash mockup). */
lmp-player.is-playing:not(.has-analyser) lmp-eq {
  visibility: visible;
  opacity: 0.55;
}

lmp-controls {
  grid-area: controls;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

lmp-prev,
lmp-next,
lmp-play,
lmp-mute {
  color: var(--mm-ink);
}

lmp-seek {
  grid-area: seek;
  display: block;
  color: rgba(58, 31, 18, 0.55);
}

lmp-vol {
  grid-area: vol;
  --lmp-accent: #e07a12;
  color: rgba(58, 31, 18, 0.55);
}

/* Portrait compact player — seek on top, art + copy (store/tall mockup). */
html[data-o="t"] lmp-player {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "seek seek"
    "art copy";
  gap: 4px 8px;
  padding: 6px 8px;
  align-items: center;
  flex: 1 1 auto;
  height: 100%;
  max-height: 100%;
  --lmp-btn-size: 28px;
  --lmp-rail: 4px;
}

html[data-o="t"] lmp-seek {
  grid-area: seek;
  width: 100%;
  min-width: 0;
  align-self: center;
}

html[data-o="t"] lmp-art {
  grid-area: art;
  width: 52px;
  max-height: 52px;
  aspect-ratio: 1;
  border-radius: 12px;
}

html[data-o="t"] .lmp-copy {
  grid-area: copy;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  min-width: 0;
  position: relative;
  z-index: 1;
}

html[data-o="t"] .lmp-row {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

html[data-o="t"] lmp-title {
  min-height: 16px;
  font-size: clamp(12px, 3.4vw, 15px);
}

html[data-o="t"] lmp-eq {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 18px;
  opacity: 0.55;
  pointer-events: none;
}

html[data-o="t"] .mm-brand {
  display: none;
}

.mm-brand {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding: 4px 2px;
  cursor: pointer;
  background: none;
  border: 0;
  box-shadow: none;
  isolation: auto;
}

.mm-brand::before {
  content: none;
}

.mm-brand img,
.mm-brand img[data-lux-link] {
  display: block;
  width: auto;
  max-width: min(100%, 180px);
  height: auto;
  max-height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(12, 40, 18, 0.25));
}

/* ——— center board (glass + canvases) ——— */
.mm-board {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
}

.mm-board-face {
  position: absolute;
  inset: 0;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 28%),
    linear-gradient(180deg, var(--mm-board-top) 0%, var(--mm-board-bot) 100%);
  box-shadow: inset 0 0 40px rgba(80, 140, 200, 0.12);
  pointer-events: none;
  z-index: 1;
}

.mm-board > #gpu,
.mm-board > #fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  border-radius: 28px;
  touch-action: none;
  z-index: 2;
}

.mm-board > #fx {
  pointer-events: none;
  z-index: 3;
}

.mm-board > #combo {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 4;
  pointer-events: none;
  font-weight: 900;
  font-size: clamp(22px, 4.5vmin, 42px);
  color: #fff8e6;
  text-shadow: 0 2px 0 rgba(58, 31, 18, 0.35), 0 8px 24px rgba(18, 40, 70, 0.35);
  letter-spacing: 0.02em;
  animation: mm-combo-pop 0.7s ease-out both;
}

@keyframes mm-combo-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -42%) scale(1);
  }
}

/* ——— right score panels (mockup: compact cards, not stretched columns) ——— */
html[data-o="w"] lux-tail {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: center !important;
  align-content: center !important;
  gap: 14px !important;
  padding: 18px 12px 18px 6px !important;
  grid-template-rows: none !important;
  grid-template-columns: none !important;
}

html[data-o="t"] lux-tail {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  justify-content: center !important;
  gap: 10px !important;
  padding: 4px 10px 6px !important;
  height: auto !important;
  max-height: none !important;
  grid-template-rows: none !important;
  grid-template-columns: none !important;
}

.mm-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  padding: 12px 16px;
  text-align: center;
  z-index: 1;
}

.mm-panel > * {
  position: relative;
  z-index: 1;
}

html[data-o="w"] .mm-panel {
  flex: 0 0 auto !important;
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  align-self: stretch !important;
  justify-self: stretch !important;
  grid-row: auto !important;
  grid-column: auto !important;
}

html[data-o="t"] .mm-panel {
  flex: 1 1 0 !important;
  height: auto !important;
  max-height: none !important;
  padding: 10px 12px;
  border-radius: 22px;
}

.mm-label {
  font-size: clamp(11px, 1.35vmin, 15px);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--mm-label);
  line-height: 1.1;
}

.mm-value {
  font-size: clamp(28px, 4.2vmin, 48px);
  font-weight: 900;
  color: var(--mm-ink);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

html[data-o="t"] .mm-value {
  font-size: clamp(24px, 7vw, 36px);
}

/* Hide default lux foot in wide — brand lives in the left rail. */
html[data-o="w"] lux-foot.mm-foot {
  display: none !important;
}
html[data-o="t"] lux-foot.mm-foot {
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0 8px max(2px, env(safe-area-inset-bottom, 0px)) !important;
  min-height: 0 !important;
  max-height: none;
}
html[data-o="t"] .mm-brand-foot {
  display: flex;
  margin-top: 0;
  padding: 0;
}
html[data-o="t"] .mm-brand-foot img,
html[data-o="t"] .mm-brand-foot img[data-lux-link] {
  max-height: 28px;
}

/* lux-wide/tall visibility follows orientation (engine also toggles; belt+suspenders) */
html[data-o="t"] lux-wide {
  display: none;
}
html[data-o="w"] lux-tall {
  display: none;
}
html[data-o="w"] lux-wide {
  display: contents;
}
html[data-o="t"] lux-tall {
  display: contents;
}
