
:root{--bg:#160b07;--panel:#29140c;--panel2:#3a1d10;--gold:#e3ad54;--cream:#f5e5c6;--muted:#b99b78;--line:#74451e;--sq1:#d7ad6b;--sq2:#6b3219}*{box-sizing:border-box}html,body{margin:0;height:100%;overflow:hidden;background:radial-gradient(circle at 50% 5%,#432312 0,#1a0c07 55%,#0d0604 100%);color:var(--cream);font-family:Georgia,serif}button,select{font:inherit}.app{height:100dvh;display:grid;grid-template-rows:54px 1fr 25px;gap:6px;padding:7px 2vw}.top{display:flex;align-items:center;justify-content:space-between}.brand{display:flex;gap:9px;align-items:center}.logo{width:40px;height:40px;border-radius:11px;display:grid;place-items:center;background:linear-gradient(#f2c16a,#98601f);color:#2a1609;font-size:24px;font-weight:bold}.brand h1{font-size:25px;line-height:1;margin:0}.brand small{color:#e8bb68;text-transform:uppercase;letter-spacing:1.5px;font-size:9px}.top-actions{display:flex;gap:7px}.smallbtn{border:1px solid var(--line);background:#2a160e;color:var(--cream);border-radius:10px;padding:8px 11px;cursor:pointer}.smallbtn.off{opacity:.48}.layout{min-height:0;display:grid;grid-template-columns:230px minmax(480px,1fr) 220px;gap:10px}.panel{background:linear-gradient(180deg,rgba(45,23,14,.97),rgba(27,13,8,.97));border:1px solid var(--line);border-radius:18px;padding:12px;min-height:0}.left{display:flex;flex-direction:column;gap:8px}.eyebrow{color:#e6af50;font-size:9px;text-transform:uppercase;letter-spacing:1.4px;font-weight:bold}.left h2,.right h2{font-size:17px;margin:3px 0 8px}.ctl{width:100%;min-height:58px;border:1px solid #7d4d22;background:linear-gradient(135deg,#5b2c12,#31170d);color:var(--cream);border-radius:13px;padding:9px 11px;text-align:left;cursor:pointer}.ctl strong{display:block;font-size:15px}.ctl small{color:#d2b795}.rowctl{display:grid;grid-template-columns:1fr 92px;align-items:center}.rowctl select{background:#211008;color:#f4d39c;border:0;border-radius:8px;padding:8px}.tip{margin-top:auto;border:1px solid #70421d;border-radius:13px;padding:11px;font-size:12px;line-height:1.45;background:#35190d}.stage{min-width:0;min-height:0;display:grid;grid-template-rows:150px 1fr 25px;gap:6px}.opponent{position:relative;border:1px solid var(--line);border-radius:18px;background:radial-gradient(circle at 50% 25%,#6c3719,#241008 72%);overflow:hidden}.opponent img{position:absolute;height:205px;left:50%;bottom:-54px;transform:translateX(-50%);object-fit:contain}.bubble{position:absolute;right:16px;top:12px;width:min(230px,31%);padding:10px 12px;border:1px solid #845025;border-radius:13px;background:#29150d;font-size:13px}.bubble b{display:block;color:#efbd62;font-size:9px;text-transform:uppercase;margin-bottom:5px}.board-wrap{min-height:0;display:grid;place-items:center}.frame{height:min(100%,calc(100vw - 530px));aspect-ratio:1;padding:14px;background:linear-gradient(135deg,#9a6330,#4b2613 40%,#a66d32);border:3px double #c18b49;border-radius:18px;box-shadow:0 12px 35px #0008}.board{height:100%;width:100%;display:grid;grid-template-columns:repeat(8,1fr);grid-template-rows:repeat(8,1fr);border:2px solid #2b1109}.sq{border:0;padding:0;display:grid;place-items:center;position:relative;cursor:pointer;font-family:"DejaVu Sans",Arial,sans-serif;font-size:clamp(27px,4.2vw,58px);line-height:1}.sq.light{background:var(--sq1)}.sq.dark{background:var(--sq2)}.sq.sel{box-shadow:inset 0 0 0 4px #ffe07a}.sq.legal:after{content:"";width:20%;height:20%;border-radius:50%;background:#ffe8a5aa}.sq.capture:after{content:"";position:absolute;inset:8%;border:4px solid #ffd06b;border-radius:50%}.sq.last{box-shadow:inset 0 0 0 4px #dfa63099}.piece{display:block;width:94%;height:94%;object-fit:contain;pointer-events:none;user-select:none;filter:drop-shadow(0 5px 3px rgba(0,0,0,.5))}.piece.white{filter:drop-shadow(0 5px 3px rgba(0,0,0,.55))}.piece.black{filter:drop-shadow(0 5px 3px rgba(0,0,0,.72)) drop-shadow(0 0 1px rgba(255,225,175,.42))}.status{display:flex;justify-content:space-between;align-items:center;font-size:12px;color:#e8d6ba}.lamp{display:inline-block;width:9px;height:9px;border-radius:50%;background:#70d886;box-shadow:0 0 8px #70d886;margin-right:7px}.right{display:grid;grid-template-rows:auto auto;align-content:end;gap:9px}.captured,.lesson{font-size:12px;line-height:1.35}.footer{text-align:center;color:#b59570;font-size:9px}.toast{position:fixed;left:50%;bottom:40px;transform:translateX(-50%);background:#24120b;border:1px solid #b27432;border-radius:10px;padding:9px 15px;opacity:0;pointer-events:none;transition:.2s}.toast.show{opacity:1}@media(max-width:1050px){.layout{grid-template-columns:180px minmax(430px,1fr) 180px}.frame{height:min(100%,calc(100vw - 400px))}.ctl{min-height:49px;padding:7px}.opponent{height:120px}.stage{grid-template-rows:120px 1fr 22px}.opponent img{height:170px}.bubble{font-size:11px}}@media(max-width:780px) and (orientation:portrait){html,body{overflow:auto}.app{height:auto;min-height:100vh;grid-template-rows:auto auto}.layout{grid-template-columns:1fr}.left{display:grid;grid-template-columns:repeat(2,1fr)}.tip{margin:0}.stage{height:auto;grid-template-rows:125px auto 25px}.frame{width:min(94vw,620px);height:auto}.right{grid-template-rows:auto}.top-actions .label{display:none}}

/* 2026-08-05 screen-fit correction: board is constrained by available viewport height,
   while realistic piece artwork is scaled inside each existing square. */
.layout{overflow:hidden}
.stage{overflow:hidden}
.board-wrap{overflow:hidden;min-height:0;min-width:0}
.frame{
  width:min(calc(100dvh - 245px),calc(100vw - 510px),720px);
  height:min(calc(100dvh - 245px),calc(100vw - 510px),720px);
  max-width:100%;
  max-height:100%;
  flex:none;
}
.piece{
  width:76%;
  height:76%;
  object-fit:contain;
  object-position:center bottom;
}
.piece[data-piece="p"]{width:68%;height:68%}
@media(max-height:820px) and (min-width:781px){
  .app{grid-template-rows:48px 1fr 18px;gap:4px;padding-top:4px;padding-bottom:4px}
  .stage{grid-template-rows:118px 1fr 20px;gap:4px}
  .opponent img{height:170px;bottom:-48px}
  .frame{
    width:min(calc(100dvh - 205px),calc(100vw - 510px),650px);
    height:min(calc(100dvh - 205px),calc(100vw - 510px),650px);
    padding:10px;
  }
  .piece{width:73%;height:73%}
  .piece[data-piece="p"]{width:64%;height:64%}
  .ctl{min-height:50px;padding:7px 9px}
  .left{gap:6px}
  .tip{padding:8px}
}
@media(max-width:1050px) and (min-width:781px){
  .frame{
    width:min(calc(100dvh - 205px),calc(100vw - 390px),620px);
    height:min(calc(100dvh - 205px),calc(100vw - 390px),620px);
  }
}
@media(max-width:780px){
  .frame{width:min(94vw,620px);height:auto;max-height:none}
  .piece{width:76%;height:76%}
}

/* 2026-08-05 balanced viewport correction.
   Goldie and the board are sized independently. The complete desktop game must
   remain inside the visible browser area without vertical scrolling or clipping. */
@media (min-width:781px){
  .app{
    height:100dvh;
    grid-template-rows:48px minmax(0,1fr) 16px;
    gap:4px;
    padding:4px 1.4vw;
    overflow:hidden;
  }
  .layout{
    min-height:0;
    height:100%;
    overflow:hidden;
  }
  .stage{
    min-height:0;
    height:100%;
    grid-template-rows:150px minmax(0,1fr) 20px;
    gap:4px;
    overflow:hidden;
  }
  .opponent{
    min-height:0;
    height:150px;
  }
  .opponent img{
    height:285px;
    width:auto;
    max-width:none;
    bottom:-103px;
    transform:translateX(-50%);
  }
  .board-wrap{
    min-height:0;
    height:100%;
    overflow:hidden;
    display:grid;
    place-items:center;
  }
  .frame{
    box-sizing:border-box;
    width:min(570px,calc(100vw - 535px),calc(100dvh - 260px));
    height:min(570px,calc(100vw - 535px),calc(100dvh - 260px));
    min-width:0;
    min-height:0;
    max-width:100%;
    max-height:100%;
    padding:9px;
    border-radius:15px;
  }
  .piece{
    width:70%;
    height:70%;
    object-position:center bottom;
  }
  .piece[data-piece="p"]{
    width:61%;
    height:61%;
  }
  .status{height:20px;min-height:20px}
}
@media (min-width:781px) and (max-height:760px){
  .stage{grid-template-rows:126px minmax(0,1fr) 18px}
  .opponent{height:126px}
  .opponent img{height:248px;bottom:-92px}
  .frame{
    width:min(515px,calc(100vw - 515px),calc(100dvh - 225px));
    height:min(515px,calc(100vw - 515px),calc(100dvh - 225px));
    padding:8px;
  }
  .piece{width:68%;height:68%}
  .piece[data-piece="p"]{width:59%;height:59%}
}
@media (min-width:781px) and (min-height:900px){
  .stage{grid-template-rows:180px minmax(0,1fr) 22px}
  .opponent{height:180px}
  .opponent img{height:340px;bottom:-122px}
  .frame{
    width:min(630px,calc(100vw - 535px),calc(100dvh - 300px));
    height:min(630px,calc(100vw - 535px),calc(100dvh - 300px));
  }
}


/* 2026-08-06 fancy piece integration.
   Pieces preserve their natural width; only their height is scaled to fit each square. */
.piece{
  position:absolute;
  left:50%;
  bottom:2%;
  transform:translateX(-50%);
  width:auto !important;
  height:72% !important;
  max-width:none !important;
  max-height:none !important;
  object-fit:contain;
  object-position:center bottom;
  pointer-events:none;
  user-select:none;
  display:block;
  filter:drop-shadow(0 4px 3px rgba(0,0,0,.45));
}
.piece.black{filter:drop-shadow(0 5px 4px rgba(0,0,0,.65)) drop-shadow(0 0 1px rgba(255,235,200,.18));}
.piece.white{filter:drop-shadow(0 4px 3px rgba(0,0,0,.35));}
.piece[data-piece="p"]{height:58% !important;}
.piece[data-piece="r"]{height:68% !important;}
.piece[data-piece="n"]{height:70% !important;}
.piece[data-piece="b"]{height:72% !important;}
.piece[data-piece="q"]{height:74% !important;}
.piece[data-piece="k"]{height:77% !important;}
@media (min-width:781px) and (max-height:760px){
  .piece[data-piece="p"]{height:56% !important;}
  .piece[data-piece="r"]{height:66% !important;}
  .piece[data-piece="n"]{height:68% !important;}
  .piece[data-piece="b"]{height:70% !important;}
  .piece[data-piece="q"]{height:72% !important;}
  .piece[data-piece="k"]{height:75% !important;}
}


/* 2026-08-06 luxury board and larger Goldie layout */
:root{
  --sq1:#d8b477;
  --sq2:#6a341d;
  --board-gold:#d4a458;
  --board-dark:#1d0f09;
}

/* Goldie now appears directly in the scene without a visible portrait panel. */
.opponent{
  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;
  overflow:visible !important;
  box-shadow:none !important;
}
.opponent::before,
.opponent::after{content:none !important;display:none !important;}
.opponent img{
  filter:drop-shadow(0 12px 18px rgba(0,0,0,.45));
}
.bubble{display:none !important;}

/* Luxury board: layered walnut, ebony and brass frame with inset bevels. */
.frame{
  position:relative;
  padding:16px !important;
  background:
    linear-gradient(135deg,rgba(255,255,255,.12),transparent 18%,transparent 78%,rgba(0,0,0,.28)),
    repeating-linear-gradient(90deg,rgba(255,255,255,.025) 0 2px,rgba(0,0,0,.025) 2px 5px),
    linear-gradient(145deg,#6b3b1e 0%,#2c160c 28%,#7f4a25 52%,#241108 78%,#5b3018 100%) !important;
  border:1px solid #e0b56a !important;
  border-radius:20px !important;
  box-shadow:
    0 16px 38px rgba(0,0,0,.62),
    0 3px 0 #160a05,
    inset 0 0 0 3px #2a140a,
    inset 0 0 0 6px #b9803d,
    inset 0 0 0 8px #3a1d0e !important;
}
.frame::before{
  content:"";
  position:absolute;
  inset:7px;
  border:1px solid rgba(255,218,145,.55);
  border-radius:14px;
  pointer-events:none;
  box-shadow:inset 0 0 12px rgba(0,0,0,.55);
}
.frame::after{
  content:"G";
  position:absolute;
  left:50%;
  bottom:-12px;
  transform:translateX(-50%);
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  border-radius:50%;
  color:#2a1409;
  font-weight:700;
  font-size:18px;
  background:radial-gradient(circle at 35% 28%,#f0cf82,#b5792f 58%,#6f4017 100%);
  border:2px solid #e2b967;
  box-shadow:0 4px 10px rgba(0,0,0,.55),inset 0 1px 1px rgba(255,255,255,.55);
  pointer-events:none;
  z-index:5;
}
.board{
  position:relative;
  border:2px solid #1b0c06 !important;
  box-shadow:
    0 0 0 2px #bf8746,
    0 0 0 4px #281208,
    inset 0 0 16px rgba(0,0,0,.28) !important;
  background:#3a1b0d;
}
.sq.light{
  background:
    linear-gradient(135deg,rgba(255,255,255,.12),transparent 38%),
    repeating-linear-gradient(90deg,rgba(104,61,29,.05) 0 1px,transparent 1px 5px),
    linear-gradient(145deg,#dfbd80,#c89a5d) !important;
}
.sq.dark{
  background:
    linear-gradient(135deg,rgba(255,255,255,.045),transparent 40%),
    repeating-linear-gradient(90deg,rgba(255,255,255,.018) 0 1px,transparent 1px 5px),
    linear-gradient(145deg,#754024,#542714) !important;
}
.sq:hover{box-shadow:inset 0 0 0 2px rgba(255,220,140,.28);}
.sq.sel{box-shadow:inset 0 0 0 4px #f6cf73,inset 0 0 22px rgba(255,220,120,.3) !important;}
.sq.last{box-shadow:inset 0 0 0 4px rgba(226,170,77,.58) !important;}

@media (min-width:781px){
  .stage{
    grid-template-rows:190px minmax(0,1fr) 20px !important;
  }
  .opponent{
    height:190px !important;
  }
  .opponent img{
    height:355px !important;
    bottom:-124px !important;
    width:auto !important;
    max-width:none !important;
  }
  .frame{
    width:min(535px,calc(100vw - 535px),calc(100dvh - 310px)) !important;
    height:min(535px,calc(100vw - 535px),calc(100dvh - 310px)) !important;
  }
}
@media (min-width:781px) and (max-height:760px){
  .stage{grid-template-rows:155px minmax(0,1fr) 18px !important;}
  .opponent{height:155px !important;}
  .opponent img{height:305px !important;bottom:-110px !important;}
  .frame{
    width:min(470px,calc(100vw - 515px),calc(100dvh - 270px)) !important;
    height:min(470px,calc(100vw - 515px),calc(100dvh - 270px)) !important;
    padding:13px !important;
  }
}
@media (min-width:781px) and (min-height:900px){
  .stage{grid-template-rows:220px minmax(0,1fr) 22px !important;}
  .opponent{height:220px !important;}
  .opponent img{height:410px !important;bottom:-145px !important;}
  .frame{
    width:min(590px,calc(100vw - 535px),calc(100dvh - 355px)) !important;
    height:min(590px,calc(100vw - 535px),calc(100dvh - 355px)) !important;
  }
}

/* v10: no top header, side-mounted controls, fully visible Goldie, stocky 85%-wide pieces */
@media (min-width:781px){
  html,body{overflow:hidden}
  .app{height:100dvh;display:grid;grid-template-rows:minmax(0,1fr) 18px;gap:3px;padding:5px 10px;overflow:hidden}
  .top{display:none!important}
  .layout{height:100%;min-height:0;display:grid;grid-template-columns:235px minmax(500px,1fr) 215px;gap:10px;overflow:hidden}
  .left{padding:10px;gap:6px;overflow:hidden}
  .side-brand{display:flex;align-items:center;gap:8px;padding-bottom:4px;border-bottom:1px solid rgba(227,173,84,.28)}
  .side-brand .logo{width:35px;height:35px;font-size:20px;flex:0 0 auto}
  .side-brand h1{margin:0;font-size:21px;line-height:1}
  .side-brand small{font-size:7px;color:#e8bb68;text-transform:uppercase;letter-spacing:1.2px}
  .left h2{margin:2px 0 3px;font-size:16px}
  .ctl{min-height:48px;padding:7px 9px}
  .ctl strong{font-size:14px}.ctl small{font-size:11px}
  .side-toggles{display:grid;grid-template-columns:1fr 1fr;gap:5px}
  .side-toggles .smallbtn{padding:7px 5px;font-size:11px;min-width:0;text-align:center}
  .tip{margin-top:auto;padding:8px;font-size:11px}
  .stage{height:100%;min-height:0;display:grid;grid-template-rows:225px minmax(0,1fr) 20px;gap:4px;overflow:hidden}
  .opponent{height:225px;min-height:225px;overflow:visible!important;display:flex;align-items:flex-end;justify-content:center}
  .opponent img{position:relative!important;left:auto!important;bottom:auto!important;transform:none!important;height:315px!important;width:auto!important;max-width:none!important;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 12px 18px rgba(0,0,0,.45))}
  .board-wrap{height:100%;min-height:0;display:grid;place-items:start center;overflow:hidden}
  .frame{width:min(540px,calc(100vw - 495px),calc(100dvh - 275px))!important;height:min(540px,calc(100vw - 495px),calc(100dvh - 275px))!important;max-width:100%;max-height:100%;padding:13px!important}
  .right{align-content:end;gap:8px}
  .footer{font-size:8px}
  .piece{position:absolute;left:50%;bottom:3%;transform:translateX(-50%);width:85%!important;height:auto!important;max-width:85%!important;max-height:83%!important;object-fit:contain;object-position:center bottom;display:block}
  .piece[data-piece="p"],.piece[data-piece="r"],.piece[data-piece="n"],.piece[data-piece="b"],.piece[data-piece="q"],.piece[data-piece="k"]{width:85%!important;height:auto!important;max-width:85%!important;max-height:83%!important}
}
@media (min-width:781px) and (max-height:800px){
  .layout{grid-template-columns:220px minmax(460px,1fr) 200px}
  .stage{grid-template-rows:180px minmax(0,1fr) 18px}
  .opponent{height:180px;min-height:180px}
  .opponent img{height:255px!important}
  .frame{width:min(485px,calc(100vw - 450px),calc(100dvh - 215px))!important;height:min(485px,calc(100vw - 450px),calc(100dvh - 215px))!important;padding:11px!important}
  .ctl{min-height:43px;padding:5px 8px}.tip{padding:6px}.side-toggles .smallbtn{padding:5px 3px;font-size:10px}
}
@media (min-width:781px) and (min-height:950px){
  .stage{grid-template-rows:255px minmax(0,1fr) 22px}
  .opponent{height:255px;min-height:255px}.opponent img{height:360px!important}
  .frame{width:min(600px,calc(100vw - 495px),calc(100dvh - 315px))!important;height:min(600px,calc(100vw - 495px),calc(100dvh - 315px))!important}
}

/* 2026-08-06 verified classic layout: recognizable pieces, board lower, Goldie fully visible. */
@media (min-width:781px){
  .app{padding:5px 10px;height:100dvh;overflow:hidden}
  .layout{grid-template-columns:235px minmax(500px,1fr) 215px;gap:10px;height:100%;overflow:hidden}
  .stage{grid-template-rows:250px minmax(0,1fr) 20px;gap:6px;height:100%;overflow:hidden}
  .opponent{height:250px;min-height:250px;display:flex;align-items:flex-end;justify-content:center;overflow:hidden!important}
  .opponent img{
    position:relative!important;
    left:auto!important;
    bottom:-8px!important;
    transform:none!important;
    height:260px!important;
    width:auto!important;
    max-width:none!important;
    object-fit:contain;
    object-position:center bottom;
    filter:drop-shadow(0 10px 16px rgba(0,0,0,.42));
  }
  .board-wrap{height:100%;min-height:0;display:grid;place-items:start center;overflow:hidden;padding-top:8px}
  .frame{
    width:min(520px,calc(100vw - 500px),calc(100dvh - 325px))!important;
    height:min(520px,calc(100vw - 500px),calc(100dvh - 325px))!important;
    max-width:100%;max-height:100%;padding:13px!important;
  }
  .piece{
    position:absolute;
    left:50%;
    bottom:3%;
    transform:translateX(-50%);
    width:auto!important;
    max-width:82%!important;
    height:76%!important;
    max-height:76%!important;
    object-fit:contain;
    object-position:center bottom;
    display:block;
    pointer-events:none;
    user-select:none;
  }
  .piece.white{
    filter:brightness(1.08) contrast(1.16) saturate(.92) drop-shadow(0 3px 2px rgba(36,16,7,.58));
  }
  .piece.black{
    filter:brightness(1.28) contrast(1.22) saturate(.9) drop-shadow(0 4px 3px rgba(0,0,0,.72)) drop-shadow(0 0 1px rgba(255,210,120,.7));
  }
  .piece[data-piece="p"]{height:66%!important;max-height:66%!important}
  .piece[data-piece="r"]{height:72%!important;max-height:72%!important}
  .piece[data-piece="n"]{height:74%!important;max-height:74%!important}
  .piece[data-piece="b"]{height:75%!important;max-height:75%!important}
  .piece[data-piece="q"]{height:77%!important;max-height:77%!important}
  .piece[data-piece="k"]{height:78%!important;max-height:78%!important}
}
@media (min-width:781px) and (max-height:820px){
  .stage{grid-template-rows:205px minmax(0,1fr) 18px;gap:4px}
  .opponent{height:205px;min-height:205px}
  .opponent img{height:220px!important;bottom:-7px!important}
  .board-wrap{padding-top:5px}
  .frame{
    width:min(470px,calc(100vw - 470px),calc(100dvh - 260px))!important;
    height:min(470px,calc(100vw - 470px),calc(100dvh - 260px))!important;
    padding:11px!important;
  }
}
@media (min-width:781px) and (max-height:820px){
  .opponent img{height:202px!important;bottom:0!important}
}


/* 2026-08-06 right-side Goldie layout revision.
   Goldie moves to the right, the board uses the center column, and both are sized as large as possible. */
@media (min-width: 781px){
  .app{
    height:100dvh;
    grid-template-rows:minmax(0,1fr) 18px;
    gap:4px;
    padding:6px 10px 4px;
    overflow:hidden;
  }
  .layout{
    display:grid;
    grid-template-columns:210px minmax(0,1fr) 260px;
    grid-template-rows:minmax(0,1fr) 22px;
    grid-template-areas:
      "left board goldie"
      "left status right";
    align-items:stretch;
    gap:8px;
    overflow:hidden;
    min-height:0;
    height:100%;
  }
  .left{grid-area:left; padding:10px; gap:6px; overflow:hidden;}
  .right{grid-area:right; display:grid; grid-template-rows:auto auto; align-content:end; gap:8px; min-height:0;}
  .captured,.lesson{padding:10px;}
  .captured h2,.lesson h2,.left h2{font-size:16px; margin:2px 0 6px;}
  .ctl{min-height:52px; padding:7px 10px;}
  .ctl strong{font-size:14px;}
  .ctl small{font-size:12px;}
  .side-toggles{display:grid; grid-template-columns:1fr 1fr; gap:6px;}
  .smallbtn{padding:8px 8px; font-size:12px; line-height:1.1;}
  .tip{padding:10px; font-size:12px;}

  .stage{display:contents;}
  .board-wrap{
    grid-area:board;
    min-height:0; min-width:0;
    display:grid;
    place-items:end center;
    overflow:hidden;
    padding-top:56px;
  }
  .opponent{
    grid-area:goldie;
    position:relative;
    min-height:0;
    height:100%;
    background:transparent !important;
    border:0 !important;
    border-radius:0 !important;
    overflow:hidden !important;
    box-shadow:none !important;
    display:flex;
    align-items:flex-start;
    justify-content:center;
    padding-top:4px;
  }
  .opponent img{
    position:relative !important;
    left:auto !important;
    bottom:auto !important;
    transform:none !important;
    width:auto;
    height:min(54vh, 520px);
    max-width:100%;
    object-fit:contain;
    filter:drop-shadow(0 14px 20px rgba(0,0,0,.40));
  }
  .bubble{display:none !important;}

  .frame{
    width:min(calc(100vw - 510px), calc(100dvh - 84px), 760px) !important;
    height:min(calc(100vw - 510px), calc(100dvh - 84px), 760px) !important;
    max-width:100%;
    max-height:100%;
    padding:12px !important;
    margin-top:auto;
  }
  .status{
    grid-area:status;
    align-self:center;
    height:22px; min-height:22px;
    padding:0 8px;
  }
  .piece{
    position:absolute;
    left:50%; bottom:2%; transform:translateX(-50%);
    width:82% !important; height:82% !important;
    object-fit:contain; object-position:center bottom;
  }
  .piece.white{filter:contrast(1.12) brightness(1.08) drop-shadow(0 4px 2px rgba(0,0,0,.32));}
  .piece.black{filter:contrast(1.18) brightness(.93) drop-shadow(0 5px 3px rgba(0,0,0,.55)) drop-shadow(0 0 1px rgba(255,238,200,.30));}
  .piece[data-piece="p"]{width:72% !important; height:72% !important;}

  .footer{font-size:9px; line-height:1; padding-top:2px;}
}
@media (min-width: 781px) and (max-width: 1400px){
  .layout{grid-template-columns:200px minmax(0,1fr) 240px;}
  .frame{width:min(calc(100vw - 470px), calc(100dvh - 88px), 700px) !important; height:min(calc(100vw - 470px), calc(100dvh - 88px), 700px) !important;}
  .opponent img{height:min(50vh, 460px);}
}
@media (min-width: 781px) and (max-height: 800px){
  .layout{grid-template-columns:195px minmax(0,1fr) 230px; gap:7px;}
  .left{padding:8px; gap:5px;}
  .ctl{min-height:48px; padding:6px 9px;}
  .smallbtn{padding:7px 6px; font-size:11px;}
  .board-wrap{padding-top:42px;}
  .frame{width:min(calc(100vw - 450px), calc(100dvh - 76px), 660px) !important; height:min(calc(100vw - 450px), calc(100dvh - 76px), 660px) !important; padding:10px !important;}
  .opponent img{height:min(46vh, 400px);}
  .captured,.lesson{padding:9px; font-size:11px;}
}

/* 2026-08-06 reference layout supplied by Will.
   Controls left, oversized board center, Goldie and learning/captured areas right. */
@media (min-width: 781px){
  .app{
    height:100dvh;
    display:grid;
    grid-template-rows:minmax(0,1fr) 18px;
    gap:2px;
    padding:4px 8px 2px;
    overflow:hidden;
  }
  .layout{
    height:100%;
    min-height:0;
    display:grid;
    grid-template-columns:200px minmax(560px,1fr) minmax(430px,620px);
    grid-template-rows:minmax(0,1fr) 22px;
    grid-template-areas:
      "left board right"
      "left status right";
    gap:8px;
    overflow:hidden;
  }
  .left{
    grid-area:left;
    height:100%;
    padding:10px;
    gap:6px;
    overflow:hidden;
  }
  .side-brand h1{font-size:22px;margin:0;}
  .side-brand small{font-size:8px;}
  .left h2{font-size:17px;margin:2px 0 6px;}
  .ctl{min-height:50px;padding:7px 9px;}
  .ctl strong{font-size:14px;}
  .ctl small{font-size:11px;}
  .side-toggles{display:grid;grid-template-columns:1fr 1fr;gap:5px;}
  .smallbtn{padding:7px 5px;font-size:11px;line-height:1.15;}
  .tip{padding:9px;font-size:11px;line-height:1.35;}

  .stage{display:contents;}
  .board-wrap{
    grid-area:board;
    min-width:0;
    min-height:0;
    height:100%;
    display:grid;
    place-items:center;
    overflow:hidden;
  }
  .frame{
    width:min(calc(100dvh - 44px),calc(100vw - 760px),790px) !important;
    height:min(calc(100dvh - 44px),calc(100vw - 760px),790px) !important;
    max-width:100%;
    max-height:100%;
    padding:12px !important;
  }
  .status{
    grid-area:status;
    height:22px;
    min-height:22px;
    padding:0 8px;
    align-self:center;
  }

  .right-scene{
    grid-area:right;
    position:relative;
    min-width:0;
    min-height:0;
    height:100%;
    overflow:hidden;
    background:transparent;
  }
  .tips-area{
    position:absolute;
    top:5%;
    left:8%;
    right:4%;
    text-align:center;
    z-index:3;
  }
  .tips-area h2{
    margin:0 0 8px;
    font-family:Arial,sans-serif;
    font-size:clamp(22px,1.8vw,34px);
    font-weight:400;
    color:#fff4df;
    text-shadow:0 2px 4px #000;
  }
  .tips-area h3{
    margin:0 0 4px;
    font-size:clamp(15px,1vw,20px);
    color:#e9b660;
  }
  .tips-area p{
    margin:0 auto;
    max-width:420px;
    font-size:clamp(12px,.85vw,16px);
    line-height:1.35;
    color:#f0dcc0;
  }
  .opponent{
    position:absolute !important;
    left:3%;
    bottom:8%;
    width:68%;
    height:78%;
    border:0 !important;
    background:transparent !important;
    overflow:visible !important;
    box-shadow:none !important;
  }
  .opponent img{
    position:absolute !important;
    left:50% !important;
    bottom:0 !important;
    transform:translateX(-50%) !important;
    height:100% !important;
    width:auto !important;
    max-width:100%;
    object-fit:contain;
    filter:drop-shadow(0 14px 20px rgba(0,0,0,.42));
  }
  .bubble{display:none !important;}
  .captured{
    position:absolute;
    right:1%;
    width:46%;
    padding:0;
    border:0;
    background:transparent;
    text-align:center;
    z-index:4;
  }
  .captured h2{
    margin:0 0 8px;
    font-family:Arial,sans-serif;
    font-size:clamp(20px,1.55vw,30px);
    font-weight:400;
    color:#fff4df;
    text-shadow:0 2px 4px #000;
  }
  .captured p{
    margin:0;
    min-height:38px;
    font-size:clamp(18px,1.35vw,28px);
    letter-spacing:4px;
    color:#f1d09a;
    text-shadow:0 2px 3px #000;
  }
  .goldie-captured{top:34%;}
  .player-captured{top:66%;}

  .piece{
    position:absolute;
    left:50%;
    bottom:2%;
    transform:translateX(-50%);
    width:82% !important;
    height:82% !important;
    object-fit:contain;
    object-position:center bottom;
  }
  .piece[data-piece="p"]{width:70% !important;height:70% !important;}
  .piece.white{filter:contrast(1.12) brightness(1.08) drop-shadow(0 4px 2px rgba(0,0,0,.34));}
  .piece.black{filter:contrast(1.2) brightness(.92) drop-shadow(0 5px 3px rgba(0,0,0,.56)) drop-shadow(0 0 1px rgba(255,238,200,.32));}
  .footer{font-size:8px;line-height:1;}
}

@media (min-width:781px) and (max-width:1450px){
  .layout{grid-template-columns:190px minmax(500px,1fr) minmax(350px,470px);}
  .frame{
    width:min(calc(100dvh - 48px),calc(100vw - 650px),720px) !important;
    height:min(calc(100dvh - 48px),calc(100vw - 650px),720px) !important;
  }
  .opponent{left:0;width:72%;height:74%;}
  .captured{width:47%;}
}

@media (min-width:781px) and (max-height:800px){
  .layout{grid-template-columns:185px minmax(480px,1fr) minmax(340px,450px);}
  .left{padding:7px;gap:4px;}
  .ctl{min-height:45px;padding:6px 8px;}
  .smallbtn{padding:6px 4px;font-size:10px;}
  .tip{padding:7px;font-size:10px;}
  .frame{
    width:min(calc(100dvh - 38px),calc(100vw - 625px),690px) !important;
    height:min(calc(100dvh - 38px),calc(100vw - 625px),690px) !important;
    padding:10px !important;
  }
  .tips-area{top:3%;}
  .opponent{bottom:5%;height:75%;}
  .goldie-captured{top:35%;}
  .player-captured{top:68%;}
}


/* 2026-08-06 final Goldie size / proximity tuning. */
@media (min-width:781px){
  .right-scene{overflow:hidden;}
  .tips-area{top:4%; left:10%; right:4%;}
  .opponent{
    left:-8% !important;
    bottom:0 !important;
    width:84% !important;
    height:88% !important;
  }
  .opponent img{
    height:100% !important;
    max-width:none !important;
  }
  .goldie-captured{top:36%; right:0; width:44%;}
  .player-captured{top:70%; right:0; width:44%;}
}
@media (min-width:781px) and (max-width:1450px){
  .opponent{left:-10% !important; width:88% !important; height:86% !important;}
  .goldie-captured{top:37%; width:43%;}
  .player-captured{top:71%; width:43%;}
}
@media (min-width:781px) and (max-height:800px){
  .tips-area{top:2%;}
  .opponent{left:-8% !important; width:82% !important; height:84% !important; bottom:0 !important;}
  .goldie-captured{top:35%; width:43%;}
  .player-captured{top:69%; width:43%;}
}


/* 2026-08-06 Goldie position tweak: move 70px closer to the board. */
@media (min-width:781px){
  .opponent{transform:translateX(-70px) !important;}
}


/* 2026-08-06 arm visibility fix: keep Goldie close to the board without clipping her arm. */
@media (min-width:781px){
  .right-scene{overflow:hidden !important;}
  .opponent{
    transform:none !important;
    left:-14% !important;
    width:96% !important;
    height:88% !important;
    bottom:0 !important;
  }
  .opponent img{
    left:50% !important;
    bottom:0 !important;
    height:100% !important;
    width:auto !important;
    max-width:none !important;
  }
}
@media (min-width:781px) and (max-width:1450px){
  .opponent{left:-15% !important; width:98% !important; height:86% !important;}
}
@media (min-width:781px) and (max-height:800px){
  .opponent{left:-12% !important; width:94% !important; height:84% !important;}
}
.rotate-prompt{display:none}
@media(max-width:780px) and (orientation:portrait){
  .app{display:none}
  .rotate-prompt{
    display:flex;
    position:fixed;
    inset:0;
    z-index:9999;
    align-items:center;
    justify-content:center;
    padding:32px;
    text-align:center;
    background:radial-gradient(circle at 50% 5%,#432312 0,#1a0c07 55%,#0d0604 100%);
    color:var(--cream);
  }
  .rotate-prompt-inner{max-width:320px}
  .rotate-icon{font-size:64px;margin-bottom:16px;animation:rotate-hint 1.8s ease-in-out infinite}
  .rotate-prompt p{font-size:16px;line-height:1.5;font-family:Georgia,serif}
  @keyframes rotate-hint{0%,100%{transform:rotate(0deg)}50%{transform:rotate(90deg)}}
}
