@font-face {
  font-family: Nastaliq;
  src: url('/shared/fonts/noto-nastaliq-urdu.woff2') format('woff2');
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: 'Trebuchet MS', system-ui, sans-serif;
  --ink: #203f35;
  --green: #245e48;
  --deep: #194835;
  --sun: #ffcf5a;
  --cream: #fff6d9;
  --papaya: #ff9859;
  background: #ffe5a2;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 49% 20%,#fff9dc,transparent 65%), #ffe5a2;
}
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button {
  min-width: 120px;
  min-height: 120px;
  border: 0;
  font: inherit;
  font-weight: 800;
  color: inherit;
  cursor: pointer;
}
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 5px solid #136f8d; outline-offset: 4px; }
button:active:enabled { translate: 0 3px; }
h1, h2, p { margin: 0; }

.toolbar {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 6px clamp(14px,2vw,38px) 0;
  background: var(--deep);
  box-shadow: 0 5px 0 #f3ab48;
  color: var(--cream);
  z-index: 2;
}
.tool {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .35em;
  padding: 0 16px;
  min-height: 120px;
  min-width: 120px;
  border-radius: 18px 18px 0 0;
  background: #2d6951;
  color: #fff7de;
  text-decoration: none;
  text-align: center;
  font-size: clamp(20px,1.55vw,32px);
  font-weight: 800;
}
.tool span { color: #ffdb79; font-size: 1.35em; line-height: 1; }
.brand {
  flex: 1;
  align-self: center;
  padding: 0 10px;
  text-align: center;
  font-family: Georgia, serif;
  font-weight: 900;
  font-size: clamp(30px,4.25vw,84px);
  line-height: .95;
  letter-spacing: -.045em;
  text-shadow: 0 3px #102f25;
}
.brand span { color: var(--sun); }
#app { flex: 1; display: grid; min-width: 0; }
.message { place-self: center; font-size: 36px; }
.market {
  align-self: stretch;
  width: min(100% - 80px,1650px);
  margin: 20px auto 0;
  position: relative;
  display: flex;
  flex-direction: column;
}
.awning {
  flex: 0 0 clamp(40px,6vh,68px);
  border-radius: 25px 25px 14px 14px;
  background: repeating-linear-gradient(90deg,#ed6f40 0 7.14%,#ffe9a9 7.14% 14.28%);
  border-bottom: 9px solid #a63d282e;
  box-shadow: 0 8px 0 #a961252c;
}
.market-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 29px 12px;
  gap: 20px;
}
.market h1, .celebration h1 {
  font: 900 clamp(48px,5vw,96px)/1 Georgia,serif;
  letter-spacing: -.055em;
}
.market-heading p { font-size: clamp(23px,2vw,38px); font-weight: 700; margin-top: 6px; }
.market-heading .fruit-spill { flex: 1; height: clamp(80px,11.6vh,125px); }
.duo-button, .primary, .secondary, .speaker, .hint-button, dialog button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .4em;
  padding: 0 23px;
  border-radius: 28px;
  background: var(--green);
  color: #fff7dc;
  box-shadow: inset 0 -6px #143f34, 0 4px #6a472125;
  font-size: clamp(24px,2.05vw,40px);
  line-height: 1.05;
}
.duo-button { padding: 0 30px; white-space: nowrap; }
.duo-button span { color: var(--sun); font-size: .7em; }
.shelves {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  grid-template-rows: repeat(2,minmax(125px,1fr));
  gap: 13px 15px;
  padding: 14px 20px 19px;
  border: 9px solid #a55934;
  border-radius: 18px 18px 11px 11px;
  background: linear-gradient(#89452e 0 48%,#b97749 48% 50%,#89452e 50%);
  box-shadow: inset 0 6px #66342255, 0 7px #693b2a42;
}
.level {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 10px 6px;
  position: relative;
  border-radius: 14px 14px 22px 22px;
  border: 3px solid #fff9da93;
  box-shadow: inset 0 -8px #9f592a29, 0 5px #522b24a0;
  background: var(--tile,#fff1b7);
  text-align: center;
}
.tile-2,.tile-6 { --tile: #ffd48f; --stamp: #984a2f; }
.tile-3,.tile-7 { --tile: #d8e6a4; --stamp: #386243; }
.tile-4,.tile-8 { --tile: #ffbc9a; --stamp: #9c433b; }
.level:disabled { background: #ead6ae; border-color: #faebcb9c; color: #55473a; }
.level-icon {
  display: grid;
  place-items: center;
  color: #fff6d7;
  background: var(--stamp,#397650);
  border-radius: 50%;
  width: 1.45em;
  height: 1.45em;
  font: 900 clamp(26px,2.55vw,52px)/1 Georgia,serif;
}
.level:disabled .level-icon { background: #806b51; }
.level-title { font-size: clamp(22px,2vw,40px); line-height: 1.05; }
.level-title b { color: var(--stamp,#245e48); }
.lock,.star-row { font-size: clamp(19px,1.8vw,34px); line-height: 1.1; }
.lock { color:#614e39; }
.star-row { display: inline-flex; gap: .13em; margin-top: 2px; }
.lit { color: #ffb900; text-shadow: 0 2px #874a2b, 1px 0 #874a2b, -1px 0 #874a2b; }
.unlit { color: #8d784f; }
.market footer { display: flex; justify-content: flex-end; }
.reset-button {
  background: transparent;
  min-height: 120px;
  padding: 0 13px;
  font-size: clamp(18px,1.3vw,25px);
  text-decoration: underline;
  color: #654b35;
}

.boards { display: grid; min-width: 0; }
.duo { grid-template-columns: repeat(2,minmax(0,1fr)); }
.board { min-width: 0; display: flex; flex-direction: column; padding: clamp(15px,2vh,24px) clamp(20px,3.6vw,74px); }
.duo .board { padding: 14px clamp(12px,1.5vw,30px) 18px; }
.duo .board + .board { border-left: 8px double #32765a; background: #fce5b2; }
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0 12px; }
.round-label { font-size: clamp(20px,1.75vw,36px); font-weight: 900; }
.round-track { display: flex; gap: clamp(4px,.55vw,10px); }
.round-track i { width: clamp(9px,1vw,20px); aspect-ratio: 1; border: 2px solid #9a8457; border-radius: 50%; }
.round-track .done { background: #639751; border-color: #4e713d; }
.round-track .current { background: #ffad4d; border-color: #8f5629; }
.puzzle {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0,1.15fr) minmax(0,1fr);
  gap: clamp(18px,3vw,60px);
  align-items: center;
  padding: 0 0 20px;
}
.clue-side,.answer-side { text-align: center; min-width: 0; }
.clue-side h2,.answer-title {
  font: 900 clamp(29px,3vw,63px)/1.04 Georgia,serif;
  letter-spacing: -.035em;
}
.answer-title { margin: 0 0 16px; }
.clue-actions { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 10px; }
.scene:has(.basket-tap) { margin-bottom: 40px; }
.clue-actions:empty { display: none; }
.speaker { background: #e3f0b8; color: #275540; box-shadow: inset 0 -6px #b2c57c; }
.hint-button,.secondary { background: #ffe093; color: #523b27; box-shadow: inset 0 -6px #dfa64c; }
.scene {
  position: relative;
  isolation: isolate;
  margin: 9px auto 0;
  width: min(100%,66vh,720px);
  aspect-ratio: 520 / 290;
  border-radius: 50% 50% 28px 28px;
  background: radial-gradient(ellipse at 50% 65%,#fff3ae 5%,#ffd675 56%,transparent 69%);
}
.vessel { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fruit-window { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; }
.hidden-fruit { position: absolute; width: 46%; left: 27%; top: 0; }
.hidden-fruit svg,.reveal-fruit svg,.card-art svg,.finish-art svg { display: block; width: 100%; height: 100%; }
.scene-peek .hidden-fruit { top: calc(6% - var(--hint) * 8%); }
.scene-small-peek .hidden-fruit { top: calc(29% - var(--hint) * 9%); }
.scene-shadow .hidden-fruit { top: -11%; animation: colour-in 12s var(--elapsed) both; }
.scene-shadow.helped .hidden-fruit { animation: none; }
@keyframes colour-in {
  0%, 26% { filter: brightness(0) opacity(.85); }
  100% { filter: brightness(1) opacity(1); }
}
.scene-cut .hidden-fruit { width: 39%; left: 30.5%; top: -11%; }
.scene-zoom .fruit-window {
  inset: 0 22% 38%;
  border: 5px solid #f9c765;
  border-radius: 40px 40px 24px 24px;
  background: #fff5c9;
}
.scene-zoom .hidden-fruit { inset: -10% 24% auto; width: 52%; animation: zoom-out 13s var(--elapsed) both; }
.scene-zoom.helped .hidden-fruit { animation-delay: calc(var(--elapsed) - var(--hint) * 3300ms); }
@keyframes zoom-out { from { scale: 4.8; } to { scale: 1; } }
.basket-tap {
  position: absolute;
  inset: auto 17% -6%;
  display: grid;
  align-items: end;
  justify-items: center;
  background: transparent;
  color: #fff1d2;
  border-radius: 20px;
  min-height: max(120px,43%);
  padding: 0;
  font-size: clamp(21px,1.8vw,35px);
}
.basket-tap span {
  background: #5c3624;
  border: 2px solid #eab46f;
  border-radius: 12px;
  padding: .15em .8em;
}
.riddle-scene { width: min(100%,820px); min-height: 230px; aspect-ratio: auto; background: #ffdfa1; border: 3px solid #e2ab54; }
.riddle-scene .vessel { opacity: .20; }
.riddle {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  text-align: left;
  gap: 14px;
  padding: clamp(13px,2vw,33px);
  min-height: 230px;
}
.riddle p,.slice-hint { font-size: clamp(23px,2.22vw,44px); line-height: 1.1; font-weight: 800; }
.riddle p + p { margin-top: .38em; padding-top: .38em; border-top: 2px solid #9d62276b; }
.splash {
  flex: 0 0 clamp(64px,8vw,146px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 61% 39% 67% 33% / 41% 55% 45% 59%;
  background: var(--swatch,#428557);
  border: 3px solid #734b3640;
  box-shadow: 7px 7px #874e2930, inset 7px 8px #ffffff46;
  color: #fff4cc;
  font: 900 clamp(44px,6vw,108px)/1 Georgia,serif;
}
.slice-hint {
  position: absolute;
  inset: auto 0 0;
  background: #fff0c4;
  padding: 8px 12px;
  border-radius: 15px;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2,minmax(120px,1fr));
  gap: clamp(12px,1.35vw,25px);
  margin: 0 auto;
}
.answer {
  min-width: 120px;
  height: clamp(120px,23vh,253px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1px;
  background: #fff8df;
  border: 3px solid #d59b52;
  border-radius: 23px;
  box-shadow: inset 0 -7px #f4dfad, 0 5px #9a5c3035;
  padding: 6px 8px 11px;
  font-size: clamp(25px,3vw,60px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.answer:disabled { opacity: .46; }
.card-art {
  display: grid;
  width: min(96%,clamp(105px,19vh,209px));
  aspect-ratio: 1;
  place-items: center;
}
.emoji { font-family: 'Segoe UI Emoji','Noto Color Emoji',sans-serif; font-size: clamp(76px,14vh,152px); line-height: 1; }
.picture-word .card-art { width: min(86%,clamp(80px,15vh,165px)); }
.picture-word .emoji { font-size: clamp(58px,11vh,125px); }
.picture-word .card-word { font-size: clamp(24px,2.05vw,39px); }
.retry .clue-side { animation: wobble .35s ease-out; }
@keyframes wobble { 25% { rotate: -1deg; } 65% { rotate: 1deg; } }

.reveal { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.reveal-scene { width: min(100%,78vh,800px); }
.reveal-fruit { position: absolute; z-index: 1; width: 55%; top: -29%; left: 22.5%; animation: bounce .65s cubic-bezier(.17,.8,.33,1.2) both; }
@keyframes bounce {
  from { opacity: 0; transform: translateY(39%) scale(.65); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.reveal-card { text-align: center; padding: 24px 14px; border-radius: 36px; background: #fff4cf; border: 4px solid #dc9c50; }
.reveal-card h2 { font: 900 clamp(46px,6vw,116px)/1 Georgia,serif; letter-spacing: -.045em; overflow-wrap: anywhere; }
.urdu { font: clamp(35px,4.1vw,82px)/1.95 Nastaliq,serif; }
.reveal-actions,.finish-actions,.dialog-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 13px; }
.burst { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; }
.burst i {
  position: absolute;
  top: 40%;
  left: 50%;
  width: 15px;
  height: 20px;
  border-radius: 65% 35%;
  background: var(--drop);
  color: var(--drop);
  animation: fly .85s ease-out both;
}
.burst i:nth-child(5n),.burst i:nth-child(5n+1) { background: none; font: 900 43px/1 Georgia,serif; }
@keyframes fly {
  0% { opacity: 0; transform: rotate(var(--turn)) translateX(15px) scale(.3); }
  28% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--turn)) translateX(calc(var(--distance) * 1.7)) scale(1.1); }
}

.picker,.waiting,.celebration { text-align: center; }
.picker,.waiting { display: grid; align-content: center; flex: 1; }
.picker h2,.waiting h2 { font: 900 clamp(37px,4vw,76px)/1 Georgia,serif; }
.picker p,.waiting p,.celebration p { font-size: clamp(22px,2.25vw,43px); margin: 8px 0; font-weight: 700; }
.picker-grid { display: grid; grid-template-columns: repeat(4,minmax(120px,1fr)); gap: 9px; margin-top: 12px; }
.picker .level { min-height: clamp(120px,18vh,195px); }
.picker .level-title { font-size: clamp(17px,1.55vw,31px); }
.duo .puzzle { display: flex; flex-direction: column; justify-content: center; gap: clamp(8px,1vh,18px); padding: 0; }
.duo .clue-side,.duo .answer-side { width: 100%; }
.duo .clue-side h2,.duo .answer-title { font-size: clamp(25px,2.2vw,43px); }
.duo .answer-title { margin-bottom: 7px; }
.duo .scene { width: min(100%,49vh,540px); margin-top: 5px; }
.duo .riddle-scene { width: 100%; min-height: 0; }
.duo .riddle { min-height: 110px; padding: 10px; }
.duo .splash { flex-basis: clamp(55px,5vw,100px); }
.duo .riddle p,.duo .slice-hint { font-size: clamp(22px,1.85vw,37px); }
.duo .answers { grid-template-columns: repeat(var(--cards),minmax(120px,1fr)); gap: 8px; }
.duo .answer { height: clamp(120px,18vh,200px); font-size: clamp(23px,2.1vw,41px); }
.duo .card-art { width: min(100%,clamp(93px,13vh,150px)); }
.duo .emoji { font-size: clamp(65px,10vh,110px); }
.duo .picture-word .card-art { width: min(82%,clamp(76px,11vh,124px)); }
.duo .picture-word .emoji { font-size: clamp(51px,8vh,90px); }
.duo .picture-word .card-word { font-size: clamp(18px,1.55vw,30px); }
.duo .reveal { gap: 0; }
.duo .reveal-card { width: min(94%,530px); padding: 14px; }
.duo .urdu { font-size: clamp(31px,3.2vw,64px); }
.duo .reveal-card h2 { font-size: clamp(36px,4vw,75px); }
.finish-icon { font-size: clamp(64px,8vw,152px); color: #bd6f13; }
.celebration {
  width: min(100% - 56px,1260px);
  place-self: center;
  position: relative;
  background: #fff5d1;
  border: 6px solid #e5a951;
  border-radius: 50px 50px 36px 36px;
  padding: 16px 20px 26px;
  box-shadow: 0 12px #ac69204a;
}
.celebration .star-row { font-size: clamp(56px,6.5vw,125px); }
.fruit-spill { display: flex; justify-content: center; height: clamp(82px,16vh,175px); }
.fruit-spill svg { width: auto; max-width: 29%; height: 100%; }
.fruit-spill svg:first-child { rotate: -13deg; }
.fruit-spill svg:last-child { rotate: 13deg; }
.finish-actions { margin-top: 16px; }
.scores { display: flex; justify-content: center; gap: clamp(25px,6vw,115px); margin-top: 18px; font-size: clamp(24px,2.3vw,44px); }
.scores strong { display: block; color: #2e7050; font-size: 1.55em; }
dialog {
  border: 5px solid #d59142;
  border-radius: 26px;
  background: #fff2c7;
  color: var(--ink);
  padding: 30px;
  text-align: center;
  font-size: clamp(22px,2vw,39px);
}
dialog::backdrop { background: #273a2ab5; }
dialog p { margin: 10px 0 20px; }
.paused * { animation-play-state: paused !important; }

@media (max-height: 850px) {
  .market { margin-top: 12px; }
  .market-heading { padding-bottom: 5px; }
  .board-head { padding: 2px 0 7px; }
  .board { padding-top: 12px; padding-bottom: 10px; }
  .puzzle { padding-bottom: 6px; }
  .duo .riddle p,.duo .slice-hint { font-size: clamp(21px,1.85vw,34px); }
}
@media (max-width: 1000px) {
  .toolbar { flex-wrap: wrap; justify-content: center; }
  .brand { order: -1; flex: 0 0 100%; }
  .market { width: calc(100% - 30px); }
  .market-heading .fruit-spill { display: none; }
  .shelves { grid-template-columns: repeat(2,minmax(120px,1fr)); }
  .puzzle { grid-template-columns: 1fr; gap: 12px; }
  .duo .answers,.picker-grid { grid-template-columns: repeat(2,minmax(120px,1fr)); }
}
@media (max-width: 570px) {
  .duo { grid-template-columns: 1fr; }
  .duo .board + .board { border-left: none; border-top: 8px double #32765a; }
  .market-heading { flex-wrap: wrap; padding: 12px 5px; }
}
@media (prefers-reduced-motion: reduce) {
  .hidden-fruit,.reveal-fruit,.retry .clue-side,.burst i { animation: none !important; }
  .scene-shadow:not(.helped) .hidden-fruit { animation: colour-in 12s var(--elapsed) both !important; }
  .scene-zoom:not(.helped) .hidden-fruit { animation: zoom-out 13s var(--elapsed) both steps(4,end) !important; }
  .burst { display: none; }
}
