body { 
    margin:0; 
    font-family:Arial,sans-serif; 
    background:#fff; 
    color:#222; 
}

/* NAV */
nav.navbar {
  width:100%;
  background:#fafafa;
  border-bottom:1px solid #e0e0e0;
  padding:12px 24px;
  display:flex;
  align-items:center;
  gap:20px;
  position:sticky;
  top:0;
  z-index:1000;
}

nav a {
  text-decoration:none;
  color:#333;
  font-weight:500;
  padding:6px 10px;
  transition:0.15s ease;
}

nav a:hover {
  background:#f0f0f0;
  border-radius:6px;
}

.nav-links {
  display:flex;
  gap:20px;
  flex:1;
}

.hamburger {
  display:none;
  flex-direction:column;
  cursor:pointer;
  gap:4px;
}

.hamburger div {
  width:25px;
  height:3px;
  background-color:#333;
}

@media (max-width:550px){
  .nav-links{
    display:none;
    flex-direction:column;
    position:absolute;
    top:60px;
    left:0;
    width:100%;
    background:#fafafa;
    border-top:1px solid #ddd;
    padding:10px 0;
  }
  .nav-links.active{display:flex;}
  .hamburger{display:flex;}
}

/* PAGE WRAPPER */
.page{
  max-width:1200px;
  margin:40px auto;
  padding:0 20px;
  display:flex;
  gap:40px;
}

.left{flex:2;}
.right{
  flex:1;
  border-left:1px solid #ddd;
  padding-left:20px;
}

.right textarea{
  width:100%;
  height:500px;
  resize:none;
  border:1px solid #ccc;
  padding:10px;
  font-family:monospace;
  overflow-y:scroll;
  font-size:0.95rem;
}

h1{margin-bottom:10px;}

.ad-block{
  width:100%; height:90px;
  background:#f0f0f0;
  text-align:center;
  line-height:90px;
  margin:20px 0;
  color:#555; font-weight:bold;
}

/* BOARD */
#boardWrapper, #rackWrapper{
  width:100%;
  display:flex;
  justify-content:center;
  overflow:hidden;
}

#board, #rack{
  display:grid;
  gap:8px;
  margin:20px 0;
}

.cell-container, .rack-cell-container{
  position:relative;
  width:36px;
  height:36px;
}

.cell, .rack-cell{
  width:100%;
  height:100%;
  font-size:18px;
  text-align:center;
  border:1px solid #ccc;
  border-radius:4px;
  outline:none;
  caret-color:transparent;
}

.cell.active, .rack-cell.active{
  border:2px solid #0078ff;
}

.number-box{
  position:absolute;
  top:0;
  right:0;
  width:35%;
  height:35%;
  font-size:0.45em;
  color:#555;
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:none;
}

.button-row{
  display:flex;
  justify-content:space-between;
  gap:20px;
  margin:5px 0 20px 0;
  max-width:100%;
}

#solveBtn,#clearBtn{
  padding:10px 20px;
  color:white;
  border:none;
  border-radius:6px;
  font-size:1rem;
  cursor:pointer;
}

#solveBtn{background:#0078ff;}
#solveBtn:hover{background:#005fcc;}

#clearBtn{background:#d93025;}
#clearBtn:hover{background:#b32018;}

@media (max-width:850px){
  .page{flex-direction:column; gap:20px;}
  .right{border-left:none; padding-left:0;}
}

@media (max-width:550px){
  #board{transform:scale(0.82); transform-origin:top center;}
}

@media (max-width:430px){
  #board{transform:scale(0.70);}
}

@media (max-width:360px){
  #board{transform:scale(0.62);}
}

/* FOOTER */
footer{
  margin-top:80px;
  padding:20px 0;
  text-align:center;
  color:#777;
  font-size:0.9rem;
  border-top:1px solid #e0e0e0;
  width:100%;
}

footer a{
  color:#555;
  text-decoration:none;
}

footer a:hover{text-decoration:underline;}
