/* Minimash styles: neon arcade
   The game sits in a glowing arcade cabinet in the middle. Making a game is on the left,
   the feed on the right. On phones the cabinet comes first and fills most of the screen. */

/* ---------- Colors and fonts ---------- */
:root {
  --bg: #0B0820;          /* deep arcade night */
  --panel: #130F36;
  --well: #0E0A28;        /* inputs, list rows */
  --line: #2C2766;
  --ink: #F4F1FF;
  --muted: #A9A3D9;
  --pink: #FF2E97;        /* hot pink neon */
  --pink-ink: #1C0012;    /* text on pink */
  --cyan: #26E6FF;        /* electric cyan neon */
  --gold: #FFD84D;        /* first place, credits */

  --glow-pink: 0 0 6px rgba(255, 46, 151, .8), 0 0 24px rgba(255, 46, 151, .45);
  --glow-cyan: 0 0 6px rgba(38, 230, 255, .8), 0 0 24px rgba(38, 230, 255, .4);

  --logo: "Monoton", "Chakra Petch", system-ui, sans-serif;
  --ui: "Chakra Petch", system-ui, -apple-system, "Segoe UI", sans-serif;

  color-scheme: dark;
}

/* ---------- Page ---------- */
* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 16px/1.5 var(--ui);
  background:
    radial-gradient(900px 500px at 0% -10%, rgba(255, 46, 151, .16), transparent 60%),
    radial-gradient(800px 500px at 100% 110%, rgba(38, 230, 255, .12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  padding-inline: 16px;
  padding-block: calc(18px + env(safe-area-inset-top, 0px)) calc(40px + env(safe-area-inset-bottom, 0px));
}
body.no-scroll { overflow: hidden; }

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---------- Header ---------- */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
}

.logo {
  margin: 0;
  font: 400 clamp(36px, 7vw, 58px)/1 var(--logo);
  color: var(--pink);
  text-shadow: var(--glow-pink);
  letter-spacing: .02em;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.who {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 15px;
}
.who input { width: 150px; padding: 8px 12px; font-size: 15px; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  gap: 20px;
  align-items: start;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(260px, 320px);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "make  stage feed"
    "remix stage feed";
}
.make { grid-area: make; }
.remix { grid-area: remix; }
.stage { grid-area: stage; }
.feedpanel { grid-area: feed; }

/* ---------- Panels and shared pieces ---------- */
.panel {
  background: rgba(19, 15, 54, .88);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

h2 {
  margin: 0;
  font: 700 20px/1.2 var(--ui);
}

.note {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.row { display: flex; flex-wrap: wrap; gap: 10px; }
.row input { flex: 1 1 180px; min-width: 0; }
.row button { flex: 1 0 auto; }

/* ---------- Form controls ---------- */
textarea,
input {
  width: 100%;
  font: 600 17px/1.4 var(--ui);
  color: var(--ink);
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  resize: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea::placeholder,
input::placeholder { color: #6E68A8; }
textarea:focus,
input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 16px rgba(38, 230, 255, .3);
}

button {
  font: 700 16px/1 var(--ui);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 18px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s, background .15s;
}
button:hover:not(:disabled) {
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}
button:active:not(:disabled) { transform: scale(.97); }
button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
button:disabled { opacity: .45; cursor: not-allowed; }

/* The main action buttons glow pink */
button.go {
  background: var(--pink);
  border-color: var(--pink);
  color: var(--pink-ink);
  font-size: 17px;
  padding: 15px 18px;
}
button.go:hover:not(:disabled) {
  border-color: var(--pink);
  box-shadow: var(--glow-pink);
}

button.ghost {
  padding: 8px 12px;
  font-size: 14px;
  color: var(--cyan);
  border-color: rgba(38, 230, 255, .4);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  text-align: left;
  font: 600 14px/1.2 var(--ui);
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--well);
}
.chip:hover:not(:disabled) { color: var(--ink); }

.status { font-weight: 700; color: var(--muted); min-height: 1.5em; }
.status:empty { display: none; }
.status.err { color: var(--pink); }

.credits {
  margin: 0;
  font-weight: 700;
  font-size: 14px;
  color: var(--gold);
}

/* ---------- The arcade cabinet ---------- */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.cabinet {
  width: 100%;
  /* As wide as possible while the whole cabinet still fits in the window's height */
  max-width: clamp(320px, calc((100vh - 250px) * 9 / 13 + 28px), 470px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 24px 24px 16px 16px;
  background: linear-gradient(180deg, #1C1650 0%, #110D30 100%);
  border: 2px solid #3A2F8A;
  box-shadow:
    0 0 0 1px rgba(255, 46, 151, .35),
    0 0 40px rgba(255, 46, 151, .22),
    0 0 90px rgba(38, 230, 255, .1);
}

/* The lit sign on top shows the game's name */
.marquee {
  border-radius: 14px 14px 6px 6px;
  padding: 12px 14px;
  text-align: center;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .03) 0 2px, transparent 2px 4px),
    #0A0722;
  border: 1px solid rgba(38, 230, 255, .35);
}
.marquee b {
  display: block;
  font: 700 clamp(20px, 3vw, 26px)/1.15 var(--ui);
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  letter-spacing: .03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 13;
  border-radius: 10px;
  overflow: hidden;
  background: #05030F;
  border: 2px solid #000;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, .8);
}
.screen iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px;
}
.prompt {
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* "Building your game" overlay */
.building {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
  background: #0B0820;
  font: 700 19px/1.3 var(--ui);
}
.building small { font: 600 14px var(--ui); color: var(--muted); }

.dots { display: flex; gap: 8px; }
.dots i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: var(--glow-pink);
  animation: bounce 1s infinite ease-in-out;
}
.dots i:nth-child(2) { background: var(--cyan); box-shadow: var(--glow-cyan); animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

/* Full screen mode */
.cabinet.is-full {
  position: fixed;
  inset: 0;
  z-index: 40;
  max-width: none;
  border-radius: 0;
  border: 0;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
}
.cabinet.is-full .marquee { padding: 8px; }
.cabinet.is-full .screen {
  flex: 1;
  aspect-ratio: auto;
}

/* ---------- High scores ---------- */
.scores {
  width: 100%;
  max-width: 470px;
}

.scorehead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.mybest {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}
.mybest b {
  margin-left: 6px;
  font-size: 24px;
  color: var(--pink);
  text-shadow: var(--glow-pink);
  font-variant-numeric: tabular-nums;
}

.board {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  counter-reset: rank;
}
.board li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--well);
  counter-increment: rank;
}
.board li::before {
  content: counter(rank);
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}
.board li:first-child::before { color: var(--gold); text-shadow: 0 0 10px rgba(255, 216, 77, .6); }
.board li.me { box-shadow: inset 0 0 0 1px var(--cyan); }
.board .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .score { font-weight: 700; font-variant-numeric: tabular-nums; }
.board li.empty { grid-template-columns: 1fr; color: var(--muted); font-weight: 600; }
.board li.empty::before { content: none; }

/* ---------- Feed ---------- */
.feed { display: flex; flex-direction: column; gap: 8px; }

.card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  text-align: left;
  border-radius: 12px;
  background: var(--well);
  border: 1px solid transparent;
}
.card[aria-current="true"] {
  border-color: var(--pink);
  box-shadow: 0 0 14px rgba(255, 46, 151, .35);
}

.card .icon {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font: 700 19px var(--ui);
  color: var(--bg);
}
.card .text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.card .text b { font: 700 15px/1.25 var(--ui); }
.card .text small {
  font: 600 13px/1.3 var(--ui);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Your face ---------- */
.face-button {
  flex: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  font-size: 15px;
}
.face-button .face {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--well);
  border: 1px dashed var(--cyan);
  color: var(--cyan);
  font-size: 18px;
  overflow: hidden;
}
.face-button .face img { width: 100%; height: 100%; object-fit: cover; }
.face-button.has-face .face { border: 2px solid var(--cyan); box-shadow: var(--glow-cyan); }

.selfie {
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100svh - 24px);
  overflow: auto;
  padding: 20px;
  border-radius: 18px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid #3A2F8A;
  box-shadow: 0 0 40px rgba(255, 46, 151, .25);
}
.selfie::backdrop { background: rgba(5, 3, 20, .82); }
.selfie[open] { display: flex; flex-direction: column; gap: 14px; }

.selfie-view {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: var(--well);
  display: grid;
  place-items: center;
}
.selfie-view video,
.selfie-view canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.selfie-view video { transform: scaleX(-1); }   /* mirror, like a phone's selfie camera */
.selfie-view .result {
  width: 62%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid var(--cyan);
  box-shadow: var(--glow-cyan);
}
.selfie-view .guide {
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  border: 2px dashed rgba(38, 230, 255, .7);
  pointer-events: none;
}
.selfie-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.selfie-actions button { flex: 1; }
.selfie .file-label {
  text-align: center;
  font-weight: 700;
  color: var(--cyan);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.selfie .file-label input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* ---------- Pop-up message ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--cyan);
  color: var(--bg);
  font: 700 16px var(--ui);
  box-shadow: var(--glow-cyan);
  z-index: 60;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Tablets and small laptops ---------- */
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "stage make"
      "stage remix"
      "stage feed";
  }
}

/* ---------- Phones: the game comes first and fills the screen ---------- */
@media (max-width: 760px) {
  body { padding-inline: 10px; }
  .wrap { gap: 14px; }
  .top { gap: 6px 12px; }
  .tagline { width: 100%; order: 3; font-size: 14px; }
  .who { margin-left: 0; width: 100%; order: 4; }
  .who input { flex: 1; width: auto; min-width: 0; }

  .layout {
    gap: 14px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: "stage" "make" "remix" "feed";
  }
  .stage { gap: 14px; }

  .cabinet {
    max-width: none;
    padding: 6px;
    gap: 6px;
    border-radius: 18px 18px 12px 12px;
  }
  .marquee { padding: 8px 10px; }
  .screen {
    aspect-ratio: auto;
    height: clamp(420px, 70svh, 760px);
  }
  .scores { max-width: none; }
}

/* ---------- People who turn off animations ---------- */
@media (prefers-reduced-motion: reduce) {
  .dots i { animation: none; }
  * { transition: none !important; }
}
