/* styles.css */
:root{
  --bg: #0b1020;
  --panel: #121735;
  --accent: #6ee7ff;
  --accent-2: #7c7cff;
  --text: #eef2ff;
  --muted: #a6b0d6;
  --grid: #1b2147;
  --well: #0f1430;
  --btn: #1a2042;
  --btn-border: #2a3270;
  --btn-hover: #2b356b;
  --primary: #4cc9f0;
  --shadow: rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin:0;
  background: radial-gradient(circle at 20% 0%, #0c122e 0%, var(--bg) 60%);
  color: var(--text);
  font: 500 16px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
}

#app{
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px clamp(12px, 3vw, 24px);
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom: 12px;
}
.brand{
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: clamp(20px, 3vw, 28px);
  color: white;
  text-shadow: 0 6px 18px var(--shadow);
}
.controls-row{
  display:flex; gap:10px; align-items:center;
}
.toggle{
  display:flex; align-items:center; gap:8px; color:var(--muted);
}
.toggle input{ width:18px; height:18px; }

.layout{
  display:grid;
  grid-template-columns: 300px minmax(320px, 1fr);
  gap: 16px;
}
.panel{
  background: linear-gradient(180deg, var(--panel), #0e1330);
  border: 1px solid #1a2050;
  border-radius: 16px;
  box-shadow: 0 10px 30px var(--shadow);
  padding: 14px;
}
.stats .stat{
  display:flex; align-items:baseline; justify-content:space-between;
  padding: 6px 0;
  border-bottom: 1px dashed #20285f;
}
.stats .stat:last-child{ border-bottom: none;}
.label{ color: var(--muted); font-size: 13px;}
.value{ font-size: 20px; font-weight: 700;}

.box{
  margin-top: 16px;
  padding: 10px;
  background: #0c1233;
  border-radius: 12px;
  border: 1px solid #1b2258;
}
.box-title{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.playfield-panel{
  display:flex;
  flex-direction: column;
  align-items:center;
  justify-content:flex-start;
  gap: 12px;
}
.stage-wrap{
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #1a2050;
  background: linear-gradient(180deg, #0e143b, #060a20);
  padding: 10px;
}
#playfield{
  display:block;
  background:
    linear-gradient(0deg, transparent 24px, var(--grid) 25px),
    linear-gradient(90deg, transparent 24px, var(--grid) 25px);
  background-size: 30px 30px, 30px 30px;
  outline: none;
}
#hold, #next{
  background: #0c112f;
  border-radius: 8px;
  display:block;
}

.overlay{
  position:absolute; inset:0; background: rgba(6,8,20,0.7);
  display:flex; align-items:center; justify-content:center;
  backdrop-filter: blur(2px);
}
.overlay.hidden{ display:none; }
.overlay-content{
  background: #0d1338;
  border: 1px solid #232a67;
  padding: 18px 20px;
  border-radius: 12px;
  text-align:center;
  width: min(92vw, 360px);
}
.overlay-actions{ display:flex; gap:10px; justify-content:center; margin-top: 10px;}

.btn{
  appearance: none;
  border: 1px solid var(--btn-border);
  background: linear-gradient(180deg, var(--btn), #0f1535);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
  cursor:pointer;
  box-shadow: 0 6px 16px var(--shadow);
  transition: transform .05s ease, background-color .2s ease, border-color .2s ease;
  user-select: none;
}
.btn.primary{
  border-color: #2e9cd4;
  background: linear-gradient(180deg, #2aa7e6, #1b5b9e);
}
.btn:hover{ transform: translateY(-1px); background-color: var(--btn-hover); }
.btn:active{ transform: translateY(1px); }

.touch-controls{
  display:grid;
  gap: 8px;
  width: 100%;
}
.tc-row{ display:flex; gap:8px; }
.tc-btn{ flex:1; }
.tc-btn.wide{ flex: 1; font-size: 18px; }
.tc-row:first-child .tc-btn{ font-size: 18px; }

.footer{
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  text-align:center;
}

/* Responsive */
@media (min-width: 980px){
  .touch-controls{ display:none; }
}

@media (max-width: 720px){
  .layout{
    grid-template-columns: 1fr;
  }
  .stats{
    order:2;
  }
  #playfield{ width: 270px; height: 540px; background-size: 27px 27px, 27px 27px; }
  .stage-wrap{ padding: 8px; }
}

/* Piece colors (used by canvas fill) */
.mino-I { background-color:#00e5ff; }
.mino-J { background-color:#3b82f6; }
.mino-L { background-color:#f59e0b; }
.mino-O { background-color:#fde047; }
.mino-S { background-color:#22c55e; }
.mino-Z { background-color:#ef4444; }
.mino-T { background-color:#a855f7; }

