﻿/* ===== TREASURE MAP GAME STYLES ===== */

:root {
  --ocean-blue: #1a6b8a;
  --deep-ocean: #0d3b4f;
  --sand: #f4e4c1;
  --gold: #ffd700;
  --pirate-brown: #5c3a21;
  --red-flag: #c0392b;
  --green-island: #27ae60;
  --white: #ffffff;
  --shadow: rgba(0, 0, 0, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(180deg, var(--ocean-blue) 0%, var(--deep-ocean) 100%);
  min-height: 100vh;
  color: var(--white);
  overflow-x: hidden;
}

/* Ocean wave animation */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 50px,
    rgba(255, 255, 255, 0.03) 50px,
    rgba(255, 255, 255, 0.03) 100px
  );
  animation: waves 8s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes waves {
  0% { transform: translateX(0); }
  100% { transform: translateX(100px); }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* Header */
.game-header {
  text-align: center;
  padding: 20px 0;
}

.game-header h1 {
  font-size: 2.8rem;
  color: var(--gold);
  text-shadow: 3px 3px 6px var(--shadow), 0 0 20px rgba(255, 215, 0, 0.3);
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.game-header .subtitle {
  font-size: 1.1rem;
  color: var(--sand);
  opacity: 0.9;
}

/* Screens */
.screen {
  display: none;
  animation: fadeIn 0.5s ease;
}

.screen.active {
  display: block;
}

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

/* Setup Screen */
.setup-panel {
  background: rgba(92, 58, 33, 0.85);
  border-radius: 20px;
  padding: 40px;
  max-width: 600px;
  margin: 40px auto;
  box-shadow: 0 10px 40px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 215, 0, 0.3);
}

.setup-panel h2 {
  text-align: center;
  color: var(--gold);
  font-size: 1.8rem;
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 25px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--sand);
  font-size: 1.05rem;
  font-weight: 600;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid rgba(255, 215, 0, 0.3);
  border-radius: 12px;
  font-size: 1.1rem;
  background: rgba(0, 0, 0, 0.3);
  color: var(--white);
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.form-group select option {
  background: var(--pirate-brown);
  color: var(--white);
}

/* Game Mode Cards */
.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.mode-card {
  background: rgba(0, 0, 0, 0.3);
  border: 3px solid transparent;
  border-radius: 16px;
  padding: 25px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.mode-card:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px var(--shadow);
}

.mode-card.selected {
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.15);
}

.mode-card .icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.mode-card h3 {
  color: var(--gold);
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.mode-card p {
  color: var(--sand);
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 16px 40px;
  border: none;
  border-radius: 14px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), #ffaa00);
  color: var(--pirate-brown);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255, 215, 0, 0.6);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
}

.btn-center {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

/* Game Screen */
.game-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 30px;
  align-items: start;
}

@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
}

/* Game Info Bar */
.info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 16px;
  padding: 15px 25px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.info-item {
  text-align: center;
}

.info-item .label {
  font-size: 0.8rem;
  color: var(--sand);
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.info-item .value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold);
}

.timer-warning {
  animation: pulse 1s ease infinite;
  color: var(--red-flag) !important;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Map Grid */
.map-container {
  background: rgba(92, 58, 33, 0.7);
  border-radius: 20px;
  padding: 25px;
  box-shadow: 0 10px 40px var(--shadow);
  border: 2px solid rgba(255, 215, 0, 0.2);
}

.map-title {
  text-align: center;
  color: var(--gold);
  font-size: 1.3rem;
  margin-bottom: 15px;
}

.grid-wrapper {
  position: relative;
}

/* Column headers */
.column-headers {
  display: grid;
  grid-template-columns: 40px repeat(6, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.col-header {
  text-align: center;
  font-weight: 700;
  color: var(--gold);
  font-size: 1.1rem;
  padding: 8px 0;
}

.col-header.corner {
  visibility: hidden;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: 40px repeat(6, 1fr);
  gap: 4px;
}

.row-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--gold);
  font-size: 1.1rem;
}

.grid-cell {
  aspect-ratio: 1;
  background: linear-gradient(135deg, #2980b9, #1a6b8a);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  position: relative;
  font-size: 1.8rem;
  border: 2px solid rgba(255, 255, 255, 0.1);
  min-height: 70px;
}

.grid-cell.revealed {
  background: linear-gradient(135deg, var(--green-island), #1e8449);
  cursor: default;
  animation: revealPop 0.5s ease;
}

@keyframes revealPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.grid-cell.wrong {
  animation: shake 0.5s ease;
  border-color: var(--red-flag) !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.grid-cell .landmark-icon {
  font-size: 2rem;
}

.grid-cell .landmark-name {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--white);
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  font-weight: 600;
}

/* Water cells */
.grid-cell.water {
  background: linear-gradient(135deg, #1a5276, #0d3b4f);
  cursor: default;
}

/* Side Panel */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Coordinate Input */
.coord-input-panel {
  background: rgba(92, 58, 33, 0.85);
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 8px 30px var(--shadow);
  border: 2px solid rgba(255, 215, 0, 0.2);
}

.coord-input-panel h3 {
  color: var(--gold);
  margin-bottom: 15px;
  text-align: center;
  font-size: 1.2rem;
}

.coord-input-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 15px;
}

.coord-input-row input {
  width: 40px;
  max-width: 50px;
  padding: 10px 6px;
  border: 2px solid rgba(255, 215, 0, 0.3);
  border-radius: 10px;
  font-size: 1rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.3);
  color: var(--white);
}

.coord-input-row input::placeholder {
  font-size: 0.85rem;
  opacity: 0.6;
}

.coord-input-row input:focus {
  outline: none;
  border-color: var(--gold);
}

/* Feedback */
.feedback {
  text-align: center;
  padding: 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.feedback.correct {
  background: rgba(39, 174, 96, 0.3);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.5);
}

.feedback.wrong {
  background: rgba(192, 57, 43, 0.3);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.5);
}

.feedback.hint {
  background: rgba(255, 215, 0, 0.2);
  color: var(--gold);
  border: 1px solid rgba(255, 215, 0, 0.4);
}

/* Landmark List */
.landmark-list {
  background: rgba(92, 58, 33, 0.85);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 30px var(--shadow);
  border: 2px solid rgba(255, 215, 0, 0.2);
}

.landmark-list h3 {
  color: var(--gold);
  margin-bottom: 15px;
  text-align: center;
  font-size: 1.2rem;
}

.landmark-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  transition: all 0.3s ease;
}

.landmark-item.found {
  background: rgba(39, 174, 96, 0.2);
}

.landmark-item .icon {
  font-size: 1.5rem;
  width: 35px;
  text-align: center;
}

.landmark-item .info {
  flex: 1;
}

.landmark-item .name {
  font-weight: 600;
  color: var(--white);
  font-size: 0.95rem;
}

.landmark-item .coord {
  font-size: 0.8rem;
  color: var(--sand);
  opacity: 0.7;
}

.landmark-item.found .name {
  color: #2ecc71;
}

/* Hint Button */
.hint-btn {
  width: 100%;
  padding: 12px;
  background: rgba(255, 215, 0, 0.2);
  border: 2px solid rgba(255, 215, 0, 0.4);
  border-radius: 10px;
  color: var(--gold);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.hint-btn:hover {
  background: rgba(255, 215, 0, 0.3);
}

.hint-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Countdown Overlay */
.countdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.countdown-number {
  font-size: 8rem;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 40px rgba(255, 215, 0, 0.6);
  animation: countdownPulse 1s ease infinite;
}

@keyframes countdownPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Result Screen */
.result-panel {
  background: rgba(92, 58, 33, 0.9);
  border-radius: 20px;
  padding: 50px 40px;
  max-width: 550px;
  margin: 40px auto;
  text-align: center;
  box-shadow: 0 15px 50px var(--shadow);
  border: 2px solid rgba(255, 215, 0, 0.3);
}

.result-panel .trophy {
  font-size: 5rem;
  margin-bottom: 20px;
}

.result-panel h2 {
  color: var(--gold);
  font-size: 2rem;
  margin-bottom: 15px;
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 30px 0;
}

.stat-box {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  padding: 20px;
}

.stat-box .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
}

.stat-box .stat-label {
  font-size: 0.85rem;
  color: var(--sand);
  margin-top: 5px;
}

/* Name Input for Score */
.name-input-section {
  margin: 25px 0;
}

.name-input-section input {
  width: 100%;
  padding: 14px;
  border: 2px solid rgba(255, 215, 0, 0.3);
  border-radius: 12px;
  font-size: 1.1rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.3);
  color: var(--white);
  margin-bottom: 15px;
}

.name-input-section input:focus {
  outline: none;
  border-color: var(--gold);
}

/* Leaderboard */
.leaderboard-panel {
  background: rgba(92, 58, 33, 0.85);
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 8px 30px var(--shadow);
  border: 2px solid rgba(255, 215, 0, 0.2);
}

.leaderboard-panel h3 {
  color: var(--gold);
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.leaderboard-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid transparent;
  border-radius: 10px;
  color: var(--sand);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(255, 215, 0, 0.15);
}

.leaderboard-list {
  list-style: none;
}

.leaderboard-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.leaderboard-entry:nth-child(1) {
  background: rgba(255, 215, 0, 0.2);
  border: 1px solid rgba(255, 215, 0, 0.4);
}

.leaderboard-entry:nth-child(2) {
  background: rgba(192, 192, 192, 0.15);
  border: 1px solid rgba(192, 192, 192, 0.3);
}

.leaderboard-entry:nth-child(3) {
  background: rgba(205, 127, 50, 0.15);
  border: 1px solid rgba(205, 127, 50, 0.3);
}

.rank {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--gold);
  font-size: 0.9rem;
}

.leaderboard-entry:nth-child(1) .rank {
  background: var(--gold);
  color: var(--pirate-brown);
}

.player-info {
  flex: 1;
}

.player-name {
  font-weight: 600;
  color: var(--white);
}

.player-details {
  font-size: 0.8rem;
  color: var(--sand);
  opacity: 0.7;
}

.player-score {
  font-weight: 700;
  color: var(--gold);
  font-size: 1.1rem;
}

/* Confetti */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  to {
    top: 110vh;
    transform: rotate(720deg);
  }
}

/* Responsive */
@media (max-width: 600px) {
  .game-header h1 {
    font-size: 1.8rem;
  }
  
  .setup-panel {
    padding: 25px 20px;
  }
  
  .mode-cards {
    grid-template-columns: 1fr;
  }
  
  .grid-cell {
    min-height: 55px;
    font-size: 1.4rem;
  }
  
  .grid-cell .landmark-icon {
    font-size: 1.5rem;
  }
  
  .info-bar {
    justify-content: center;
  }
  
  .result-stats {
    grid-template-columns: 1fr;
  }
}

/* Streak indicator */
.streak-badge {
  display: inline-block;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  animation: streakGlow 1s ease infinite alternate;
}

@keyframes streakGlow {
  from { box-shadow: 0 0 5px rgba(231, 76, 60, 0.5); }
  to { box-shadow: 0 0 15px rgba(231, 76, 60, 0.8); }
}

/* Progress bar */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  margin-top: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #ffaa00);
  border-radius: 4px;
  transition: width 0.5s ease;
}
