* {
    box-sizing: border-box;
  }
  
  body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: linear-gradient(#f4e3b2, #7fb6a4, #3b4b7a);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
  }
  
  header {
    margin-top: 10px;
  }
  
  #controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 8px 0;
  }
  
  #counter {
    margin: 6px 0;
    font-size: 1.1rem;
  }
  
  #keyboardInput {
    width: 80vw;
    max-width: 400px;
    padding: 10px;
    font-size: 1rem;
    text-align: center;
    margin-bottom: 10px;
  }
  
  #board {
    display: grid;
    gap: 0.6vmin;
    width: 92vmin;        /* <-- main scaling */
    max-width: 500px;    /* desktop cap */
    aspect-ratio: 1 / 1;
  }
  
  .tile {
    background: #f7f3dc;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(22px, 5vmin, 42px);
    font-weight: 600;
    user-select: none;
    touch-action: none;
  }
  
  .tile.active {
    background: #ffd166;
  }
  
  #words {
    display: none;
    margin-top: 10px;
    max-height: 25vh;
    overflow-y: auto;
    width: 80vw;
    max-width: 400px;
  }
  
  #words .found {
    color: green;
  }
  
  #words .missed {
    color: #333;
  }
  
  .popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
  }
  
  .popup.show {
    display: flex;
  }
  
  .popup-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    max-width: 90vw;
  }
  