/* Area Game */
  #areaWelcome, #areaVictory, #areaComplete { text-align: center; color: white; overflow-y: auto; }
  #areaWelcome h1, #areaVictory h1 { font-size: 2.7em; margin-bottom: 12px; text-shadow: 3px 3px 6px rgba(0,0,0,0.25); animation: bounce 2s infinite; }
  .shape-icons { font-size: 4em; margin: 24px 0; display: flex; gap: 36px; align-items: center; justify-content: center; }
  #areaGame { justify-content: flex-start; padding: 10px 16px; overflow-y: auto; }
  #areaLevelSelect { text-align: center; color: white; overflow-y: auto; }

  .am-formula-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: 12px; max-width: 780px; width: 100%; margin-bottom: 20px; }
  .am-formula-card { background: rgba(255,255,255,0.95); border-radius: 14px; padding: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.12); border-left: 4px solid #ccc; text-align: left; }
  .am-formula-card .am-sname { font-weight: 700; font-size: 1em; display: block; margin-bottom: 4px; }
  .am-formula-card svg { width: 100%; height: 80px; display: block; margin: 4px auto; }
  .am-formula-card .am-ftext { font-size: 1.05em; color: #e74c3c; font-weight: 700; margin: 6px 0 2px; }
  .am-formula-card .am-fwhy { font-size: 0.8em; color: #888; }

  .am-level-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(170px,1fr)); gap: 14px; max-width: 600px; width: 100%; margin: 14px 0 20px; }
  .am-level-btn { background: rgba(255,255,255,0.94); border: 2px solid rgba(255,255,255,0.6); border-radius: 14px; padding: 16px; text-align: center; cursor: pointer; font-family: inherit; color: #333; transition: all 0.2s; }
  .am-level-btn:hover { transform: translateY(-4px); box-shadow: 0 6px 20px rgba(0,0,0,0.2); }
  .am-level-btn.locked { opacity: 0.45; pointer-events: none; }
  .am-level-btn .am-ln { font-size: 1.8em; font-weight: 900; color: #667eea; }
  .am-level-btn .am-lname { font-weight: 700; margin: 2px 0; }
  .am-level-btn .am-ldesc { font-size: 0.78em; color: #888; }

  .am-game-header { display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 780px; margin-bottom: 6px; }
  .am-card-grid { display: grid; gap: 10px; max-width: 780px; width: 100%; justify-items: center; }
  .am-card { background: rgba(255,255,255,0.96); border-radius: 12px; padding: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.12); border: 3px solid #ccc; cursor: pointer; width: 100%; max-width: 175px; min-height: 180px; display: flex; flex-direction: column; align-items: center; transition: all 0.2s; position: relative; }
  .am-card:hover { transform: translateY(-3px); box-shadow: 0 4px 16px rgba(0,0,0,0.18); }
  .am-card.selected { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.35); transform: translateY(-4px); }
  .am-card.matched { animation: amMatchPop 0.6s ease-out forwards; }
  .am-card.shake { animation: amShake 0.5s ease-out; }
  .am-card.locked { border-style: dashed; opacity: 0.85; }
  .am-card .am-lock { position: absolute; top: 4px; right: 6px; font-size: 1.1em; }
  .am-card .am-abadge { position: absolute; bottom: 4px; right: 6px; background: #e74c3c; color: #fff; padding: 1px 8px; border-radius: 8px; font-size: 0.8em; font-weight: 700; }
  .am-card svg { width: 100%; height: 100px; }
  .am-card .am-clabel { font-size: 0.78em; color: #999; margin-top: 3px; }
  .am-card .am-fhint { font-size: 0.72em; color: #667eea; font-weight: 600; margin-top: 1px; }
  .am-card .am-mismatch { position: absolute; bottom: -24px; left: 50%; transform: translateX(-50%); background: #e74c3c; color: #fff; padding: 2px 8px; border-radius: 6px; font-size: 0.78em; font-weight: 600; white-space: nowrap; opacity: 0; transition: opacity 0.3s; }
  .am-card .am-mismatch.show { opacity: 1; }

  .am-score-bar { display: flex; justify-content: center; gap: 24px; padding: 10px 20px; margin-top: 10px; background: rgba(255,255,255,0.85); border-radius: 14px; box-shadow: 0 2px 10px rgba(0,0,0,0.08); color: #333; font-size: 0.95em; }
  .am-score-bar .am-sval { font-weight: 900; font-size: 1.2em; color: #667eea; }
  .am-score-bar .am-cval { font-weight: 900; font-size: 1.2em; color: #f59e0b; }

  .am-combo-float { position: fixed; pointer-events: none; z-index: 200; font-weight: 900; text-align: center; animation: amComboFloat 1.3s ease-out forwards; }
  .am-combo-float .am-btext { font-size: 56px; color: #ff6b35; text-shadow: 0 3px 12px rgba(255,107,53,.5); line-height: 1; }
  .am-combo-float .am-stext { font-size: 18px; color: #f59e0b; }
  .am-combo-float.mega .am-btext { font-size: 72px; color: #ff3e00; text-shadow: 0 4px 18px rgba(255,62,0,.6); }
  .am-match-flash { position: fixed; pointer-events: none; z-index: 199; font-size: 30px; font-weight: 900; color: #2e7d32; animation: amMatchFloat 0.8s ease-out forwards; }

  @keyframes amMatchPop { 0%{transform:scale(1);opacity:1} 30%{transform:scale(1.08);box-shadow:0 0 24px rgba(76,175,80,.5)} 100%{transform:scale(0);opacity:0} }
  @keyframes amShake { 0%,100%{transform:translateX(0)} 15%{transform:translateX(-8px)} 30%{transform:translateX(8px)} 45%{transform:translateX(-6px)} 60%{transform:translateX(6px)} 75%{transform:translateX(-3px)} }
  @keyframes amComboFloat { 0%{transform:scale(0) translateY(0);opacity:0} 15%{transform:scale(1.5) translateY(-5px);opacity:1} 35%{transform:scale(1.15) translateY(-18px);opacity:1} 70%{transform:scale(1.1) translateY(-50px);opacity:.8} 100%{transform:scale(1) translateY(-100px);opacity:0} }
  @keyframes amMatchFloat { 0%{transform:scale(0) translateY(0);opacity:0} 20%{transform:scale(1.2) translateY(-8px);opacity:1} 100%{transform:translateY(-40px);opacity:0} }
  @keyframes amUnlock { 0%{box-shadow:0 0 0 0 rgba(76,175,80,.5)} 50%{box-shadow:0 0 0 10px rgba(76,175,80,0)} 100%{box-shadow:none} }

  .am-reverse-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.45); display: none; align-items: center; justify-content: center; z-index: 150; }
  .am-reverse-overlay.active { display: flex; }
  .am-reverse-box { background: #fff; border-radius: 18px; padding: 24px; max-width: 340px; width: 90%; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.25); position: relative; }
  .am-reverse-box h3 { font-size: 1.1em; margin-bottom: 10px; color: #4b5fd5; }
  .am-reverse-box svg { width: 170px; height: 95px; margin: 6px auto; display: block; }
  .am-reverse-box .am-ragiven { font-size: 1.2em; font-weight: 700; color: #e74c3c; margin: 6px 0; }
  .am-reverse-box .am-rinput-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 12px 0; }
  .am-reverse-box input[type=number] { width: 72px; padding: 7px 10px; border: 2px solid #d0d0d0; border-radius: 10px; font-size: 1.15em; text-align: center; font-weight: 700; outline: none; }
  .am-reverse-box input:focus { border-color: #667eea; }
  .am-reverse-box input.wrong { border-color: #e74c3c; animation: amShake 0.4s; }
  .am-reverse-box .am-rhint { font-size: 0.82em; color: #e74c3c; min-height: 18px; }
  .am-rclose { position: absolute; top: 8px; right: 12px; font-size: 1.2em; cursor: pointer; color: #999; background: none; border: none; }

  .am-complete-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; max-width: 340px; }
  .am-stat { background: rgba(255,255,255,0.92); border-radius: 12px; padding: 12px; color: #333; }
  .am-stat .am-stlabel { font-size: 0.78em; color: #999; }
  .am-stat .am-stval { font-size: 1.7em; font-weight: 900; color: #667eea; }

  .am-review-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 12px; max-width: 700px; width: 100%; margin: 14px 0; }
  .am-review-card { background: rgba(255,255,255,0.94); border-radius: 12px; padding: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); border-left: 3px solid #ccc; display: flex; align-items: center; gap: 10px; color: #333; text-align: left; }
  .am-review-card svg { width: 70px; height: 50px; flex-shrink: 0; }
  .am-review-card .am-rformula { font-weight: 700; color: #e74c3c; font-size: 0.95em; }
  .am-review-card .am-rtip { font-size: 0.75em; color: #888; margin-top: 2px; }

  .confetti-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 100; }
  .confetti-piece { position: absolute; width: 10px; height: 10px; top: -20px; animation: confettiFall linear forwards; }
  @keyframes confettiFall { to { top: 110vh; transform: rotate(720deg); } }
  @keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-5px)} 80%{transform:translateX(5px)} }
