:root{
--base:#050b07;--panel:#07130b;--panel2:#0b1f12;--line:#1f7132;--bright:#81ff44;--soft:#c8ffc0;--gold:#f0cf83;--white:#f3fce8;--dim:#88b496;--red:#f16a66;
--display:"Orbitron",system-ui,sans-serif;--body:"Rajdhani",system-ui,sans-serif;color-scheme:dark}
*{box-sizing:border-box}html{background:var(--base);scrollbar-color:#246c2e var(--base)}
body{margin:0;color:var(--white);font-family:var(--body);font-weight:600;background:radial-gradient(ellipse 95% 37% at 50% 0%,#10301a 0%,#030a06 65%,#020603 100%);min-height:100svh;overflow-x:hidden}
button,a{-webkit-tap-highlight-color:transparent;touch-action:manipulation}
button{font:inherit;color:inherit;cursor:pointer}
a{color:inherit;text-decoration:none}
button:focus-visible,a:focus-visible{outline:3px solid #ddff8d;outline-offset:3px}
.circuit{position:fixed;z-index:0;pointer-events:none;top:0;bottom:0;width:28%;opacity:.32;background:
repeating-linear-gradient(135deg,transparent 0,transparent 31px,rgba(83,255,88,.09) 32px,transparent 33px,transparent 91px),
repeating-linear-gradient(90deg,transparent 0 32px,rgba(44,197,61,.26) 33px,transparent 34px 95px);
filter:drop-shadow(0 0 4px #06b434)}
.circuit-left{left:0;clip-path:polygon(0 0,100% 0,48% 30%,100% 54%,18% 88%,60% 100%,0 100%)}
.circuit-right{right:0;transform:scaleX(-1);clip-path:polygon(0 0,100% 0,48% 30%,100% 54%,18% 88%,60% 100%,0 100%)}
.app{position:relative;z-index:1;margin:0 auto;max-width:970px;padding:15px max(10px,env(safe-area-inset-left)) calc(25px + env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-right));}
.site-header{display:flex;justify-content:space-between;align-items:center;gap:10px;min-height:89px;padding:0 5px 9px;border-bottom:1px solid #249b36}
.chrome{background:linear-gradient(150deg,#09180e,#030b06);color:var(--soft);border:1px solid #278d3c;border-radius:12px;box-shadow:inset 0 0 13px #08331c,0 0 13px #0b5c27;transition:transform .16s,border-color .16s}
.chrome:active,.action-btn:active{transform:scale(.96)}
.square-icon{width:clamp(35px,8vw,50px);height:clamp(38px,8vw,50px);display:grid;place-items:center;font-size:clamp(1.1rem,3.4vw,1.55rem);flex:none}
.back{font-size:1.45rem}
.brand{display:flex;align-items:center;gap:7px;min-width:0;justify-content:center;flex:1}
.brand-icon{position:relative;width:clamp(47px,10vw,75px);height:clamp(48px,10vw,76px);overflow:hidden;flex:none;filter:drop-shadow(0 0 8px #41ff3e)}
.brand-icon img{position:absolute;width:100%;height:100%;object-fit:contain;top:0;left:0;}
.brand-letters{text-align:center;min-width:0}
.brand-name{font-family:var(--display);font-weight:800;line-height:1.12;color:#a2ff73;text-shadow:0 0 6px #6aff33,0 0 24px #34db26;letter-spacing:.035em;font-size:clamp(.95rem,3.8vw,2.5rem);white-space:nowrap}
.brand-game{font:700 clamp(.59rem,1.9vw,.9rem) var(--display);letter-spacing:clamp(.06em,.6vw,.3em);margin-top:6px;color:#f8fef1;white-space:nowrap}
.header-actions{display:flex;gap:4px;flex:none}
.matchup{position:relative;display:grid;grid-template-columns:minmax(0,1fr) 115px minmax(0,1fr);gap:8px;align-items:stretch;padding:18px 0 12px}
.player{min-width:0;border:1px solid #277b3a;background:linear-gradient(125deg,#0a2012,#030b07);border-radius:9px;display:flex;align-items:center;gap:8px;padding:9px 8px;box-shadow:inset 0 0 24px #051e0e,0 0 10px #083b16}
.player-avatar{flex:none;display:grid;place-items:center;width:clamp(31px,8vw,65px);height:clamp(39px,9vw,65px);font-size:clamp(1.6rem,5vw,2.55rem);border:1px solid #30894c;border-radius:9px;background:radial-gradient(#1c6834,#05170b);text-shadow:0 0 8px #85ff5f}
.avatar-you{color:#ffeac4}.avatar-bot{color:#9fff83}
.player-text{min-width:0;display:flex;flex-direction:column;gap:3px;line-height:1.08}
.player-title{font:800 clamp(.8rem,2.5vw,1.3rem) var(--body);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.player-subtitle{font:700 clamp(.6rem,1.8vw,.81rem) var(--body);letter-spacing:.02em;color:#91ff73;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.player-stat{font:700 clamp(.74rem,2.3vw,1rem) var(--display);color:#d9eed8;white-space:nowrap}
.clock-center{text-align:center;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:7px}
.live-indicator{font:700 .62rem var(--display);white-space:nowrap;color:#79da80;letter-spacing:.04em}
.time-display{width:100%;color:#adff8c;background:#092a12;border:1px solid #4de54e;border-radius:10px;padding:5px 4px;font:800 clamp(1.07rem,3.6vw,2rem) var(--display);text-shadow:0 0 9px #34ff29;box-shadow:0 0 15px #08792280;font-variant-numeric:tabular-nums}
.clock-center small{font-size:.72rem;color:var(--dim);font-weight:700;white-space:nowrap}
.board-shell{border:1px solid #228e32;border-radius:14px;padding:8px 5px 6px;background:linear-gradient(145deg,#0a2813,#030b07 50%,#0e2e16);box-shadow:inset 0 0 22px #3deb2633,0 0 21px #2aaf3d55}
.board-topbar{display:flex;justify-content:space-between;align-items:center;color:#80b48c;font:700 .68rem var(--display);padding:0 5px 8px;letter-spacing:.05em}
#turnText{color:#c7ffbe;text-shadow:0 0 8px #5ffe4e}
.board-layout{display:grid;grid-template-columns:19px minmax(0,1fr);align-items:stretch}
.ranks{display:flex;flex-direction:column;justify-content:space-around;text-align:center;font:700 clamp(.65rem,2vw,.92rem) var(--display);color:#9bab9d;white-space:pre-line}
.board-outer{position:relative;border:2px solid #68ff51;border-radius:5px;box-shadow:0 0 16px #65ff5a7d, inset 0 0 19px #27c13442;overflow:hidden;aspect-ratio:1/1;background:#031106}
.board-watermark{position:absolute;inset:0;z-index:0;pointer-events:none;display:grid;place-items:center;opacity:.24;mix-blend-mode:screen;overflow:hidden}
.board-watermark img{width:44%;height:auto;transform:translateY(12%) scale(1.3);filter:brightness(1.35) saturate(1.5);mask-image:linear-gradient(to bottom,#000 0 75%,transparent 88%)}
.board{position:absolute;inset:0;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));grid-template-rows:repeat(8,minmax(0,1fr));touch-action:manipulation}
.sq{width:100%;height:100%;min-width:0;border:0;border-right:1px solid #55cf5950;border-bottom:1px solid #55cf5950;border-radius:0;position:relative;padding:0;display:grid;place-items:center;overflow:hidden;background:transparent}
.sq.light{background:linear-gradient(145deg,#135e34d9,#0d4d2bd8 70%,#0a391ed9)}
.sq.dark{background:linear-gradient(145deg,#07180dc9,#010b07c9 75%,#071b0ec9)}
.sq.selected{background:#a1ff538c!important;box-shadow:inset 0 0 0 2px #e8ffae,0 0 14px #81ff44}
.sq.last-move{background-color:#e2ba3750;box-shadow:inset 0 0 0 2px #ddca6166}
.sq.in-check{background:#f748485c!important;box-shadow:inset 0 0 0 2px #ff7676}
.sq.legal:after{content:"";position:absolute;z-index:4;width:25%;height:25%;border-radius:50%;background:#aeff8a90;box-shadow:0 0 12px #57ff4da8;pointer-events:none}
.sq.capture:after{content:"";position:absolute;z-index:4;inset:5%;width:auto;height:auto;border-radius:50%;background:transparent;border:4px solid #aaff91;box-shadow:inset 0 0 10px #aaff62;pointer-events:none}
.sq:focus-visible{outline:3px solid #eafa8e;outline-offset:-3px;z-index:8}
.piece{position:relative;display:block;width:91%;height:96%;z-index:2;pointer-events:none;filter:drop-shadow(0 2px 2px #000d) drop-shadow(0 0 3px #0e652f)}
.piece.white{filter:drop-shadow(0 2px 2px #000c) drop-shadow(0 0 3px #ffd774)}
.piece svg{width:100%;height:100%;display:block}
.piece .piece-mark{fill:#d8ffb7;stroke:#1e5b18;stroke-width:1.8px;filter:drop-shadow(0 0 2px #54ff26)}
.piece.white .piece-mark{fill:#7aef3e;stroke:#194b0c}
.files{margin-left:19px;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));padding:8px 0 0}
.files span{text-align:center;color:#a8b6a7;font:700 clamp(.65rem,2.2vw,.94rem) var(--display)}
.match-info{padding:11px 6px 7px;min-height:61px}
.status-line{display:flex;align-items:center;gap:9px;min-height:23px;font-family:var(--display);font-size:clamp(.7rem,2vw,.88rem)}
.status-pip{width:8px;height:8px;border-radius:50%;background:var(--bright);box-shadow:0 0 9px var(--bright)}
#gameStatus{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.move-count{margin-left:auto;color:var(--dim);font-size:.65rem;white-space:nowrap}
.history{font-size:.9rem;color:#abc9ae;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:3px 0 0 17px;min-height:23px}
.action-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px;margin:7px 0 15px}
.action-btn{display:flex;flex-direction:column;gap:4px;align-items:center;justify-content:center;min-width:0;min-height:85px;padding:10px 4px;background:linear-gradient(140deg,#071a0d,#010703);border:1px solid #278b42;border-radius:11px;font:700 clamp(.7rem,2.4vw,1rem) var(--body);box-shadow:inset 0 0 16px #05331b;text-align:center;white-space:nowrap}
.action-btn.active,.action-btn:hover{border-color:#81ff44;box-shadow:inset 0 0 16px #105c21,0 0 15px #49ff4972}
.action-icon{font-size:clamp(1.4rem,4vw,2.1rem);color:#acffa7;text-shadow:0 0 11px #6eff52;line-height:1.3}
.level-control{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;max-width:610px;margin:0 auto 16px}
.level-control button{font:700 clamp(.78rem,2.4vw,1rem) var(--body);min-height:42px;background:#06140b;border:1px solid #42634b;border-radius:10px}
.level-control button.selected{border-color:#9bff81;box-shadow:inset 0 0 10px #1fa342,0 0 13px #6eff5780;color:#d0ffca}
.level-control[hidden]{display:none}
.bottom-line{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:.7rem;letter-spacing:.07em;color:#6e9f7d;border-top:1px solid #194825;padding-top:9px}
.bottom-line button{font-size:.86rem;background:#122719;border:1px solid #346b3e;border-radius:7px;padding:6px 12px;min-width:72px}
.bottom-line button:disabled{opacity:.4}
footer{font-size:.72rem;letter-spacing:.06em;text-align:center;color:#567b5f;padding:14px 0 0}
footer a{color:#91d09b;display:inline-block;padding:10px 6px}
dialog{border:1px solid #63ef58;background:#07160a;color:#efffe5;border-radius:18px;padding:0;width:min(440px,calc(100% - 28px));max-height:85vh;box-shadow:0 0 34px #28e84f66}
dialog::backdrop{background:#000c;backdrop-filter:blur(8px)}
.modal-panel{padding:28px 22px;position:relative}
.modal-panel h2{font:800 1.28rem var(--display);color:#a3ff76;text-shadow:0 0 8px #39f436;margin:0 0 15px}
.modal-panel p{font-size:1.06rem;color:#b6d3b8;line-height:1.4}
.modal-panel a{color:#b5ff90;text-decoration:underline}
.close-modal{position:absolute;right:12px;top:12px;background:#14301a;border:1px solid #4e985b;border-radius:8px;width:32px;height:32px}
.modal-group{display:flex;flex-wrap:wrap;gap:10px;margin:15px 0}
.modal-choice{padding:10px 14px;background:#0f341c;border:1px solid #51b35c;border-radius:8px;font-size:.99rem}
.modal-choice.selected{border-color:#c5ffa8;box-shadow:0 0 9px #53d63a}
.promotion-choices{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.promotion-choices button{display:grid;place-items:center;background:#14241a;border:1px solid #71bc71;border-radius:8px;padding:10px 1px;font-size:2rem;min-height:60px}
.toast{position:fixed;z-index:50;left:50%;bottom:26px;transform:translateX(-50%) translateY(10px);background:#102718;border:1px solid #70ff65;border-radius:9px;padding:10px 15px;max-width:min(90vw,430px);box-shadow:0 0 12px #28f85d66;color:#d9ffd0;font-size:1rem;opacity:0;pointer-events:none;transition:opacity .25s,transform .25s}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
@media(min-width:720px){
.app{padding-top:17px}.board-shell{max-width:665px;margin:0 auto}.matchup{max-width:665px;margin:0 auto}.match-info,.action-grid{max-width:665px;margin-left:auto;margin-right:auto}.site-header{margin-bottom:8px}
}
@media(max-width:550px){
.app{padding-left:6px;padding-right:6px;padding-top:7px}
.site-header{min-height:67px}.brand-icon{width:42px;height:46px}.brand-name{font-size:clamp(.9rem,4.1vw,1.3rem)}.brand-game{font-size:.59rem;margin-top:3px}
.square-icon{width:33px;height:35px;font-size:1rem}.header-actions{gap:3px}
.matchup{grid-template-columns:minmax(0,1fr) 92px minmax(0,1fr);gap:4px;padding:12px 0 10px}
.player{padding:5px 3px;gap:3px}.player-avatar{width:25px;height:35px;font-size:1.4rem;border-radius:6px}
.player-title{font-size:.74rem}.player-subtitle{font-size:.58rem}
.player-stat{font-size:.68rem}
.live-indicator{font-size:.51rem}.time-display{font-size:1rem;padding:6px 2px}
.board-shell{padding:4px 2px}.board-layout{grid-template-columns:15px minmax(0,1fr)}
.files{margin-left:15px}.ranks{font-size:.68rem}
.board-topbar{padding-bottom:5px;font-size:.56rem}
.action-grid{gap:5px}.action-btn{min-height:73px;font-size:.75rem}.action-icon{font-size:1.65rem}
}
@media(max-width:355px){.brand-icon{width:35px;height:38px}.square-icon{width:28px;height:32px}.player-avatar{display:none}.matchup{grid-template-columns:minmax(0,1fr) 82px minmax(0,1fr)}.brand-name{font-size:.83rem}.action-btn{font-size:.65rem}}
@media(prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}


/* Chess UX v2: maximize the real board, not decoration. Large taps, fewer choices.
   Matches the existing HOODBTC green/black palette and original branding. */
.board-shell{width:100%;margin-inline:auto}
.piece{width:100%;height:100%}
.piece svg{width:116%;height:110%;margin-left:-8%;margin-top:-4%}
.sq.legal:after{width:32%;height:32%;background:#c5ff94b5;box-shadow:0 0 14px #6eff5a}
.board-watermark{opacity:.17}
.action-btn{transition:border-color .15s,box-shadow .15s}
.action-btn:focus-visible{outline:3px solid #dfff95;outline-offset:2px}
.action-btn[aria-pressed="true"]{border-color:#baff9d;box-shadow:0 0 12px #60ed56}
@media(min-width:720px){
  .app{max-width:1160px}
  .board-shell,.matchup,.match-info,.action-grid{max-width:min(93vw,870px);margin-left:auto;margin-right:auto}
  .board-layout{grid-template-columns:22px minmax(0,1fr)}
  .files{margin-left:22px}
  .board-topbar{font-size:.79rem}
  .action-grid{margin-top:10px}
  .board-shell{box-shadow:inset 0 0 26px #3deb2633,0 0 28px #2aaf3d66}
}
@media(max-width:719px){
  /* iPhone portrait: let the chessboard reach practically edge to edge. */
  body{background:radial-gradient(ellipse at 50% 0%,#11331a,#030904 73%)}
  .circuit{display:none}
  .app{max-width:none;padding:env(safe-area-inset-top) 0 calc(12px + env(safe-area-inset-bottom))}
  .site-header{min-height:56px;gap:6px;padding:4px 6px 5px;margin:0;border-bottom-color:#236432}
  .brand{gap:4px;justify-content:flex-start}
  .brand-icon{width:36px;height:41px}
  .brand-name{font-size:clamp(.96rem,4.7vw,1.5rem);letter-spacing:0}
  .brand-game{font-size:.59rem;letter-spacing:.19em;margin-top:3px}
  .header-actions #statsBtn,.header-actions #trophyBtn{display:none}
  .square-icon{width:39px;height:39px;font-size:1.14rem;border-radius:8px}
  .matchup{grid-template-columns:minmax(0,1fr) minmax(78px,21%) minmax(0,1fr);gap:5px;padding:7px 7px 7px}
  .player{min-height:47px;padding:4px 6px;gap:0}
  .player-avatar{display:none}
  .player-title{font-size:clamp(.84rem,2.7vw,1.02rem)}
  .player-subtitle{font-size:.64rem}
  .player-stat{font-size:.79rem}
  .live-indicator{display:none}
  .clock-center{gap:2px}
  .time-display{font-size:clamp(1.1rem,4vw,1.35rem);padding:5px 2px}
  .clock-center small{font-size:.61rem;letter-spacing:0}
  .board-shell{width:100%;max-width:none;border-radius:6px;padding:3px 0 5px;border-left:none;border-right:none}
  .board-topbar{padding:0 3px 3px;min-height:18px;justify-content:center}
  .board-topbar span:first-child,.board-topbar span:last-child{display:none}
  #turnText{font-size:.68rem}
  .board-layout{grid-template-columns:10px minmax(0,1fr)}
  .ranks{font-size:.58rem;line-height:1}
  .board-outer{border-width:1px;border-radius:3px;box-shadow:0 0 7px #6aff5a99}
  .files{margin-left:10px;padding:5px 0 0}
  .files span{font-size:.66rem}
  .sq{border-color:#5ce95b6b}
  .sq.light{background:linear-gradient(145deg,#146c35ed,#0d4f2bee)}
  .sq.dark{background:linear-gradient(145deg,#08180de6,#020b06e8)}
  .match-info{min-height:32px;padding:8px 10px 0}
  .status-line{font-size:.77rem;gap:6px}
  .history{display:none}
  .move-count{font-size:.61rem}
  .action-grid{gap:6px;margin:9px 6px 8px}
  .action-btn{min-height:64px;padding:7px 2px;border-radius:9px;font-size:clamp(.76rem,2.65vw,.94rem)}
  .action-icon{font-size:clamp(1.45rem,5vw,1.85rem)}
  .bottom-line{margin:0 8px;padding-top:6px;font-size:.61rem;letter-spacing:0}
  .bottom-line button{min-height:36px;min-width:70px}
  footer{font-size:.65rem;padding:11px 8px}
  .focus-mode .site-header{min-height:46px}
  .focus-mode .brand-icon{width:30px;height:34px}
  .focus-mode .matchup{padding:3px 6px}
  .focus-mode .player{min-height:39px}
  .focus-mode .board-topbar{min-height:15px}
  .focus-mode .match-info{min-height:28px;padding-top:5px}
  .focus-mode .bottom-line,.focus-mode footer{display:none}
  .focus-mode .action-grid{margin-top:5px}
}
@media(max-width:355px){
  .site-header{min-height:51px}
  .brand-icon{width:30px;height:34px}
  .brand-name{font-size:.93rem}
  .player-title{font-size:.72rem}
  .player-subtitle{font-size:.59rem}
  .player-stat{font-size:.68rem}
  .square-icon{width:34px;height:36px}
  .action-btn{font-size:.72rem;min-height:59px}
}
