:root {
  --yellow: #FFED00;
  --yellow-h: #F5DC00;
  --ink: #111111;
  --white: #FFFFFF;
  --grey: #6B6B6B;
  --grey-2: #9E9E9E;
  --soft: #F4F4F4;
  --disabled: #E8E8E8;
  --fun-d: #FF5A36;
  --fun-c: #7C5CFF;
  --fun-v: #00C2A8;
  --radius: 28px;
  --pad: 20px;
  --safe-b: max(18px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--white); color: var(--ink); }
body {
  font-family: Manrope, system-ui, sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden;
}
.dela { font-family: "Dela Gothic One", sans-serif; font-weight: 400; letter-spacing: -0.01em; line-height: 1.08; }

#app { height: 100%; display: flex; flex-direction: column; }

.gate, .locked {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px var(--pad);
  gap: 16px;
}
.locked h1 { font-size: 32px; }
.locked p { color: var(--grey); max-width: 280px; }
.locked--tab {
  height: 100%;
  min-height: 280px;
  justify-content: flex-start;
  padding-top: 48px;
}

.top {
  padding: 14px var(--pad) 8px;
}
.top small {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--grey-2);
}
.top h2 { font-size: 24px; margin-top: 4px; }
.top--neuro h2 {
  font-size: 30px;
  max-width: 11.5em;
  margin-top: 8px;
  line-height: 1.05;
}
.top--result {
  padding: 10px var(--pad) 12px;
}
.top--result small { display: none; }
.top--result.top--neuro h2 {
  font-size: 20px;
  max-width: none;
  margin-top: 0;
}

.pages { flex: 1; overflow: hidden; position: relative; }
.page {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 8px var(--pad) 110px;
  display: none;
}
.page.on { display: block; }
.page.on.page--result {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 6px;
  padding-bottom: 88px;
}

.program-card {
  background: var(--ink);
  color: var(--white);
  border-radius: var(--radius);
  padding: 24px 22px;
  box-shadow: 0 10px 30px rgba(17,17,17,.10);
}
.program-card .city { color: var(--yellow); font-weight: 800; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.program-card h3 { font-size: 28px; margin: 10px 0 8px; }
.program-body { margin-top: 18px; color: #ddd; white-space: pre-wrap; }
.sched { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.sched-item {
  background: rgba(255,255,255,.06);
  border-radius: 18px;
  padding: 12px 14px;
}
.sched-item--break {
  background: var(--yellow);
  color: var(--ink);
}
.sched-item--block { background: rgba(255,237,0,.12); }
.sched-time {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--yellow);
  margin-bottom: 4px;
}
.sched-item--break .sched-time { color: rgba(17,17,17,.55); }
.sched-title { font-family: "Dela Gothic One", sans-serif; font-size: 18px; }
.sched-name { font-family: "Dela Gothic One", sans-serif; font-size: 16px; line-height: 1.2; }
.sched-org { color: #cbb8ff; font-weight: 800; font-size: 12px; margin-top: 4px; }
.sched-topic { color: #ddd; font-size: 13px; margin-top: 4px; }

.photo-box--hero { min-height: 320px; }
.photo-box--compact img { height: 180px; }
.hint { color: var(--grey); text-align: center; font-weight: 800; font-size: 14px; margin-top: 8px; }

.neuro {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 10px;
}
.neuro-lead {
  font-weight: 800;
  font-size: 18px;
  line-height: 1.35;
  color: var(--ink);
}
.neuro-body {
  color: var(--grey);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.5;
}
.neuro .btn { margin-top: 10px; }
.btn-link {
  appearance: none;
  border: 0;
  background: none;
  font-family: Manrope, sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: var(--grey);
  cursor: pointer;
  padding: 10px 8px;
  text-align: center;
}
.btn-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.photo-box {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #2a2a2a;
  min-height: 220px;
  display: grid;
  place-items: center;
  color: #fff;
  cursor: pointer;
}
.photo-box img { width: 100%; height: 260px; object-fit: cover; display: block; }
.pill-top {
  position: absolute; top: 12px; left: 12px;
  background: var(--yellow); color: var(--ink);
  font-weight: 800; font-size: 12px; letter-spacing: .04em;
  padding: 6px 10px; border-radius: 999px;
}
.cam-hint { color: #fff; font-weight: 800; text-align: center; padding: 20px; }
.shutter-row { display: flex; justify-content: center; margin: 16px 0 8px; }
.btn--fab {
  width: 76px; height: 76px; border-radius: 999px; font-size: 28px;
}

.page--magic,
.page--pick,
.page--result { overflow: hidden; }

.pick {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 18px;
  min-height: 0;
}
.pick-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 0;
}
.pick-title {
  text-align: center;
  font-size: 20px;
  margin: 0;
}
.pick .tpl-grid { flex: 1; align-content: start; }
.pick .cta { margin-top: auto; }
.photo-box--thumb {
  width: 72px;
  height: 72px;
  min-height: 72px;
  flex-shrink: 0;
  border-radius: 20px;
}
.photo-box--thumb img {
  width: 100%;
  height: 100%;
}
.photo-box--thumb .cam-hint {
  font-size: 11px;
  padding: 4px;
}
.pick-head .btn {
  flex: 1;
  height: 48px;
  font-size: 15px;
}

.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tpl {
  border: none;
  border-radius: 20px;
  padding: 12px 40px 12px 12px;
  min-height: 0;
  text-align: left;
  cursor: pointer;
  display: block;
  box-shadow: 0 4px 14px rgba(17,17,17,.06);
  color: var(--ink);
  position: relative;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1);
}
.tpl:active { transform: scale(.94); }
.tpl .emoji {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 22px;
  line-height: 1;
}
.tpl .t-name { font-family: "Dela Gothic One", sans-serif; font-size: 14px; line-height: 1.15; }
.tpl .t-desc { font-size: 11px; font-weight: 800; color: rgba(17,17,17,.55); margin-top: 4px; line-height: 1.3; }
.tpl--0 { background: var(--yellow); }
.tpl--1 { background: #FFD4C8; }
.tpl--2 { background: #D9D0FF; }
.tpl--3 { background: #C8F4E4; }
.tpl.on::after {
  content: "✓";
  position: absolute; top: 8px; left: 8px;
  width: 20px; height: 20px; border-radius: 999px;
  background: var(--ink); color: #fff;
  font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
}
.tpl.on .t-name { padding-left: 18px; }

.btn {
  appearance: none; border: 0; cursor: pointer;
  font-family: Manrope, sans-serif; font-weight: 800; font-size: 17px; line-height: 1;
  border-radius: 999px; height: 56px; padding: 0 22px;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), background .15s;
}
.btn:active { transform: scale(.95); }
.btn--primary { background: var(--yellow); color: var(--ink); box-shadow: 0 10px 26px rgba(255,237,0,.45); }
.btn--primary:hover { background: var(--yellow-h); }
.btn--dark { background: var(--ink); color: #fff; }
.btn--soft { background: var(--soft); color: var(--ink); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--block { width: 100%; }
.btn:disabled { background: var(--disabled); color: var(--grey-2); box-shadow: none; cursor: default; transform: none; }

.cta { margin-top: 14px; }

.page--magic { overflow: hidden; }
.magic {
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 8vh;
}
.queue-note {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.25;
  color: var(--ink);
  background: var(--yellow);
  border-radius: 999px;
  padding: 10px 16px;
  margin: 0 12px 8px;
  box-shadow: 0 8px 20px rgba(255,237,0,.35);
}
.queue-note[hidden] { display: none !important; }
.magic-stage {
  flex: 1;
  display: grid;
  place-items: end center;
  width: 100%;
  padding-bottom: 12px;
}
.magic-circle {
  position: relative;
  width: 236px;
  height: 236px;
  border-radius: 999px;
  border: 3px solid var(--yellow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 18px 20px;
}
.magic-circle .ring {
  position: absolute;
  inset: -3px;
  width: auto;
  height: auto;
  border-radius: 999px;
  border: 3px solid var(--yellow);
  opacity: .35;
  animation: pulse 2.6s ease-out infinite;
}
.orb { font-size: 64px; animation: pop .5s cubic-bezier(.34,1.56,.64,1); }
.magic-circle .orb { font-size: 48px; position: relative; z-index: 1; animation: pop .5s cubic-bezier(.34,1.56,.64,1); }
.magic-circle h3 {
  font-size: 22px;
  position: relative;
  z-index: 1;
}
.magic-foot {
  flex: 0 0 36%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding-top: 18px;
}
.prog { width: 180px; height: 8px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.prog i { display: block; height: 100%; width: 20%; background: var(--yellow); border-radius: 999px; animation: fill 70s ease-in-out infinite; }
.sub { color: var(--grey); font-weight: 800; }

.result {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: auto;
  gap: 14px;
}
.result-img {
  flex: 1 1 0;
  min-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #111;
  cursor: zoom-in;
}
.result-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 32%;
  display: block;
}
.page--result .act-row { margin: 0; }
.page--result .act {
  padding: 10px 6px;
  border-radius: 16px;
}
.page--result .act .ic { font-size: 18px; margin-bottom: 4px; }
.page--result .btn { height: 48px; padding: 0 16px; font-size: 16px; }
.act-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 0; }
.act {
  background: var(--soft); border-radius: 18px; padding: 14px 8px;
  text-align: center; font-weight: 800; font-size: 12px; cursor: pointer;
}
.act .ic { display: block; font-size: 20px; margin-bottom: 6px; }

.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.g-card { border-radius: 20px; overflow: hidden; background: var(--soft); }
.g-card img { width: 100%; height: 160px; object-fit: cover; display: block; }
.g-card span { display: block; padding: 10px 12px 12px; font-weight: 800; font-size: 13px; }
.empty { color: var(--grey); text-align: center; padding: 40px 10px; }

.tabs {
  position: sticky; bottom: 0;
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  background: #fff;
  padding: 8px 10px var(--safe-b);
  box-shadow: 0 -8px 24px rgba(17,17,17,.06);
}
.tab {
  border: 0; background: transparent;
  font-family: Manrope, sans-serif; font-weight: 800; font-size: 11px;
  color: var(--grey-2); padding: 8px 4px; cursor: pointer;
}
.tab.on { color: var(--ink); }
.tab .ic { display: block; font-size: 18px; margin-bottom: 2px; }

.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-weight: 800; font-size: 14px;
  padding: 12px 16px; border-radius: 999px; z-index: 20;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #000;
  cursor: zoom-out;
}
.lightbox.on { display: grid; place-items: center; }
.lightbox img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes pulse { to { transform: scale(1.35); opacity: 0; } }
@keyframes pop { from { transform: scale(.6); } }
@keyframes fill { 0% { width: 12%; } 50% { width: 70%; } 100% { width: 92%; } }

@media (prefers-reduced-motion: reduce) {
  .ring, .orb, .prog i, .btn { animation: none; transition: none; }
}
