/* ── missions.css ── */

.missions-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px;
  min-height: calc(100vh - 72px);
}

/* ── Header ── */
.missions-header {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
}

.missions-hero-img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
}

.missions-intro {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.missions-intro .search-field {
  max-width: 460px;
  margin-top: 4px;
}

@media (max-width: 720px) {
  .missions-header {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 14px;
  }
  .missions-header .missions-stats {
    grid-column: 1 / -1;
  }
}

.missions-header h1 {
  font-family: "Rajdhani", "Noto Sans KR", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
  color: var(--amber);
}

#missions-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.missions-stats {
  display: flex;
  gap: 16px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.missions-stats strong {
  color: var(--text);
  font-size: 1rem;
}

/* ── Toolbar ── */
.missions-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-field span {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
}

#search-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

#search-input:focus {
  border-color: var(--amber);
}

/* ── Type chips ── */
.type-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.type-chip {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.type-chip:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.type-chip.active {
  background: var(--amber);
  border-color: var(--amber);
  color: #071017;
  font-weight: 600;
}

.type-chip .chip-count {
  font-size: 0.6875rem;
  opacity: 0.75;
  margin-left: 2px;
}

/* ── Filter row ── */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-select,
.sort-select {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-select span,
.sort-select span {
  font-size: 0.75rem;
  color: var(--muted);
}

.filter-select select,
.sort-select select {
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 0.8125rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238fa9b3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
}

/* ── Check filters ── */
.check-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.check-label input[type="checkbox"] {
  accent-color: var(--amber);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ── Result info ── */
.result-info {
  margin-bottom: 12px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.result-info strong {
  color: var(--text);
}

/* ── Grid ── */
.missions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

/* ── Card ── */
.mission-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mission-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 1px var(--line-strong);
}

.card-type {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(97, 210, 242, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
  align-self: flex-start;
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
  line-height: 1.4;
}

.card-title .token-chip {
  display: inline-block;
  background: var(--amber);
  color: #071017;
  font-size: 0.6875rem;
  padding: 0 5px;
  border-radius: 4px;
  font-weight: 700;
  vertical-align: middle;
  margin: 0 1px;
}

.card-title-en {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.reward-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--amber-bright);
}

.reward-badge.varies {
  color: var(--muted);
  font-weight: 400;
}

.rep-badge {
  font-size: 0.6875rem;
  color: var(--green);
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.badge {
  font-size: 0.625rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-danger {
  background: rgba(239, 107, 100, 0.15);
  color: var(--danger);
}

.badge-green {
  background: rgba(115, 213, 162, 0.12);
  color: var(--green);
}

.badge-muted {
  background: rgba(143, 169, 179, 0.12);
  color: var(--muted);
}

.badge-amber {
  background: rgba(240, 163, 26, 0.12);
  color: var(--amber);
}

.difficulty-stars {
  font-size: 0.6875rem;
  color: var(--amber);
  letter-spacing: 1px;
}

/* ── More button ── */
.more-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.more-button {
  padding: 10px 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.more-button:hover {
  background: var(--panel-light);
  border-color: var(--amber);
}

/* ── Empty / Error ── */
.empty-state,
.error-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
}

.empty-state strong,
.error-state strong {
  display: block;
  color: var(--text);
  margin-bottom: 8px;
}

/* ── Dialog ── */
.detail-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  max-width: 560px;
  width: calc(100vw - 32px);
  max-height: 85vh;
  overflow-y: auto;
  padding: 0;
  box-shadow: var(--shadow);
}

.detail-dialog::backdrop {
  background: rgba(5, 11, 16, 0.7);
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}

.detail-head h2 {
  font-family: "Rajdhani", "Noto Sans KR", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: var(--amber);
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}

.detail-title-en {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
  font-weight: 400;
  line-height: 1.3;
  flex: none;
}

.detail-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.125rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.detail-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.detail-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 0.875rem;
  line-height: 1.6;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-section-title {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--cyan);
  margin-bottom: 2px;
}

.detail-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.detail-list li {
  background: var(--panel-light);
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 0.8125rem;
}

.detail-desc {
  white-space: pre-line;
  margin: 0;
  color: var(--text);
}

.detail-origin {
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
}

.detail-rank {
  font-size: 0.8125rem;
}

.detail-rep-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.detail-rep-table th,
.detail-rep-table td {
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
}

.detail-rep-table th {
  color: var(--muted);
  font-weight: 500;
}

.token-chip {
  display: inline-block;
  background: var(--amber);
  color: #071017;
  font-size: 0.6875rem;
  padding: 0 5px;
  border-radius: 4px;
  font-weight: 700;
  vertical-align: middle;
  margin: 0 1px;
}

/* ── Footer ── */
.missions-footer {
  margin-top: 40px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.8;
}

.missions-footer a {
  color: var(--cyan);
}

/* ── Responsive 390px ── */
@media (max-width: 390px) {
  .missions-main {
    padding: 16px 12px;
  }

  .missions-header h1 {
    font-size: 1.5rem;
  }

  .missions-stats {
    gap: 10px;
    font-size: 0.75rem;
  }

  .missions-stats strong {
    font-size: 0.9rem;
  }

  .filter-row {
    flex-direction: column;
  }

  .detail-dialog {
    width: calc(100vw - 16px);
    max-height: 90vh;
  }
}
