/* =========================
   BASE
========================= */
* {
    box-sizing: border-box;
  }
  
  body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at top, #0f1720, #0b0c10);
    color: #c5c6c7;
    margin: 0;
    padding: 48px 20px;
    -webkit-font-smoothing: antialiased;
  }
  
  /* =========================
     APP LAYOUT
  ========================= */
  .app {
    max-width: 560px;
    margin: auto;
  }
  
  /* =========================
     HERO
  ========================= */
  .logo-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
  }
  
  .logo-title img {
    height: 42px;
    width: auto;
    display: block;
    background: rgba(102,252,241,0.06);
    padding: 6px;
    border-radius: 10px;
    filter: drop-shadow(0 0 10px rgba(102,252,241,0.45));
  }
  
  .hero h1 {
    font-size: 2.05rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    line-height: 1;
  }
  
  .primary-rule {
    font-size: 14px;
    color: #8b949e;
    margin-bottom: 28px;
    line-height: 1.6;
  }
  
  /* =========================
     CURRENT WORD
  ========================= */
  .current-word {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.15rem;
    margin-bottom: 28px;
  }
  
  .current-word .label {
    font-size: 12px;
    color: #6b7280;
  }
  
  .current-word .word {
    color: #66fcf1;
    font-weight: 600;
    letter-spacing: 0.02em;
  }
  
  .next-letter {
    margin-left: auto;
    background: rgba(102,252,241,0.12);
    padding: 6px 12px;
    border-radius: 999px;
    color: #66fcf1;
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(6px);
  }
  
  /* =========================
     INPUT
  ========================= */
  input {
    width: 100%;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #2b3a45;
    background: #0b0c10;
    color: white;
    font-size: 16px; /* 🔥 iOS zoom fix */
    transition: all 0.2s ease;
  }
  
  input::placeholder {
    color: #6b7280;
  }
  
  input:focus {
    outline: none;
    border-color: #66fcf1;
    box-shadow: 0 0 0 1px #66fcf1, 0 0 20px rgba(102,252,241,0.15);
  }
  
  /* =========================
     BUTTONS
  ========================= */
  .actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
  }
  
  button {
    flex: 1;
    padding: 11px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: #1f2833;
    color: #c5c6c7;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.18s ease;
  }
  
  button:hover {
    transform: translateY(-1px);
  }
  
  #submitBtn {
    background: linear-gradient(135deg, #66fcf1, #45a29e);
    color: #0b0c10;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(102,252,241,0.25);
  }
  
  #submitBtn:hover {
    box-shadow: 0 8px 28px rgba(102,252,241,0.35);
  }
  
  #hintBtn {
    border: 1px solid #66fcf1;
    color: #66fcf1;
    background: transparent;
  }
  
  #resetBtn {
    color: #ef4444;
    background: rgba(239,68,68,0.05);
  }
  
  #endGameBtn {
    color: #facc15;
    background: rgba(250,204,21,0.05);
  }
  
  /* =========================
     HINT
  ========================= */
  .hint-display {
    margin-top: 12px;
    font-family: monospace;
    font-size: 15px;
    letter-spacing: 3px;
    color: #45a29e;
    min-height: 20px;
  }
  
  /* =========================
     FEEDBACK
  ========================= */
  .feedback {
    margin-top: 6px;
    font-size: 13px;
  }
  
  /* =========================
     STATS BAR
  ========================= */
  .stats-bar {
    display: flex;
    justify-content: space-between;
    margin-top: 36px;
    font-size: 13px;
    color: #8b949e;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 16px;
  }
  
  .stats-bar div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }
  
  .stats-bar span {
    font-size: 15px;
    font-weight: 600;
    color: #66fcf1;
  }
  
  /* =========================
     CHAIN SECTION
  ========================= */
  .chain-section {
    margin-top: 28px;
  }
  
  .chain-section h2 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #d1d5db;
  }
  
  .word-chain {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .chain-word {
    padding: 7px 11px;
    border-radius: 8px;
    background: linear-gradient(145deg, #1f2833, #19212a);
    border: 1px solid rgba(255,255,255,0.05);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
  }
  
  .chain-word:hover {
    border-color: rgba(102,252,241,0.3);
    transform: translateY(-1px);
  }
  
  .letter-count {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(102,252,241,0.15);
    color: #66fcf1;
    font-weight: 600;
  }
  
  .chain-empty {
    color: #6b7280;
    font-style: italic;
  }
  
  /* =========================
     RULES
  ========================= */
  .rules {
    margin-top: 24px;
    font-size: 13px;
    color: #8b949e;
  }
  
  summary {
    cursor: pointer;
    margin-bottom: 6px;
    color: #9ca3af;
  }
  
  /* =========================
     FOOTER
  ========================= */
  .footer {
    margin-top: 40px;
    font-size: 11px;
    color: #6b7280;
    text-align: center;
    opacity: 0.7;
  }
  
  /* =========================
     ANIMATION
  ========================= */
  .word-chain.reorder {
    animation: pop 0.25s ease;
  }
  
  @keyframes pop {
    0% { transform: scale(0.98); opacity: 0.6; }
    100% { transform: scale(1); opacity: 1; }
  }
  
  /* =========================
     MOBILE FIXES (FINAL)
  ========================= */
  @media (max-width: 600px) {
  
    body {
      padding: 20px 12px;
    }
  
    .logo-title {
      gap: 10px;
      margin-bottom: 10px;
    }
  
    .logo-title img {
      height: 32px;
      padding: 4px;
      filter: drop-shadow(0 0 6px rgba(102,252,241,0.35));
    }
  
    .hero h1 {
      font-size: 1.7rem;
    }
  
    .primary-rule {
      font-size: 13px;
      margin-bottom: 20px;
    }
  
    .current-word {
      margin-bottom: 20px;
      font-size: 1rem;
    }
  
    input {
      padding: 14px;
      font-size: 16px; /* 🔥 prevents zoom */
    }
  
    .actions {
      flex-wrap: wrap;
      gap: 8px;
    }
  
    button {
      flex: 1 1 48%;
      padding: 10px;
      font-size: 13px;
    }
  
    /* 🔥 PERFECT STATS GRID */
    .stats-bar {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 12px;
      text-align: center;
    }
  
    .stats-bar div {
      width: 100%;
    }
  
    .chain-section {
      margin-top: 22px;
    }
  
    .footer {
      margin-top: 28px;
    }
  }