:root{
  --tower-width:160px;
  --tower-height:360px;
  --disk-height:30px;
  --max-disks:8;
}
body{
  font-family: "Segoe UI", Roboto, "Noto Sans TC", Arial, sans-serif;
  background:#f3f6fb;
  color:#111;
  margin:0;
  padding:18px;
  display:flex;
  flex-direction:column;
  align-items:center;
  min-height:100vh;
  box-sizing:border-box;
}

header{ text-align:center; margin-bottom:12px; }
h1{ margin:4px 0 2px; font-size:1.4rem; }
p.lead{ margin:0; color:#444; font-size:0.95rem; }

#controls{
  margin-top:12px;
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
#controls label{ font-size:0.95rem; }
input[type="number"]{
  width:64px;
  padding:6px 8px;
  border-radius:6px;
  border:1px solid #cfd8e3;
}
button{
  background:#2463eb;
  color:white;
  border:none;
  padding:8px 12px;
  border-radius:8px;
  cursor:pointer;
  font-weight:600;
}
button.secondary{
  background:#44475a;
}
button:disabled{ opacity:0.5; cursor:not-allowed; }

.status{
  margin-top:14px;
  display:flex;
  gap:18px;
  align-items:center;
  flex-wrap:wrap;
}
.status div{ background:white; padding:8px 12px; border-radius:8px; box-shadow:0 1px 4px rgba(16,24,40,0.06); }

.game-area{
  margin-top:18px;
  width:100%;
  display:flex;
  justify-content:center;
}

.tower{
  width:var(--tower-width);
  height:var(--tower-height);
  margin:0 14px;
  background:linear-gradient(180deg,#fff,#f7fbff);
  border-radius:10px;
  border:2px solid rgba(34,60,90,0.06);
  position:relative;
  display:flex;
  flex-direction:column-reverse;
  align-items:center;
  padding-bottom:12px;
}
.tower .peg{
  position:absolute;
  bottom:12px;
  width:10px;
  height:80%;
  background:#cfd8e3;
  border-radius:6px;
}
.tower .label{
  position:absolute;
  top:8px;
  font-weight:700;
  color:#2b3a67;
}

.disk{
  height:var(--disk-height);
  margin:4px 0;
  border-radius:6px;
  line-height:var(--disk-height);
  color:white;
  font-weight:700;
  user-select:none;
  display:flex;
  justify-content:center;
  align-items:center;
  box-shadow:0 3px 8px rgba(16,24,40,0.12);
}

/* responsive */
@media (max-width:700px){
  :root{ --tower-width:30vw; --tower-height:300px; }
  .game-area{ padding:0 8px; }
}

/* visual feedback when tower can accept drop */
.tower.hover-ok{ outline:3px dashed rgba(36,99,235,0.28); }
.tower.hover-bad{ outline:3px dashed rgba(220,60,60,0.28); }

/* selected disk highlight */
.disk.selected{ outline:3px solid rgba(36,99,235,0.18); transform:translateY(-4px); }