:root {
  --primary: #1247f5;
  --primary-dark: #1247f5;
  --secondary: #5ce1e6;
  --secondary-dark: #3acfd5;
  --dark: #121212;
  --darker: #0a0a0a;
  --darkest: #050505;
  --light: #e0e0e0;
  --error: #ff4d4d;
  --error-dark: #e63c3c;
  
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.83, 0, 0.17, 1);
}

body {
  background-color: var(--dark);
  color: var(--light);
  font-family: 'Courier New', monospace, system-ui;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  overflow-x: hidden;
}

.game-container {
  background-color: var(--darker);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 600px;
  box-shadow: 
    0 0 20px rgba(0, 255, 157, 0.1),
    0 0 0 1px rgba(110, 255, 137, 0.05);
  position: relative;
  overflow: hidden;
  transition: all 0.4s var(--ease-out);
  z-index: 1;
}

.game-container::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at center,
    rgba(110, 255, 137, 0.05) 0%,
    transparent 70%
  );
  z-index: -1;
  pointer-events: none;
}

.game-container.celebrate {
  animation: celebrate 2s var(--ease-in-out);
  box-shadow: 
    0 0 40px var(--primary),
    0 0 0 2px rgba(110, 255, 137, 0.2);
}

@keyframes celebrate {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.02) rotate(0.5deg); }
  50% { transform: scale(1.01) rotate(-0.5deg); }
  75% { transform: scale(1.02) rotate(0.5deg); }
}

h1 {
  text-align: center;
  color: rgb(15, 206, 15);
  margin-bottom: 0.5rem;
  font-size: 2.5rem;
  text-shadow: 
    0 0 10px rgba(38, 236, 74, 0.3),
    0 0 20px rgba(16, 241, 57, 0.1);
  letter-spacing: 1px;
  position: relative;
}

h1::after {
  content: '';
  display: block;
  width: 100px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), transparent);
  margin: 0.5rem auto 0;
  opacity: 0.5;
}

.subtitle {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--secondary);
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.difficulty-selector {
  margin-bottom: 2rem;
  text-align: center;
}

.difficulty-selector h3 {
  margin-bottom: 0.8rem;
  color: var(--light);
  font-weight: normal;
}

.difficulty-options {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.difficulty-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--light);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  font-size: 0.95rem;
  min-width: 100px;
}

.difficulty-btn.active {
  background: var(--primary);
  color: var(--darkest);
  font-weight: bold;
  border-color: transparent;
  box-shadow: 0 0 15px rgba(110, 255, 137, 0.3);
  transform: translateY(-2px);
}

.difficulty-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.game-board {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  min-height: 250px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.feedback {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.attempt-header {
  display: flex;
  justify-content: space-between;
  padding: 0.8rem 0.5rem;
  font-weight: bold;
  color: var(--secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.attempt {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  opacity: 0;
  transform: translateY(15px);
  transition: all 0.4s var(--ease-out);
  border-left: 3px solid transparent;
}

.attempt:nth-child(even) {
  background: rgba(0, 0, 0, 0.15);
}

.attempt.visible {
  opacity: 1;
  transform: translateY(0);
}

.attempt .guess {
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 1.2rem;
  letter-spacing: 2px;
}

.feedback-symbols {
  display: flex;
  gap: 12px;
}

.input-section {
  display: flex;
  gap: 12px;
  margin-bottom: 1.5rem;
}

#guess-input {
  flex: 1;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: white;
  font-size: 1.1rem;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  letter-spacing: 1px;
  transition: all 0.3s var(--ease-out);
}

#guess-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(110, 255, 137, 0.2);
  background: rgba(255, 255, 255, 0.12);
}

#guess-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0;
}

#guess-input.shake {
  animation: shake 0.5s var(--ease-out);
  border-color: var(--error);
  box-shadow: 0 0 0 2px rgba(255, 77, 77, 0.2);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

#submit-guess {
  background: var(--primary);
  color: var(--darkest);
  border: none;
  padding: 1rem 1.8rem;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  font-size: 1rem;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

#submit-guess:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(110, 255, 137, 0.3);
}

#submit-guess:active {
  transform: translateY(0);
}

#submit-guess.pulse {
  animation: pulse 0.4s var(--ease-out);
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.game-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  color: var(--secondary);
  font-size: 1.1rem;
}

.game-info span {
  font-weight: bold;
  color: var(--light);
}

.hint-section {
  text-align: center;
  margin-top: 1.5rem;
}

#hint-btn {
  background: rgba(92, 225, 230, 0.15);
  border: 1px solid var(--secondary);
  color: var(--secondary);
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#hint-btn:hover {
  background: rgba(92, 225, 230, 0.25);
  transform: translateY(-1px);
}

#hint-btn:active {
  transform: translateY(0);
}

#hint-text {
  display: block;
  margin-top: 0.8rem;
  color: var(--secondary);
  font-style: italic;
  animation: fadeIn 0.5s var(--ease-out);
}

.correct {
  color: var(--primary);
  animation: popIn 0.3s var(--ease-out) forwards;
  display: inline-block;
}

.incorrect {
  color: var(--error);
  opacity: 0.7;
}

@keyframes popIn {
  0% { transform: scale(0); opacity: 0; }
  80% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.result-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out);
}

.result-modal.visible {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--darker);
  padding: 2.5rem;
  border-radius: 16px;
  text-align: center;
  max-width: 90%;
  width: 450px;
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.4s var(--ease-out);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.result-modal.visible .modal-content {
  transform: scale(1);
  opacity: 1;
}

.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.result-modal.win .modal-content::before {
  background: linear-gradient(90deg, var(--primary), #0db4ca);
}

.result-modal.lose .modal-content::before {
  background: linear-gradient(90deg, var(--error), #ff6b00);
}

.modal-content h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--light);
}

.result-modal.win h2 {
  color: var(--primary);
  text-shadow: 0 0 10px rgba(110, 255, 137, 0.3);
}

.result-modal.lose h2 {
  color: var(--error);
  text-shadow: 0 0 10px rgba(255, 77, 77, 0.3);
}

.win-message {
  font-size: 1.2rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  color: var(--light);
  animation: fadeIn 0.6s var(--ease-out) 0.2s both;
}

.code-reveal {
  font-size: 1.8rem;
  margin: 2rem 0;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  letter-spacing: 3px;
  color: var(--light);
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 8px;
  display: inline-block;
  animation: fadeIn 0.6s var(--ease-out) 0.4s both;
}

#play-again-btn {
  background: var(--primary);
  color: var(--darkest);
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  font-size: 1.1rem;
  margin-top: 1.5rem;
  position: relative;
  overflow: hidden;
}

#play-again-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(110, 255, 137, 0.3);
}

#play-again-btn:active {
  transform: translateY(0);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.error-message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--error);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  z-index: 100;
  animation: slideIn 0.4s var(--ease-out);
  box-shadow: 0 5px 15px rgba(255, 77, 77, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.error-message::before {
  content: '⚠';
  font-size: 1.2rem;
}

.error-message.fade-out {
  animation: fadeOut 0.3s var(--ease-out) forwards;
}

@keyframes slideIn {
  from { 
    opacity: 0;
    transform: translate(-50%, -30px);
  }
  to { 
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

@media (max-width: 600px) {
  .game-container {
    padding: 1.5rem;
    border-radius: 12px;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .difficulty-options {
    flex-direction: column;
    align-items: center;
  }
  
  .difficulty-btn {
    width: 100%;
    max-width: 200px;
  }
  
  .input-section {
    flex-direction: column;
  }
  
  .modal-content {
    padding: 1.5rem;
  }
  
  .code-reveal {
    font-size: 1.4rem;
    padding: 0.8rem;
  }
}