/* ---------- Base / Theme ---------- */
:root{
  --bg:#121213;
  --fg:#d7dadc;
  --tile-edge:#3a3a3c;
  --tile-good:#6aaa64;   
  --key:#818384;
  --key-bad:#3a3a3c;

  /* Responsive sizes */
  --tile: clamp(40px, 9vw, 76px);
  --tile-font: clamp(28px, 5vw, 38px);
  --gap: clamp(6px, 1vw, 10px);
  --kb-h: clamp(36px, 6vw, 52px);
  --kb-w: clamp(28px, 6vw, 56px);
  --title: clamp(22px, 3.2vw, 32px);
  --def: clamp(16px, 2.2vw, 20px);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: "Clear Sans","Helvetica Neue",Arial,sans-serif;
  background:var(--bg);
  color:var(--fg);
  display:flex;
  flex-direction:column;
  align-items:center;
}

/* ---------- Top bar ---------- */
.topbar{
  width:100%;
  max-width:720px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  padding:10px 16px;
  border-bottom:1px solid #2a2a2a;
}
.logo{height:60px; width:auto; object-fit:contain}
.title{font-size:var(--title); font-weight:700; letter-spacing:.04em;}

/* ---------- Containers ---------- */
.game-container, .intro-container{
  width:100%;
  max-width:720px;
  padding:18px 16px 28px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:16px;
  text-align:center;
}

/* ---------- Intro button ---------- */
.primary-btn{
  display:inline-block;
  padding:12px 20px;
  border-radius:10px;
  background:var(--tile-good);
  color:white;
  text-decoration:none;
  font-weight:800;
  box-shadow:0 3px 0 #325c30;
}
.primary-btn:hover{transform:translateY(-1px)}

/* ---------- Heading ---------- */
.introheading{
  max-width:620px;
  font-size:30px;
  color:#ffffff;
  opacity:1.0;
}

/* ---------- Definition ---------- */
.definition{
  max-width:620px;
  font-size:25px;
  font-style:italic;
  color:#ffffff;
  opacity:1.0;
}

/* ---------- Intro Rules ---------- */
.introrules{
  max-width:620px;
  font-size:20px;
  color:#ffffff;
  opacity:1.0;
  text-align:left;
}

/* ---------- Target badge ---------- */
.target-wrap{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
}
.target-label{
  font-size:clamp(14px,2vw,16px);
  letter-spacing:.08em;
  opacity:.85;
}
.target-chip{
  display:flex;
  align-items:center;
  justify-content:center;
  width:clamp(120px,14vw,160px);
  height:clamp(120px,14vw,160px);
  border-radius:999px;
  font-size:clamp(40px,6vw,56px);
  font-weight:900;
  color:#fff;
  background: radial-gradient(80% 80% at 50% 20%, #2c2c2c, #1a1a1a);
  border:3px solid var(--tile-good);
  box-shadow:0 0 24px rgba(106,170,100,.35), inset 0 0 18px rgba(106,170,100,.25);
}

/* ---------- Tiles ---------- */
.letter-row{
  display:flex;
  gap:var(--gap);
  justify-content:center;
  flex-wrap:wrap;
}
.tile{
  width:var(--tile);
  height:var(--tile);
  border:2px solid var(--tile-edge);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:var(--tile-font);
  background:transparent;
  color:#fff;
  border-radius:6px;
  transition:transform .2s ease, background .2s ease, color .2s ease;
  cursor:pointer;
}

/* Selected tile → green */
.tile.selected{
  background: var(--tile-good);
  border-color: var(--tile-good);
  color: white;
}

/* Newly created numbers → yellow (until used) */
.tile.created{
  background: #eab308;    /* amber-500 */
  border-color: #eab308;
  color: #111;
}

/* Used tile → greyed out */
.tile.used{
  opacity:.35;
  pointer-events:none;
}

/* ---------- Status & banner ---------- */
.status{display:flex; flex-direction:column; gap:6px; align-items:center}
.lives{font-size:clamp(16px, 2vw, 20px)}
.banner{margin-top:4px; font-weight:800}
.banner.win{color:var(--tile-good)}
.banner.lose{color:#ff6b6b}

/* ---------- Keyboard ---------- */
.keyboard{display:flex; flex-direction:column; gap:8px; width:100%; max-width:720px}
.kb-row{display:flex; justify-content:center; gap:8px; flex-wrap:wrap}
.key{
  min-width:var(--kb-w);
  height:var(--kb-h);
  padding:0 10px;
  border-radius:8px;
  border:none;
  font-weight:800;
  font-size:clamp(14px,2vw,18px);
  color:white;
  background:var(--key);
  cursor:pointer;
  box-shadow:0 3px 0 #5c5c5e;
  transition:transform .05s ease, opacity .2s ease;
}
.key:active{transform:translateY(1px)}
.key:disabled{opacity:.5; cursor:not-allowed}

/* Operator selected → green */
.key.selected{
  background: var(--tile-good);
  box-shadow:0 3px 0 #325c30;
  color:white;
}

/* ---------- Victory Modal ---------- */
.modal{
  position:fixed;
  top:0; left:0; right:0; bottom:0;
  background:rgba(0,0,0,0.75);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:1000;
}
.modal.hidden{display:none;}
.modal-content{
  background:#1a1a1a;
  color:white;
  padding:20px;
  border-radius:12px;
  max-width:400px;
  width:90%;
  text-align:center;
  box-shadow:0 0 20px rgba(0,0,0,0.6);
}
.modal-content h2{margin-top:0;}
.modal-content input{margin:10px 0; padding:6px; border-radius:6px; border:none;}

/* ---------- Mobile adjustments ---------- */
@media (max-width: 480px) {
  :root {
    --tile: clamp(50px, 12vw, 90px);       /* slightly wider tiles */
    --tile-font: clamp(32px, 6vw, 42px);   /* larger tile numbers */
    --kb-w: clamp(40px, 12vw, 70px);       /* wider keyboard buttons */
    --kb-h: clamp(40px, 12vw, 70px);       /* taller keyboard buttons */
  }

  .primary-btn {
    padding: 14px 24px;  /* larger buttons for mobile */
    font-size: clamp(18px, 4vw, 22px);
  }
}

/* Nav bar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1a1a1a;
  padding: 10px 16px;
  border-bottom: 1px solid #333;
}

.navbar .logo {
  color: white;
  font-weight: bold;
  font-size: 20px;
}

.navbar .menu-toggle {
  display: none;
  font-size: 26px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
}

.navbar .nav-links {
  list-style: none;
  display: flex;
  gap: 16px;
}

.navbar .nav-links li a {
  text-decoration: none;
  color: white;
  font-weight: 600;
}

/* Mobile view */
@media (max-width: 720px) {
  .navbar .menu-toggle {
    display: block;
  }
  .navbar .nav-links {
    display: none;
    flex-direction: column;
    background: #1a1a1a;
    position: absolute;
    top: 60px;
    right: 10px;
    border: 1px solid #333;
    padding: 10px;
  }
  .navbar .nav-links.show {
    display: flex;
  }
}
