/* Meme Lab. Only what game.css does not already cover. */

.ml-wrap { max-width: 44rem; margin: 0 auto; }

.ml-stage {
  display: grid; place-items: center;
  padding: 8px;
  border: var(--edge); border-radius: 18px;
  background: rgba(36, 4, 15, .62);
  box-shadow: var(--pop-lg);
  transition: border-color .15s ease;
}
.ml-stage.is-over { border-color: var(--pink); }
#ml-canvas {
  display: block;
  border-radius: 10px;
  /* The canvas is the drag surface; without this a sticker drag scrolls the
     page out from under the meme on every phone. */
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  cursor: grab;
}
#ml-canvas:active { cursor: grabbing; }

.ml-hint {
  min-height: 1.2em; margin: .5rem 0 0; text-align: center;
  font-size: .85rem; font-weight: 700; color: var(--pink-3);
}

.ml-modes, .ml-row {
  display: flex; flex-wrap: wrap; gap: .45rem;
  justify-content: center; margin: .8rem 0 0;
}
.ml-modes .btn[aria-pressed="true"] {
  background: var(--pink); color: var(--cream-2); border-color: var(--ink);
}
.ml-out { margin-top: 1rem; }

.ml-palette {
  display: grid; gap: .4rem; margin: .9rem 0 0;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
}
.ml-chip {
  display: grid; place-items: center;
  padding: 4px; aspect-ratio: 1;
  background: rgba(36, 4, 15, .62);
  border: 2px solid var(--ink); border-radius: 14px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  transition: transform .1s ease, background .12s ease;
}
.ml-chip:hover, .ml-chip:focus-visible { background: var(--plum-3); }
.ml-chip:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.ml-chip canvas { width: 100%; height: 100%; display: block; }

.ml-fields {
  display: grid; gap: .5rem; margin: .9rem 0 0;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 520px) { .ml-fields { grid-template-columns: 1fr; } }
.ml-field span {
  display: block; font-size: .72rem; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--pink-3); margin-bottom: .25rem;
}
.ml-field input {
  width: 100%; padding: .6rem .7rem;
  font: inherit; font-weight: 700; color: var(--cream);
  background: rgba(36, 4, 15, .72);
  border: 2px solid var(--ink); border-radius: 12px;
}
.ml-field input:focus-visible { outline: 3px solid var(--pink); outline-offset: 1px; }

/* A file input styled as a button: the real control is kept in the DOM and
   made invisible rather than replaced, so the keyboard and screen readers
   still get a real file picker. */
.ml-file { position: relative; overflow: hidden; cursor: pointer; }
.ml-file input {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}

.ml-priv {
  margin-top: 1.2rem; font-size: .85rem; font-weight: 600;
  color: var(--pink-3); text-align: center;
}
.ml-priv b { color: var(--cream); }

@media (prefers-reduced-motion: reduce) {
  .ml-chip, .ml-stage { transition: none; }
}

.ml-auto { margin-top: 1rem; }
/* .btn sets its own display, which beats the UA's [hidden] rule — so the ring
   toggle has to be hidden explicitly or it shows up outside PFP mode. */
.ml-auto .btn[hidden] { display: none; }
.ml-auto .btn-buy { font-size: 1.02rem; padding: .7rem 1.5rem; }

.ml-sub {
  margin: 1rem 0 0; text-align: center;
  font-size: .74rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--pink-3); opacity: .8;
}

/* The X mark sits on the button's own baseline, not on the text baseline. */
.ml-x { display: inline-flex; align-items: center; gap: .5rem; }
.ml-x svg { width: 1em; height: 1em; fill: currentColor; flex: none; }

.ml-xnote {
  margin: .6rem auto 0; max-width: 34rem; text-align: center;
  font-size: .8rem; font-weight: 600; color: var(--pink-3);
}

/* Photo controls — hidden until there is a photo to control. */
.ml-photo {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  justify-content: center; margin: .9rem 0 0;
}
.ml-photo[hidden] { display: none; }
.ml-zoom { display: flex; align-items: center; gap: .6rem; flex: 1 1 15rem; }
.ml-zoom span {
  font-size: .72rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--pink-3); white-space: nowrap;
}
.ml-zoom input[type="range"] {
  flex: 1; min-width: 8rem; height: 30px;
  -webkit-appearance: none; appearance: none;
  background: transparent; cursor: pointer;
}
.ml-zoom input[type="range"]::-webkit-slider-runnable-track {
  height: 10px; border-radius: 6px;
  background: linear-gradient(90deg, var(--plum-3), var(--pink));
  border: 2px solid var(--ink);
}
.ml-zoom input[type="range"]::-moz-range-track {
  height: 10px; border-radius: 6px;
  background: linear-gradient(90deg, var(--plum-3), var(--pink));
  border: 2px solid var(--ink);
}
.ml-zoom input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; margin-top: -10px;
  border-radius: 50%; background: var(--cream);
  border: 3px solid var(--ink); box-shadow: 0 2px 0 var(--ink);
}
.ml-zoom input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--cream); border: 3px solid var(--ink);
}
.ml-zoom input[type="range"]:focus-visible { outline: 3px solid var(--pink); outline-offset: 4px; }

.ml-help {
  margin: .7rem auto 0; max-width: 38rem; text-align: center;
  font-size: .78rem; font-weight: 600; line-height: 1.5;
  color: var(--pink-3); opacity: .85;
}

.ml-row .btn[disabled] { opacity: .4; cursor: default; box-shadow: none; }

/* What happened when you pressed POST TO X — said here, because the tab that
   would say it is the one that just took focus. */
.ml-xpanel { margin: .9rem 0 0; padding: .9rem 1rem; text-align: center; }
.ml-xpanel[hidden] { display: none; }
.ml-xmsg {
  margin: 0 0 .7rem; font-size: .92rem; font-weight: 700;
  line-height: 1.45; color: var(--cream);
}
.ml-xpanel .ml-row { margin: 0; }
