/* styles.css - Kanji Cards Modern Design */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background: radial-gradient(ellipse at center, #2d5016 0%, #1a3d0f 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Table Surface - Poker Table Effect */
.table-surface {
  min-height: 100vh;
  padding: 20px;
  background-image: radial-gradient(ellipse 800px 400px at 50% 50%, rgba(76, 175, 80, 0.2) 0%, transparent 100%);
  position: relative;
}

.table-surface::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.03) 0%, transparent 50%);
  pointer-events: none;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Game Title */
.game-title {
  font-size: 2.5em;
  text-align: center;
  color: #ffd700;
  text-shadow: 
    0 0 10px rgba(255, 215, 0, 0.5),
    0 0 20px rgba(255, 215, 0, 0.3),
    3px 3px 6px rgba(0, 0, 0, 0.8);
  margin-bottom: 30px;
  font-weight: 900;
  letter-spacing: 3px;
}

/* Disable glow animation on mobile for better performance */
@media (min-width: 769px) {
  .game-title {
    animation: glow 2s ease-in-out infinite alternate;
  }
}

@keyframes glow {
  from {
    text-shadow: 
      0 0 10px rgba(255, 215, 0, 0.5),
      0 0 20px rgba(255, 215, 0, 0.3),
      3px 3px 6px rgba(0, 0, 0, 0.8);
  }
  to {
    text-shadow: 
      0 0 20px rgba(255, 215, 0, 0.8),
      0 0 30px rgba(255, 215, 0, 0.5),
      3px 3px 6px rgba(0, 0, 0, 0.8);
  }
}

/* Main Menu */
#main-menu {
  background: linear-gradient(135deg, rgba(232, 213, 183, 0.95) 0%, rgba(201, 168, 112, 0.95) 100%);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border: 3px solid rgba(139, 69, 19, 0.3);
}

.level-selection h2 {
  text-align: center;
  color: #3e2723;
  margin-bottom: 25px;
  font-size: 1.3em;
  font-weight: 700;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

/* Level Buttons */
.levels {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 30px;
}

.level-btn {
  padding: 10px 20px;
  font-size: 16px;
  color: white;
  border: 3px solid rgba(0, 0, 0, 0.4);
  border-radius: 5px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  font-weight: bold;
  text-shadow: 
    2px 2px 4px rgba(0, 0, 0, 0.7),
    -1px -1px 0 rgba(0, 0, 0, 0.3),
    1px -1px 0 rgba(0, 0, 0, 0.3),
    -1px 1px 0 rgba(0, 0, 0, 0.3),
    1px 1px 0 rgba(0, 0, 0, 0.3);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.level-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.4);
}

/* Color coding for levels - Higher contrast */
#n5 {
  background: linear-gradient(45deg, #2e7d32, #66bb6a);
}

#n4 {
  background: linear-gradient(45deg, #558b2f, #8bc34a);
}

#n3 {
  background: linear-gradient(45deg, #f9a825, #ffeb3b);
}

#n2 {
  background: linear-gradient(45deg, #ef6c00, #ff9800);
}

#n1 {
  background: linear-gradient(45deg, #c62828, #ef5350);
}

/* Settings */
.settings {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 25px 0;
  flex-wrap: wrap;
}

.setting {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(101, 67, 33, 0.1);
  padding: 12px 20px;
  border-radius: 10px;
  border: 2px solid rgba(139, 69, 19, 0.2);
}

.settings label {
  font-size: 1.1em;
  font-weight: 600;
  color: #3e2723;
}

.settings select {
  padding: 8px 15px;
  font-size: 1em;
  border: 2px solid #8b4513;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  font-weight: 600;
  color: #3e2723;
  transition: all 0.3s;
}

.settings select:hover {
  border-color: #654321;
  box-shadow: 0 2px 8px rgba(139, 69, 19, 0.3);
}

/* Instructions */
.instructions {
  margin-top: 25px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(232, 213, 183, 0.5) 0%, rgba(201, 168, 112, 0.5) 100%);
  border-radius: 12px;
  border: 2px solid rgba(139, 69, 19, 0.3);
  text-align: center;
  line-height: 1.8;
}

.instructions strong {
  color: #3e2723;
  font-size: 1.1em;
}

.instructions p {
  color: #4e342e;
  margin: 0;
}

/* Game Section */
.game {
  background: linear-gradient(135deg, rgba(232, 213, 183, 0.95) 0%, rgba(201, 168, 112, 0.95) 100%);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border: 3px solid rgba(139, 69, 19, 0.3);
}

.game-header {
  margin-bottom: 15px;
  margin-top: 10px;
}

.counters {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 10px;
}

.counter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9em;
  font-weight: 600;
}

.counter-label {
  color: #3e2723;
}

.counter-value {
  font-size: 1.3em;
  font-weight: 700;
  min-width: 25px;
  text-align: center;
}

.correct-counter .counter-value {
  color: #2e7d32;
}

.wrong-counter .counter-value {
  color: #c62828;
}

/* Kanji Card */
.card-container {
  perspective: 1000px;
  margin: 20px auto 10px;
  display: flex;
  justify-content: center;
}

.kanji-card {
  width: 260px;
  height: 260px;
  position: relative;
  transform-style: preserve-3d;
}

.card-inner {
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(135deg, rgba(101, 67, 33, 0.1) 0%, rgba(139, 90, 43, 0.1) 100%),
    linear-gradient(90deg, 
      #d4a574 0%, 
      #c19a6b 20%, 
      #d4a574 40%, 
      #c19a6b 60%, 
      #d4a574 80%,
      #c19a6b 100%),
    linear-gradient(180deg, #e8d5b7 0%, #c9a870 100%);
  border-radius: 20px;
  border: 8px solid #8b4513;
  box-shadow: 
    0 15px 40px rgba(0, 0, 0, 0.5),
    inset 0 2px 10px rgba(139, 69, 19, 0.3),
    inset 0 -2px 10px rgba(0, 0, 0, 0.2),
    0 0 0 2px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  will-change: auto;
}

.card-inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    repeating-linear-gradient(0deg,
      transparent 0px,
      rgba(139, 69, 19, 0.02) 1px,
      transparent 2px,
      transparent 10px);
  pointer-events: none;
}

.card-inner::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 10%;
  right: 10%;
  bottom: 10%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

#kanji-display {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 110px;
  font-weight: 400;
  color: #2c1810;
  text-shadow: 
    2px 2px 0px rgba(139, 69, 19, 0.2),
    4px 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 1;
  animation: kanjiPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  will-change: transform;
  transform: translateZ(0);
}

@keyframes kanjiPop {
  0% { 
    transform: scale(0) rotate(-180deg) translateZ(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(10deg) translateZ(0);
  }
  100% { 
    transform: scale(1) rotate(0deg) translateZ(0);
    opacity: 1;
  }
}

/* Input Field */
#user-input {
  width: 100%;
  max-width: 500px;
  padding: 18px 25px;
  font-size: 1.3em;
  text-align: center;
  border: 3px solid #8b4513;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.9);
  margin: 10px auto;
  display: block;
  font-weight: 500;
  transition: border-color 0.3s, box-shadow 0.3s;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  will-change: auto;
}

#user-input:focus {
  outline: none;
  border-color: #654321;
  box-shadow: 0 0 0 4px rgba(139, 69, 19, 0.2), 0 4px 15px rgba(0, 0, 0, 0.2);
}

.correct-feedback {
  border-color: #2e7d32 !important;
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%) !important;
  animation: successPulse 0.5s;
}

.wrong-feedback {
  border-color: #c62828 !important;
  background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%) !important;
  animation: errorShake 0.5s;
}

@keyframes successPulse {
  0%, 100% { transform: scale(1) translateZ(0); }
  50% { transform: scale(1.02) translateZ(0); }
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0) translateZ(0); }
  25% { transform: translateX(-10px) translateZ(0); }
  75% { transform: translateX(10px) translateZ(0); }
}

/* Cancel Button */
.cancel-btn {
  margin-top: 20px;
  padding: 12px 30px;
  font-size: 1.1em;
  background: linear-gradient(135deg, #c62828 0%, #b71c1c 100%);
  color: white;
  border: 2px solid rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(198, 40, 40, 0.3);
  transition: all 0.3s;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.cancel-btn:hover {
  background: linear-gradient(135deg, #b71c1c 0%, #a31515 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(198, 40, 40, 0.4);
}

/* Results Section */
.results-container {
  background: linear-gradient(135deg, rgba(232, 213, 183, 0.95) 0%, rgba(201, 168, 112, 0.95) 100%);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border: 3px solid rgba(139, 69, 19, 0.3);
}

.results-title {
  text-align: center;
  font-size: 2em;
  color: #3e2723;
  margin-bottom: 30px;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

.score-summary {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.score-box {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(245, 245, 245, 0.8) 100%);
  padding: 25px 35px;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  text-align: center;
  min-width: 140px;
  border: 3px solid;
}

.score-number {
  font-size: 3em;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
}

.score-label {
  font-size: 1em;
  color: #666;
  font-weight: 600;
}

.correct-box {
  border-color: #2e7d32;
}

.correct-box .score-number {
  color: #2e7d32;
}

.wrong-box {
  border-color: #c62828;
}

.wrong-box .score-number {
  color: #c62828;
}

.accuracy-box {
  border-color: #1565c0;
}

.accuracy-box .score-number {
  color: #1565c0;
}

/* Kanji Summary */
#kanji-summary {
  background: linear-gradient(135deg, rgba(232, 213, 183, 0.5) 0%, rgba(201, 168, 112, 0.5) 100%);
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 30px;
  border: 2px solid rgba(139, 69, 19, 0.3);
  line-height: 2;
  font-size: 1.1em;
  text-align: center;
}

#kanji-summary strong {
  color: #3e2723;
  font-size: 1.3em;
  display: block;
  margin-bottom: 15px;
}

.correct-kanji {
  color: #2e7d32;
  font-weight: 700;
  font-size: 1.3em;
  background: rgba(46, 125, 50, 0.1);
  padding: 2px 8px;
  border-radius: 5px;
  display: inline-block;
  margin: 0 2px;
}

.mistaken-kanji {
  color: #c62828;
  font-weight: 700;
  font-size: 1.3em;
  background: rgba(198, 40, 40, 0.1);
  padding: 2px 8px;
  border-radius: 5px;
  display: inline-block;
  margin: 0 2px;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
}

.mistaken-kanji:hover {
  background: rgba(198, 40, 40, 0.2);
  transform: scale(1.1);
}

/* Result Actions */
.result-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.action-btn {
  padding: 15px 30px;
  font-size: 1.1em;
  border: 2px solid rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.copy-btn {
  background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
  color: white;
}

.copy-btn:hover {
  background: linear-gradient(135deg, #0d47a1 0%, #0a3d91 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(21, 101, 192, 0.4);
}

.whatsapp-btn {
  background: linear-gradient(135deg, #1faa59 0%, #128c48 100%);
  color: white;
}

.whatsapp-btn:hover {
  background: linear-gradient(135deg, #128c48 0%, #0e7a3e 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(31, 170, 89, 0.4);
}

.play-again-btn {
  background: linear-gradient(135deg, #ef6c00 0%, #e65100 100%);
  color: white;
}

.play-again-btn:hover {
  background: linear-gradient(135deg, #e65100 0%, #d84315 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(239, 108, 0, 0.4);
}

/* Footer */
.footer {
  text-align: center;
  margin-top: 30px;
  padding: 20px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9em;
}

.footer strong {
  color: #ffd700;
  font-weight: 700;
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-title {
    font-size: 2em;
  }
  
  .levels {
    flex-wrap: wrap;
  }
  
  .kanji-card {
    width: 220px;
    height: 220px;
  }
  
  #kanji-display {
    font-size: 100px;
  }
  
  .counter {
    font-size: 0.85em;
  }
  
  .counter-value {
    font-size: 1.2em;
  }
  
.score-summary {
    gap: 10px;
    flex-wrap: nowrap;
  }
  
  .score-box {
    padding: 15px 10px;
    min-width: 90px;
    flex: 1;
  }
  
  .score-number {
    font-size: 2em;
    margin-bottom: 5px;
  }
  
  .score-label {
    font-size: 0.8em;
  }
  
  .result-actions {
    flex-direction: column;
  }
  
  .action-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .game-title {
    font-size: 1.5em;
  }
  
  .levels {
    flex-direction: column;
  }
  
  .kanji-card {
    width: 200px;
    height: 200px;
  }
  
  #kanji-display {
    font-size: 90px;
  }
  
  .counter {
    font-size: 0.8em;
  }
  
  .counter-value {
    font-size: 1.1em;
  }
  
  .score-summary {
    gap: 8px;
  }
  
  .score-box {
    padding: 12px 8px;
    min-width: 80px;
  }
  
  .score-number {
    font-size: 1.8em;
  }
  
  .score-label {
    font-size: 0.75em;
  }
}