/* The artwork leads; each mode has one clear set of controls. */
body.app-polished:not(.adult){
  --bg:#fffdf8;--panel:#fff;--ink:#172b52;--sub:#52617b;
  --accent:#294de5;--accent-deep:#203db6;--app-line:#dbe3f1;
  --app-tint:#edf1ff;--mint:#16845d;--gold:#bd8611;
  --artwork-header:url("entrance/kids-continuous-wide-v82.webp");background:#fffdf8;color:var(--ink);
}
body.app-polished.adult{
  --bg:#f7f4ec;--panel:#fffefb;--ink:#2d392d;--sub:#68705d;
  --accent:#4c603f;--accent-deep:#394c2e;--app-line:#dddccd;
  --app-tint:#edf0e5;--gold:#947130;--artwork-header:url("entrance/atelier-continuous-wide-v82.webp");
  background:#f7f4ec;color:var(--ink);
}
body.app-polished:is(.game-lobby,.adult) #home{
  isolation:isolate;position:relative;overflow:hidden;
  padding-top:calc(14px + env(safe-area-inset-top));
}
body.app-polished:is(.game-lobby,.adult) #home::before{
  content:"";position:absolute;top:0;left:0;right:0;height:128px;z-index:-1;
  background-image:var(--artwork-header);background-size:cover;background-position:center;
  opacity:.13;pointer-events:none;
  -webkit-mask-image:linear-gradient(#000 35%,transparent);mask-image:linear-gradient(#000 35%,transparent);
}
body.app-polished.game-lobby:not(.adult) #home::before{background-color:#294de5;background-image:linear-gradient(#294de5df,#294de5ed),var(--artwork-header);opacity:1;-webkit-mask-image:none;mask-image:none;border-radius:0 0 28px 28px;}
body.app-polished.adult #home::before{height:320px;background-position:center top;opacity:.09;}
body.app-polished:is(.game-lobby,.adult) #home .topline{
  min-height:52px;gap:8px;padding-bottom:10px;margin-bottom:14px;
  border:0;align-items:center;
}
body.app-polished:is(.game-lobby,.adult) #home .topline .logo .brand-puzzle{width:32px;height:32px;padding:0;background:none;flex:none;}
body.app-polished:is(.game-lobby,.adult) #home #modeToggle{
  border:1px solid var(--app-line);background:#fff;border-radius:16px;
  padding:3px;box-shadow:0 2px 5px #152d4910;
}
body.app-polished:is(.game-lobby,.adult) #home #modeToggle button{
  min-height:48px;height:auto;padding:8px 13px;color:var(--sub);
  border-radius:12px;font:600 13px/1.3 var(--body);box-shadow:none;
}
body.app-polished:is(.game-lobby,.adult) #home #modeToggle button[aria-pressed="true"],
body.app-polished:is(.game-lobby,.adult) #home #modeToggle button.on{
  background:var(--accent);color:#fff;box-shadow:none;
}
body.app-polished:is(.game-lobby,.adult) #home #setBtn{
  width:48px;height:48px;min-height:48px;border:1px solid var(--app-line);
  background:#fff;border-radius:15px;box-shadow:none;color:var(--ink);
}
body.app-polished:is(.game-lobby,.adult) #home #coinBtn{
  min-height:48px;padding:0 10px;border:1px solid #ebbb36;
  border-radius:15px;background:#ffcf45;box-shadow:none;color:#5b420a;
}
body.app-polished:is(.game-lobby,.adult) #home #coinBtn .seg{color:inherit;font-size:13px;min-height:44px;}
body.app-polished:is(.game-lobby,.adult) #home #coinBtn .ui-icon{color:inherit;}
body.app-polished:is(.game-lobby,.adult) #home #dailyCard{
  background:#fff!important;border:1px solid var(--app-line)!important;
  border-radius:24px;box-shadow:0 8px 22px #1c35610b;
  padding:18px;gap:16px;margin-bottom:20px;
}
body.app-polished:is(.game-lobby,.adult) #home #dailyCard .stage-art{
  border:0;border-radius:16px;box-shadow:none;background:#f4f5f0;
}
body.app-polished:is(.game-lobby,.adult) #home #dailyCard #dailyThumb{border-radius:0;}
body.app-polished:is(.game-lobby,.adult) #home #dailyCard .stage-preview{gap:12px;}
body.app-polished:is(.game-lobby,.adult) #home #dailyCard .stage-controls{gap:10px;padding:0;}
body.app-polished:is(.game-lobby,.adult) #home #dailyName{color:var(--ink);text-shadow:none;}
body.app-polished:not(.adult) #home #dailyName{font:400 23px/1.3 'Jua',sans-serif;letter-spacing:-.02em;}
body.app-polished:is(.game-lobby,.adult) #home #stageCnts{gap:7px;}
body.app-polished:is(.game-lobby,.adult) #home #stageCnts .cnt{
  min-height:48px;height:auto;padding:10px 3px;border:1px solid #d9e0ed!important;
  border-radius:12px;background:#f5f7fc!important;color:#4d5b76;
  box-shadow:none;font:600 14px/1.25 var(--body);
}
body.app-polished:not(.adult) #home #stageCnts .cnt.on{
  border-color:#dda721!important;background:#ffcf45!important;color:#513a03;
  box-shadow:inset 0 -2px 0 #eab62a;
}
body.app-polished.game-lobby:not(.adult) #home .daily .playbtn{
  min-height:64px;padding:14px 16px;border:0!important;border-radius:17px;
  background:#294de5!important;color:#fff;box-shadow:0 5px 0 #1934a0;
  text-shadow:none;font:700 22px/1.3 var(--body);letter-spacing:-.02em;
}
body.app-polished.game-lobby:not(.adult) #home .daily .playbtn.resumebtn:not([hidden]) + .playbtn{
  min-height:48px;background:#eef2ff!important;border:1px solid #cbd5fa!important;
  color:#2445c2;box-shadow:none;font-size:15px;
}
body.app-polished:is(.game-lobby,.adult) #home #cTabs{gap:7px;margin-bottom:10px;padding-bottom:3px;}
body.app-polished:is(.game-lobby,.adult) #home #cTabs .ctab{
  min-height:48px;padding:10px 12px;border:1px solid var(--app-line)!important;
  border-radius:12px;background:#fff!important;color:var(--sub);
  font:600 13px/1.25 var(--body);box-shadow:none;
}
body.app-polished:not(.adult) #home #cTabs .ctab.on{
  border-color:#294de5!important;background:#294de5!important;color:#fff;
  box-shadow:none;
}
body.app-polished:is(.game-lobby,.adult) #home #caro .card{
  border:2px solid #e0e6f0!important;border-radius:15px;
  background:#fff!important;box-shadow:none;padding:6px;
}
body.app-polished:not(.adult) #home #caro .card[aria-pressed="true"]{
  border-color:#edb623!important;background:#fffdf4!important;box-shadow:0 0 0 1px #edb623;transform:none;
}
body.app-polished:is(.game-lobby,.adult) #home #caro .card .chip{
  font-size:11px;line-height:1.4;color:#36674c;background:#e8f4ec;
}
/* Photo creation stays first, with the same existing input and event handlers. */
body.app-polished:is(.game-lobby,.adult) #home{display:flex;gap:14px;}
body.app-polished:is(.game-lobby,.adult) #home .topline{order:0;margin-bottom:0;}
body.app-polished:is(.game-lobby,.adult) #home #photoEntry{order:1;margin:0;}
body.app-polished:is(.game-lobby,.adult) #home #dailyCard{order:2;margin:0;}
body.app-polished:is(.game-lobby,.adult) #home #pickSec{order:3;}
body.app-polished:is(.game-lobby,.adult) #home #collCard{order:4;margin:0;}
body.app-polished:is(.game-lobby,.adult) #home #gameDock:empty{display:none;}
body.app-polished:is(.game-lobby,.adult) #home #photoEntry #photoChoose{
  width:100%;min-height:56px;padding:10px 14px;gap:12px;
  border:1px solid var(--app-line)!important;border-radius:14px;
  background:#fff!important;box-shadow:0 2px 6px #152d4908;color:var(--ink);
}
body.app-polished:is(.game-lobby,.adult) #home #photoEntry #photoChoose > .ui-icon{display:block;width:28px;height:28px;flex:none;color:var(--accent);}
body.app-polished.game-lobby:not(.adult) #home #collCard{min-height:56px;padding:12px 14px;background:#fff!important;border:1px solid #b9d8c6!important;border-radius:14px;box-shadow:none;color:#126647;}
body.app-polished.adult #home #dailyCard{padding:20px;background:#fffefb!important;border-color:#d8d5c6!important;}
body.app-polished.adult #home .picker-heading{display:none;}
body.app-polished.adult #home #coinBtn{background:#f1e7cf;border-color:#d8c593;color:#755b24;}
body.app-polished.adult #home #dailyName{font:600 23px/1.4 'Noto Serif KR',serif;letter-spacing:-.035em;}
body.app-polished.adult #home #dailyCard .stage-art{border-radius:9px;}
body.app-polished.adult #home #stageCnts .cnt{background:#f5f4ed!important;border-color:#dedfd1!important;color:#666d5a;}
body.app-polished.adult #home #stageCnts .cnt.on{background:#e5ecd9!important;border-color:#758d5f!important;color:#3e5630;box-shadow:none;}
body.app-polished.adult #home .daily .playbtn{
  min-height:58px;background:#4c603f!important;border:1px solid #3f5034!important;
  border-radius:11px;color:#fffef6;box-shadow:inset 0 1px 0 #8d9e7644;
  text-shadow:none;font:600 18px/1.4 var(--body);
}
body.app-polished.adult #home .daily .playbtn.resumebtn:not([hidden]) + .playbtn{
  min-height:48px;background:#f1f2e9!important;color:#4c603f;border-color:#d4dbc7!important;
}
body.app-polished.adult #home #cTabs .ctab.on{background:#e7eddc!important;border-color:#a3b391!important;color:#3c5331;}
body.app-polished.adult #home #caro .card{border-color:#e0decf!important;border-radius:8px;}
body.app-polished.adult #home #caro .card[aria-pressed="true"]{border-color:#798b66!important;background:#fffef8!important;}
body.app-polished.adult #home .photo-entry #photoChoose,
body.app-polished.adult #home #collCard{
  min-height:56px;padding:12px 15px;background:#fffefb!important;
  border:1px solid #d9d8c8!important;border-radius:12px;box-shadow:none;
}
body.app-polished.adult #home .photo-entry #photoChoose > .ui-icon{width:24px;height:24px;color:#8d7139;}
/* Sheets inherit the mode rather than bringing back the old toy textures. */
body.app-polished:is(.game-lobby,.adult) :is(#settings,#collview,#sheet,#themeview,#packview) .box{
  background:var(--panel)!important;border:1px solid var(--app-line);
  border-radius:24px;box-shadow:0 20px 64px #1627422e;
}
body.app-polished:not(.adult) :is(#settings,#collview,#sheet,#themeview,#packview) .box{border-top:5px solid #294de5;}
body.app-polished.adult :is(#settings,#collview,#sheet,#themeview,#packview) .box{border-top:3px solid #aa8d4a;border-radius:17px;}
body.app-polished:is(.game-lobby,.adult) :is(#settings,#collview,#sheet,#themeview,#packview) button:not(.card){min-height:48px;}
body.app-polished:not(.adult) :is(#settings,#collview,#sheet) :is(button.on,button[aria-pressed="true"]){background:#eaf0ff;color:#203eb8;border-color:#6d85e7;}
body.app-polished.adult :is(#settings,#collview,#sheet) :is(button.on,button[aria-pressed="true"]){background:#e8edde;color:#3f5633;border-color:#93a67f;}
body.app-polished:is(.game-lobby,.adult) #collview .frame-shelf{background:transparent;border-bottom:1px solid var(--app-line);border-radius:0;padding:10px 0 14px;gap:8px;}
body.app-polished:is(.game-lobby,.adult) #collview .frame-token{gap:5px;}
body.app-polished:is(.game-lobby,.adult) #collview .frame-token img{max-width:70px;}
body.app-polished:is(.game-lobby,.adult) #collview .frame-token b{color:var(--ink);font-size:12px;}
body.app-polished:is(.game-lobby,.adult) #collview .frame-token small{color:var(--sub);font-size:11px;}
body.app-polished:is(.game-lobby,.adult) #collview .frame-token:not(.earned) img{opacity:.5;}
body.app-polished:is(.game-lobby,.adult) #collview .frame-token.earned img{opacity:1;}
body.app-polished:is(.game-lobby,.adult) #collview .album-tabs button{min-height:48px;}
body.app-polished:is(.game-lobby,.adult) #collview .album-tabs button[aria-pressed="true"]{color:var(--accent-deep);border-bottom-color:var(--accent);}
/* HUD spacing is measured by the existing game layout code. */
body.app-polished:is(.game-lobby,.adult) #game,body.app-polished:is(.game-lobby,.adult) #arena{background:var(--bg);}
body.app-polished:is(.game-lobby,.adult) #gtop{background:var(--bg);padding-top:calc(8px + env(safe-area-inset-top));padding-bottom:6px;}
body.app-polished.game-lobby:not(.adult) #gtop .gbtn{
  min-width:48px;width:52px;min-height:64px;padding:4px 3px;gap:1px;
  background:#fff!important;border:1px solid #cbd6ee;border-radius:13px;
  box-shadow:none;color:#334d83;font:600 11px/1.25 var(--body);
}
body.app-polished.game-lobby:not(.adult) #gtop .gbtn img{width:36px;height:36px;}
body.app-polished.game-lobby:not(.adult) #gtop #kidHint{background:#ffcf45!important;border-color:#dbab22;color:#58410c;box-shadow:none;}
body.app-polished.game-lobby:not(.adult) #gtop{grid-template-columns:52px minmax(0,1fr) 52px 52px;gap:2px 8px;}
body.app-polished:is(.game-lobby,.adult) #gtitle{min-width:0;overflow:hidden;text-overflow:ellipsis;color:var(--ink);}
body.app-polished:not(.adult) #gtitle{font:400 18px/1.25 'Jua',sans-serif;}
body.app-polished.adult #gtitle{white-space:nowrap;font:600 16px/1.4 var(--body);}
body.app-polished.adult #gtop .gbtn{min-width:48px;min-height:48px;padding:6px 9px;background:#fffef8!important;border:1px solid #d6d9c9;color:#536743;border-radius:10px;}
body.app-polished:is(.game-lobby,.adult) #gcount{color:var(--sub);font-variant-numeric:tabular-nums;}
body.app-polished.game-lobby:not(.adult) #gprog{height:7px;border:0;background:#e2e8f7;border-radius:8px;}
body.app-polished.game-lobby:not(.adult) #gprog > *{background:#16845d;}
body.app-polished:is(.game-lobby,.adult) #kidGameHelp{color:var(--sub);font-weight:500;}
body.app-polished:is(.game-lobby,.adult) #board{background:#fffefb;box-shadow:0 0 0 1px #d8dece,0 6px 16px #253c2112;}
body.app-polished:not(.adult) #winwrap .win{background:#fff!important;border:2px solid #294de5;border-radius:26px;box-shadow:0 14px 50px #1f35972b;}
body.app-polished:not(.adult) #winwrap .wbtns .playbtn{background:#294de5!important;color:#fff;border-color:#294de5;}
body.app-polished.adult #winwrap .win{background:#fffefb!important;border:1px solid #b9ab85;border-radius:18px;}
body.app-polished.adult #winwrap .wbtns .playbtn{background:#4c603f!important;color:#fff;border-color:#4c603f;}
body.app-polished:is(.game-lobby,.adult) :is(#home,#gtop,#settings,#collview,#sheet) button:focus-visible{outline:3px solid var(--accent);outline-offset:3px;}
@media(max-width:650px){
  body.app-polished:is(.game-lobby,.adult) #home{padding-inline:14px;}
  body.app-polished:is(.game-lobby,.adult) #home .topline{gap:6px;grid-template-columns:minmax(24px,1fr) auto 48px 48px;}
  body.app-polished:is(.game-lobby,.adult) #home #modeToggle button{padding-inline:10px;font-size:12px;}
  body.app-polished:is(.game-lobby,.adult) #home #dailyCard{padding:14px;gap:14px;border-radius:21px;margin-bottom:18px;}
  body.app-polished:is(.game-lobby,.adult) #home #dailyName{font-size:21px;}
  body.app-polished.adult #home{gap:15px;}
  body.app-polished.adult #home #dailyCard{padding:16px;margin:0;}
  body.app-polished.adult #home #dailyCard .stage-preview{gap:10px;}
  body.app-polished.adult #home #dailyCard .stage-summary{gap:3px;}
  body.app-polished.adult #home #dailyCard .stage-controls{gap:8px;}
  body.app-polished.adult #home #dailyName{font-size:22px;}
  body.app-polished:is(.game-lobby,.adult) #home #cTabs .ctab{padding:10px 11px;font-size:12px;}
  body.app-polished:is(.game-lobby,.adult) #gtop{padding-inline:12px;}
}
@media(max-width:350px){
  body.app-polished:is(.game-lobby,.adult) #home{padding-inline:10px;}
  body.app-polished:is(.game-lobby,.adult) #home .topline{gap:4px;grid-template-columns:32px minmax(0,1fr) 48px 48px;}
  body.app-polished:is(.game-lobby,.adult) #home #modeToggle{width:100%;}
  body.app-polished:is(.game-lobby,.adult) #home #modeToggle button{flex:1;min-width:0;padding-inline:7px;}
  body.app-polished:is(.game-lobby,.adult) #home #setBtn{width:48px;}
  body.app-polished:is(.game-lobby,.adult) #home #coinBtn{padding-inline:6px;}
  body.app-polished:is(.game-lobby,.adult) #home #dailyCard{padding:12px;}
  body.app-polished:is(.game-lobby,.adult) #home #stageCnts{gap:5px;}
  body.app-polished:is(.game-lobby,.adult) #home #stageCnts .cnt{font-size:12px;}
  body.app-polished.game-lobby:not(.adult) #gtop{gap:2px 5px;padding-inline:10px;}
  body.app-polished:is(.game-lobby,.adult) #gtitle{font-size:15px;}
}
@media(max-height:480px) and (orientation:landscape){
  body.app-polished.game-lobby:not(.adult) #gtop{grid-template-columns:48px minmax(0,1fr) 48px 48px 66px;padding-block:4px;}
  body.app-polished.game-lobby:not(.adult) #gtop .gbtn{width:48px;min-height:48px;font-size:10px;}
  body.app-polished.game-lobby:not(.adult) #gtop .gbtn img{width:30px;height:30px;}
}
@media(prefers-reduced-motion:reduce){body.app-polished:is(.game-lobby,.adult) #home::before{animation:none;}}
