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

body {
  background: #1a1a2e;
  color: #e0e0e0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", sans-serif;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

header {
  text-align: center;
  margin-bottom: 20px;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  color: #ffd54f;
  margin-bottom: 12px;
}

#countdown-bar {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  margin-bottom: 8px;
}

#countdown-bar.countdown {
  color: #ffd54f;
  background: #16213e;
}

#countdown-bar.expired {
  color: #ff8a65;
  background: #2a1a1e;
}

#status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 20px;
  background: #16213e;
  border-radius: 8px;
  font-size: 14px;
  color: #ccc;
  flex-wrap: wrap;
}

.btn-undo {
  background: transparent;
  border: 1px solid #ff8a65;
  color: #ff8a65;
  padding: 4px 14px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-undo:hover {
  background: #ff8a6522;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.filter-label {
  font-size: 12px;
  color: #888;
  margin-right: 4px;
  white-space: nowrap;
}

.filter-chip {
  background: #16213e;
  border: 1px solid #2a2a4a;
  color: #aaa;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: #ffd54f66;
  color: #e0e0e0;
}

.filter-chip.active {
  background: #ffd54f;
  border-color: #ffd54f;
  color: #1a1a2e;
  font-weight: 600;
}

.filter-search {
  margin-left: auto;
}

.filter-search input {
  background: #16213e;
  border: 1px solid #2a2a4a;
  border-radius: 20px;
  padding: 6px 16px;
  color: #e0e0e0;
  font-size: 13px;
  width: 200px;
  outline: none;
  transition: border-color 0.2s;
}

.filter-search input:focus {
  border-color: #ffd54f;
}

.filter-search input::placeholder {
  color: #666;
}

.filter-info {
  text-align: center;
  font-size: 13px;
  color: #888;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.card {
  background: #16213e;
  border-radius: 8px;
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.3s;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.card-highlight {
  box-shadow: 0 0 0 2px #ffd54f, 0 0 16px rgba(255,213,79,0.3);
  transform: translateY(-2px);
}

.card-highlight:hover {
  opacity: 0.85;
}

.card-rarity {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.card-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.card-profession {
  font-size: 12px;
  color: #888;
}

.card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ff8a65;
  color: #1a1a2e;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

#results-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid #2a2a4a;
}

#results-section h2 {
  text-align: center;
  color: #ffd54f;
  margin-bottom: 20px;
  font-size: 22px;
}

.result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #16213e;
  border-radius: 6px;
  margin-bottom: 6px;
  transition: background 0.2s;
}

.result-highlight {
  background: #1e2a4a;
  box-shadow: inset 0 0 0 1px #ffd54f44;
}

.result-rank {
  width: 30px;
  font-size: 14px;
  text-align: center;
  flex-shrink: 0;
}

.result-name {
  width: 80px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.result-prof {
  width: 40px;
  font-size: 11px;
  color: #888;
  flex-shrink: 0;
}

.result-rarity {
  width: 30px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.result-bar-wrap {
  flex: 1;
  height: 20px;
  background: #0f0f1f;
  border-radius: 10px;
  overflow: hidden;
}

.result-bar {
  height: 100%;
  background: linear-gradient(90deg, #ffd54f, #ff8a65);
  border-radius: 10px;
  transition: width 0.5s ease;
  min-width: 4px;
}

.result-count {
  width: 50px;
  text-align: right;
  font-size: 13px;
  color: #aaa;
  flex-shrink: 0;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  background: #16213e;
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 420px;
  width: 90%;
  text-align: center;
}

.modal-content h3 {
  color: #ffd54f;
  font-size: 20px;
  margin-bottom: 16px;
}

.modal-content p {
  color: #ccc;
  font-size: 15px;
  margin-bottom: 10px;
  line-height: 1.6;
}

.modal-hint {
  font-size: 12px !important;
  color: #888 !important;
}

.modal-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-cancel {
  background: #333;
  color: #ccc;
}

.btn-cancel:hover {
  background: #444;
}

.btn-confirm {
  background: #ff8a65;
  color: #1a1a2e;
}

.btn-confirm:hover:not(:disabled) {
  opacity: 0.9;
}

@media (max-width: 600px) {
  h1 { font-size: 22px; }

  .filters {
    gap: 8px;
  }

  .filter-chip {
    font-size: 11px;
    padding: 3px 8px;
  }

  .filter-search {
    margin-left: 0;
    width: 100%;
  }

  .filter-search input {
    width: 100%;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }

  .card {
    padding: 12px 4px;
  }

  .card-name {
    font-size: 14px;
  }

  .result-name {
    width: 60px;
  }

  .result-prof, .result-rarity {
    display: none;
  }
}
