/* ===== DOSE OF SPIRIT: mix your own =====
   Colours come from the shared tokens (--ink, --surface, --line ...), so dark mode and bar light follow on their own.
   Every class is prefixed mx- so nothing here collides with the wall filters (.chip, .cell, .search). */

.mix-sec { padding: var(--sec-pad) 0 calc(var(--sec-pad) + 16px); overflow-x: clip; scroll-margin-top: var(--nav-h); }
.mx-grid {
  max-width: 1320px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 36px);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start;
}
.mx-card { background: var(--surface); border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); min-width: 0; }
html[data-theme="dark"] .mx-card { box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- Stage: the glass ---------- */
.mx-stage {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 14px 16px 18px;
  background: radial-gradient(ellipse at 50% 38%, var(--stage-core), var(--surface) 72%);
}
.mx-glass { width: min(340px, 100%); }
.mx-svg { display: block; width: 100%; height: auto; }
.mx-ln { fill: none; stroke: var(--ink); stroke-opacity: .42; stroke-width: 1.1; stroke-linejoin: round; }
.mx-ln.mx-soft { stroke-opacity: .2; }
.mx-hl { fill: none; stroke: #fff; stroke-opacity: .85; stroke-width: 3.2; stroke-linecap: round; }
.mx-hl-s { stroke-opacity: .5; stroke-width: 1.6; }
.mx-floor { opacity: calc(var(--sh)); }
.mx-layer { stroke: none; }
.mx-seam { stroke: #fff; stroke-opacity: .38; stroke-width: 1; }
.mx-surface { stroke: #fff; stroke-opacity: .55; stroke-width: .8; fill-opacity: .9; }
.mx-spoon { stroke: var(--ink); stroke-opacity: .75; stroke-width: 2.2; stroke-linecap: round; }
.mx-spoon-b { fill: var(--ink); fill-opacity: .75; }
.mx-stream { fill: none; stroke-width: 4.5; stroke-linecap: round; }
.mx-stream-s { stroke: #fff; stroke-opacity: .5; stroke-width: 1.2; stroke-linecap: round; }
.mx-ripple { fill: none; stroke: #fff; stroke-opacity: .7; stroke-width: 1.2; opacity: 0; transition: opacity .15s; }

.mx-count { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-2); text-align: center; }
.mx-hint { margin: 0; font-size: 14px; color: var(--mute); text-align: center; }
.mx-hint[hidden] { display: none; }

.mx-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: 100%; }
.mx-chips:empty { display: none; }
/* the chip area keeps its height so the glass does not jump when chips come and go */
.mx-slots { width: 100%; min-height: 116px; display: grid; align-content: start; }
.mx-chip {
  display: flex; align-items: center; gap: 9px; min-width: 0; max-width: 100%;
  min-height: 52px; padding: 4px 4px 4px 12px; border-radius: 999px;
  background: var(--glass); box-shadow: inset 0 0 0 1px var(--line);
}
.mx-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), inset 0 2px 3px rgba(255, 255, 255, .5); }
.mx-chip-t { display: grid; min-width: 0; line-height: 1.2; }
.mx-chip-t b { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-chip-t small { font-size: 11px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-x {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink-2); transition: background .2s, color .2s;
}
.mx-x:hover { background: var(--glass-hover); color: var(--ink); }

.mx-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; }
.mx-actions .btn { min-height: 46px; }
.btn[aria-disabled="true"] { opacity: .45; cursor: default; }
.btn[aria-disabled="true"]:hover { box-shadow: none; }
.btn[aria-disabled="true"].btn-ink:hover { background: var(--ink); }

/* ---------- Picker ---------- */
.mx-picker { padding: 16px; display: grid; gap: 12px; }
.mx-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mx-search {
  flex: 1 1 220px; min-width: 0; display: flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 16px; border-radius: 999px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--mute);
}
.mx-search svg { flex: none; }
.mx-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: inherit; font-size: 16px; }
.mx-search:focus-within { box-shadow: inset 0 0 0 2px var(--ink); }
.mx-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.mx-pill {
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--glass); box-shadow: inset 0 0 0 1px var(--line);
  font-size: 14px; font-weight: 500; transition: background .25s, color .25s, box-shadow .25s;
}
.mx-pill:hover { background: var(--glass-hover); }
.mx-pill[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.mx-tray { display: none; margin: 0; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.mx-tray-dots { display: inline-flex; gap: 4px; }
.mx-tray-dots i { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }
.mx-note { margin: 0; min-height: 3em; font-size: 14px; line-height: 1.45; color: var(--ink-2); }

.mx-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 8px;
  max-height: 388px; overflow-y: auto; overscroll-behavior: contain; padding: 4px;
  scrollbar-width: thin;
}
.mx-pick {
  display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 56px;
  padding: 6px 10px 6px 12px; border-radius: 12px; text-align: left;
  background: var(--wall); transition: background .2s, transform .2s var(--ease), box-shadow .2s;
}
.mx-pick[hidden] { display: none; }
.mx-pick:hover { background: var(--wall-2); }
.mx-pick:active { transform: scale(.97); }
.mx-pick[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink); }
.mx-mv { flex: none; width: 20px; height: 44px; overflow: visible; }
.mx-mv-ln { stroke: var(--ink); stroke-opacity: .22; stroke-width: .8; }
.mx-pick-t { display: grid; min-width: 0; line-height: 1.2; overflow-wrap: anywhere; }
.mx-pick-t b { font-size: 14px; font-weight: 700; }
.mx-pick-t small { font-size: 12px; color: var(--mute); }
.mx-empty { padding: 24px 0; }
.mx-empty[hidden] { display: none; }

/* ---------- Result card ---------- */
.mx-result { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; padding: 22px 18px 20px; }
.mx-r-main { min-width: 0; }
.mx-r-main .eyebrow { margin-bottom: 8px; }
.mx-r-name { margin: 0; font-size: clamp(26px, 4.2vw, 44px); line-height: 1.02; letter-spacing: -.035em; font-weight: 800; overflow-wrap: anywhere; }
html[data-lang="th"] .mx-r-name { line-height: 1.2; letter-spacing: -.01em; }
.mx-result[data-ready="false"] .mx-r-name { font-size: 18px; letter-spacing: -.01em; line-height: 1.35; font-weight: 600; color: var(--mute); }
.mx-r-state { margin: 12px 0 0; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.mx-r-state[hidden] { display: none; }
.mx-sw { flex: none; width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2), inset 0 2px 3px rgba(255, 255, 255, .5); }
.mx-r-made { margin: 12px 0 0; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.mx-r-made span { color: var(--mute); }
.mx-r-made b { font-weight: 600; }
.mx-flavor { margin: 0; align-content: start; }
.mx-result[data-ready="false"] .mx-flavor { opacity: .5; }
.mx-flavor .fl-row { grid-template-columns: 88px minmax(0, 1fr); }
/* partial bars: each segment fills by its own fraction (set from mix.js as --mxp) */
.mx-flavor .fl-segs i::after { transform: scaleX(var(--mxp, 0)); }
.mx-r-buy { display: grid; gap: 12px; align-content: start; }
.mx-facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mx-facts div { min-width: 0; }
.mx-facts dt { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
html[data-lang="th"] .mx-facts dt { letter-spacing: 0; text-transform: none; }
.mx-facts dd { margin: 2px 0 0; font-size: 15px; font-weight: 600; }
.mx-facts .mx-price { font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -.03em; font-family: "Inter Tight", var(--f-sans); }
.mx-r-buy .fine { margin: 0; text-align: center; }
.mx-r-buy .btn { white-space: normal; text-align: center; min-height: 48px; height: auto; padding-top: 10px; padding-bottom: 10px; }

/* ---------- Detail drawer button ---------- */
.d-body .mix-add-btn { margin: 14px 0 0 8px; }

/* ---------- Wider screens ---------- */
@media (min-width: 760px) {
  .mx-result { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 26px 28px; gap: 24px 32px; }
  .mx-r-buy { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; }
  .mx-r-buy .fine { grid-column: 1 / -1; }
}
@media (min-width: 960px) {
  .mx-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; }
  .mx-result { grid-column: 1 / -1; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .9fr); }
  .mx-r-buy { grid-column: auto; grid-template-columns: minmax(0, 1fr); align-items: start; }
  .mx-r-buy .fine { grid-column: auto; }
  .mx-stage { align-self: stretch; justify-content: center; }
}

/* ---------- Phones ---------- */
@media (max-width: 959px) {
  .mx-tray { display: flex; }
}
@media (max-width: 520px) {
  .mx-stage { padding: 10px 12px 16px; }
  .mx-glass { width: min(300px, 100%); }
  .mx-picker { padding: 12px; }
  .mx-note { min-height: 4.4em; }
  .mx-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 340px; }
  .mx-pick { padding: 6px 8px 6px 10px; gap: 8px; }
  .mx-chip { flex: 1 1 calc(50% - 4px); padding-left: 10px; gap: 7px; }
  .mx-chip-t b { white-space: normal; overflow-wrap: break-word; line-height: 1.15; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .mx-chip-t small { display: none; }
  .mx-actions .btn { flex: 1 1 0; padding: 0 14px; }
  .mx-flavor .fl-row { grid-template-columns: 76px minmax(0, 1fr); }
  .mx-result { padding: 20px 16px 18px; }
}

/* ---------- Dark mode and bar light ---------- */
html[data-theme="dark"] .mx-ln { stroke-opacity: .5; }
html[data-theme="dark"] .mx-hl { stroke-opacity: .6; }
html[data-theme="dark"] .mx-floor { opacity: .9; }
html[data-light="bar"]:root .mx-ln { stroke: #ffc27a; stroke-opacity: .5; }
html[data-light="bar"]:root .mx-hl { stroke: #ffd9a8; stroke-opacity: .75; }
html[data-light="bar"]:root .mx-hl-s { stroke-opacity: .5; }
html[data-light="bar"]:root .mx-mv-ln { stroke: #ffaa5a; stroke-opacity: .42; }
html[data-light="bar"]:root .mx-stage { background: radial-gradient(ellipse at 50% 38%, var(--stage-core), var(--surface) 72%); }

@media (prefers-reduced-motion: reduce) {
  .mx-pick, .mx-pill, .mx-x { transition: none; }
  .mx-pick:active { transform: none; }
}
