* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  text-align: center;
  padding: 0;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 25px;
  background: rgba(0, 0, 0, 0.2);
  width: 100%;
  box-sizing: border-box;
}

.nav-link {
  color: #a0a0c0;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: #fff;
}

.auth-btn {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.auth-btn.logged-in {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-icon-btn {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.header-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.header-icon-btn svg {
  width: 18px;
  height: 18px;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9em;
  box-shadow: 0 2px 10px rgba(255, 107, 53, 0.4);
}

.streak-icon {
  font-size: 1.1em;
}

.game-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 0;
}

h1 {
  font-size: 2.8em;
  margin: 20px 0 10px;
  letter-spacing: 4px;
  font-weight: 800;
  text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

#hint {
  margin: 10px 0 30px;
  font-style: italic;
  font-size: 1.1em;
  color: #a0a0c0;
  letter-spacing: 1px;
}

.game-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 50px;
  flex-wrap: wrap;
  padding: 20px;
  max-width: 800px;
}

#color-wheel {
  position: relative;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), inset 0 0 30px rgba(255, 255, 255, 0.05);
}

.wedge {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 50%;
  transform-origin: 0% 100%;
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.wedge:hover {
  filter: brightness(1.3);
  z-index: 1;
}

#color-wheel::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90px;
  height: 90px;
  background: linear-gradient(135deg, #1a1a2e, #0f0f23);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

#game-grid {
  display: grid;
  grid-template-rows: repeat(5, 1fr);
  grid-gap: 17px;
}

.row {
  display: flex;
  gap: 17px;
}

.tile {
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tile:hover {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.3);
}

.tile.correct {
  border: none;
  outline: 4px solid #4ade80;
  outline-offset: 3px;
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.6), inset 0 0 0 2px rgba(74, 222, 128, 0.3);
}

.tile.misplaced {
  border: none;
  outline: 4px solid #fb923c;
  outline-offset: 3px;
  box-shadow: 0 0 20px rgba(251, 146, 60, 0.6), inset 0 0 0 2px rgba(251, 146, 60, 0.3);
}

.tile.wrong::after {
  content: "✕";
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.8em;
  font-weight: bold;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}

#victory-overlay,
#try-again-overlay,
#info-overlay,
#login-overlay,
#stats-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 25px;
  z-index: 10;
}

#victory-message,
#try-again-message {
  font-size: 3em;
  font-weight: 700;
  letter-spacing: 2px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#victory-message {
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#try-again-message {
  color: #ff6b6b;
}

#reveal-pattern,
#reveal-pattern-lose {
  display: flex;
  gap: 12px;
  margin: 10px 0;
}

.reveal-tile {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  animation: pop-in 0.5s ease-out forwards;
  transform: scale(0);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.reveal-tile:nth-child(1) { animation-delay: 0.1s; }
.reveal-tile:nth-child(2) { animation-delay: 0.2s; }
.reveal-tile:nth-child(3) { animation-delay: 0.3s; }
.reveal-tile:nth-child(4) { animation-delay: 0.4s; }
.reveal-tile:nth-child(5) { animation-delay: 0.5s; }

.overlay-subtitle {
  color: #a0a0c0;
  font-size: 1.1em;
  margin-top: -10px;
}

.overlay-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 15px;
}

#save-palette,
#save-palette-lose,
#close-info {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: 2px solid transparent;
  padding: 12px 26px;
  border-radius: 30px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  min-width: 160px;
}

#save-palette:hover,
#save-palette-lose:hover,
#close-info:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.secondary-btn {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(247, 147, 30, 0.25));
  color: #fff;
  border: 2px solid rgba(255, 147, 53, 0.5);
  padding: 12px 26px;
  border-radius: 30px;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.2);
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  min-width: 160px;
}

.secondary-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 147, 53, 0.8);
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.3), rgba(247, 147, 30, 0.35));
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.35);
}

.info-content {
  background: linear-gradient(135deg, #1e1e2e, #2a2a40);
  padding: 30px;
  border-radius: 20px;
  max-width: 420px;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.info-content h2 {
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
  font-size: 1.5em;
  text-align: center;
  width: 100%;
}

.info-content p {
  color: #c0c0d0;
  line-height: 1.7;
  margin: 10px 0;
  font-size: 0.95em;
}

.info-content .info-icon {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  width: 100%;
}

.info-content .info-icon span {
  font-size: 1.2em;
}

#close-info {
  margin-top: 20px;
}

.info-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  width: 100%;
  align-items: center;
}

.info-buttons button {
  width: 100%;
  max-width: 280px;
}


.stats-content {
  background: linear-gradient(135deg, #1e1e2e, #2a2a40);
  padding: 30px;
  border-radius: 20px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-content h2 {
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
  font-size: 1.5em;
}

.stats-content h3 {
  color: #a0a0c0;
  font-size: 0.9em;
  margin: 20px 0 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.05);
  padding: 15px 10px;
  border-radius: 10px;
}

.stat-number {
  font-size: 1.8em;
  font-weight: 700;
  color: #fff;
}

.stat-label {
  font-size: 0.7em;
  color: #a0a0c0;
  margin-top: 5px;
}

.guess-distribution {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.guess-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.guess-row .guess-num {
  width: 16px;
  font-weight: 600;
  color: #a0a0c0;
}

.guess-row .guess-bar {
  height: 24px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 4px;
  min-width: 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 0.8em;
  font-weight: 600;
  transition: width 0.5s ease;
}

#close-stats {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  padding: 12px 30px;
  border-radius: 30px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#close-stats:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translateY(-20px) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) rotate(720deg);
  }
}

.login-content {
  background: linear-gradient(135deg, #1e1e2e, #2a2a40);
  padding: 30px;
  border-radius: 20px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.palette-border {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  border-radius: 6px;
  overflow: hidden;
}

.palette-border .swatch {
  flex: 1;
  height: 6px;
}

.login-content h2 {
  font-size: 1.4em;
  margin: 0;
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
}

.login-content input {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-size: 1em;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-content input:focus {
  border-color: #667eea;
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.login-content input::placeholder {
  color: #666;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  color: #333;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 1em;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

.google-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
  background: #f5f5f5;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 15px;
  color: #666;
  font-size: 0.9em;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
}

.login-actions {
  display: flex;
  gap: 10px;
}

.login-content button {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex: 1;
}

.login-content button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#reset-password-btn,
#close-login-overlay {
  background: rgba(255, 255, 255, 0.1);
  color: #a0a0c0;
}

#reset-password-btn:hover,
#close-login-overlay:hover {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

.error-message {
  color: #ff6b6b;
  margin-top: 5px;
  font-size: 0.9em;
  text-align: center;
}

.success-message {
  color: #4ade80;
  margin-top: 5px;
  font-size: 0.9em;
  text-align: center;
}

.hidden {
  display: none !important;
}

.daily-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
  color: #a0a0c0;
}

.stat-icon {
  font-size: 1.1em;
}

.stat-text {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-item span#player-count,
.stat-item span#best-player,
.stat-item span#best-guess,
.stat-item span#countdown {
  color: #fff;
  font-weight: 600;
}

@media (max-width: 768px) {
  .daily-stats {
    gap: 15px;
    padding: 12px 15px;
  }
  
  .stat-item {
    font-size: 0.8em;
  }
}

#info-btn {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

#info-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

#info-btn svg {
  width: 18px;
  height: 18px;
}

@keyframes pop-in {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 2em;
    letter-spacing: 2px;
  }
  
  #hint {
    font-size: 0.95em;
    margin: 5px 0 20px;
  }
  
  .game-container {
    gap: 30px;
  }
  
  #color-wheel {
    width: 220px;
    height: 220px;
  }
  
  #color-wheel::before {
    width: 70px;
    height: 70px;
  }
  
  .tile {
    width: 44px;
    height: 44px;
  }
  
  .row {
    gap: 15px;
  }
  
  #game-grid {
    grid-gap: 15px;
  }
  
  #victory-message,
  #try-again-message {
    font-size: 2.2em;
  }
  
  .reveal-tile {
    width: 50px;
    height: 50px;
  }
  
  #info-btn {
    width: 32px;
    height: 32px;
  }
  
  #info-btn svg {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  
  h1 {
    font-size: 1.6em;
  }
  
  .tile {
    width: 38px;
    height: 38px;
  }
  
  .game-container {
    gap: 20px;
  }
  
  #color-wheel {
    width: 180px;
    height: 180px;
  }
  
  #color-wheel::before {
    width: 55px;
    height: 55px;
  }
  
  .login-content {
    width: 90%;
    max-width: 300px;
  }
  
  .info-content {
    max-width: 90%;
    padding: 20px;
  }
  
  .reveal-tile {
    width: 40px;
    height: 40px;
  }
}

.duplicate-msg {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: #ff9f43;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  z-index: 1000;
  animation: fadeInOut 1.5s ease-in-out;
  pointer-events: none;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}
