:root {
  --bg-dark: #0b0e14;
  --card-bg: rgba(22, 27, 38, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  --accent: #5865f2;
  --accent-glow: rgba(88, 101, 242, 0.35);
  --accent-hover: #4752c4;
  --text-main: #f3f4f6;
  --text-sub: #9ca3af;
  --text-dim: #6b7280;
  --success: #22c55e;
  --danger: #ef4444;
}

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

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(88, 101, 242, 0.12), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(35, 165, 90, 0.08), transparent 40%);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  padding: 40px 20px;
}

.app-shell {
  max-width: 1000px;
  margin: 0 auto;
}

.hero-section {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.app-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-subtitle {
  color: var(--text-sub);
  font-size: 14px;
  margin-bottom: 24px;
}

.search-bar {
  display: flex;
  gap: 12px;
}

.input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  padding-right: 48px;
}

.watch-input-wrapper {
  margin-bottom: 12px;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0 24px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px var(--accent-glow);
}

button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
  margin-top: 20px;
}

.modal-buttons button {
  flex: 1;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

.icon-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 8px;
  height: auto;
  border-radius: 8px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  transform: none;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.action-icon-btn {
  color: var(--accent);
}

.action-icon-btn:hover {
  background: var(--accent);
  color: #fff;
}

input[type="text"] {
  background: rgba(10, 13, 20, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 14px 18px;
  color: var(--text-main);
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
  height: 46px;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.collapsible-section {
  background: rgba(10, 13, 20, 0.4);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.collapsible-header {
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  outline: none;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.collapsible-header::-webkit-details-marker {
  display: none;
}

.collapsible-header::after {
  content: '›';
  font-size: 18px;
  transition: transform 0.2s ease;
  color: var(--text-sub);
}

details[open] .collapsible-header::after {
  transform: rotate(90deg);
}

.collapsible-content {
  padding: 12px 16px 16px 16px;
  border-top: 1px solid var(--card-border);
}

.styled-select {
  width: 100%;
  background: rgba(10, 13, 20, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  cursor: pointer;
}

.styled-select:focus {
  border-color: var(--accent);
}

.id-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 110px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.id-tag {
  background: rgba(88, 101, 242, 0.15);
  border: 1px solid rgba(88, 101, 242, 0.3);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-family: monospace;
  display: flex;
  align-items: center;
  gap: 6px;
}

.id-tag-remove {
  cursor: pointer;
  color: var(--text-sub);
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.id-tag-remove:hover {
  color: var(--danger);
}

.option-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  user-select: none;
}

.toggle-pill {
  width: 42px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}

.toggle-pill::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-sub);
  transition: all 0.2s ease;
}

.toggle-pill.active {
  background: var(--accent);
}

.toggle-pill.active::after {
  background: #fff;
  transform: translateX(18px);
}

.toggle-text {
  font-size: 13px;
  color: var(--text-sub);
  cursor: pointer;
}

.status-banner {
  font-size: 13px;
  font-weight: 500;
  margin-top: 14px;
  min-height: 20px;
}

.status-banner.error { color: var(--danger); }
.status-banner.success { color: var(--success); }

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

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 80px 20px;
  font-size: 15px;
}

.badge-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.badge-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.icon-holder {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: rgba(10, 13, 20, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.icon-holder img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.icon-holder img.scaled {
  transform: scale(1.4);
}

.badge-card.locked .icon-holder img {
  filter: grayscale(1);
  opacity: 0.4;
}

.lock-tag {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
}

.lock-tag svg {
  width: 12px;
  height: 12px;
  stroke: var(--text-sub);
}

.badge-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-label {
  font-size: 12px;
  color: var(--text-dim);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: #161b26;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  max-width: 460px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  color: var(--text-sub);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  height: auto;
  box-shadow: none;
}

.close-btn:hover {
  color: var(--text-main);
  background: transparent;
  transform: none;
}

.modal-header {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.modal-icon-holder {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(10, 13, 20, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-icon-holder img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
}

.modal-meta {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

.modal-body {
  color: var(--text-sub);
  font-size: 14px;
  line-height: 1.6;
}

.highlight-box {
  background: rgba(88, 101, 242, 0.1);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
  color: var(--text-main);
  font-size: 14px;
}

.progression-path {
  margin-top: 20px;
  border-top: 1px solid var(--card-border);
  padding-top: 16px;
}

.path-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 12px;
}

.path-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.step-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(10, 13, 20, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-icon img {
  width: 20px;
  height: 20px;
}

.step-info {
  flex: 1;
}

.step-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.step-desc {
  font-size: 12px;
  color: var(--text-dim);
}

@media (max-width: 520px) {
  .search-bar {
    flex-direction: column;
  }
}