/* ========== TRACKER STYLES ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #1e2430;
  color: #e0e0e0;
  min-height: 100vh;
}

/* Header */
header {
  background-color: #252d3d;
  padding: 20px;
  text-align: center;
  border-bottom: 2px solid #2e3a4e;
  position: relative;
}

header h1 {
  color: #00e08a;
  margin-bottom: 15px;
  font-size: 2rem;
  text-shadow: 0 0 10px rgba(0, 224, 138, 0.15);
}

/* Player name display (top-right corner) */
.player-name-display {
  position: absolute;
  top: 16px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #2e3a4e;
  border: 1px solid #3a4660;
  border-radius: 8px;
  padding: 6px 14px;
}

.player-head {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  image-rendering: pixelated;
  display: none;
}

.player-name-display span {
  color: #00e08a;
  font-size: 0.9rem;
  font-weight: 600;
}

.header-back-link {
  display: inline-block;
  color: #00c878;
  font-size: 0.9rem;
  text-decoration: none;
  margin-bottom: 10px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.header-back-link:hover {
  opacity: 1;
}

/* File inputs */
.file-inputs {
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
}

.file-input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.file-input-group label {
  color: #9aa0aa;
  font-size: 0.9rem;
}

.file-input-group input[type="file"] {
  background-color: #2e3a4e;
  color: #e0e0e0;
  padding: 10px 15px;
  border: 1px solid #3a4660;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.file-input-group input[type="file"]:hover {
  background-color: #3a4660;
  border-color: #00e08a;
}

/* Progress bar */
.progress-container {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.progress-bar {
  width: 300px;
  height: 20px;
  background-color: #2e3a4e;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #3a4660;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00e08a, #00b86b);
  width: 0%;
  transition: width 0.5s ease;
}

.progress-text {
  color: #00e08a;
  font-weight: bold;
  min-width: 50px;
}

/* Container layout */
.container {
  display: flex;
  min-height: calc(100vh - 150px);
}

/* Sidebar */
#chapterList {
  width: 420px;
  background-color: #252d3d;
  padding: 28px;
  border-right: 2px solid #2e3a4e;
  overflow-y: auto;
}

#chapterList h2 {
  color: #00e08a;
  margin-bottom: 15px;
  font-size: 1.3rem;
  border-bottom: 1px solid #2e3a4e;
  padding-bottom: 10px;
}

#chapterNav {
  list-style: none;
}

#chapterNav li {
  padding: 22px 22px;
  margin-bottom: 14px;
  background-color: #2e3a4e;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 22px;
}

#chapterNav li .chapter-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
  image-rendering: pixelated;
}

#chapterNav li .chapter-label {
  flex: 1;
  min-width: 0;
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

#chapterNav li:hover {
  background-color: #3a4660;
  border-left-color: #00e08a;
}

#chapterNav li.active {
  background-color: #3a4660;
  border-left-color: #00e08a;
}

.chapter-progress {
  font-size: 0.8rem;
  color: #9aa0aa;
  margin-top: 5px;
}

/* Main quest panel */
#questList {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-content: flex-start;
}

.placeholder {
  width: 100%;
  text-align: center;
  color: #7a8090;
  font-size: 1.2rem;
  margin-top: 50px;
}

/* Quest cards — 2 column layout */
.quest-card {
  background-color: #252d3d;
  border-radius: 12px;
  padding: 15px;
  width: calc(50% - 10px);
  display: flex;
  align-items: center;
  gap: 15px;
  border: 2px solid #2e3a4e;
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
}

.quest-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.quest-card:focus {
  outline: 2px solid #00e08a;
  outline-offset: 2px;
}

/* Completed quests */
.quest-card.completed {
  border-color: #00c878;
  background-color: rgba(0, 200, 120, 0.08);
  box-shadow: 0 0 15px rgba(0, 224, 138, 0.15);
}

.quest-card.completed:hover {
  box-shadow: 0 5px 25px rgba(0, 224, 138, 0.25);
}

.quest-card.completed .quest-name {
  color: #00e08a;
}

.quest-card.completed .quest-status {
  color: #00e08a;
}

/* Completion indicator badge */
.quest-completion-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  background-color: #00c878;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1e2430;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0, 224, 138, 0.4);
  animation: completionPulse 2s ease-in-out infinite;
}

@keyframes completionPulse {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(0, 224, 138, 0.4);
  }
  50% {
    box-shadow: 0 2px 12px rgba(0, 224, 138, 0.6);
  }
}

/* Incomplete quests */
.quest-card.incomplete {
  border-color: #333a48;
  background-color: rgba(51, 58, 72, 0.3);
}

.quest-card.incomplete .quest-name {
  color: #9aa0aa;
}

.quest-card.incomplete .quest-status {
  color: #9aa0aa;
}

/* Quest icon */
.quest-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background-color: #2e3a4e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quest-icon img {
  max-width: 40px;
  max-height: 40px;
  image-rendering: pixelated;
}

.quest-icon .fallback-icon {
  font-size: 24px;
}

/* Quest info */
.quest-info {
  flex: 1;
  min-width: 0;
}

.quest-name {
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quest-reward {
  font-size: 0.85rem;
  color: #ffd700;
  margin-bottom: 5px;
}

.quest-status {
  font-size: 0.8rem;
  font-weight: 500;
}

/* Tooltip */
.quest-card[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #252d3d;
  color: #e0e0e0;
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: pre-wrap;
  max-width: 250px;
  z-index: 100;
  border: 1px solid #3a4660;
}

.hidden {
  display: none !important;
}

/* Quest description modal */
.quest-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.quest-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.quest-modal-content {
  position: relative;
  background: #252d3d;
  border: 2px solid #2e3a4e;
  border-radius: 12px;
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.quest-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #2e3a4e;
}

.quest-modal-header h3 {
  color: #00e08a;
  font-size: 1.25rem;
  margin: 0;
}

.quest-modal-close {
  background: transparent;
  border: none;
  color: #9aa0aa;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
}

.quest-modal-close:hover {
  color: #e0e0e0;
}

.quest-modal-body {
  padding: 20px;
  overflow-y: auto;
}

.quest-modal-desc-label {
  color: #9aa0aa;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.quest-modal-desc {
  color: #e0e0e0;
  font-size: 1rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Error message */
.error-message {
  background-color: rgba(255, 68, 68, 0.15);
  border: 1px solid #ff4444;
  color: #ff6666;
  padding: 15px 20px;
  border-radius: 8px;
  margin: 20px;
  text-align: center;
}

/* Share button */
.share-btn {
  background-color: #2e3a4e;
  color: #00e08a;
  border: 1px solid #00c878;
  border-radius: 8px;
  padding: 10px 22px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.share-btn:hover {
  background-color: rgba(0, 200, 120, 0.12);
}

.share-banner {
  margin-top: 14px;
  background-color: rgba(0, 200, 120, 0.08);
  border: 1px solid #00c878;
  border-radius: 8px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.share-banner span {
  color: #9aa0aa;
  font-size: 0.85rem;
}

.share-url {
  flex: 1;
  min-width: 200px;
  background-color: #1e2430;
  color: #e0e0e0;
  border: 1px solid #3a4660;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-family: monospace;
}

.share-copy-btn {
  background-color: #2e3a4e;
  color: #00e08a;
  border: 1px solid #3a4660;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.share-copy-btn:hover {
  background-color: #3a4660;
}

/* Shared (read-only) mode indicator */
.shared-mode-banner {
  background-color: rgba(0, 200, 120, 0.08);
  border: 1px solid #00c878;
  border-radius: 8px;
  padding: 10px 18px;
  margin-top: 12px;
  color: #9aa0aa;
  font-size: 0.9rem;
  text-align: center;
}

/* Responsive */
@media (max-width: 900px) {
  .container {
    flex-direction: column;
  }

  #chapterList {
    width: 100%;
    border-right: none;
    border-bottom: 2px solid #2e3a4e;
  }

  #chapterNav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  #chapterNav li {
    margin-bottom: 0;
  }

  .quest-card {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .file-inputs {
    flex-direction: column;
    gap: 15px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .progress-bar {
    width: 200px;
  }
}
