:root {
  --plum: #24142e;
  --plum2: #3a2147;
  --cream: #fbf3e4;
  --cream2: #f1e4cc;
  --ink: #2a1d33;
  --tang: #ff6b35;
  --mustard: #ffc43d;
  --teal: #1fa39a;
  --pink: #e83f8a;
  --muted: #7a6a80;
  --line: #e2d2b6;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  color: var(--ink);
  font-family: 'DM Sans', system-ui, sans-serif;
  background:
    radial-gradient(1100px 700px at 8% -10%, #51295f 0%, transparent 60%),
    radial-gradient(900px 700px at 110% 115%, #6a2140 0%, transparent 60%),
    var(--plum);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; color: inherit; }

#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

#top {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; color: var(--cream);
  padding-top: max(8px, env(safe-area-inset-top));
}
.logo {
  font-family: 'Shrikhand', cursive; font-size: 26px; line-height: 1;
  background: none; border: 0; color: var(--cream); cursor: pointer; padding: 4px 2px;
  text-shadow: 2px 2px 0 var(--tang), 4px 4px 0 var(--pink), 6px 6px 0 rgba(0, 0, 0, 0.3);
}
.logo .amp { color: var(--mustard); margin: 0 5px; }
.badge {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); color: var(--cream2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.badge.pro { background: var(--pink); color: #fff; }
.badge.career { background: var(--teal); color: #fff; }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--cream); background: transparent;
  color: var(--cream); font-weight: 800; font-size: 16px; cursor: pointer;
}
.icon-btn.off { opacity: 0.4; text-decoration: line-through; }
.pill-btn {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--cream); background: var(--cream);
  color: var(--ink); font-weight: 700; cursor: pointer;
}

#main {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 14px;
  padding: 0 14px 14px; min-height: 0;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
#stageWrap {
  position: relative; border-radius: 22px; overflow: hidden; background: #1c3d3f; min-height: 0;
  box-shadow: 0 0 0 3px var(--ink), 7px 7px 0 rgba(0, 0, 0, 0.35);
}
#stage { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.stage-hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(36, 20, 46, 0.78); color: var(--cream); font-size: 13px; font-weight: 600;
  padding: 6px 14px; border-radius: 999px; pointer-events: none; transition: opacity 0.3s; white-space: nowrap;
  backdrop-filter: blur(4px);
}

#panel {
  background: var(--cream); border-radius: 22px; display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  box-shadow: 0 0 0 3px var(--ink), 7px 7px 0 rgba(0, 0, 0, 0.35);
}
.steps { display: flex; list-style: none; margin: 0; padding: 12px 12px 6px; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.steps li {
  flex: 1; text-align: center; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 6px 4px; border-radius: 999px; color: var(--muted); background: var(--cream2); white-space: nowrap;
}
.steps li.done { background: #d5ecdc; color: #2d6a4f; }
.steps li.cur { background: var(--ink); color: var(--cream); }
.step-body { flex: 1; overflow-y: auto; padding: 4px 16px 16px; -webkit-overflow-scrolling: touch; }
.step-nav { display: flex; gap: 10px; padding: 12px 16px; border-top: 2px dashed var(--line); align-items: center; }

.btn {
  font: 700 15px 'DM Sans', sans-serif; border-radius: 14px; padding: 11px 16px; border: 2.5px solid var(--ink);
  cursor: pointer; background: #fff; color: var(--ink); box-shadow: 3px 3px 0 var(--ink); transition: transform 0.06s, box-shadow 0.06s;
  touch-action: manipulation;
}
.btn:active:not(:disabled), .btn.down { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--tang); color: #fff; flex: 1; }
.btn.primaryish { background: var(--mustard); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; padding-left: 4px; padding-right: 4px; }
.btn.ghostish { background: transparent; box-shadow: none; border-style: dashed; margin-top: 8px; }
.btn.small { font-size: 13px; padding: 8px 12px; border-width: 2px; box-shadow: 2px 2px 0 var(--ink); border-radius: 11px; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn.hold {
  width: 100%; margin: 6px 0 10px; padding: 16px; font-size: 17px; background: var(--teal); color: #fff;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.btn.hold.down { background: #137a73; }
.btn.neutral { width: 100%; background: #6fc3ff; margin: 6px 0; }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }

.step-title { font-family: 'Shrikhand', cursive; font-weight: 400; font-size: 27px; margin: 6px 0 2px; letter-spacing: 0.3px; }
.step-sub { color: var(--muted); font-size: 14px; margin: 0 0 10px; line-height: 1.4; }
.group { margin: 12px 0; }
.lbl { display: block; font-weight: 800; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
.note { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 6px 0; }
.tapnote { color: var(--ink); background: #fff3cf; border-radius: 10px; padding: 7px 10px; font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.row.col { flex-direction: column; }
.modal-card .row .btn { white-space: nowrap; }
.row.col .btn { width: 100%; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  flex: 1 1 auto; font: 700 13.5px 'DM Sans', sans-serif; padding: 9px 10px; border-radius: 11px; border: 2px solid var(--ink);
  background: #fff; cursor: pointer; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  touch-action: manipulation;
}
.seg button.on { background: var(--ink); color: var(--cream); }
.seg button:disabled { opacity: 0.4; cursor: not-allowed; border-style: dashed; }
.lk { width: 12px; height: 12px; flex: none; }

.range-head { display: flex; justify-content: space-between; align-items: baseline; }
.rv { font-weight: 700; font-size: 13px; }
input[type='range'] { width: 100%; accent-color: var(--tang); height: 28px; }

.check {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 8px;
  border: 2px solid var(--ink); border-radius: 14px; background: #fff; cursor: pointer;
}
.check b { display: block; font-size: 15px; }
.check small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.check .box { width: 24px; height: 24px; flex: none; border-radius: 7px; border: 2.5px solid var(--ink); background: #fff; position: relative; }
.check.on { background: #e5f5ea; }
.check.on .box { background: var(--teal); border-color: var(--teal); }
.check.on .box::after { content: ''; position: absolute; left: 6px; top: 1px; width: 6px; height: 12px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.check:disabled { opacity: 0.45; }

.tcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 4px; }
.tcard {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 14px;
  border: 2px solid var(--ink); background: #fff; cursor: pointer; font-weight: 700; font-size: 12.5px;
}
.tcard svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tcard span { display: inline-flex; gap: 4px; align-items: center; }
.tcard svg.lk { width: 12px; height: 12px; stroke: currentColor; }
.tcard.on { background: var(--mustard); box-shadow: 2px 2px 0 var(--ink); }
.tcard:disabled { opacity: 0.38; border-style: dashed; cursor: not-allowed; }

.bottles { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.bottle {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px;
  border: 2px solid transparent; background: transparent; cursor: pointer; font-size: 10.5px; font-weight: 700; line-height: 1.15; text-align: center;
}
.bottle .bsvg { width: 26px; height: 48px; transition: transform 0.15s; }
.bottle:hover .bsvg { transform: translateY(-3px) rotate(-6deg); }
.bottle.on { border-color: var(--ink); background: #fff; box-shadow: 2px 2px 0 var(--ink); }
.bottle.on .bsvg { transform: translateY(-3px) rotate(-10deg); }
.bottle.add .plus { width: 30px; height: 48px; display: grid; place-items: center; font-size: 26px; border: 2px dashed var(--ink); border-radius: 10px; }

.status { font-size: 13px; font-weight: 700; margin: 6px 0; min-height: 18px; display: flex; gap: 6px; flex-wrap: wrap; }
.pill { background: var(--cream2); padding: 4px 10px; border-radius: 999px; }
.result-box { background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 14px; margin: 10px 0; font-size: 15px; line-height: 1.45; }
.result-box b { font-size: 22px; }
.meter { position: relative; height: 30px; border-radius: 999px; border: 2px solid var(--ink); background: #3b2a28; overflow: hidden; margin-bottom: 10px; }
.meter-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #8fd3ff, #dff4ff); transition: width 0.2s; }
.meter span { position: relative; display: block; text-align: center; line-height: 26px; font-size: 13px; font-weight: 700; color: #fff; mix-blend-mode: difference; }

.scoreline { display: flex; align-items: center; gap: 12px; margin: 6px 0 10px; }
.score { font-family: 'Shrikhand', cursive; font-size: 46px; line-height: 1; color: var(--tang); text-shadow: 2px 2px 0 var(--ink); }
.stars { font-size: 26px; letter-spacing: 2px; display: inline-flex; }
.star { color: #d8ccb6; }
.star.on { color: var(--mustard); text-shadow: 1px 1px 0 var(--ink); }
.rating { font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; font-size: 13px; color: var(--muted); }

/* tutor */
.tutor {
  position: absolute; left: 14px; bottom: 14px; right: 14px; max-width: 470px; display: flex; gap: 12px; align-items: flex-start;
  background: var(--cream); border-radius: 18px; padding: 12px 14px; box-shadow: 0 0 0 3px var(--ink), 5px 5px 0 rgba(0, 0, 0, 0.35);
}
.tutor.pop { animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes pop { from { transform: translateY(20px) scale(0.95); opacity: 0; } to { transform: none; opacity: 1; } }
.tutor-av { width: 54px; height: 54px; flex: none; animation: sway 4s ease-in-out infinite; }
@keyframes sway { 50% { transform: rotate(8deg); } }
.tutor-name { font-family: 'Shrikhand', cursive; color: var(--tang); font-size: 16px; }
#tutorText { font-size: 14px; line-height: 1.45; margin: 2px 0 8px; }
.tutor-ok { border: 2px solid var(--ink); background: var(--mustard); border-radius: 10px; padding: 5px 14px; font-weight: 800; cursor: pointer; }

.busy {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px;
  background: rgba(36, 20, 46, 0.35); color: var(--cream); font-weight: 800; font-size: 16px;
}
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, 0.25); border-top-color: var(--mustard); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(20, 10, 26, 0.68); display: grid; place-items: center; z-index: 20; padding: 16px; backdrop-filter: blur(3px); }
.modal[hidden], .tutor[hidden], .busy[hidden] { display: none; }
.modal-card {
  background: var(--cream); border-radius: 24px; padding: 22px; width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
  box-shadow: 0 0 0 3px var(--ink), 8px 8px 0 rgba(0, 0, 0, 0.4); animation: pop 0.3s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.modal-card.wide { width: min(900px, 100%); }
.modal-title { font-family: 'Shrikhand', cursive; font-weight: 400; font-size: 30px; margin: 0 0 4px; }
.modal-sub { color: var(--muted); margin: 0 0 14px; font-size: 14px; }

.menu { text-align: center; }
.menu-card { background: radial-gradient(circle at 50% 0%, #fff7e8, var(--cream) 60%); }
.menu-logo { font-family: 'Shrikhand', cursive; font-size: clamp(42px, 10vw, 64px); line-height: 1; color: var(--cream); margin-top: 6px;
  text-shadow: 3px 3px 0 var(--tang), 6px 6px 0 var(--pink), 9px 9px 0 var(--teal), 12px 12px 0 var(--ink); -webkit-text-stroke: 2px var(--ink); }
.menu-logo .amp { color: var(--mustard); margin: 0 8px; }
.menu-tag { margin: 18px 0 18px; font-weight: 700; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; font-size: 12.5px; }
.menu-btns { display: grid; gap: 10px; }
.mbtn {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 14px 18px; border-radius: 18px; border: 3px solid var(--ink);
  cursor: pointer; box-shadow: 4px 4px 0 var(--ink); transition: transform 0.08s;
}
.mbtn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.mbtn b { font-family: 'Shrikhand', cursive; font-weight: 400; font-size: 23px; }
.mbtn small { font-size: 13px; font-weight: 600; opacity: 0.85; }
.mbtn.career { background: var(--mustard); }
.mbtn.free { background: var(--teal); color: #fff; }
.mbtn.pro { background: var(--pink); color: #fff; }
.mbtn.gal { background: #fff; }
.menu-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 16px; }
.linkbtn { background: none; border: 0; text-decoration: underline; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px; }

.lessons { display: grid; gap: 8px; margin-bottom: 8px; }
.lesson { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--ink); background: #fff; cursor: pointer; text-align: left; }
.lesson .ln { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--cream); display: grid; place-items: center; font-weight: 800; flex: none; }
.lesson .lt { flex: 1; }
.lesson .lt b { display: block; font-size: 15.5px; }
.lesson .lt small { color: var(--muted); font-size: 12.5px; }
.lesson .stars { font-size: 18px; }
.lesson.locked { opacity: 0.45; border-style: dashed; cursor: not-allowed; }

.intro { text-align: center; }
.intro-av { width: 84px; height: 84px; margin: 0 auto 6px; animation: sway 4s ease-in-out infinite; }
.intro-text { font-size: 15.5px; line-height: 1.55; text-align: left; }
.goals { text-align: left; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 10px 14px; margin: 12px 0; }
.goals ul { margin: 6px 0 0; padding-left: 20px; }
.goals li { margin: 3px 0; font-size: 14px; }
.goals li.bonus { color: var(--muted); font-style: italic; }
.goals.res ul { list-style: none; padding-left: 0; }
.goals.res li::before { display: inline-block; width: 22px; font-weight: 900; }
.goals.res li.ok::before { content: '✓'; color: #2d9a5f; }
.goals.res li.no::before { content: '✗'; color: #d0473a; }

.results { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.res-img { width: 100%; border-radius: 16px; box-shadow: 0 0 0 3px var(--ink); display: block; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; margin: 10px 0; }
.stats div { background: #fff; border-radius: 10px; padding: 6px 8px; border: 1.5px solid var(--line); }
.stats small { display: block; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.stats b { font-size: 17px; }
.notes ul { padding-left: 0; list-style: none; margin: 6px 0; }
.notes li { font-size: 13.5px; line-height: 1.45; padding: 6px 0 6px 26px; position: relative; border-bottom: 1px dashed var(--line); }
.notes li::before { position: absolute; left: 2px; top: 5px; font-weight: 900; }
.notes li.good::before { content: '✓'; color: #2d9a5f; }
.notes li.tip::before { content: '!'; color: #fff; background: var(--tang); border-radius: 50%; width: 17px; height: 17px; display: grid; place-items: center; font-size: 12px; top: 7px; }
.unlocks { background: var(--mustard); border: 2px solid var(--ink); border-radius: 12px; padding: 8px 12px; margin: 10px 0; font-size: 14px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.gitem { padding: 0; border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; background: #fff; cursor: pointer; text-align: left; }
.gitem img { width: 100%; display: block; aspect-ratio: 1; object-fit: cover; }
.gitem span { display: flex; justify-content: space-between; padding: 6px 8px; font-weight: 700; font-size: 12.5px; gap: 6px; }
.gitem small { color: var(--tang); }
.gbig { width: 100%; max-width: 560px; display: block; margin: 0 auto 12px; border-radius: 16px; box-shadow: 0 0 0 3px var(--ink); }

.mixer { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: center; }
.mixprev { width: 110px; height: 110px; border-radius: 50%; border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.mixrow { display: grid; grid-template-columns: 18px 72px 1fr; gap: 8px; align-items: center; font-size: 13px; font-weight: 700; text-transform: capitalize; }
.mixsw { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--ink); }
.txt { width: 100%; font: 600 15px 'DM Sans', sans-serif; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--ink); background: #fff; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--cream); padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
  transition: all 0.25s; z-index: 30; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 860px) {
  /* Phone: stage pinned on top, the panel scrolls underneath it. */
  #top { padding: 6px 12px; gap: 8px; }
  .logo { font-size: 21px; }
  .pill-btn { padding: 0 10px; height: 32px; font-size: 13px; }
  .icon-btn { width: 32px; height: 32px; }
  #main { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 10px; padding: 0 10px 10px; }
  #stageWrap { height: min(100vw - 20px, 50dvh); }
  .steps { padding: 8px 10px 4px; }
  .step-body { padding: 2px 14px 12px; }
  .step-title { font-size: 23px; }
  .step-nav { padding: 8px 12px; }
  .btn { padding: 10px 14px; }
  .tutor { left: 8px; right: 8px; bottom: 8px; padding: 10px; gap: 8px; }
  .tutor-av { width: 40px; height: 40px; }
  #tutorText { font-size: 13px; }
  .results { grid-template-columns: 1fr; }
  .res-img { max-width: 420px; margin: 0 auto; }
  .tcards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 420px) {
  .badge { display: none; }
  .mixer { grid-template-columns: 1fr; justify-items: center; }
  .mixer > div:last-child { width: 100%; }
}
