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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1a2e;
  color: #eee;
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

/* 開始畫面 */
.start-content {
  text-align: center;
  padding: 2rem;
}

.start-content h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1.1rem;
  color: #aaa;
  margin-bottom: 2rem;
}

.team-select p {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

/* 密碼表單 */
.password-form {
  margin-top: 2rem;
  text-align: center;
}

.password-form p {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.password-form input {
  width: 200px;
  padding: 0.8rem 1rem;
  font-size: 1.1rem;
  border: 2px solid #444;
  border-radius: 12px;
  background: #2a2a3e;
  color: #eee;
  text-align: center;
  margin-bottom: 0.8rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.password-form input:focus {
  outline: none;
  border-color: #f0c040;
}

.password-form .btn-primary {
  width: 200px;
  margin: 0 auto;
  display: block;
}

.error-text {
  color: #f44336;
  font-size: 0.9rem;
  margin-top: 0.8rem;
}

.reload-btn {
  margin-top: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #555;
  background: #2a2a3e;
  color: #aaa;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.6;
}

.team-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  max-width: 320px;
  margin: 0 auto;
}

.team-btn {
  padding: 1rem;
  font-size: 1.1rem;
  border: 2px solid #444;
  border-radius: 12px;
  background: #2a2a3e;
  color: #eee;
  cursor: pointer;
  transition: all 0.2s;
}

.team-btn:active {
  transform: scale(0.95);
  border-color: #f0c040;
  background: #3a3a5e;
}

/* 地圖 */
#map {
  width: 100%;
  height: 100%;
}

#status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(26, 26, 46, 0.9);
  backdrop-filter: blur(8px);
  padding: 0.6rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  z-index: 1000;
}

.map-menu-btn {
  background: none;
  border: none;
  color: #eee;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
}

.map-menu {
  position: fixed;
  top: 2.5rem;
  right: 0.5rem;
  background: #2a2a3e;
  border: 1px solid #555;
  border-radius: 8px;
  z-index: 1001;
  overflow: hidden;
}

.map-menu button {
  display: block;
  width: 100%;
  padding: 0.7rem 1.2rem;
  background: none;
  border: none;
  border-bottom: 1px solid #444;
  color: #eee;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.map-menu button:last-child { border-bottom: none; }
.map-menu button:active { background: #3a3a5e; }

#team-label {
  font-weight: bold;
}

#gps-status {
  color: #aaa;
}

#distance-hint {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 26, 46, 0.92);
  backdrop-filter: blur(8px);
  padding: 0.8rem 1.5rem;
  border-radius: 25px;
  font-size: 1rem;
  z-index: 1000;
  border: 1px solid #444;
}

/* 站點彈窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 2000;
}

.modal-content {
  background: #1e1e32;
  border-radius: 20px 20px 0 0;
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

#station-badge {
  font-size: 1.2rem;
  font-weight: bold;
}

#station-month {
  font-size: 1rem;
  color: #f0c040;
}

#station-photo-container {
  text-align: center;
  margin-bottom: 1rem;
}

#station-photo {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 12px;
}

#photo-caption {
  font-size: 0.85rem;
  color: #aaa;
  margin-top: 0.5rem;
}

#station-task h3,
#station-quiz h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

#task-text {
  font-size: 0.95rem;
  line-height: 1.5;
}

#quiz-question {
  font-size: 0.95rem;
  margin-bottom: 0.8rem;
}

#quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-option {
  padding: 0.8rem 1rem;
  border: 2px solid #444;
  border-radius: 10px;
  background: #2a2a3e;
  color: #eee;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.quiz-option:active {
  transform: scale(0.98);
}

.quiz-option.correct {
  border-color: #4caf50;
  background: #1b3a1b;
}

.quiz-option.wrong {
  border-color: #f44336;
  background: #3a1b1b;
}

#quiz-feedback {
  margin-top: 0.8rem;
  padding: 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.4;
}

#quiz-feedback.correct {
  background: #1b3a1b;
  color: #81c784;
}

#quiz-feedback.wrong {
  background: #3a1b1b;
  color: #ef9a9a;
}

.btn-primary {
  width: 100%;
  padding: 1rem;
  margin-top: 1rem;
  font-size: 1.1rem;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  background: #f0c040;
  color: #1a1a2e;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:active {
  transform: scale(0.97);
  background: #e0b030;
}

/* 線索卡片 */
.clue-card {
  text-align: center;
  padding: 2rem 1.5rem;
}

.clue-card h2 {
  font-size: 1.4rem;
  margin-bottom: 1.2rem;
}

#clue-text {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #f0c040;
  margin-bottom: 0.5rem;
}

/* 完成畫面 */
.finish-content {
  text-align: center;
  padding: 2rem;
}

.finish-content h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

#finish-summary {
  font-size: 1.1rem;
  color: #aaa;
  margin-bottom: 1.5rem;
}

#finish-stats {
  font-size: 1rem;
  line-height: 2;
}

/* Leaflet 自訂樣式 */
.station-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: bold;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.station-locked {
  background: #666;
}

.station-scout-locked {
  background: #666;
  opacity: 0.4;
}

.station-current {
  background: #f0c040;
  color: #1a1a2e;
  animation: pulse 1.5s infinite;
}

.station-done {
  background: #4caf50;
}

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

.user-marker {
  width: 16px;
  height: 16px;
  background: #4285f4;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(66, 133, 244, 0.6);
}

.user-accuracy {
  border: 2px solid rgba(66, 133, 244, 0.3);
  background: rgba(66, 133, 244, 0.1);
  border-radius: 50%;
}

/* 倒數計時警告 */
#timer.warning {
  color: #FF9800;
  font-weight: bold;
}

#timer.danger {
  color: #F44336;
  font-weight: bold;
  animation: blink 1s infinite;
}

#timer.overtime {
  color: #F44336;
  font-weight: bold;
  animation: blink 0.5s infinite;
}

@keyframes blink {
  50% { opacity: 0.5; }
}
