/* Mango Mash — paint + LMP/board chrome. Shell geometry stays with lux-*. */

:root {
  --mm-ink: #2a160e;
  --mm-label: #f08a1a;
  --mm-glass-fill: rgba(255, 252, 245, 0.2);
  --mm-panel-fill: rgba(255, 255, 255, 0.42);
  --mm-gold: #ffb84a;
  --mm-gold-hot: #ffe2a0;
  --mm-gold-deep: #e07a12;
  --mm-board-top: #cfe9ff;
  --mm-board-bot: #fff6c8;
  --mm-shadow: 0 20px 50px rgba(18, 40, 70, 0.3);
  --mm-font: "Trebuchet MS", "Avenir Next", "Segoe UI", ui-sans-serif, sans-serif;
  --lmp-accent: #e07a12;
  --lmp-track: rgba(58, 31, 18, 0.18);
  /* Liquid Glass 27 — blur / sat / rim */
  --mm-glass-blur: 30px;
  --mm-glass-sat: 1.65;
  --mm-rim: 28px;
  /* Light catches the top of the stroke; the body of the rim is mango. */
  --mm-rim-grad: linear-gradient(
    162deg,
    #fffaf0 0%,
    #ffe3ad 10%,
    #ffb13c 26%,
    #ff8a14 58%,
    #e25c00 80%,
    #ffd089 100%
  );
}

* {
  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;
}

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;
}

/* Heat canvas sits behind lux chrome; CSS scene remains until GL is ready. */
#mm-heat {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  pointer-events: none;
  display: block;
}

html.mm-heat-on {
  background-image: none;
}

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

@media (orientation: landscape) {
  html[data-lux-shell]:not([data-r]) body {
    display: none;
  }
}

/* ——— Liquid Glass 27 frames (player / scores / board) ———
   Golden Gate edges, tinted mango. The kit's glass rim is a hairline
   light ring (zero blur) plus dark inner lens shadows on the top and
   bottom only — not a stacked gold picture frame. Safari-safe: no SVG
   backdrop-filter. */
.mm-glass,
.mm-board,
lmp-player {
  --_rim: var(--mm-rim);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--_rim);
  border: 2px solid transparent;
  background:
    linear-gradient(transparent, transparent) padding-box,
    var(--mm-rim-grad) border-box;
  background-clip: padding-box, border-box;
  box-shadow:
    0 18px 40px rgba(28, 16, 8, 0.28),
    inset 0 1px 0 rgba(255, 250, 236, 0.9),
    inset 0 34px 1px -33px rgba(176, 72, 8, 0.5),
    inset 0 -34px 1px -33px rgba(120, 48, 6, 0.38);
}

.mm-glass::before,
.mm-board::before,
lmp-player::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(
      160deg,
      rgba(255, 255, 255, 0.82) 0%,
      rgba(255, 248, 230, 0.32) 28%,
      rgba(255, 214, 150, 0.16) 100%
    ),
    var(--mm-glass-fill);
  backdrop-filter: blur(var(--mm-glass-blur)) saturate(var(--mm-glass-sat)) brightness(1.06);
  -webkit-backdrop-filter: blur(var(--mm-glass-blur)) saturate(var(--mm-glass-sat)) brightness(1.06);
}


/* Music card: frost the scene on the element itself. A ::before at z-index -1
   inside isolation never sampled the beach, so the card read as a blue slab. */
lmp-player {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 244, 220, 0.4) 46%, rgba(255, 236, 200, 0.3) 100%) padding-box,
    var(--mm-rim-grad) border-box !important;
  background-clip: padding-box, border-box !important;
  backdrop-filter: blur(var(--mm-glass-blur)) saturate(var(--mm-glass-sat)) !important;
  -webkit-backdrop-filter: blur(var(--mm-glass-blur)) saturate(var(--mm-glass-sat)) !important;
}

lmp-player::before {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 36%),
    rgba(255, 255, 255, 0.12);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 0;
}


/* face paint stays under canvases; glass ::before is behind the host */

/* Inner metric cards — denser milky glass, tighter chrome */
.mm-glass-inset {
  --_rim: 22px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--_rim);
  border: 1.5px solid transparent;
  background:
    linear-gradient(transparent, transparent) padding-box,
    var(--mm-rim-grad) border-box;
  background-clip: padding-box, border-box;
  box-shadow:
    0 10px 24px rgba(28, 16, 8, 0.2),
    inset 0 1px 0 rgba(255, 250, 236, 0.9),
    inset 0 22px 1px -21px rgba(176, 72, 8, 0.4),
    inset 0 -22px 1px -21px rgba(120, 48, 6, 0.3);
}

.mm-glass-inset::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 246, 226, 0.4) 42%, rgba(255, 210, 140, 0.22) 100%),
    var(--mm-panel-fill);
  backdrop-filter: blur(18px) saturate(1.45);
  -webkit-backdrop-filter: blur(18px) saturate(1.45);
}

.mm-logo {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
}

/* Wide head: title on top, player centered in the space under it.
   The packer gives both cells equal rows and stretches them, which
   letterboxes the wordmark and leaves a gap above it. */
html[data-o="w"] lux-head {
  grid-template-rows: auto minmax(0, 1fr) !important;
  padding-top: 0;
}
html[data-o="w"] lux-head > lux.mm-logo {
  padding: 0;
  width: 100%;
  height: auto !important;
  max-width: 100%;
  max-height: 100%;
  align-self: start !important;
  justify-self: stretch;
}
html[data-o="w"] lux-head > lux.mm-logo > img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center top;
  padding: 0;
  min-width: 0;
  min-height: 0;
}
html[data-o="w"] lux-head > lux.mm-player {
  align-self: center !important;
  height: auto !important;
  max-height: 100%;
  padding: 0;
}

/* Tall head is one shell row. The packer measures max-content and, when
   the two cells fit, uses columns max-content | 1fr — logo on the left,
   player in the rest. Height:100% does not resolve while that measure
   runs (and a stale --eh on an orientation flip makes the PNG read as
   1200px), so cap the wordmark to the row. The player cell is the 1fr
   track; stretch it so the card fills that track instead of shrink-wrapping. */
html[data-o="t"] lux-head > lux.mm-logo {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  padding: 0;
  justify-self: start !important;
  align-self: center !important;
}
html[data-o="t"] lux-head > lux.mm-logo > img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(20vw, 100%);
  max-height: var(--eh);
  object-fit: contain;
  object-position: left center;
  padding: 0;
}
html[data-o="t"] lux-head > lux.mm-player {
  place-content: stretch !important;
  place-items: stretch !important;
}

/* Wide LMP — lux-wide children join via display:contents. */
lmp-player {
  --lmp-btn-size: 40px;
  --lmp-rail: 5px;
  --lmp-btn-bg: transparent;
  --lmp-btn-hover: rgba(224, 122, 18, 0.12);
  min-height: 0;
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "art" "eq" "title" "controls" "seek" "vol";
  gap: 8px;
  padding: 14px;
  color: var(--mm-ink);
}

lmp-player > * {
  position: relative;
  z-index: 1;
}

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

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: eq;
  align-self: center;
  justify-self: stretch;
  z-index: 1;
  height: 40px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

/* Show EQ while playing (analyser when ready, else LMP sine). */
lmp-player.is-playing lmp-eq {
  opacity: 0.92;
}
lmp-player.is-playing.has-analyser lmp-eq {
  opacity: 1;
}

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;
  color: rgba(58, 31, 18, 0.55);
}

/* Tall LMP — store composition: cover is the full row, title sits on top
   of the controls, and the volume track takes the width the buttons leave. */
html[data-o="t"] lmp-player {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 0 6px 0 0;
  --_rim: 12px;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-width: 0;
  box-sizing: border-box;
  --lmp-btn-size: 16px;
  --lmp-rail: 4px;
}

html[data-o="t"] lmp-player lmp-art {
  flex: 0 0 auto;
  align-self: stretch;
  width: min(46px, calc(var(--eh) - 4px));
  height: 100%;
  max-width: min(46px, calc(var(--eh) - 4px));
  max-height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px 8px 8px 10px;
  box-shadow: none;
}

html[data-o="t"] lmp-player .lmp-copy {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2px 0;
  overflow: hidden;
}

html[data-o="t"] lmp-player lmp-title {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  height: auto;
  /* Nowrap title must not count toward the packer's max-content. */
  contain: inline-size;
  justify-content: flex-start;
  font-size: clamp(11px, 3.1vw, 13px);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

html[data-o="t"] lmp-player .lmp-copy > lmp-eq {
  position: absolute;
  left: 0;
  right: 0;
  top: 1px;
  height: 16px;
  max-height: none;
  min-width: 0;
  width: auto;
  margin: 0;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
}

html[data-o="t"] lmp-player.is-playing .lmp-copy > lmp-eq {
  opacity: 0.75;
}

html[data-o="t"] lmp-player .lmp-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

html[data-o="t"] .lmp-row lmp-prev,
html[data-o="t"] .lmp-row lmp-play,
html[data-o="t"] .lmp-row lmp-next,
html[data-o="t"] .lmp-row lmp-mute {
  flex: 0 0 auto;
}

/* lux-row children default to flex: 0 0 auto. The track has to grow. */
html[data-o="t"] .lmp-row lmp-vol {
  grid-area: auto;
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  max-width: none;
  margin: 0;
}

html[data-o="t"] .lmp-row lmp-vol::part(min),
html[data-o="t"] .lmp-row lmp-vol::part(max) {
  width: 12px;
  height: 12px;
}

html[data-o="t"] .lmp-row lmp-vol::part(range) {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

/* ——— board ———
   The shared frame paints an opaque mango gradient under the whole box.
   That hides the heat. Here the fill is only a light lens, and the mango
   stroke is a 2px ring so the haze keeps moving behind the pieces. */
.mm-board {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.05) 28%,
    rgba(255, 248, 236, 0.03) 100%
  );
  backdrop-filter: blur(5px) saturate(1.55);
  -webkit-backdrop-filter: blur(5px) saturate(1.55);
}

.mm-board::before {
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.mm-board::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: var(--mm-rim-grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 6;
}

.mm-board-face {
  position: absolute;
  inset: 0;
  border-radius: 28px;
  background: none;
  box-shadow: none;
  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;
  background: transparent;
  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);
  }
}

/* A little air beside the rails. Leave the wide body's bottom pad to the
   shell so the brand sits under the board. */
html[data-lux-shell][data-o="w"] lux-body {
  padding-top: 12px;
  padding-left: 14px;
  padding-right: 14px;
  box-sizing: border-box;
}
html[data-lux-shell][data-o="w"] lux-head {
  padding-right: 8px;
}
html[data-lux-shell][data-o="w"] lux-tail {
  padding-left: 8px;
}
html[data-lux-shell][data-o="t"] lux-body {
  padding: 8px;
  box-sizing: border-box;
}
/* Shell rows are --eh and --et. Clip paint to those tracks so the player
   and the score glass cannot fall through into the board or the brand. */
html[data-lux-shell][data-o="t"] lux-head,
html[data-lux-shell][data-o="t"] lux-tail {
  overflow: hidden;
}

/* ——— tail scores: hug the two lux-metric cards, don't fill the rail ——— */
.mm-scores {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: stretch !important;
  gap: 12px;
  padding: 12px;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

html[data-o="w"] .mm-scores {
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  justify-self: stretch !important;
  align-self: center !important;
}

html[data-o="t"] .mm-scores {
  flex-direction: row !important;
  align-items: stretch !important;
  justify-content: center !important;
  gap: 8px;
  padding: 4px 8px;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  --_rim: 16px;
}

lux-metric.mm-metric {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  flex: 0 0 auto;
  align-self: stretch !important;
  width: auto !important;
  min-width: 0;
  padding: 18px 16px;
  text-align: center;
  white-space: normal !important;
  contain: content;
  --lux-metric-gap: 6px;
  --lux-metric-ink: none;
  color: var(--mm-ink);
  font-family: var(--mm-font);
}

html[data-o="t"] lux-metric.mm-metric {
  flex: 1 1 0;
  width: auto !important;
  height: 100%;
  max-height: 100%;
  padding: 3px 8px;
  gap: 1px !important;
  --_rim: 12px;
}

lux-metric.mm-metric::part(icon) {
  display: none;
}

lux-metric.mm-metric::part(label) {
  font-size: clamp(12px, 1.4vmin, 16px);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mm-label);
  line-height: 1.1;
  opacity: 1;
  text-shadow: 0 1px 8px rgba(255, 248, 230, 0.7);
}

lux-metric.mm-metric::part(value) {
  font-size: clamp(28px, 4.5vmin, 52px);
  font-weight: 900;
  color: var(--mm-ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

html[data-o="t"] lux-metric.mm-metric::part(label) {
  font-size: 9px;
  letter-spacing: 0.06em;
}
html[data-o="t"] lux-metric.mm-metric::part(value) {
  font-size: clamp(16px, 4.8vw, 22px);
}

/* Promote LMP content above glass sheen */
lmp-player > * {
  position: relative;
  z-index: 1;
}

/* ——— foot brand ——— */
lux-foot .mm-brand {
  max-width: 100%;
  min-width: 0;
}
lux-foot .mm-brand img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: clamp(36px, 5vw, 54px);
}
