/* Trail Quest - Adventure Game Styles */

:root {
  --color-bg: #1a1a2e;
  --color-bg-light: #16213e;
  --color-primary: #e94560;
  --color-secondary: #0f3460;
  --color-accent: #f4d35e;
  --color-success: #4ade80;
  --color-text: #eee;
  --color-text-muted: #94a3b8;
  --color-card: #16213e;
  --color-border: #334155;
  --font-display: 'Georgia', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.6;
}

#app {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
}

/* Screens */
.screen {
  display: none;
  min-height: 100vh;
  padding: 1rem;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0 1rem 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1rem;
}

header h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.back-btn {
  background: var(--color-secondary);
  border: none;
  color: var(--color-text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
}

.progress-badge {
  background: var(--color-primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Welcome Screen */
.welcome-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
}

.quest-badge {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulse 2s infinite;
}

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

.welcome-content h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--color-accent);
}

.subtitle {
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

.quest-info {
  background: var(--color-card);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  border: 1px solid var(--color-border);
}

.quest-info p {
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.quest-meta {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.welcome-links {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

/* Buttons */
.btn-primary {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  max-width: 300px;
  transition: transform 0.1s, opacity 0.1s;
}

.btn-primary:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.btn-secondary {
  background: var(--color-secondary);
  color: white;
  border: 1px solid var(--color-border);
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
  max-width: 300px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.5rem 1rem;
}

.btn-text:hover {
  color: var(--color-text);
}

/* Hub Screen */
.hub-content {
  flex: 1;
}

.stops-timeline {
  position: relative;
  padding-left: 2rem;
}

.stops-timeline::before {
  content: '';
  position: absolute;
  left: 0.75rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

.timeline-stop {
  position: relative;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--color-card);
  border-radius: 8px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: border-color 0.2s;
}

.timeline-stop::before {
  content: '';
  position: absolute;
  left: -1.65rem;
  top: 1.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-border);
  border: 2px solid var(--color-bg);
}

.timeline-stop.completed::before {
  background: var(--color-success);
}

.timeline-stop.current::before {
  background: var(--color-accent);
  box-shadow: 0 0 8px var(--color-accent);
}

.timeline-stop.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.timeline-stop h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.timeline-stop .location {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.timeline-stop .status {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
}

.hub-actions {
  padding: 1.5rem 0;
}

.hints-badge {
  text-align: center;
  padding: 1rem;
  color: var(--color-accent);
  font-size: 0.9rem;
}

/* Stop Screen */
.stop-content {
  flex: 1;
}

.location-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-secondary);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.story-box {
  background: var(--color-card);
  padding: 1.25rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--color-accent);
  font-size: 0.95rem;
}

.story-box p {
  margin-bottom: 0.75rem;
}

.story-box p:last-child {
  margin-bottom: 0;
}

.story-box em {
  color: var(--color-text-muted);
}

.puzzle-box {
  background: var(--color-card);
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--color-primary);
}

.puzzle-box h3 {
  margin-bottom: 1rem;
  color: var(--color-primary);
}

#puzzle-question {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.puzzle-input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.puzzle-input-group input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
}

.puzzle-input-group input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.puzzle-input-group .btn-primary {
  width: auto;
  padding: 0.75rem 1.5rem;
}

/* When input is hidden (multiple choice), make button full width */
.puzzle-input-group input.hidden + .btn-primary {
  width: 100%;
}

.puzzle-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.puzzle-option {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 1rem;
  border-radius: 8px;
  text-align: left;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.2s;
}

.puzzle-option:hover {
  border-color: var(--color-primary);
}

.puzzle-option.selected {
  border-color: var(--color-primary);
  background: var(--color-secondary);
}

.hint-text {
  background: var(--color-accent);
  color: #1a1a2e;
  padding: 0.75rem;
  border-radius: 8px;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.feedback {
  padding: 0.75rem;
  border-radius: 8px;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.feedback.error {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.feedback.success {
  background: rgba(74, 222, 128, 0.2);
  color: var(--color-success);
}

/* Success State */
.success-box {
  text-align: center;
  padding: 2rem 1rem;
}

.success-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

#success-message {
  margin-bottom: 1rem;
}

.next-clue {
  background: var(--color-secondary);
  padding: 1rem;
  border-radius: 8px;
  margin: 1.5rem 0;
  font-style: italic;
  border-left: 4px solid var(--color-accent);
}

/* Scanner */
.scanner-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#qr-reader {
  width: 100%;
  max-width: 400px;
}

.scanner-hint {
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 1rem;
}

/* Completion Screen */
.complete-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  text-align: center;
}

.complete-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.complete-content h1 {
  font-family: var(--font-display);
  color: var(--color-accent);
  margin-bottom: 1.5rem;
}

.stats-box {
  background: var(--color-card);
  padding: 1.5rem;
  border-radius: 12px;
  margin: 1.5rem 0;
  width: 100%;
  max-width: 300px;
}

.stats-box h3 {
  margin-bottom: 1rem;
  color: var(--color-accent);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.stat-row:last-child {
  border-bottom: none;
}

.reward-box {
  background: linear-gradient(135deg, var(--color-primary), #ff6b6b);
  padding: 1.5rem;
  border-radius: 12px;
  margin: 1rem 0;
  width: 100%;
  max-width: 300px;
}

.reward-box h3 {
  margin-bottom: 0.5rem;
}

.reward-code {
  background: white;
  color: #1a1a2e;
  padding: 0.75rem;
  border-radius: 8px;
  font-family: monospace;
  font-size: 1.25rem;
  font-weight: bold;
  margin: 0.75rem 0;
}

.reward-valid {
  font-size: 0.8rem;
  opacity: 0.9;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--color-card);
  border-radius: 16px;
  padding: 1.5rem;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-large {
  max-width: 500px;
}

.modal-content h2 {
  margin-bottom: 1.5rem;
  font-family: var(--font-display);
  color: var(--color-accent);
}

.help-section {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}

.help-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.help-section h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.help-section p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* Trail Map */
.trail-map {
  background: var(--color-bg);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.map-note {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.map-stops {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.map-stop {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--color-card);
  border-radius: 8px;
}

.map-stop-number {
  background: var(--color-primary);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.map-stop-info {
  flex: 1;
}

.map-stop-info h4 {
  font-size: 0.9rem;
  margin-bottom: 0.1rem;
}

.map-stop-info p {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.map-disclaimer {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: 1rem;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Focus states */
*:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

/* Ending story */
.ending-note {
  background: var(--color-secondary);
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
