/* AllConnect phone, iPhone style: silver bezel, dynamic island, status icons, dim-to-close power behavior. */

/* ---------- device ---------- */
#phone{container-type:size;background:rgba(8,10,36,.62)}
.frame{position:absolute;left:50%;right:auto;bottom:auto;top:calc(12px + var(--sat));transform:translateX(-50%);
  /* --fw / --fh = outer size of the frame. Width always fits the screen (8px gutter each side); height leaves room for the nav bar.
     Everything on the home screen scales from these two numbers, so it works from 320px-wide phones up to desktop. */
  --fh:min(max(300px,calc(100cqh - 24px - var(--sat) - var(--sab))),1400px);--fw:min(calc(100cqw - 16px),calc(var(--fh) * .8));
  --ic:clamp(42px,min(calc(var(--fw) * .15),calc(var(--fh) * .09)),62px);
  height:var(--fh);width:var(--fw);max-width:calc(100cqw - 16px);aspect-ratio:auto;
  padding:9px;border-radius:52px;background:#04050a;
  box-shadow:0 0 0 2.5px #d3d6dd,0 0 0 5px #6f737d,0 30px 70px rgba(0,0,0,.6)}
.frame::before,.frame::after{content:"";position:absolute;width:4px;background:#b9bcc5;border-radius:3px}
.frame::before{left:-7px;top:19%;height:7%;box-shadow:0 52px 0 #b9bcc5}
.frame::after{right:-7px;top:25%;height:12%}
.screen{border-radius:43px;
  background:radial-gradient(circle at 78% 6%,rgba(96,112,255,.55),transparent 46%),radial-gradient(circle at 0% 40%,rgba(190,64,190,.4),transparent 42%),linear-gradient(180deg,#26286b 0%,#231c5b 42%,#1b1a52 72%,#2b2b86 100%)}
.screen::after{display:none}
.island{top:calc(10px + env(safe-area-inset-top, 0px));width:31%;height:29px;border-radius:20px;background:#000;z-index:5}
.sb{height:56px;padding:0 26px 7px;top:env(safe-area-inset-top, 0px);font-size:15.5px;font-weight:600;letter-spacing:.2px;position:relative;z-index:4}
.sbr{display:flex;align-items:center;gap:6px}
.sbr svg{display:block}
.home{display:block;width:34%;height:5px;bottom:8px;background:rgba(255,255,255,.9)}

/* ---------- home screen pages ---------- */
.scroll{display:flex;flex-direction:column;overflow:hidden;padding-bottom:calc(14px + var(--sab));grid-template-columns:none}
#apps.ios{flex:1;min-height:0;display:flex;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;padding:0;gap:0;scrollbar-width:none}
#apps.ios::-webkit-scrollbar{display:none}
#apps.ios .pg{flex:none;width:100%;box-sizing:border-box;display:block;padding:0 12px 6px;scroll-snap-align:start;overflow-y:auto;scrollbar-width:none;grid-template-columns:none}
#apps.ios .pg::-webkit-scrollbar{display:none}
.lock{padding:2px 14px 0;text-align:left}
.lock b{display:block;font:800 clamp(44px,calc(var(--fw) * .19),68px)/1 Outfit,system-ui,sans-serif;letter-spacing:-3px}
.lock span{display:block;font-size:14px;font-weight:500;margin-top:4px;opacity:.95;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.lock .hello i{font-style:normal}
.lock .od{display:inline-block;width:11px;height:11px;border-radius:50%;background:#176BFF;margin-right:5px;vertical-align:-1px}
.happen{margin:clamp(8px,calc(var(--fh) * .02),14px) 2px 0;background:#fff;color:#1b2236;border-radius:22px;padding:11px 12px 11px 14px;display:flex;align-items:center;gap:12px;box-shadow:0 8px 22px rgba(0,0,0,.25)}
.happen .hi{font-size:26px;width:30px;text-align:center;flex:none}
.happen small{display:block;font-size:12px;color:#6b7390;font-weight:600}
.happen b{display:block;font:700 16px/1.2 'Plus Jakarta Sans',system-ui,sans-serif}
.happen>div{min-width:0;text-align:left}.happen>div b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.happen button{margin-left:auto;flex:none;border:0;border-radius:99px;padding:9px 16px;background:linear-gradient(#ffa826,#ff7a00);color:#fff;font:800 14px 'Plus Jakarta Sans',system-ui,sans-serif}
#apps.ios .grid{display:grid;grid-template-columns:repeat(4,1fr);gap:clamp(8px,calc(var(--fh) * .02),12px) 2px;margin-top:clamp(8px,calc(var(--fh) * .02),16px);padding:0}
#apps.ios .pg:not(.pg1) .grid{margin-top:14px}
#apps.ios .app,.dock .app{font-size:12.5px;font-weight:500}
#apps.ios .ic,.dock .ic{width:var(--ic);max-width:100%;font-size:calc(var(--ic) * .48);border-radius:23%;margin:0 auto 5px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.5),inset 0 -10px 16px rgba(0,0,0,.14),0 7px 14px rgba(0,0,0,.38)}
#apps.ios .app em{-webkit-line-clamp:1;white-space:nowrap;text-overflow:ellipsis;margin-top:1px}
#apps.ios .adic img{width:100%;height:100%;border-radius:inherit;object-fit:cover}
.goalcard{margin:clamp(8px,calc(var(--fh) * .02),16px) 2px 0;background:rgba(255,255,255,.15);border:1px solid rgba(255,255,255,.14);border-radius:22px;padding:14px 16px;cursor:pointer;backdrop-filter:blur(10px)}
.goalcard small{display:block;font-weight:800;letter-spacing:.06em;font-size:12.5px;opacity:.85}
.goalcard b{display:block;font:800 22px/1.2 Outfit,system-ui,sans-serif;margin-top:5px}
.screen .pgdots{flex:none;display:flex;justify-content:center;gap:9px;padding:6px 0 10px}
.screen .pgdots i{width:8px;height:8px;border-radius:50%;background:rgba(255,255,255,.4)}
.screen .pgdots i.on{background:#fff}
.dock{flex:none;margin:0 clamp(8px,calc(var(--fw) * .04),14px) clamp(8px,calc(var(--fh) * .025),18px);padding:clamp(8px,calc(var(--fh) * .018),12px) 6px;display:flex;justify-content:space-around;background:rgba(255,255,255,.17);border:1px solid rgba(255,255,255,.16);border-radius:34px;backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px)}
.dock .app{width:calc(var(--ic) + 20px)}.dock .app em{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}
.dock .ic{margin:0 auto}
.phmenu,.phpop{display:none!important}
.closephone{display:none!important}
.frame-power{position:absolute;right:-8px;top:25%;width:7px;height:12%;min-height:44px;padding:0;border:0;border-radius:0 4px 4px 0;background:linear-gradient(90deg,#858994,#e4e6ed,#7c8089);box-shadow:1px 0 2px #0008;z-index:8;cursor:pointer}
.frame-power:focus-visible{outline:2px solid #7c3aed;outline-offset:3px}
.screen{transition:opacity .28s ease,filter .28s ease,transform .28s ease;transform-origin:center}
#phone.powering-off .screen{opacity:0;filter:brightness(0);transform:scale(.985);pointer-events:none}
#phone.powering-on .screen{animation:phoneWake .34s ease both}
@keyframes phoneWake{from{opacity:0;filter:brightness(0);transform:scale(.985)}to{opacity:1;filter:brightness(1);transform:scale(1)}}
@media(prefers-reduced-motion:reduce){.screen,#phone.powering-on .screen{transition:none;animation:none}}

/* ---------- clean screen: Show buttons + map + phone ---------- */
.cleanbar{position:absolute;left:10px;right:10px;bottom:calc(10px + var(--sab));z-index:6;display:none;align-items:center;justify-content:center;gap:12px}
.cleanbar .pill{border:0;cursor:pointer;color:var(--ink,#1b2236)}
.cleanbar .cbshow{display:flex;align-items:center;gap:10px;padding:0 26px;height:56px;white-space:nowrap;font:700 17px 'Plus Jakarta Sans',system-ui,sans-serif}
.cleanbar .cbic{width:56px;height:56px;padding:0;display:grid;place-items:center;border-radius:50%}
.cleanbar svg{width:25px;height:25px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linejoin:round;stroke-linecap:round}

/* ---------- daily gem hunt ---------- */
.gmsub{margin:-4px 0 12px;color:var(--mut);font-size:15px}
.gmclue{background:linear-gradient(135deg,#2f2c75,#241f5a);color:#fff;border-radius:20px;padding:16px 18px;margin-bottom:14px}
.gmclue small{color:#b9a9ff;font-weight:800;letter-spacing:.06em;font-size:12px}
.gmclue b{display:block;font:800 21px/1.28 Outfit,system-ui,sans-serif;margin-top:7px}
.gmtxt{color:var(--mut);font-size:14.5px;line-height:1.5;margin:0 0 12px}
.gmtiers{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:12px 0}
.gmtiers div{background:#f1f3fa;border-radius:16px;padding:10px 4px;text-align:center}
.gmtiers small{display:block;color:var(--mut);font-size:12px;font-weight:600}.gmtiers b{display:block;font-size:15px;margin-top:3px}
.gmfound{font-size:14px;color:var(--mut);margin:6px 0}.gmfound b{color:var(--ink)}
.gmwin{background:#e7f8ee;color:#12803f;border-radius:14px;padding:11px 14px;font-weight:700;font-size:14px;margin:8px 0}
.gmhint{background:#fff6dc;color:#7a5b00;border-radius:14px;padding:11px 14px;font-weight:600;font-size:14px;margin:0 0 10px}
.gmhb{margin:0 0 10px}
.gmgo{width:100%;margin-top:10px;padding:14px;font-size:15px}
html[data-theme="dark"] .gmtiers div{background:#20263a}
html[data-theme="dark"] .gmwin{background:#12301f;color:#7be0a4}
html[data-theme="dark"] .gmhint{background:#35290a;color:#f3d484}

/* ---------- goals sheet ---------- */
.glh{display:flex;align-items:center;gap:12px;margin:0 0 12px}.glh b{display:block;font:800 19px Outfit,system-ui,sans-serif}.glh small{color:var(--mut);font-size:13.5px}
.glhus{display:flex;align-items:center;gap:12px;border:1.5px solid #f0cf86;background:#fff8e6;border-radius:20px;padding:14px;margin-bottom:12px;cursor:pointer}
.glhus .gli{font-size:28px;width:44px;height:44px;border-radius:50%;background:#f9e3a8;display:grid;place-items:center;flex:none}
.glhus>div{flex:1;min-width:0}.glhus b{display:block;font:800 17px Outfit,system-ui,sans-serif;color:#2a2110}.glhus small{display:block;color:#7a6a45;font-size:13px;line-height:1.35}
.glhus>.fa-solid{color:#a38a4d}
.gldr{background:linear-gradient(135deg,#5b3fd1,#7c3aed);color:#fff;border-radius:22px;padding:16px;margin-bottom:14px}
.gldr>small{font-weight:800;letter-spacing:.06em;font-size:12px;opacity:.8}
.gldt{display:flex;gap:12px;align-items:center;margin:8px 0 12px}.gldt>span{font-size:38px}.gldt b{display:block;font:800 22px Outfit,system-ui,sans-serif}.gldt small{opacity:.85;font-size:13.5px}
.glpb{height:12px;border-radius:99px;background:rgba(0,0,0,.35);overflow:hidden}.glpb i{display:block;height:100%;border-radius:99px;background:linear-gradient(90deg,#fbbf24,#f59e0b)}
.gldr em{display:block;text-align:right;font-style:normal;font-size:13px;margin-top:8px;opacity:.9}
.gln>div{margin:0 0 12px}.gln span{display:block;font-weight:700;font-size:14px;margin-bottom:5px}
html[data-theme="dark"] .glhus{background:#2b2216;border-color:#9b7a2e}
html[data-theme="dark"] .glhus b{color:#f7e6b8}html[data-theme="dark"] .glhus small{color:#c9b57f}

/* ---------- desktop: keep the wide tablet frame (same as before), with the new look inside ---------- */
@media (min-width:768px) and (min-height:520px){
  .frame{--fw:min(1000px,calc(100cqw - 48px));--fh:min(680px,calc(100cqh - 170px));--ic:clamp(40px,calc(var(--fh) * .095),66px);
    top:50%;transform:translate(-50%,-50%);width:var(--fw);height:var(--fh);padding:14px;border-radius:38px;box-shadow:0 0 0 2px #d3d6dd,0 0 0 4px #6f737d,0 30px 90px rgba(0,0,0,.55)}
  .frame::before,.frame::after{display:none}
  .screen{border-radius:26px}
  .island{top:11px;width:9px;height:9px;border-radius:50%;background:#1b2030}
  .home{display:none}
  .sb{padding:14px 26px 0}
  .lock{padding:clamp(6px,calc(var(--fh) * .03),20px) 28px 0}.lock b{font-size:clamp(46px,calc(var(--fh) * .13),84px)}
  .happen{max-width:420px}
  #apps.ios .pg{padding:0 22px 6px}
  #apps.ios .grid{grid-template-columns:repeat(6,1fr);gap:clamp(8px,calc(var(--fh) * .03),20px) 6px}
  #apps.ios .ic,.dock .ic{width:var(--ic);max-width:var(--ic);font-size:calc(var(--ic) * .47)}
  .dock .app{width:calc(var(--ic) + 24px)}
  .goalcard{max-width:420px}
  .dock{width:min(520px,calc(100% - 40px));margin:0 auto 14px}
  .closephone{display:none!important}
  .screen .pgdots{width:100%;box-sizing:border-box}
}

/* Keep app headers below the dynamic island/status row on notched phones. */
.screen.light .appview{top:58px;padding-bottom:18px}
@media (min-width:768px) and (min-height:520px){.screen.light .appview{top:54px}}


/* ---------- landscape phones / short windows: use the full width, keep the nav bar visible underneath ---------- */
@media (max-height:519px){
  #phone{position:fixed}   /* use the whole landscape screen, not the narrow app column */
  .frame{top:calc(8px + var(--sat));--fh:max(220px,calc(100cqh - 16px - var(--sat) - var(--sab)));--fw:min(1000px,calc(100cqw - 16px));--ic:clamp(34px,calc(var(--fh) * .13),56px);padding:8px;border-radius:30px}
  .frame::before,.frame::after,.frame-power{display:none}
  .screen{border-radius:23px}
  .island{top:8px;width:8px;height:8px;border-radius:50%;background:#1b2030}
  .home{display:none}
  .sb{height:34px;padding:10px 22px 0;font-size:13px}
  .screen.light .appview{top:36px}
}

/* ---------- compact home: when the frame is short, tuck the clock and city card on the left and the apps on the right ---------- */
@container (min-width:600px) and (max-height:800px){
  #apps.ios .pg1{display:grid;grid-template-columns:minmax(0,.85fr) minmax(0,1.4fr);grid-template-rows:auto auto 1fr;column-gap:20px;align-content:start}
  #apps.ios .pg1 .lock{grid-column:1;grid-row:1}
  #apps.ios .pg1 .happen{grid-column:1;grid-row:2;max-width:none}
  #apps.ios .pg1 .grid{grid-column:2;grid-row:1 / span 3;margin-top:8px}
  #apps.ios .pg:not(.pg1) .goalcard{max-width:none}
}
@container (max-height:520px){
  .sb{height:34px}
  .lock b{font-size:clamp(36px,calc(var(--fh) * .13),52px);letter-spacing:-2px}
  .lock span{font-size:12.5px;margin-top:2px}
  .happen{padding:7px 10px 7px 12px;border-radius:18px}.happen .hi{font-size:22px}.happen b{font-size:14px}.happen button{padding:7px 13px;font-size:13px}
  #apps.ios .app,.dock .app{font-size:11.5px}
  .screen .pgdots{padding:3px 0 5px}
  .dock{padding:6px;margin-bottom:6px}.dock .app em{display:none}.dock .ic{margin-bottom:0}
  .happen small{display:none}
}

/* ---------- small portrait phones: shrink the home screen so the clock, city card, apps and dock all fit without scrolling ---------- */
@container (max-width:599px) and (max-height:610px){
  .frame{--ic:clamp(40px,min(calc(var(--fw) * .14),calc(var(--fh) * .085)),56px)}
  .sb{height:44px;padding-top:calc(11px + env(safe-area-inset-top, 0px))}
  .lock b{font-size:clamp(40px,calc(var(--fw) * .15),52px);letter-spacing:-2px}
  .lock span{font-size:13px;margin-top:2px}
  .happen{padding:8px 10px 8px 12px;border-radius:18px}.happen .hi{font-size:22px;width:26px}.happen b{font-size:14.5px}.happen button{padding:7px 14px;font-size:13px}
  #apps.ios .grid{gap:8px 2px}
  #apps.ios .app,.dock .app{font-size:11.5px}
  .screen .pgdots{padding:3px 0 6px}
  .dock{padding:8px 6px}.dock .app em{display:none}.dock .ic{margin-bottom:0}
}
@container (max-width:599px) and (max-height:510px){
  .lock .hello{display:none}
  .happen small{display:none}
  .sb{height:36px;padding-top:calc(8px + env(safe-area-inset-top, 0px))}
  .lock b{font-size:40px}
}

/* =====================================================================================================
   APPS INSIDE THE FRAME (Messages, Gist, Camera, Bank, Jobs ...)
   These follow the size of the phone/tablet frame itself (#phone is the size container), not the browser window,
   so they behave the same on a phone, a landscape phone, a small laptop window and a big desktop.
   ===================================================================================================== */

/* wide frames (tablet, landscape phone): keep readable column widths and centre them */
@container (min-width:600px){
  .ahead,.abody,.seg2,.chips2,.qr,.cin,.emo,.csub,.polban{width:100%;max-width:780px;margin-left:auto;margin-right:auto}
  .abody{padding-left:20px;padding-right:20px}.ahead{padding-left:20px}
  .abody>.gp,.abody>.gtease,.abody>.gfind,.abody #gfeed,.gprof,.gcin{max-width:640px;margin-left:auto;margin-right:auto}
  #gfeed .gp,.gcin{width:100%}
  .asheet .shcard{max-width:560px;margin:0 auto;border-radius:22px 22px 0 0}
  .gimgs{max-height:360px}
  .shcard .seg2{max-width:none;margin-left:0;margin-right:0}
}

/* nothing inside an app may push the page sideways on narrow frames */
.abody{overflow-x:hidden}
.abody img,.abody video{max-width:100%}
.shcard{max-width:100%;box-sizing:border-box}

/* app headers follow the status bar height used by the compact home layouts */
@container (max-width:599px) and (max-height:610px){
  .screen.light .appview{top:46px}
  .ahead{padding:4px 14px 6px}
  .ahead h2{font-size:19px}
}
@container (max-width:599px) and (max-height:510px){
  .screen.light .appview{top:42px}
  .ahead{padding:2px 12px 4px}
  .ahead h2{font-size:18px}
  .abody{padding-left:12px;padding-right:12px}
  .shcard{padding:12px 12px 16px}
}

/* short portrait frames: slimmer camera controls so the picture keeps most of the space */
@container (max-width:599px) and (max-height:610px){
  .cam-top{padding:2px 8px 4px}.cam-b{min-width:34px;height:34px}
  .cam-shut{width:60px;height:60px}.cam-th,.cam-flip{width:44px;height:44px}
  .cam-bar{padding:4px 16px 4px}.cam-zoom{padding:0 18px}.cam-zoom input{height:20px}
  .cam-filters{padding:2px 10px}.cam-filters button{padding:5px 12px}
}

/* short, wide frames (landscape phone, small laptop window): camera preview on the left, controls in a column on the right */
@container (min-width:600px) and (max-height:800px){
  .cam{display:grid;grid-template-columns:minmax(0,1fr) clamp(96px,16cqw,150px);grid-template-rows:auto minmax(0,1fr)}
  .cam-top{grid-column:1;grid-row:1;max-width:none;padding:2px 10px 4px}
  .cam-stage{grid-column:1;grid-row:2}
  .cam-ctl{grid-column:2;grid-row:1 / span 2;display:flex;flex-direction:column;justify-content:center;gap:10px;padding:6px 10px;overflow:hidden}
  .cam-bar{flex-direction:column;gap:12px;padding:0;max-width:none}
  .cam-zoom{padding:0;max-width:none}.cam-zoom span{min-width:28px}.cam-zoom input{min-width:0;width:100%}
  .cam-filters{flex-wrap:wrap;padding:0;justify-content:center}
  .cam-shut{width:clamp(52px,16cqh,72px);height:clamp(52px,16cqh,72px)}
  .cam-th,.cam-flip{width:clamp(38px,11cqh,50px);height:clamp(38px,11cqh,50px)}
}

/* very short frames: slimmer headers and composer */
@container (max-height:520px){
  .ahead{padding-top:2px;padding-bottom:3px}.ahead h2{font-size:18px}
  .cin{padding:3px 12px}.ebtn,.sbtn{width:32px;height:32px}
  .cin input{padding:8px 13px}
}
