/* Each color has one job, so the eye learns it fast:
   ink = text · deep blue = headings and links · gold = the Lamp, the main button and money ·
   green = came true / OK · red = delete and errors. Gold is never used for text (1.8:1 on paper). */
:root{
  --blue:#2BA9E0;
  --blue-deep:#1478A8;
  --gold:#FBB417;
  --gold-soft:#FFD45E;
  --gold-deep:#E09A00;
  --ink:#141414;
  --red:#C9271D;
  --green:#178048;
  --paper:#FFFDF6;
  --cream:#FFF6E3;
  --muted:#5E5646;
  --line:rgba(20,20,20,.12);   /* quiet lines around cards */
  --field:#8A8274;             /* borders of things you type in or tap: soft, but 3.7:1 so they stay visible */
  --shadow:0 1px 2px rgba(20,20,20,.05),0 6px 20px rgba(20,20,20,.07);
  --shadow-up:0 2px 4px rgba(20,20,20,.06),0 12px 28px rgba(20,20,20,.11);
  /* spacing steps: the main gaps on the page all come from these */
  --s1:8px;--s2:16px;--s3:24px;--s4:48px;--s5:clamp(72px,12vw,112px);
  --head:'Lilita One','Baloo Bhaijaan 2',system-ui,sans-serif;
  --body:'Baloo 2','Baloo Bhaijaan 2',system-ui,sans-serif;
}
html[lang="ar"]{
  --head:'Baloo Bhaijaan 2','Lilita One',system-ui,sans-serif;
  --body:'Baloo Bhaijaan 2','Baloo 2',system-ui,sans-serif;
}
*,*::before,*::after{margin:0;padding:0;box-sizing:border-box;}
html{-webkit-text-size-adjust:100%;}
body{
  /* plain warm paper */
  background:linear-gradient(#fff 0%, var(--paper) 55%, var(--cream) 100%);
  font-family:var(--body);
  color:var(--ink);
  line-height:1.45;
  min-height:100svh;
  overflow-x:hidden;
  -webkit-tap-highlight-color:transparent;
}
::selection{background:var(--gold);color:var(--ink);}
[hidden]{display:none !important;}
html[lang="ar"] h1,html[lang="ar"] h2,html[lang="ar"] h3,html[lang="ar"] .btn,
html[lang="ar"] label,html[lang="ar"] legend,html[lang="ar"] .tab,html[lang="ar"] .wall-all,html[lang="ar"] .more-btn{font-weight:800;}

/* ---------- top bar ---------- */
.top{
  max-width:1140px;margin:0 auto;padding:14px 16px;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
}
.brand{display:flex;align-items:center;gap:8px;text-decoration:none;}
.brand img{width:52px;height:auto;filter:drop-shadow(1px 2px 0 rgba(20,20,20,.25));}
.brand span{
  font-family:'Lilita One',sans-serif;font-size:1.25rem;color:var(--blue);
  -webkit-text-stroke:1px var(--ink);letter-spacing:.02em;
}
.top-right{display:flex;align-items:center;gap:2px;}
/* the globe and the social links: plain icons, no circles, each with a thumb-sized tap area */
.lang-btn,.socials a{
  width:44px;height:44px;display:grid;place-items:center;padding:0;border:0;border-radius:50%;
  background:none;color:var(--ink);cursor:pointer;transition:background-color .15s ease;
}
.lang-btn:hover,.socials a:hover{background:rgba(20,20,20,.06);}
/* the globe: the same key that switches Arabic and English on phone keyboards */
.lang-btn svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;}
/* lang.js hides the English words of an Arabic visit until app.js swaps them in, so English never flashes.
   If the scripts fail, the words show anyway after 3 seconds. */
html.i18n-wait [data-i18n]{visibility:hidden;animation:i18n-show 0s 3s forwards;}
@keyframes i18n-show{to{visibility:visible;}}
.lang-btn:focus-visible,.socials a:focus-visible,.btn:focus-visible,.tx-link:focus-visible{outline:3px solid var(--blue-deep);outline-offset:3px;}
.socials{display:flex;gap:2px;}
.socials svg{width:19px;height:19px;}

/* ---------- layout: one column, three parts, room to breathe between them ---------- */
.wrap{max-width:1140px;margin:0 auto;padding:var(--s1) var(--s2) var(--s5);}
/* the wish box sits close under the hook, high on the first screen; the Wall and the steps get more air */
#wish{margin-top:var(--s3);scroll-margin-top:var(--s3);}
.part-wall,.coin{margin-top:var(--s5);}
.part-head{text-align:center;margin:0 auto var(--s3);max-width:640px;}
.part-head h2{font-family:var(--head);font-weight:400;font-size:clamp(1.95rem,6.2vw,2.7rem);line-height:1.12;color:var(--blue-deep);}
.part-head h2 label{display:inline;font:inherit;margin:0;cursor:pointer;}
.part-sub{margin-top:var(--s1);font-size:1.05rem;font-weight:600;color:var(--muted);text-wrap:balance;}

/* ---------- 1 · the hook ---------- */
/* registered so the Lamp's fill level can animate smoothly */
@property --fill{syntax:'<percentage>';inherits:true;initial-value:0%;}
.scene{text-align:center;display:flex;flex-direction:column;align-items:center;padding-top:clamp(8px,2vw,24px);}
/* small on purpose: the wish question below is the one big thing on the screen.
   The other genies are grey; this Genie is the same deep blue as the question */
h1{font-family:var(--head);font-weight:400;line-height:1.12;margin:0 0 clamp(12px,3vw,24px);}
.h1-a,.h1-b{display:block;text-wrap:balance;animation:rise .7s cubic-bezier(.2,.8,.3,1) both;}
.h1-a{font-size:clamp(1rem,2.6vw,1.2rem);color:var(--muted);}
.h1-b{font-size:clamp(1.12rem,3vw,1.4rem);margin-top:.15em;animation-delay:.45s;color:var(--blue-deep);}
html[lang="ar"] h1{line-height:1.35;}

.lamp-caption{opacity:0;transition:opacity .7s ease;}
.scene.told .lamp-caption{opacity:1;}

/* the Lamp is the meter: a pale ghost of the lamp, with gold rising from the base as it fills */
.lamp{
  --fill:0%;position:relative;width:clamp(132px,36vw,190px);
  transition:--fill 2.2s cubic-bezier(.25,.8,.3,1);
  animation:rise .8s .7s cubic-bezier(.2,.8,.3,1) both;
}
.lamp-art{position:relative;aspect-ratio:900/542;filter:drop-shadow(0 6px 6px rgba(20,20,20,.14));}
.lamp img{position:absolute;inset:0;width:100%;height:100%;}
.lamp-empty{filter:grayscale(1) brightness(1.25);opacity:.3;}
.lamp-gold{
  -webkit-mask-image:linear-gradient(to top,#000 calc(var(--fill) - 4%),transparent calc(var(--fill) + 4%));
          mask-image:linear-gradient(to top,#000 calc(var(--fill) - 4%),transparent calc(var(--fill) + 4%));
}
/* a full Lamp glows, still, once the gold has risen */
.lamp.glow .lamp-art{filter:drop-shadow(0 0 10px rgba(251,180,23,.8));transition:filter 1.2s ease 2s;}
.lamp-caption{margin-top:var(--s1);font-size:.88rem;font-weight:700;color:var(--muted);text-wrap:balance;}
.lamp-caption.came-true{color:var(--green);font-weight:800;}
.lamp-caption:empty{display:none;}
.lamp-why{margin-top:4px;font-style:italic;max-width:34em;margin-inline:auto;}

/* ---------- 2 · the wish: the main element of the page ---------- */
.panel{
  position:relative;max-width:600px;margin:0 auto;background:#fff;border:1px solid var(--line);border-radius:24px;
  box-shadow:var(--shadow);padding:var(--s3);
}
/* the biggest words on the page, in one object with the box they ask you to fill */
#askHead{margin-bottom:var(--s2);scroll-margin-top:calc(var(--s3) + var(--s3));}
#askHead h2{font-size:clamp(2.4rem,7vw,3rem);text-wrap:balance;}
/* room to breathe: 32px between boxes, 8px from a question to its own box, so each question stays with its box */
.field{border:0;margin:0 0 calc(var(--s3) + var(--s1));min-width:0;}
label,legend{display:block;font-family:var(--head);font-weight:400;font-size:1.08rem;margin-bottom:var(--s1);}
.count{font-size:.85rem;color:var(--muted);font-variant-numeric:tabular-nums;}
.count.over{color:var(--red);font-weight:800;}
input[type="text"],textarea{
  width:100%;font:inherit;font-size:1.06rem;color:var(--ink);
  padding:.7rem .9rem;border:1.5px solid var(--field);border-radius:12px;background:var(--paper);
  transition:border-color .15s ease,box-shadow .15s ease;
}
textarea{resize:vertical;min-height:100px;line-height:1.4;}
input::placeholder,textarea::placeholder{color:#776F61;}
input[type="text"]:focus,textarea:focus{outline:none;border-color:var(--blue-deep);box-shadow:0 0 0 4px rgba(20,120,168,.18);}
input[aria-invalid="true"],textarea[aria-invalid="true"]{border-color:var(--red);background:#FFF4F3;}
.affix{
  display:flex;align-items:stretch;border:1.5px solid var(--field);border-radius:12px;background:var(--paper);
  overflow:hidden;transition:border-color .15s ease,box-shadow .15s ease;
}
.affix > span{display:grid;place-items:center;padding:0 .85rem;font-weight:800;color:var(--muted);background:var(--cream);border-right:1px solid var(--line);}
.affix input[type="text"]{border:0;border-radius:0;background:transparent;box-shadow:none;}
.affix:focus-within{border-color:var(--blue-deep);box-shadow:0 0 0 4px rgba(20,120,168,.18);}
.affix:has(input[aria-invalid="true"]){border-color:var(--red);background:#FFF4F3;}
.field-err{color:var(--red);font-size:.92rem;font-weight:700;margin-top:5px;}
.field-err:empty,.form-err:empty{display:none;}
.under-row{display:flex;align-items:flex-start;gap:10px;margin-top:5px;}
.under-row .field-err{margin-top:0;}
.under-row .count{margin-inline-start:auto;}
/* the rest of the form slides open once the wish is being written (padding keeps focus rings unclipped) */
.more{display:grid;grid-template-rows:0fr;transition:grid-template-rows .55s cubic-bezier(.2,.8,.3,1);}
.more.open{grid-template-rows:1fr;}
.more-inner{overflow:hidden;min-height:0;padding:4px 4px 0;margin-inline:-4px;}
.more:not(.open) .more-inner{visibility:hidden;} /* or Arabic marks peek out of the closed slit */
/* the wish box grows with the words (app.js sets its height), so nobody scrolls inside a small box */
#fWish{resize:none;overflow:hidden;font-size:1.18rem;min-height:132px;}
.affix .ok{display:grid;place-items:center;padding:0 .85rem;font-style:normal;font-weight:900;color:var(--green);}
.made-line{text-align:center;font-size:.92rem;font-weight:700;color:var(--muted);margin-top:12px;}
/* clipped in place — an off-screen offset (left:-9999px) becomes a sideways scroll in RTL */
.hp{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}

/* ---------- buttons ---------- */
.btn{
  font-family:var(--head);font-weight:400;font-size:1.05rem;letter-spacing:.02em;
  text-decoration:none;cursor:pointer;color:var(--ink);
  padding:.75rem 1.2rem;border-radius:14px;border:1.5px solid transparent;
  display:inline-flex;align-items:center;justify-content:center;gap:.5rem;
  box-shadow:var(--shadow);transition:transform .12s ease,box-shadow .12s ease;
}
.btn:hover{transform:translateY(-1px);box-shadow:var(--shadow-up);}
.btn:active{transform:translateY(1px);box-shadow:var(--shadow);}
.btn svg{width:20px;height:20px;flex:none;}
.btn-gold{background:var(--gold);}
.btn-ink{background:var(--ink);color:#fff;}
.btn-blue{background:var(--blue-deep);color:#fff;}
.btn-white{background:#fff;border-color:var(--field);}
.submit{width:100%;font-size:1.4rem;padding:.85rem 1.2rem;margin-top:4px;}
.submit[disabled]{opacity:.75;cursor:progress;transform:none;}
.form-err{color:var(--red);font-weight:800;text-align:center;margin-top:12px;}

/* ---------- after the wish ---------- */
.done{text-align:center;position:relative;scroll-margin-top:var(--s4);}
/* "Wish #n" for screen readers only: the card shows the number */
.done h2{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;outline:none;}
.card-canvas{
  display:block;width:100%;max-width:460px;height:auto;aspect-ratio:1/1;margin:12px auto;
  border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);background:var(--cream);
}
.done-text{font-weight:700;}
.share{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;margin-top:6px;}
.share .btn{font-size:.88rem;padding:.4rem .9rem;border-radius:12px;}
.share .btn svg{width:15px;height:15px;}

.tx-link{display:inline-block;margin-top:6px;font-weight:800;color:var(--blue-deep);}

/* ---------- 3 · what $GENIE is: three steps, then the launch status ---------- */
.coin-steps{list-style:none;display:grid;gap:var(--s2);grid-template-columns:minmax(0,1fr);max-width:980px;margin:0 auto;}
@media (min-width:760px){.coin-steps{grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--s3);}}
.coin-steps li{
  display:grid;grid-template-columns:auto 1fr;column-gap:12px;row-gap:4px;align-items:start;align-content:start;
  background:#fff;border:1px solid var(--line);border-radius:20px;box-shadow:var(--shadow);padding:var(--s2) var(--s3);
}
.coin-steps .num{
  grid-row:span 2;display:grid;place-items:center;width:34px;height:34px;border-radius:50%;
  background:var(--blue-deep);color:#fff;font-family:'Lilita One',sans-serif;font-size:1.05rem;
}
.coin-steps b{font-family:var(--head);font-weight:400;font-size:1.15rem;line-height:1.2;padding-top:5px;}
html[lang="ar"] .coin-steps b{font-weight:800;}
.coin-steps p{color:#3a342a;font-weight:600;line-height:1.4;}
.coin-status{
  max-width:980px;margin:var(--s3) auto 0;display:flex;flex-wrap:wrap;align-items:center;gap:12px var(--s2);
  background:#fff;border:1px solid var(--line);border-radius:20px;box-shadow:var(--shadow);padding:var(--s2) var(--s3);
}
.coin-status > div{flex:1 1 280px;}
.coin-status strong{display:block;font-family:var(--head);font-weight:400;font-size:1.15rem;}
html[lang="ar"] .coin-status strong{font-weight:800;}
.coin-status p{font-weight:600;line-height:1.45;color:#3a342a;margin-top:2px;}

/* ---------- footer ---------- */
.foot{
  background:var(--ink);color:#fff;text-align:center;padding:var(--s4) var(--s2);
  display:grid;gap:var(--s1);justify-items:center;
}
.foot-safe{max-width:52ch;line-height:1.55;}
.disclaimer{font-size:.84rem;opacity:.75;max-width:62ch;}
.copy{font-size:.8rem;opacity:.5;}

/* ---------- the "it will be public" note, and deleting your wish ---------- */
.btn-red{background:var(--red);color:#fff;}
.mine-confirm{width:100%;margin-top:14px;}
.mine-confirm p{font-weight:800;color:var(--red);margin-bottom:10px;}
.confirm-btns{display:grid;grid-template-columns:1fr 1fr;gap:10px;}
.confirm-btns .btn{font-size:1rem;padding:.6rem .6rem;}
.link-btn{
  font:inherit;font-weight:800;color:var(--blue-deep);background:none;border:0;cursor:pointer;
  text-decoration:underline;text-underline-offset:3px;padding:2px 0;
}
.link-btn.quiet{color:var(--muted);font-weight:700;font-size:.92rem;}
.link-btn:focus-visible{outline:3px solid var(--blue-deep);outline-offset:2px;border-radius:4px;}
.done-links{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:6px 18px;margin-top:14px;}
.done .form-err:empty{display:none;}

/* ---------- 3 · the Wish Wall (home: the latest wishes · wishes.html: all of them) ---------- */
.wall-wrap{max-width:1140px;margin:0 auto;padding:var(--s1) var(--s2) var(--s5);}
.wall-head{text-align:center;margin:var(--s3) 0 var(--s4);}
.wall-head h1{font-size:clamp(1.95rem,6.2vw,2.7rem);margin:0;color:var(--blue-deep);}
.wall-head .btn{margin-top:var(--s3);}
#shared{scroll-margin-top:var(--s2);} /* a shared link opens on its wish */

/* the wish the Lamp is filling for, or the one a shared link points at */
.featured{max-width:600px;margin:0 auto var(--s4);}
.featured-label{text-align:center;font-family:var(--head);font-size:1.08rem;color:var(--blue-deep);margin-bottom:10px;}

/* sort: plain words, the chosen one in blue with a line under it */
.tabs{display:flex;flex-wrap:wrap;justify-content:center;gap:0 var(--s3);margin-bottom:var(--s3);}
.tab{
  min-height:44px;padding:0 2px;font-family:var(--head);font-weight:400;font-size:1.02rem;color:var(--muted);cursor:pointer;
  background:none;border:0;border-bottom:2px solid transparent;transition:color .15s ease;
}
.tab:hover{color:var(--ink);}
.tab[aria-pressed="true"]{color:var(--blue-deep);border-bottom-color:var(--blue-deep);}
.tab:focus-visible,.wheart:focus-visible,.wall-all:focus-visible,.more-btn:focus-visible{outline:3px solid var(--blue-deep);outline-offset:2px;}

/* one column on every screen, the same width as the wish box, with room between the cards */
.wgrid{display:grid;gap:var(--s3);grid-template-columns:minmax(0,1fr);max-width:600px;margin-inline:auto;}

/* a wish card has three levels: the words, the name, then the small details.
   A thin line and no shadow, so the wish box stays the strongest box on the site */
.wcard{
  display:flex;flex-direction:column;gap:var(--s1);padding:var(--s3) var(--s3) 12px;
  background:#fff;border:1px solid var(--line);border-radius:20px;
}
/* the wish the Lamp is filling for: the one card as strong as the wish box */
.wcard.big{border-radius:24px;box-shadow:var(--shadow);}
.wcard.big .wtext{font-size:1.32rem;}
.wcard.flash{animation:flash 1.1s ease 3;}
.wtext{font-size:1.2rem;font-weight:600;line-height:1.5;overflow-wrap:anywhere;}
.wbar{height:8px;border-radius:999px;background:#F1EBDD;overflow:hidden;margin-top:var(--s1);}
.wbar i{display:block;height:100%;background:linear-gradient(90deg,var(--gold-soft),var(--gold));}
.wof{margin-top:-2px;font-size:.88rem;font-weight:600;color:var(--muted);}
.wtrue{font-size:.92rem;font-weight:700;color:var(--green);}
.wtrue a{color:var(--blue-deep);font-weight:600;}
/* these lines read in the page's direction, but line up with the wish above them */
.wcard[dir="ltr"] .wof,.wcard[dir="ltr"] .wtrue{text-align:left;}
.wcard[dir="rtl"] .wof,.wcard[dir="rtl"] .wtrue{text-align:right;}
.wcard-foot{display:flex;align-items:center;gap:var(--s1);}
.wby{flex:1;min-width:0;line-height:1.3;}
.wby b{display:block;font-weight:700;font-size:.98rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.whandle{display:flex;align-items:center;gap:4px;font-size:.84rem;font-weight:600;color:var(--muted);white-space:nowrap;}
.whandle bdi{overflow:hidden;text-overflow:ellipsis;}
/* grey until you tap it: then it is the only color on the card. Red outside delete and errors means "I hope so" */
.wheart{
  flex:none;display:inline-flex;align-items:center;justify-content:flex-end;gap:5px;min-width:44px;min-height:44px;padding:0;
  font:inherit;font-weight:700;font-size:.92rem;color:var(--muted);cursor:pointer;border:0;background:none;
}
.wheart svg{width:20px;height:20px;fill:none;stroke:var(--muted);stroke-width:2;stroke-linejoin:round;}
.wheart:not(.done):hover svg{stroke:var(--ink);}
.wheart[aria-pressed="true"]{color:var(--ink);}
.wheart[aria-pressed="true"] svg{fill:var(--red);stroke:var(--red);animation:pop .45s ease;}
.wheart.done{cursor:default;}

.wall-msg{text-align:center;font-weight:700;color:var(--muted);padding:var(--s3) var(--s2);}
.wall-msg:empty{display:none;}
/* quiet links in the heading blue: gold stays for the one main button */
.wall-all,.more-btn{
  display:flex;align-items:center;justify-content:center;width:max-content;max-width:100%;min-height:44px;margin:var(--s3) auto 0;
  font-family:var(--head);font-weight:400;font-size:1.05rem;color:var(--blue-deep);text-decoration:none;background:none;border:0;cursor:pointer;
}
.more-btn[disabled]{opacity:.6;cursor:progress;}
.toast{
  position:fixed;bottom:20px;left:50%;transform:translateX(-50%);z-index:10;
  background:var(--ink);color:#fff;padding:.55rem 1.1rem;border-radius:999px;font-weight:700;box-shadow:var(--shadow-up);
}
/* cards drift up softly as they scroll into view (browsers without scroll-timelines just show them) */
@supports (animation-timeline:view()){
  .wgrid .wcard{animation:rise linear both;animation-timeline:view();animation-range:entry 0% entry 55%;}
}

/* ---------- motion ---------- */
@keyframes rise{from{opacity:0;transform:translateY(14px);}to{opacity:1;transform:none;}}
@keyframes pop{50%{transform:scale(1.4);}}
@keyframes flash{50%{box-shadow:0 0 0 4px rgba(20,120,168,.35),var(--shadow);}}
/* .motion-ok = the local ?motion=1 preview */
@media (prefers-reduced-motion:reduce){
  html:not(.motion-ok) *,html:not(.motion-ok) *::before,html:not(.motion-ok) *::after{
    animation:none !important;transition:none !important;scroll-behavior:auto !important;
  }
}
