*{box-sizing:border-box}
:root{
  --bg:#080808;
  --panel:rgba(16,16,16,.96);
  --panel2:rgba(24,24,24,.96);
  --stroke:rgba(255,255,255,.10);
  --text:#f7f7f7;
  --muted:#929292;
  --accent:#ffd400;
  --danger:#ff6b6b;
}
html,body{
  margin:0;
  width:100%;
  height:100%;
  overflow:hidden;
  background:var(--bg);
  color:var(--text);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  -webkit-text-size-adjust:100%;
}
body{
  min-height:100svh;
  overscroll-behavior:none;
}
button,canvas{
  -webkit-tap-highlight-color:transparent;
}
button{
  font:inherit;
  user-select:none;
  -webkit-user-select:none;
  -webkit-touch-callout:none;
}
.page-bg{
  position:fixed;
  inset:0;
  z-index:-2;
  background:#080808 url("assets/logo-pattern.png") repeat;
  background-size:132px auto;
  background-position:10px 8px;
}
.page-bg::after{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 12% 8%,rgba(255,212,0,.10),transparent 28%),
    radial-gradient(circle at 88% 85%,rgba(255,255,255,.04),transparent 28%),
    rgba(4,4,4,.73);
}
.glass{
  background:linear-gradient(180deg,var(--panel2),var(--panel));
  border:1px solid var(--stroke);
  box-shadow:0 14px 32px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.035);
  backdrop-filter:blur(15px);
}

.app-shell{
  width:min(100%,820px);
  height:100svh;
  margin:0 auto;
  padding:5px 6px max(6px,env(safe-area-inset-bottom));
  display:grid;
  grid-template-rows:34px minmax(0,1fr) 76px;
  gap:5px;
}
.utility-bar{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  min-width:0;
}
.utility-spacer{flex:1}
.header-actions{display:flex;gap:5px}
.text-btn{
  min-width:66px;
  height:29px;
  border:1px solid var(--stroke);
  border-radius:9px;
  background:rgba(9,9,9,.88);
  color:#fff;
  font-size:9px;
  font-weight:850;
  letter-spacing:.06em;
}
.text-btn.danger{
  color:#ffd7d7;
  border-color:rgba(255,107,107,.30);
}
.text-btn:active{transform:translateY(1px)}

.game-layout{
  min-height:0;
  height:100%;
  display:grid;
  grid-template-columns:minmax(0,1fr) 104px;
  gap:6px;
  justify-content:center;
  align-items:stretch;
}
.play-column{
  min-width:0;
  min-height:0;
  display:flex;
}
.board-frame{
  width:100%;
  height:100%;
  min-width:0;
  min-height:0;
  border-radius:16px;
  padding:6px;
  display:grid;
  grid-template-rows:34px minmax(0,1fr) 20px;
}
.board-topline{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:2px;
  align-items:center;
  text-align:center;
}
.board-topline>div{
  display:flex;
  flex-direction:column;
  gap:1px;
}
.mini-label,.section-kicker{
  color:#8c8c8c;
  font-size:7px;
  font-weight:800;
  letter-spacing:.12em;
}
.board-topline strong{
  font-size:12px;
  letter-spacing:.04em;
}
.board-stage{
  position:relative;
  min-height:0;
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  border-radius:12px;
  background:
    radial-gradient(circle at 50% 8%,rgba(255,255,255,.045),transparent 38%),
    linear-gradient(180deg,#121212,#070707);
  border:1px solid rgba(255,255,255,.07);
  box-shadow:inset 0 0 28px rgba(0,0,0,.54);
}
#game{
  display:block;
  height:100%;
  width:auto;
  max-width:100%;
  aspect-ratio:1/2;
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
}
.status-row{
  min-height:0;
  display:flex;
  align-items:end;
  justify-content:space-between;
  padding:3px 2px 0;
  color:#8f8f8f;
  font-size:8px;
  font-weight:800;
  letter-spacing:.08em;
}
#comboText{color:var(--accent)}

.info-strip{
  min-height:0;
  display:grid;
  grid-template-rows:96px minmax(0,1fr) auto;
  gap:5px;
}
.side-card{
  min-height:0;
  border-radius:13px;
  padding:6px;
}
.side-card canvas{
  display:block;
  width:100%;
  height:auto;
  margin-top:2px;
}
#holdCanvas{
  height:60px;
  max-height:60px;
  object-fit:contain;
}
#nextCanvas{
  height:190px;
  max-height:190px;
  object-fit:contain;
}
.stats-card{
  display:grid;
  gap:2px;
}
.stats-card div{
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid rgba(255,255,255,.05);
  padding:4px 0;
}
.stats-card div:last-child{border-bottom:0}
.stats-card span{
  color:#888;
  font-size:7px;
  font-weight:800;
  letter-spacing:.1em;
}
.stats-card strong{font-size:10px}

.mobile-controls{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  grid-template-rows:repeat(2,1fr);
  gap:4px;
  padding:4px;
  border-radius:13px;
  min-height:76px;
  max-height:76px;
  user-select:none;
  -webkit-user-select:none;
  -webkit-touch-callout:none;
  touch-action:none;
}
.ctrl{
  min-width:0;
  min-height:0;
  border:1px solid rgba(255,255,255,.10);
  border-radius:9px;
  background:rgba(255,255,255,.035);
  color:#fff;
  font-size:10px;
  font-weight:900;
  user-select:none;
  -webkit-user-select:none;
  -webkit-touch-callout:none;
  touch-action:none;
  cursor:default;
}
.ctrl:active,.ctrl.pressed{
  transform:translateY(1px);
  border-color:rgba(255,212,0,.38);
  background:rgba(255,212,0,.13);
  color:var(--accent);
}
.ctrl.hard{
  background:rgba(255,212,0,.10);
  border-color:rgba(255,212,0,.20);
}

.overlay{
  position:absolute;
  inset:0;
  z-index:10;
  display:grid;
  place-content:center;
  text-align:center;
  background:rgba(4,4,4,.80);
  backdrop-filter:blur(8px);
  padding:15px;
}
.overlay.hidden{display:none}
.overlay-eyebrow{
  color:var(--accent);
  font-size:9px;
  font-weight:900;
  letter-spacing:.14em;
}
.overlay-title{
  margin:5px 0 13px;
  font-size:21px;
  font-weight:950;
}
.overlay button{
  justify-self:center;
  border:1px solid rgba(255,212,0,.26);
  border-radius:10px;
  background:rgba(255,212,0,.12);
  color:#fff;
  padding:8px 13px;
  font-weight:850;
}

/* Larger screens: keep the same clean 2-column layout but give the board more room. */
@media(min-width:721px){
  .app-shell{
    width:min(100%,900px);
    grid-template-rows:40px minmax(0,1fr) 58px;
    padding:7px 8px 8px;
    gap:7px;
  }
  .game-layout{
    grid-template-columns:minmax(300px,390px) 132px;
    gap:9px;
  }
  .board-frame{
    padding:8px;
    grid-template-rows:40px minmax(0,1fr) 24px;
  }
  .board-topline strong{font-size:15px}
  .mini-label,.section-kicker{font-size:8px}
  .info-strip{
    grid-template-rows:112px minmax(0,1fr) auto;
    gap:7px;
  }
  #holdCanvas{height:72px;max-height:72px}
  #nextCanvas{height:230px;max-height:230px}
  .mobile-controls{
    grid-template-columns:repeat(6,1fr);
    grid-template-rows:1fr;
    min-height:58px;
    max-height:58px;
  }
  .ctrl{font-size:12px}
  .text-btn{min-width:74px;height:32px;font-size:10px}
}

@media(max-width:390px){
  .app-shell{
    grid-template-rows:32px minmax(0,1fr) 72px;
    padding:4px 4px max(5px,env(safe-area-inset-bottom));
    gap:4px;
  }
  .game-layout{
    grid-template-columns:minmax(0,1fr) 92px;
    gap:4px;
  }
  .board-frame{
    padding:5px;
    grid-template-rows:31px minmax(0,1fr) 18px;
  }
  .board-topline strong{font-size:11px}
  .info-strip{
    grid-template-rows:84px minmax(0,1fr) auto;
    gap:4px;
  }
  #holdCanvas{height:52px;max-height:52px}
  #nextCanvas{height:150px;max-height:150px}
  .mobile-controls{
    min-height:72px;
    max-height:72px;
    gap:3px;
    padding:3px;
  }
  .ctrl{font-size:9px}
}
