:root{
  --bg: #0b1020;
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.08);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.65);
  --border: rgba(255,255,255,0.12);

  --p1: #21d07a;
  --p2: #4aa3ff;
  --win: #ffd26a;

  --shadow: 0 18px 60px rgba(0,0,0,0.50);
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 15% 10%, rgba(74,163,255,0.20), transparent 55%),
    radial-gradient(1200px 600px at 85% 30%, rgba(33,208,122,0.18), transparent 60%),
    radial-gradient(1000px 500px at 45% 90%, rgba(255,210,106,0.10), transparent 55%),
    var(--bg);
  color: var(--text);
}
#howPanel{ display:none; }
.app{
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 22px 22px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-bottom: 18px;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
}
.logo{
  width:44px;height:44px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  background: linear-gradient(135deg, rgba(74,163,255,0.35), rgba(33,208,122,0.25));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight: 800;
}
.brandText h1{
  margin:0;
  font-size: 20px;
  line-height: 1.1;
}
.brandText p{
  margin:4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.layout{
  display:grid;
  grid-template-columns: 380px 1fr;
  gap: 18px;
}
.authorName{
  color: var(--p2);
  font-weight: 800;
}

.panel{ display:flex; flex-direction:column; gap: 14px; }

.card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.cardTitle{
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.02em;
  font-weight: 600;
  text-transform: uppercase;
}

.logoImg{
  width:90px;
  height:90px;
  filter: drop-shadow(0 0 10px rgba(74,163,255,0.22))
          drop-shadow(0 0 10px rgba(33,208,122,0.18));
}
.row2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.field .label{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input{
  width:100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  outline: none;
}
.field input:focus{
  border-color: rgba(255,255,255,0.30);
}

.divider{
  height:1px;
  background: var(--border);
  margin: 12px 0;
}

.scoreBox{
  display:grid;
  gap: 10px;
}
.scoreItem{
  display:flex;
  gap:10px;
  align-items:center;
  padding: 10px;
  border-radius: 14px;
  background: var(--panel2);
  border: 1px solid var(--border);
}
.pill{
  width:10px;height:34px;
  border-radius: 99px;
}
.pill.p1{ background: rgba(33,208,122,0.9); }
.pill.p2{ background: rgba(74,163,255,0.9); }

.scoreName{ font-weight: 600; font-size: 14px; }
.scoreValue{ color: var(--muted); font-size: 13px; margin-top: 2px; }

.turnBox{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px;
  margin-top: 10px;
  border-radius: 14px;
  background: rgba(0,0,0,0.20);
  border: 1px solid var(--border);
}
.turnDot{
  width:10px; height:10px;
  border-radius: 50%;
  background: var(--p1);
  box-shadow: 0 0 16px rgba(33,208,122,0.55);
}
.turnText{ font-weight:600; }

.controls{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.controls .danger{ grid-column: 1 / span 2; }

.smallRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-top: 12px;
}
.toggle{
  display:flex;
  align-items:center;
  gap:8px;
  font-size: 13px;
  color: var(--muted);
  user-select:none;
}
.toggle input{ transform: translateY(1px); }

.hint{
  font-size: 12px;
  color: rgba(255,255,255,0.55);
}
.hint code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
}

.tipCard .para{
  margin:0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.btn{
  cursor:pointer;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 600;
  transition: transform .08s ease, background .2s ease, border-color .2s ease;
}
.btn:hover{ background: rgba(255,255,255,0.10); }
.btn:active{ transform: translateY(1px); }
.btn:disabled{
  opacity: 0.5;
  cursor:not-allowed;
}

.btn.primary{
  border-color: rgba(255,255,255,0.22);
  background: linear-gradient(135deg, rgba(74,163,255,0.25), rgba(33,208,122,0.18));
}
.btn.ghost{
  background: transparent;
}
.btn.danger{
  border-color: rgba(255,99,99,0.30);
  background: rgba(255,99,99,0.10);
}

.boardWrap{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.boardHeader{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom: 12px;
}
.badge{
  font-weight: 800;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.25);
}
.sub{
  font-size: 12px;
  color: var(--muted);
}

.board{
  display:grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.10);
  user-select:none;
}

.cell{
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  display:grid;
  place-items:center;
  cursor:pointer;
  position: relative;
  transition: transform .08s ease, background .2s ease, border-color .2s ease;
}
.cell:hover{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
}
.cell:active{ transform: translateY(1px); }

.stone{
  width: 70%;
  height: 70%;
  border-radius: 50%;
  box-shadow: 0 10px 20px rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.18);
}

.stone.p1{
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.45), rgba(33,208,122,0.95));
}
.stone.p2{
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.45), rgba(74,163,255,0.95));
}

.cell.last{
  outline: 2px solid rgba(255,255,255,0.35);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
}

.cell.win{
  outline: 2px solid rgba(255,255,255,0.25);
  position: relative;
}

.cell.win::before{
  content:"";
  position:absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg,
    rgba(74,163,255,0.0),
    rgba(255,210,106,0.95),
    rgba(74,163,255,0.0)
  );
  filter: blur(0.2px);
  box-shadow: 0 0 18px rgba(255,210,106,0.45);
  animation: beamGlow 0.85s ease-in-out infinite alternate;
  pointer-events:none;
}

@keyframes beamGlow{
  from{ opacity: 0.55; }
  to{ opacity: 1; }
}



.footerNote{
  margin-top: 12px;
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  line-height: 1.4;
}


.footerBar{
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.10);

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;

  color: rgba(255,255,255,0.70);
  font-size: 12px;
}

.footerLeft{ justify-self: start; }
.footerMid{ justify-self: center; }
.footerRight{
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.heart{
  display: inline-block;
  transform: translateY(1px);
  filter: drop-shadow(0 0 8px rgba(0, 191, 255, 0.25));
}

.iconLink{
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  transition: transform .08s ease, background .2s ease, border-color .2s ease;
}

.iconLink:hover{
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.22);
}

.iconLink:active{
  transform: translateY(1px);
}

.iconImg{
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(255,255,255,0.10));
}


/* Overlay */
.overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display:flex;
  align-items:center;
  justify-content:center;
  place-items:center;
  padding: 18px;
  z-index: 50;
}
.hidden{ display:none; }

.modal{
  width: min(500px, 92vw);
  border-radius: 18px;
  background: rgba(12,16,32,0.92);
  border: 1px solid rgba(255,255,255,0.14);
  text-align:center;
  box-shadow: var(--shadow);
  padding: 18px;
}
.modalTitle{
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
}
.modalText{
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.modalActions{
  margin-top: 14px;
  display:flex;
  justify-content:center;
  
}

/* Responsive */
@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
}
