/* hidden always wins over a display set below (e.g. .logo-prev's flex). */
[hidden] { display: none !important; }
/* MeInTheGame portal: the buyer sets up their child's game. Same palette as the site (v1). */
@font-face { font-family: "Nunito"; src: url(../assets/fonts/Nunito-Black.ttf) format("truetype"); font-weight: 900; font-display: swap; }
@font-face { font-family: "Poppins"; src: url(../assets/fonts/Poppins-SemiBold.ttf) format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --pink: #e0578f; --pink-soft: #ffe0ec; --sun: #f6c443; --grass: #3f9d3c;
  --bg: #fff8ef; --surface: #fffdf9; --surface-2: #fff3e6; --ink: #2c2433; --soft: #6c6380; --line: #f0e2d4;
  --bad: #c0392b; --shadow: 0 10px 30px rgba(80, 50, 40, .10), 0 2px 6px rgba(80, 50, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #17131f; --surface: #221c2e; --surface-2: #2b2338; --ink: #f6eefc; --soft: #b8aec8; --line: #3a3048; --pink-soft: #4a2638; }
}
:root[data-theme="dark"] { --bg: #17131f; --surface: #221c2e; --surface-2: #2b2338; --ink: #f6eefc; --soft: #b8aec8; --line: #3a3048; --pink-soft: #4a2638; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
h1, h2 { font-family: "Nunito", system-ui, sans-serif; font-weight: 900; line-height: 1.2; }
h1 { font-size: 28px; margin: 0 0 8px; }
h2 { font-size: 21px; margin: 0 0 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; max-width: 1040px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; font-family: "Nunito"; font-weight: 900; color: var(--ink); text-decoration: none; font-size: 20px; }
.brand img { width: 28px; height: 28px; }
.top-right { display: flex; gap: 12px; }
main { max-width: 1040px; margin: 0 auto; padding: 8px 16px 64px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin: 0 0 16px; box-shadow: var(--shadow); }
.narrow { max-width: 520px; margin: 40px auto; }
.soft { color: var(--soft); margin: 0 0 12px; }
.small { font-size: 14px; }
.notice { background: var(--pink-soft); border-radius: 12px; padding: 10px 14px; }
.ok { color: var(--grass); }
.num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--pink); color: #fff; font-size: 16px; }
.count { font: 600 14px "Poppins", sans-serif; background: var(--surface-2); border-radius: 999px; padding: 2px 10px; color: var(--soft); }
.count.full { background: var(--pink-soft); color: var(--pink); }
.btn { font: 600 16px "Poppins", sans-serif; background: var(--pink); color: #fff; border: 0; border-radius: 999px; padding: 12px 24px; cursor: pointer; min-height: 44px; }
.btn:disabled { opacity: .5; cursor: default; }
a.btn { display: inline-block; text-decoration: none; }
.btn.small { padding: 6px 14px; font-size: 14px; min-height: 0; }
.link { background: none; border: 0; color: var(--soft); font: inherit; cursor: pointer; padding: 6px; }
input, select { font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; min-height: 44px; }
label { display: grid; gap: 4px; font-size: 14px; color: var(--soft); margin: 0 0 10px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 16px; }
label.check input { width: 20px; height: 20px; min-height: 0; }
#loginForm { display: grid; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--bg); padding: 10px 0; margin-bottom: 8px; }
.bar.bottom { position: static; }
.plan { font-family: "Nunito"; font-weight: 900; font-size: 20px; }
.games { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.games a { display: flex; justify-content: space-between; padding: 14px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }

.cast { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.person { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: start; }
.person.off { opacity: .55; }
.person.off .fields { display: none; }
.person h3 { margin: 0 0 6px; font-size: 16px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.face { width: 84px; height: 84px; border-radius: 50%; border: 2px dashed var(--line); background: var(--surface-2) center / cover no-repeat; display: grid; place-items: center; text-align: center; font-size: 12px; color: var(--soft); cursor: pointer; }
.face.has { border: 2px solid var(--pink); color: transparent; }
.face.over, .drop.over { border-color: var(--pink); background-color: var(--pink-soft); }
details summary { cursor: pointer; color: var(--soft); font-size: 14px; margin: 4px 0; }
.forms { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.forms label { margin-bottom: 6px; }
.forms input { min-height: 36px; padding: 6px 8px; }

.quests { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.quest { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; cursor: pointer; color: var(--ink); font-size: 15px; margin: 0; }
.quest input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; flex: none; }
.quest.on { border-color: var(--pink); background: var(--pink-soft); }
.quest.locked { opacity: .45; cursor: default; }
.quest b { display: block; }
.quest small { color: var(--soft); }
.chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; display: flex; gap: 8px; align-items: center; cursor: pointer; color: var(--ink); margin: 0; font-size: 15px; }
.chip.on { border-color: var(--pink); background: var(--pink-soft); }
.chip.locked { opacity: .45; }
.chip input { width: 18px; height: 18px; min-height: 0; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 3px var(--pink); }
.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 26px; text-align: center; color: var(--soft); cursor: pointer; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.thumb .row { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; }
.thumb input { min-height: 34px; padding: 4px 8px; font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 120px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; transition: transform .25s; max-width: calc(100% - 32px); }
.toast.show { transform: translate(-50%, 0); }
@media (max-width: 520px) {
  .person { grid-template-columns: 64px minmax(0, 1fr); }
  .face { width: 64px; height: 64px; }
  h1 { font-size: 24px; }
}
.sub { font-family: "Nunito"; font-size: 17px; margin: 18px 0 4px; }
.logo-prev { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.logo-prev img { max-width: 320px; width: 60%; border-radius: 12px; background: var(--surface-2); }
.thumb .redo { margin-left: auto; }
.face-wrap { position: relative; }
.zoom-btn { position: absolute; right: -4px; bottom: -4px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; padding: 0; }
.thumb img, .logo-prev img { cursor: zoom-in; }
.zoom { position: fixed; inset: 0; z-index: 50; background: rgba(20, 16, 28, .88); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.zoom img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
#orderCard summary { cursor: pointer; font-size: 17px; }
.order { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 6px 14px; margin: 12px 0 0; }
.order dt { color: var(--soft); }
.order dd { margin: 0; white-space: pre-wrap; }

.cast-add { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--soft); }
#castAddList { display: contents; }
.add-chip { cursor: pointer; border: 2px dashed var(--pink); background: transparent; color: var(--pink); font-weight: 700; padding: 6px 14px; border-radius: 999px; font: inherit; font-weight: 700; }
.add-chip:hover { background: var(--pink-soft); }
.remove-person { border: 0; background: transparent; color: var(--soft); font-size: 16px; cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.remove-person:hover { background: var(--pink-soft); color: var(--pink); }
.no-photo { margin: 0; font-size: 13.5px; color: var(--pink); }

/* Loading screens: big, whole (the phone's long shape), the caption across the card */
.thumbs.screens { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.screens .shot { position: relative; }
.screens .shot img { aspect-ratio: 2048 / 928; object-fit: cover; }
.screens .zoom-hint { position: absolute; right: 8px; top: 8px; background: rgba(255,255,255,.85); border-radius: 999px; padding: 2px 7px; font-size: 14px; pointer-events: none; }
.screens .row { align-items: center; }
.screens .row input { flex: 1; min-width: 0; }
.zoom img { max-width: 96vw; max-height: 92vh; }

.hero-look { margin: 16px 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.hero-look h3 { margin: 0 0 2px; font-size: 16px; }
.look-row { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 10px; }
.look-row .swatches { margin: 6px 0; }
.look-row .swatch { width: 36px; height: 36px; }
.look-grid { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: center; margin-top: 8px; }
.look-3d { position: relative; width: 240px; height: 320px; border-radius: 16px; background: radial-gradient(circle at 50% 40%, #fffaf2, #f6e6d6); border: 1px solid var(--line); overflow: hidden; touch-action: pan-y; }
.look-3d canvas { width: 100% !important; height: 100% !important; display: block; cursor: grab; }
.look-3d.loading::after { content: '…'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; color: var(--soft); }
.look-spin { position: absolute; right: 10px; bottom: 8px; color: var(--soft); font-size: 18px; pointer-events: none; }
.look-row .chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
@media (max-width: 560px) { .look-grid { grid-template-columns: minmax(0, 1fr); justify-items: center; } .look-grid > div:last-child { justify-self: stretch; min-width: 0; } .look-row { grid-template-columns: 70px 1fr; } }

.plate-row { display: grid; gap: 6px; margin: 4px 0 14px; max-width: 320px; }
.plate { display: flex; align-items: stretch; border: 3px solid #222; border-radius: 8px; overflow: hidden; background: #fff; width: 230px; }
.plate i { width: 22px; background: #2e5eb8; }
.plate input { border: 0; border-radius: 0; background: #fff; font: 800 22px/1 "Nunito", system-ui, sans-serif; letter-spacing: 2px; text-align: center; text-transform: uppercase; min-height: 44px; }

.chip.soon { opacity: .75; }
.chip.soon::after { content: '•'; color: var(--pink); margin-left: -2px; font-weight: 900; }
#lookRows .look-row { grid-template-columns: 120px 1fr; }
#lookRows .chip { padding: 6px 12px; font-size: 14px; }
#lookRows .swatch { width: 30px; height: 30px; }

.look-summary { margin: 0 0 10px; font-weight: 600; line-height: 1.5; }
.look-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }

/* Look editor: five folded groups with a summary each */
.look-groups { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.look-group { min-width: 0; }
.look-group { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.look-group > summary { list-style: none; cursor: pointer; padding: 11px 14px; display: flex; gap: 12px; align-items: baseline; }
.look-group > summary::-webkit-details-marker { display: none; }
.look-group > summary::after { content: '›'; margin-left: auto; color: var(--soft); transition: transform .15s; font-size: 18px; }
.look-group[open] > summary::after { transform: rotate(90deg); }
.look-group > summary b { white-space: nowrap; }
.lg-sum { color: var(--soft); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lg-body { padding: 4px 14px 12px; border-top: 1px solid var(--line); }
.lg-body .look-row { grid-template-columns: 150px 1fr; }
.look-select { max-width: 260px; min-height: 38px; padding: 6px 10px; }
@media (max-width: 560px) { .lg-body .look-row { grid-template-columns: 1fr; gap: 4px; } }
#heroLook .look-grid { align-items: start; }
#heroLook .look-3d { position: sticky; top: 96px; }

.modal { position: fixed; inset: 0; z-index: 60; background: rgba(20, 16, 28, .55); display: grid; place-items: center; padding: 16px; }
.modal-card { background: var(--surface); border-radius: 18px; padding: 22px; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-card h3 { margin: 0 0 8px; }
.modal-actions { display: flex; gap: 14px; justify-content: flex-end; align-items: center; margin-top: 14px; }
#look3d iframe { width: 100%; height: 100%; border: 0; display: block; }

.look-btn { display: flex; gap: 6px; align-items: baseline; width: 100%; text-align: left; margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font: inherit; font-size: 14px; color: var(--ink); }
.look-btn { flex-wrap: wrap; align-items: center; }
.look-btn b { flex: 1; min-width: 0; }
/* The summary on its own line under the title, at most two lines (the card stays in its column). */
.look-btn .look-sum { order: 3; flex-basis: 100%; color: var(--soft); font-size: 13px; line-height: 1.35; min-width: 0;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.modal-card.look-dialog { max-width: 980px; width: 100%; max-height: 92vh; overflow: auto; }
.look-dialog .look-3d iframe { width: 100%; height: 100%; border: 0; display: block; }
.look-dialog .look-grid { align-items: start; }
.look-dialog .look-3d { position: sticky; top: 0; }

/* An AI run (portal/app.js runAi): its buttons are off and a bar says what it is doing. */
.ai-busy #aiBtn, .ai-busy #lookFromPhoto, .ai-busy [data-ai], .ai-busy #logoRedo, .ai-busy .thumb button { opacity: .45; pointer-events: none; }
#aiBusy { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: flex; gap: 10px; align-items: center;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 999px; background: #2b2230; color: #fff; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); }
#aiBusy[hidden] { display: none; }
#aiBusy .spin { width: 18px; height: 18px; flex: none; border: 3px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: aispin .8s linear infinite; }
@keyframes aispin { to { transform: rotate(360deg); } }

/* The child's name and boy/girl disagree (portal/app.js genderHint). */
.gender-hint { margin: 4px 0 10px; padding: 10px 12px; border-radius: 10px; background: #fff3cd; color: #6b4e00; font-size: 14px; }
.gender-hint[hidden] { display: none; }

/* Redraw one portrait (person card): opposite the zoom button. */
.redo-face { position: absolute; left: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 16px; line-height: 1; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.redo-face[hidden] { display: none; }
.ai-busy .redo-face { opacity: .45; pointer-events: none; }
.thumb .row { align-items: center; justify-content: space-between; }
/* A quest picture not drawn yet: an empty frame of the same shape. */
.screens .shot.empty { aspect-ratio: 2048 / 928; background: repeating-linear-gradient(45deg, #f6eadf 0 12px, #fbf3ec 12px 24px); border-radius: 12px; }
.screens .shot.empty img { display: none; }
#drawingThumbs img { object-fit: contain; background: #fff; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--pink, #d94f86); text-decoration: underline; cursor: pointer; }
.linkish:disabled { opacity: .5; cursor: default; }
