/* ========== Base ========== */
:root{
  --bg: #0f172a;
  --panel: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --brand: #60a5fa;
  --border: rgba(255,255,255,0.12);
  --shadow: 0 10px 25px rgba(0,0,0,0.25);
}

*{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: linear-gradient(180deg, var(--bg), #020617);
  color: var(--text);
}

a{ color: inherit; text-decoration: none; }

main{
  padding: 96px 16px 24px; /* Space for fixed navbar */
  max-width: 1100px;
  margin: 0 auto;
}

h1{ font-size: 32px; margin: 0 0 8px; }
p{ color: var(--muted); line-height: 1.6; }

/* ========== Navbar ========== */
.site-header{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background-color: rgba(17,24,39,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav{
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand svg{
  color: var(--brand);
  flex: 0 0 auto;
}

.nav-links{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a{
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--muted);
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.nav-links a:hover{
  transform: translateY(-1px);
  background-color: rgba(96,165,250,0.14);
  color: var(--text);
}

.nav-links a.active{
  background-color: rgba(96,165,250,0.22);
  color: var(--text);
}

/* ========== Components ========== */
.card{
  background-color: rgba(17,24,39,0.72);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background-color: rgba(96,165,250,0.18);
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease;
}

.btn:hover{ transform: scale(1.02); }
.btn:active{ transform: scale(0.98); }

.input{
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background-color: rgba(2,6,23,0.55);
  color: var(--text);
}

.input:focus{
  outline: 2px solid rgba(96,165,250,0.45);
  outline-offset: 1px;
}

/* ========== Mobile layout: move navbar to bottom ========== */
@media (max-width: 600px){
  main{
    padding: 24px 14px 96px; /* leave room for bottom navbar */
  }

  .site-header{
    top: auto;
    bottom: 0;
    border-bottom: none;
    border-top: 1px solid var(--border);
  }

  .nav{
    justify-content: center;
  }

  .brand{ display: none; }

  .nav-links{
    width: 100%;
    justify-content: space-around;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;

    /* hide scrollbar */
    scrollbar-width: none; /* Firefox */
  }

  .nav-links::-webkit-scrollbar{
    display: none; /* Chrome/Safari */
  }

  .nav-links a{
    padding: 10px 8px;
    border-radius: 12px;
    white-space: nowrap;
  }
}

/* ========== Sudoku ========== */
.game-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.timer{
  font-variant-numeric: tabular-nums;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background-color: rgba(2,6,23,0.45);
  color: var(--text);
}

.board{
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 2px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  overflow: hidden;
  width: min(520px, calc(100vw - 28px));
  margin: 0 auto;
  background-color: rgba(2,6,23,0.35);
  box-sizing: border-box; /* fixed typo */
}

.board .row{
  display: grid;
  gap: 0;
}

.board-9 .row{
  grid-template-columns: repeat(9, 1fr);
}

.cell{
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(255,255,255,0.10);
  background-color: rgba(17,24,39,0.35);
  color: var(--text);
  text-align: center;
  font-size: 18px;
  box-sizing: border-box;
  appearance: textfield;
}

.cell::-webkit-outer-spin-button,
.cell::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}

.cell:hover{
  background-color: rgba(96,165,250,0.14);
}

.cell:focus{
  outline: 2px solid rgba(96,165,250,0.55);
  outline-offset: -2px;
  background-color: rgba(96,165,250,0.10);
}

/* 9x9 subgrid lines */
.board-9 .row .cell:nth-child(3),
.board-9 .row .cell:nth-child(6){
  border-right-width: 3px;
  border-right-color: rgba(255,255,255,0.22);
}

.board-9 .row:nth-child(3) .cell,
.board-9 .row:nth-child(6) .cell{
  border-bottom-width: 3px;
  border-bottom-color: rgba(255,255,255,0.22);
}

/* 6x6 board */
.board-6 .row{
  grid-template-columns: repeat(6, 1fr);
}

/* 6x6 subgrid: 2x3 (vertical cut after 3rd col, horizontal cuts after row 2 and 4) */
.board-6 .row .cell:nth-child(3){
  border-right-width: 3px;
  border-right-color: rgba(255,255,255,0.22);
}

.board-6 .row:nth-child(2) .cell,
.board-6 .row:nth-child(4) .cell{
  border-bottom-width: 3px;
  border-bottom-color: rgba(255,255,255,0.22);
}

.home-image{
  width: 100%;
  margin-top: 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 200ms ease;
}

.home-image:hover{
  transform: scale(1.01);
}

