/* Banjo Hunt - Offline Quest PWA 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;
  padding-bottom: calc(4.75rem + env(safe-area-inset-bottom));
}

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

/* Screens */
.screen {
  display: none;
  min-height: 100vh;
  padding: 1rem 1rem calc(5.5rem + env(safe-area-inset-bottom));
}

.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 {
  width: clamp(4rem, 14vw, 5rem);
  margin-bottom: 0.75rem;
  animation: pulse 2s infinite;
}

.quest-badge img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(244, 211, 94, 0.35));
}

@media (max-width: 480px) {
  .quest-badge { width: clamp(3.25rem, 18vw, 4rem); margin-bottom: 0.5rem; }
  .welcome-content { padding: 1.5rem 1rem; }
  .welcome-content h1 { font-size: clamp(1.55rem, 8vw, 1.9rem); line-height: 1.15; max-width: 100%; }
  .quest-info { width: 100%; padding: 1.1rem; margin-bottom: 1.25rem; }
  .subtitle { margin-bottom: 1.25rem; }
  .btn-primary, .btn-secondary { padding: 0.9rem 1.25rem; }
  .welcome-links { gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
}

.welcome-links-compact{
  margin-top: 0.75rem;
  font-size: 0.95rem;
  color: var(--color-text-muted);
}
.welcome-links-compact a{
  color: var(--color-text-muted);
  text-decoration: underline;
}
.welcome-links-compact{ display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap: 0.35rem; }
.welcome-links-compact .sep{ opacity: .5; display:inline-block; margin: 0 0.35rem; }


@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;
  border: none;
}

#qr-reader video {
  border-radius: 8px;
}

#qr-reader__scan_region {
  background: transparent !important;
}

#qr-reader__dashboard {
  padding: 0.5rem !important;
}

#qr-reader button {
  background: var(--color-primary) !important;
  border: none !important;
  padding: 0.75rem 1.5rem !important;
  border-radius: 8px !important;
  color: #fff !important;
  font-size: 1rem !important;
  cursor: pointer;
}

#qr-reader select {
  padding: 0.5rem !important;
  border-radius: 4px !important;
  font-size: 1rem !important;
}

.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;
}

/* Email Signup */
.signup-box {
  background: var(--color-card);
  padding: 1.5rem;
  border-radius: 12px;
  margin: 1.5rem 0;
  width: 100%;
  max-width: 300px;
  text-align: center;
}

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

.signup-box > p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.signup-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.signup-form input,
.signup-form select,
.signup-form textarea {
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
}

.signup-form textarea {
  min-height: 7rem;
  resize: vertical;
}

.signup-form label {
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.signup-form input:focus,
.signup-form select:focus,
.signup-form textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

.signup-note {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.75rem;
}

.signup-success,
.sync-status.sent {
  color: var(--color-success);
  font-weight: 600;
  margin-top: 0.5rem;
}

.sync-status.pending {
  color: var(--color-accent);
  font-weight: 600;
  margin-top: 0.5rem;
}

.sync-status.queued,
.sync-status.error {
  color: #fca5a5;
  font-weight: 600;
  margin-top: 0.5rem;
}

.survey-box {
  max-width: 360px;
}

/* 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);
}

/* Privacy Footer */
.privacy-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(45, 85, 48, 0.95);
  color: #faf8f5;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  font-size: 11px;
  text-align: center;
  z-index: 100;
}

.privacy-footer p {
  margin: 0;
}

.privacy-footer a {
  color: #d4af37;
  text-decoration: underline;
}

.privacy-footer a:hover {
  color: #fff;
}

.complete-content,
.stop-content,
.hub-content,
.scanner-container,
.modal-content {
  margin-bottom: 1.5rem;
}

/* Quest selector */
.quest-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.quest-card {
  text-align: left;
  padding: 1rem;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(22,33,62,1) 0%, rgba(15,52,96,0.65) 100%);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
}

.quest-card:hover {
  border-color: rgba(233, 69, 96, 0.7);
}

.quest-card:active {
  transform: translateY(1px);
}

.quest-card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.quest-card-subtitle {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}


/* Rural/offline operations helpers */
.status-panel {
  width: 100%;
  max-width: 420px;
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: rgba(15, 52, 96, 0.55);
  text-align: left;
}
.status-panel p { margin: 0.2rem 0 0; font-size: 0.9rem; color: var(--color-text-muted); }
.status-panel.sent { border-color: rgba(74, 222, 128, 0.65); background: rgba(20, 83, 45, 0.45); }
.status-panel.pending { border-color: rgba(244, 211, 94, 0.65); background: rgba(113, 63, 18, 0.35); }
.status-panel.queued, .status-panel.update { border-color: rgba(251, 191, 36, 0.75); background: rgba(120, 53, 15, 0.45); }
.status-panel.error { border-color: rgba(248, 113, 113, 0.75); background: rgba(127, 29, 29, 0.45); }
.btn-secondary.compact, .btn-primary.compact { max-width: 180px; padding: 0.65rem 0.9rem; font-size: 0.9rem; margin-top: 0.5rem; }
.manual-code-box {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-card);
}
.manual-code-box h3 { color: var(--color-accent); margin-bottom: .35rem; }
.manual-code-box p { color: var(--color-text-muted); font-size: .9rem; margin-bottom: .75rem; }
.manual-code-row { display: flex; gap: .5rem; align-items: center; }
.manual-code-row input { flex: 1; min-width: 0; }
.manual-code-row .btn-secondary { width: auto; max-width: none; padding: .8rem 1rem; }
.sync-actions { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; margin-top: 1rem; }
.sync-status-details { display: grid; gap: .65rem; margin-top: 1rem; }
.sync-row {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.65);
  padding: .75rem;
}
.sync-row strong { display: block; color: var(--color-accent); }
.sync-row span { display: block; font-weight: 700; }
.sync-row small { display: block; color: var(--color-text-muted); margin-top: .2rem; }
.sync-row.sent { border-color: rgba(74, 222, 128, 0.55); }
.sync-row.queued, .sync-row.pending { border-color: rgba(244, 211, 94, 0.55); }
.sync-row.error { border-color: rgba(248, 113, 113, 0.65); }
@media (max-width: 480px) {
  .manual-code-row { flex-direction: column; align-items: stretch; }
  .manual-code-row .btn-secondary { width: 100%; }
}


.camera-status {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 12px;
  text-align: left;
  line-height: 1.45;
}

.camera-status.error {
  border: 1px solid rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.12);
  color: #ffd7d7;
}

.camera-status.warning {
  border: 1px solid rgba(255, 193, 7, 0.45);
  background: rgba(255, 193, 7, 0.12);
  color: #fff0bd;
}

.camera-status.info {
  border: 1px solid rgba(80, 190, 255, 0.45);
  background: rgba(80, 190, 255, 0.12);
  color: #d8f2ff;
}

.camera-status p,
.camera-status ol {
  margin: 0.5rem 0 0;
}

.camera-status ol {
  padding-left: 1.25rem;
}
