* {
  box-sizing: border-box;
  outline: none;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s var(--ease-out), color 0.3s var(--ease-out);
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  backdrop-filter: blur(28px) saturate(1.8);
  -webkit-backdrop-filter: blur(28px) saturate(1.8);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  transition: transform 0.35s var(--ease-out);
  z-index: 50;
  gap: 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding: 4px 12px;
}

.logo-box {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  background-size: 200% 200%;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-text);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  transition: transform 0.4s var(--ease-spring), box-shadow 0.3s;
}

.logo-box:hover {
  transform: rotate(8deg) scale(1.08);
  box-shadow: var(--shadow-md);
}

.brand-name {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.brand-desc {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-top: 2px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  margin-top: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s var(--ease-spring);
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 60%;
  border-radius: 0 3px 3px 0;
  background: var(--gradient-accent);
  transition: transform 0.3s var(--ease-spring);
}

.nav-item .icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--primary-light);
  color: var(--text-main);
  transform: translateX(4px);
}

.nav-item:hover .icon {
  animation: iconBounce 0.4s var(--ease-spring);
}

.nav-item:hover>.icon {
  opacity: 1;
}

.nav-item.active {
  background: var(--bg-surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transform: translateX(4px);
}

.nav-item.active::before {
  transform: translateY(-50%) scaleY(1);
}

.nav-item.active .icon {
  opacity: 1;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.2s var(--ease-spring);
}

.theme-toggle:hover {
  color: var(--text-main);
  background: var(--primary-light);
  transform: scale(0.98);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--bg-body);
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 6px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  box-shadow: var(--shadow-xs);
  font-weight: 500;
}

.status-dot-pulse {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
}

.status-running .status-dot-pulse {
  background: var(--success);
  animation: pulse-green 2s infinite;
}

.status-error .status-dot-pulse {
  background: var(--danger);
}

.separator {
  color: var(--text-muted);
  opacity: 0.5;
  margin: 0 4px;
}

.status-time {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

@keyframes pulse-green {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 0 36px 36px;
  animation: panelSlideIn 0.5s var(--ease-spring);
}

.panel.active {
  display: block;
  animation: panelSlideIn 0.45s var(--ease-spring);
}

@keyframes panelFadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  transition: transform 0.35s var(--ease-spring), box-shadow 0.35s var(--ease-out), border-color 0.35s;
  position: relative;
  overflow: hidden;
  opacity: 0;
  animation: slideUp 0.5s var(--ease-spring) both;
}

.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.4s;
  background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.03) 50%, transparent 60%);
  background-size: 200% 200%;
  pointer-events: none;
}

.stat-card:hover::after {
  opacity: 1;
  animation: shimmer 2s linear infinite;
}

.stat-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-md);
  border-color: var(--border-focus);
}

.stat-card:nth-child(1) {
  animation-delay: 0s;
}

.stat-card:nth-child(2) {
  animation-delay: 0.08s;
}

.stat-card:nth-child(3) {
  animation-delay: 0.16s;
}

.stat-card:nth-child(4) {
  animation-delay: 0.24s;
}

.stat-card.primary {
  background: var(--primary);
  background-image: var(--gradient-primary);
  background-size: 200% 200%;
  animation: slideUp 0.5s var(--ease-spring) both, gradientShift 8s ease-in-out infinite;
  color: var(--primary-text);
  border-color: transparent;
  box-shadow: var(--primary-shadow);
}

.stat-card.primary .stat-label {
  color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .stat-card.primary .stat-label {
  color: rgba(0, 0, 0, 0.6);
}

.stat-card.primary .stat-value {
  color: var(--primary-text);
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -1px;
  transition: color 0.2s;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-top: 12px;
  background: var(--bg-body);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-trend.positive {
  color: var(--success);
}

.stat-card.primary .stat-trend {
  background: rgba(255, 255, 255, 0.15);
  color: var(--primary-text);
}

[data-theme="dark"] .stat-card.primary .stat-trend {
  background: rgba(0, 0, 0, 0.1);
  color: var(--primary-text);
}

.stat-trend svg {
  width: 14px;
  height: 14px;
}

.control-bar {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  transition: border-color 0.5s, box-shadow 0.5s;
}

.status-running~.main-content .control-bar,
.control-bar.running {
  animation: breathePulse 3s ease-in-out infinite;
  border-color: var(--success);
}

.control-info {
  flex: 1;
  min-width: 0;
}

.info-item {
  display: flex;
  flex-direction: column;
}

.info-item .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 4px;
}

.info-item .value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.lyric-scroll-viewport {
  position: relative;
  width: 100%;
  height: 24px;
  overflow: hidden;
  transition: height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 40%, black 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 40%, black 100%);
}

.lyric-scroll-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.lyric-line {
  height: 24px;
  line-height: 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.lyric-sub {
  opacity: 0.3;
  transition: opacity 0.5s ease;
}

.control-actions {
  display: flex;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s var(--ease-spring);
  border: 1px solid transparent;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255, 255, 255, 0.2), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.btn:hover::after {
  opacity: 1;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 16px var(--glow-primary), var(--primary-shadow);
  transform: translateY(-2px);
}

.btn-primary svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s var(--ease-spring);
}

.btn-primary:hover svg {
  transform: scale(1.1);
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--bg-input);
  border-color: var(--text-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--primary-light);
  color: var(--text-main);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-input);
  border-color: var(--border-focus);
}

.btn-edit {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-edit:hover {
  background: var(--primary-light);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: 1px solid var(--danger);
  box-shadow: var(--shadow-xs);
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  box-shadow: var(--shadow-xs);
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.1);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.25s var(--ease-spring);
  box-shadow: var(--shadow-xs);
}

.icon-btn:hover {
  border-color: var(--border-focus);
  color: var(--text-main);
  background: var(--bg-body);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px) scale(1.05);
}

.icon-btn:active {
  transform: translateY(0) scale(0.95);
}

.payment-alert {
  background: var(--bg-surface);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  box-shadow: var(--shadow-glow);
}

.payment-content {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.payment-icon {
  color: var(--warning);
  margin-top: 2px;
}

.payment-text h3 {
  margin: 0 0 6px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.payment-text p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.payment-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.link-btn {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.link-btn:hover {
  opacity: 0.7;
}

.divider-v {
  width: 1px;
  height: 16px;
  background: var(--border-color);
}

.hidden {
  display: none !important;
}

.settings-layout {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-group {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.35s, transform 0.35s var(--ease-spring), border-color 0.35s;
  position: relative;
}

.settings-group::before {
  content: '';
  position: absolute;
  left: 0;
  top: 24px;
  bottom: 24px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gradient-accent);
  opacity: 0;
  transform: scaleY(0);
  transition: opacity 0.3s, transform 0.3s var(--ease-spring);
}

.settings-group:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.settings-group:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

.settings-group h2 {
  margin: 0 0 20px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.form-grid {
  display: grid;
  gap: 16px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-row--3 {
  grid-template-columns: repeat(3, 1fr);
}

.field-row--4 {
  grid-template-columns: repeat(4, 1fr);
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.field--switch {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.field--switch label.checkbox-wrapper {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-main);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.field--switch .field-hint {
  width: 100%;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.settings-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--border-focus);
  cursor: pointer;
}

.settings-group .field:has(> label.checkbox-wrapper) {
  margin-bottom: 0;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.25s var(--ease-out);
}

input:focus,
select:focus,
textarea:focus {
  background: var(--bg-surface);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--primary-light);
  transform: scale(1.01);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

.settings-group textarea {
  min-height: 80px;
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.table-container {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 14px 18px;
  background: var(--bg-body);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 2;
}

#panel-steam-deals th {
  position: static;
  z-index: auto;
}

td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  transition: background 0.2s, padding-left 0.25s var(--ease-spring);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: transform 0.2s var(--ease-out);
}

tr:hover td {
  background: var(--bg-input);
}

tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--border-focus);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.holding-select-cell {
  width: 48px;
  min-width: 48px;
  padding: 10px 14px;
  vertical-align: middle;
}

.holding-select-cell .holding-checkbox,
.holding-select-cell .history-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--border-focus);
}

.tx-actions {
  white-space: nowrap;
}

.text-ok {
  color: var(--success) !important;
}

.text-bad {
  color: var(--danger) !important;
}

.status-cell.status-holding {
  color: #3B82F6;
  font-weight: 500;
}

.status-cell.status-listing {
  color: #8B5CF6;
  font-weight: 500;
}

.status-cell.status-pending {
  color: var(--warning);
  font-weight: 500;
}

.status-cell.status-sold {
  color: var(--success);
  font-weight: 500;
}

.status-cell.status-error {
  color: var(--danger);
  font-weight: 500;
}

.inv-links {
  white-space: nowrap;
}

.inv-links a {
  font-size: 12px;
  margin-right: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.inv-links a:hover {
  color: var(--primary);
}

.inv-links .link-buff {
  color: var(--success);
}

.tx-type {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.tx-type.purchase {
  background: var(--bg-input);
  color: var(--text-main);
}

.tx-type.sale {
  background: var(--primary-light);
  color: var(--primary);
}

.purchases-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 13px;
  box-shadow: var(--shadow-xs);
}

.purchases-summary .summary-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.purchases-summary .summary-label {
  color: var(--text-secondary);
  font-size: 12px;
}

.purchases-summary .summary-value {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-main);
}

.purchases-summary .summary-value.mono {
  font-family: var(--font-mono);
}

.add-purchase-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  background: var(--bg-surface);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.add-purchase-bar .label {
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  margin-right: 8px;
}

.add-purchase-bar input[type="text"] {
  width: 180px;
}

.add-purchase-bar input[type="number"] {
  width: 120px;
}

.add-purchase-bar #add-purchase-steam-link {
  min-width: 300px;
  flex: 1;
}

.add-purchase-bar #add-purchase-quantity {
  width: 80px;
}

.console-wrapper {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.console-toolbar {
  background: var(--bg-body);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.console-filters {
  display: flex;
  gap: 12px;
  align-items: center;
}

.console-filters input,
.console-filters select {
  width: 160px;
}

.console-body {
  flex: 1;
  padding: 20px 24px;
  margin: 0;
  overflow-y: auto;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
}

#toast-host {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  z-index: 999;
  pointer-events: none;
  max-width: min(400px, calc(100vw - 48px));
}

#toast-host .toast {
  pointer-events: auto;
}

.toast {
  background: var(--bg-surface);
  color: var(--text-main);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  min-width: 280px;
  max-width: 100%;
  animation: toastEnter 0.45s var(--ease-spring);
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.toast.toast-exit {
  animation: toastExit 0.35s var(--ease-out) forwards;
}

.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-accent);
  transform-origin: left;
  animation: progressShrink 3.5s linear forwards;
}

.toast .t {
  font-weight: 600;
  font-size: 14px;
}

.toast .d {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.relogin-overlay,
.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px) saturate(1.5);
  -webkit-backdrop-filter: blur(12px) saturate(1.5);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayFadeIn 0.3s var(--ease-out);
}

.relogin-overlay.hidden,
.overlay.hidden {
  display: none;
}

.relogin-modal,
.overlay-content {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 460px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  animation: modalBounceIn 0.5s var(--ease-spring);
}

@keyframes modalPop {
  from {
    transform: scale(0.95) translateY(10px);
    opacity: 0;
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.relogin-modal h3,
.account-form-card h3 {
  margin: 0 0 12px 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

.relogin-modal p,
.account-form-card .form-hint {
  margin: 0 0 24px 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.relogin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.account-form-card .form-grid {
  margin-top: 20px;
}

.account-form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.panel-toolbar--accounts {
  gap: 16px;
  margin-bottom: 24px;
}

.toolbar-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.toolbar-title .hint {
  color: var(--text-muted);
  font-size: 13px;
}

.toolbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.input-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-input);
  min-width: 260px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.input-pill:focus-within {
  border-color: var(--border-focus);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.input-pill .icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.input-pill input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-main);
  width: 100%;
  font-size: 14px;
  padding: 0;
}

.accounts-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}

.accounts-left,
.accounts-right {
  min-width: 0;
}

.accounts-list {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.accounts-list-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-body);
}

.accounts-list-header .title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.accounts-list-header .count {
  font-size: 13px;
  color: var(--text-muted);
}

.account-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.account-item:hover {
  background: var(--bg-input);
}

.account-item.active {
  background: var(--bg-body);
  border-left: 3px solid var(--border-focus);
  padding-left: 17px;
}

.account-item+.account-item {
  border-top: 1px solid var(--border-color);
}

.account-avatar-wrap {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  position: relative;
}

.account-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
}

.account-avatar.placeholder {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  font-weight: 600;
  font-size: 16px;
  border: 1px solid var(--border-color);
}

.account-item-body {
  flex: 1;
  min-width: 0;
}

.account-item-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-main);
}

.account-item-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge.badge-current {
  background: var(--text-main);
  color: var(--text-inverse);
}

.account-detail {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.account-detail-header {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
}

.account-detail-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.account-detail-title {
  font-weight: 700;
  font-size: 20px;
  color: var(--text-main);
}

.account-detail-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.account-detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.account-detail-body {
  padding: 24px;
}

.kv-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px 16px;
}

.kv {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-body);
}

.kv .k {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.kv .v {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  overflow-wrap: anywhere;
}

.callout {
  margin-top: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.callout .callout-icon {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.callout .callout-text {
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.6;
}

.account-detail-empty {
  padding: 64px 24px;
  text-align: center;
}

.account-detail-empty .empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--bg-input);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.account-detail-empty h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
}

.account-detail-empty p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.steam-token-page {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.steam-token-glow {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 999px;
  background: radial-gradient(circle at center, rgba(37, 99, 235, 0.15), transparent 60%);
  filter: blur(60px);
  opacity: 0.6;
  pointer-events: none;
  animation: glowPulse 5s ease-in-out infinite;
}

[data-theme="dark"] .steam-token-glow {
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.05), transparent 60%);
}

@keyframes glowPulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.6;
  }

  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

.steam-token-card {
  position: relative;
  z-index: 1;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 440px;
  width: 100%;
}

.steam-token-title {
  margin: 0 0 32px 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-main);
}

.steam-token-circle {
  position: relative;
  width: 280px;
  height: 280px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.steam-token-ring {
  width: 280px;
  height: 280px;
  transform: rotate(-90deg);
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.06));
}

.steam-ring-bg {
  fill: none;
  stroke: var(--bg-input);
  stroke-width: 8;
}

.steam-ring-fg {
  fill: none;
  stroke: url(#steam-ring-gradient);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 691 691;
  stroke-dashoffset: 691;
  opacity: 0;
  transition: stroke-dashoffset 50ms linear, opacity 0.3s;
}

.steam-token-inner {
  position: absolute;
  inset: 24px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.steam-token-circle:hover .steam-token-inner {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.steam-code-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.steam-code-text {
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 0.25em;
  margin-left: 0.25em;
  color: var(--text-main);
  transition: color 0.3s;
}

.steam-code-subtitle {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.scroll-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.4s var(--ease-spring);
  z-index: 100;
}

.scroll-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background: var(--bg-input);
  transform: translateY(-3px);
}

.kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-secondary);
  margin-left: 8px;
  font-weight: 600;
}

@media (max-width: 768px) {
  .accounts-layout {
    grid-template-columns: 1fr;
  }

  .input-pill {
    min-width: 200px;
  }

  .kv-grid {
    grid-template-columns: 1fr;
  }

  .nav-menu {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
    margin: 0;
  }

  .nav-item {
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    font-size: 10px;
  }

  .nav-item span {
    display: block;
  }

  .nav-item.active {
    border: none;
    box-shadow: none;
    background: transparent;
    transform: scale(1.05);
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .control-bar {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }

  .control-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .field-row,
  .field-row--3,
  .field-row--4 {
    grid-template-columns: 1fr;
  }

  .payment-content {
    flex-direction: column;
  }

  .scroll-to-top {
    bottom: 90px;
  }
}

.gift-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--gradient-accent);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px var(--glow-accent);
}

.gift-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 50%, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

.gift-hero-icon {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}

.gift-hero-text h2 {
  margin: 0 0 6px 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.gift-hero-text p {
  margin: 0;
  font-size: 14px;
  opacity: 0.8;
}

.gift-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.3s, border-color 0.3s;
}

.gift-section:hover {
  box-shadow: var(--shadow-sm);
}

.gift-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.gift-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  background: var(--gradient-accent);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.gift-search-input {
  padding: 7px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 13px;
  width: 220px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gift-search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.gift-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.gift-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.gift-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.gift-friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.gift-friend-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
  background: var(--bg-body);
  position: relative;
  overflow: hidden;
}

.gift-friend-card:hover {
  border-color: var(--border-focus);
  background: var(--bg-input);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.gift-friend-card.selected {
  border-color: #6366F1;
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.gift-friend-card .gift-friend-check {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #6366F1;
  opacity: 0;
  transition: opacity 0.2s;
}

.gift-friend-card.selected .gift-friend-check {
  opacity: 1;
}

.gift-friend-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gift-friend-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gift-friend-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--text-muted);
}

.gift-friend-info {
  min-width: 0;
  flex: 1;
}

.gift-friend-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.gift-friend-id {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.gift-selected-friend {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 16px;
  animation: slideUp 0.3s var(--ease-spring) both;
}

.gift-selected-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(99, 102, 241, 0.4);
}

.gift-selected-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.gift-selected-info {
  flex: 1;
}

.gift-sel-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.gift-sel-id {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.gift-url-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.gift-url-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: var(--font-mono);
}

.gift-url-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.gift-game-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  animation: slideUp 0.3s var(--ease-spring) both;
}

.gift-game-img {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg-input);
  flex-shrink: 0;
}

.gift-game-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.gift-game-appid {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.gift-editions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gift-editions-empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: 12px 0;
  text-align: center;
}

.gift-edition-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
  background: var(--bg-body);
}

.gift-edition-item:hover {
  border-color: var(--border-focus);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.gift-edition-item.selected {
  border-color: #6366F1;
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.gift-edition-radio {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.gift-edition-item.selected .gift-edition-radio {
  border-color: #6366F1;
}

.gift-edition-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.2s;
}

.gift-edition-item.selected .gift-edition-dot {
  background: #6366F1;
}

.gift-edition-details {
  flex: 1;
}

.gift-edition-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.gift-edition-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  font-family: var(--font-mono);
}

.gift-edition-check {
  color: #6366F1;
  opacity: 0;
  transition: opacity 0.2s;
}

.gift-edition-item.selected .gift-edition-check {
  opacity: 1;
}

.gift-send-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.gift-send-info {
  font-size: 14px;
  color: var(--text-secondary);
  flex: 1;
}

.gift-send-info--ready {
  color: var(--text-main);
  font-weight: 500;
}

.gift-send-btn {
  padding: 12px 28px;
  font-size: 15px;
  border-radius: var(--radius-md);
  background: var(--gradient-accent);
  border: none;
  color: #fff;
  box-shadow: 0 4px 16px var(--glow-accent);
  gap: 10px;
}

.gift-send-btn:not(:disabled):hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--glow-accent);
}

.gift-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.gift-progress-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.4s var(--ease-spring) both;
  margin-bottom: 20px;
}

.gift-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.gift-progress-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.gift-progress-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.gift-progress-steps::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 20px;
  bottom: 20px;
  width: 2px;
  background: var(--border-color);
  z-index: 0;
}

.gift-progress-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  position: relative;
  z-index: 1;
}

.gift-step-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s var(--ease-spring);
}

.gift-step-icon--wait {
  background: var(--bg-body);
  border: 2px solid var(--border-color);
  color: var(--text-muted);
}

.gift-step-icon--running {
  background: rgba(99, 102, 241, 0.1);
  border: 2px solid #6366F1;
  color: #6366F1;
}

.gift-step-icon--ok {
  background: rgba(16, 185, 129, 0.12);
  border: 2px solid var(--success);
  color: var(--success);
}

.gift-step-icon--error {
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid var(--danger);
  color: var(--danger);
}

.gift-step-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid transparent;
  border-top-color: #6366F1;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.gift-step-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  min-width: 140px;
}

.gift-step-msg {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
}

.gift-progress-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 0 8px;
  animation: slideUp 0.4s var(--ease-spring) both;
}

.gift-result-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.gift-result-msg {
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  max-width: 540px;
}

.gift-result-msg--ok {
  color: var(--success);
}

.gift-result-msg--error {
  color: var(--danger);
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  animation: slideUp 0.3s var(--ease-spring) both;
  box-shadow: var(--shadow-md);
}

.toast-success {
  background: var(--success);
  color: #fff;
}

.toast-error {
  background: var(--danger);
  color: #fff;
}

.toast-warn {
  background: var(--warning);
  color: #fff;
}

.toast-info {
  background: var(--primary);
  color: var(--primary-text);
}

.gift-edition-price {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
  padding-right: 10px;
}

.gift-price-final {
  font-size: 15px;
  font-weight: 700;
  color: #6366F1;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.gift-price-original {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: line-through;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.gift-price-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  background: linear-gradient(135deg, #059669, #10B981);
  color: #fff;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}

.gift-wallet-area {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  backdrop-filter: blur(10px);
}

.gift-wallet-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
  white-space: nowrap;
}

.gift-wallet-wrap {
  display: flex;
  align-items: center;
}

.gift-wallet-balance {
  font-size: 18px;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  color: #fff;
  white-space: nowrap;
  transition: color 0.3s;
}

.gift-wallet-loading .gift-wallet-balance {
  opacity: 0.55;
  animation: pulse-text 1s ease-in-out infinite alternate;
}

.gift-wallet-ok .gift-wallet-balance {
  color: #fff;
}

.gift-wallet-error .gift-wallet-balance {
  color: rgba(255, 100, 100, 0.9);
}

@keyframes pulse-text {
  from {
    opacity: 0.4;
  }

  to {
    opacity: 0.8;
  }
}

.gift-wallet-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
  flex-shrink: 0;
}

.gift-wallet-refresh:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  transform: rotate(30deg) scale(1.1);
}

.gift-wallet-refresh:active {
  transform: rotate(180deg) scale(0.95);
}

.proxy-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.proxy-hero-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--gradient-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 8px 24px var(--glow-accent);
}

.proxy-hero-text h2 {
  margin: 0 0 6px 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.proxy-hero-text p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.proxy-master-toggle {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.proxy-master-toggle span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.proxy-switch {
  position: relative;
  width: 50px;
  height: 26px;
}

.proxy-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.proxy-switch-track {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-input);
  transition: .3s;
  border-radius: 34px;
  border: 1px solid var(--border-color);
}

.proxy-switch-track:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s var(--ease-spring);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.proxy-switch input:checked+.proxy-switch-track {
  background-color: var(--primary);
  border-color: var(--primary);
}

.proxy-switch input:checked+.proxy-switch-track:before {
  transform: translateX(24px);
}

.proxy-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.proxy-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.proxy-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 20px;
}

.proxy-section-header .proxy-section-title {
  margin-bottom: 0;
}

.proxy-strategy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.proxy-strategy-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s var(--ease-spring);
  background: var(--bg-body);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.proxy-strategy-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-focus);
}

.proxy-strategy-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.proxy-strategy-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.proxy-strategy-card.active .proxy-strategy-icon {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.proxy-strategy-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.proxy-strategy-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  flex: 1;
}

.proxy-strategy-desc small {
  font-size: 12px;
  opacity: 0.8;
}

.proxy-strategy-check {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.2s;
}

.proxy-strategy-card.active .proxy-strategy-check {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.proxy-test-params {
  display: flex;
  gap: 24px;
  align-items: flex-end;
}

.proxy-test-params .field {
  flex: 1;
  max-width: 400px;
  margin: 0;
}

#proxy-list-table {
  width: 100%;
}

.proxy-index {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.proxy-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.proxy-badge--idle {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.proxy-badge--ok {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.proxy-badge--fail {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  cursor: help;
}

.proxy-latency {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
}

.proxy-detected-ip {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.proxy-add-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.proxy-add-row input {
  margin: 0;
}

.proxy-add-row .btn {
  padding: 0 24px;
  white-space: nowrap;
}

.proxy-bulk-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 10px 0;
}

.proxy-bulk-hint code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.proxy-bulk-textarea {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  padding: 12px;
  border-radius: 8px;
}

.proxy-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

.sd-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.sd-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sd-update-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  box-shadow: var(--shadow-xs);
}

.sd-update-badge svg {
  opacity: 0.6;
  flex-shrink: 0;
}

.sd-count-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: 999px;
}

.sd-count-badge:empty {
  display: none;
}

.sd-progress-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--success);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 4px 12px;
  border-radius: 999px;
  animation: breathePulse 2s ease-in-out infinite;
}

.sd-fetch-btn {
  gap: 6px;
  padding: 8px 18px;
  font-size: 13px;
  border-radius: 999px;
  white-space: nowrap;
}

.sd-fetch-btn svg {
  transition: transform 0.3s var(--ease-spring);
}

.sd-fetch-btn:hover svg {
  transform: rotate(-45deg);
}

.sd-filters-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sd-search-row {
  width: 100%;
}

.sd-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.sd-search-box:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--glow-primary);
}

.sd-search-box .icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sd-search-box input {
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  padding: 0;
  line-height: 1.5;
}

.sd-search-box input::placeholder {
  color: var(--text-muted);
}

.sd-filter-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.sd-filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 160px;
}

.sd-filter-group label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sd-filter-group label svg {
  opacity: 0.5;
}

.sd-filter-group select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.sd-filter-group select:hover {
  border-color: var(--border-focus);
}

.sd-filter-group select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--glow-primary);
  outline: none;
}

.steam-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  padding-bottom: 24px;
}

.sg-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: transform 0.35s var(--ease-spring), box-shadow 0.35s var(--ease-out), border-color 0.3s;
  animation: slideUp 0.45s var(--ease-spring) both;
}

.sg-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-focus);
}

.sg-card-banner {
  position: relative;
  height: 150px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-input), var(--bg-body));
}

.sg-card-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease-out), filter 0.3s;
}

.sg-card:hover .sg-card-banner img {
  transform: scale(1.06);
}

.sg-badge-discount {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-mono);
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.45);
  letter-spacing: -0.5px;
}

.sg-card-content {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sg-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s;
}

.sg-card-title:hover {
  color: var(--primary);
}

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

.sg-review-track {
  width: 50px;
  height: 5px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.sg-review-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s var(--ease-out);
}

.sg-review-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.sg-review-cnt {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
}

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

.sg-pill {
  display: inline-flex;
  flex-direction: column;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-body);
  min-width: 70px;
  transition: border-color 0.2s;
}

.sg-pill-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.2;
  white-space: nowrap;
}

.sg-pill-price {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.sg-pill-saving {
  font-size: 10px;
  font-weight: 600;
  color: #10b981;
  margin-top: 1px;
}

.sg-pill-cn {
  border-color: rgba(59, 130, 246, 0.25);
  background: rgba(59, 130, 246, 0.06);
}

.sg-pill-cn .sg-pill-label {
  color: #3b82f6;
}

.sg-pill-compare {
  border-color: rgba(168, 85, 247, 0.25);
  background: rgba(168, 85, 247, 0.06);
}

.sg-pill-compare .sg-pill-label {
  color: #a855f7;
}

.sg-pill-cheap {
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.06);
}

.sg-pill-cheap .sg-pill-label {
  color: #10b981;
}

.sg-diff-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #fff;
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  letter-spacing: -0.3px;
}

.sg-expand-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  text-align: left;
  font-family: inherit;
  transition: color 0.2s;
}

.sg-expand-toggle:hover {
  color: var(--primary);
}

.sg-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sg-steam-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, #1b2838, #2a475e);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s var(--ease-spring), box-shadow 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.sg-steam-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.sg-steam-btn svg {
  flex-shrink: 0;
  opacity: 0.9;
}

.sg-expand-panel {
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
  margin-top: 2px;
  animation: panelFadeIn 0.25s ease;
}

.sg-expand-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.sg-expand-table tr:hover {
  background: var(--primary-light);
}

.sg-exp-name {
  color: var(--text-muted);
  font-weight: 500;
  padding: 3px 4px;
  white-space: nowrap;
  width: 62px;
}

.sg-exp-price {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-main);
  padding: 3px 4px;
  font-size: 11px;
}

.sg-exp-orig {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.6;
  padding: 3px 4px;
}

.steam-deals-sentinel {
  display: flex;
  justify-content: center;
  padding: 24px 0 48px;
}

.steam-deals-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.spinner-ring {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.steam-deals-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 48px 0;
}

.steam-deals-empty svg {
  opacity: 0.3;
}

.steam-deals-empty p {
  font-size: 14px;
  margin: 0;
}

/* ═══════════════════════════════════════════════
   Debug / Run Log Console Panel
   ═══════════════════════════════════════════════ */
#panel-debug {
  padding: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#panel-debug.active {
  display: flex;
}

.console-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-body);
}

/* ─── Toolbar ────────────────────────────────── */
.console-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.console-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.console-filters input[type="text"],
.console-filters select {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-mono);
  transition: all 0.2s var(--ease-out);
  height: 34px;
}

#log-search {
  width: 220px;
  min-width: 120px;
}

#log-search:focus,
.console-filters select:focus {
  border-color: var(--border-focus);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-light);
  transform: none;
}

.console-filters .checkbox-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  transition: all 0.2s;
}

.console-filters .checkbox-wrapper:hover {
  border-color: var(--border-focus);
  color: var(--text-main);
  background: var(--bg-surface);
}

.console-filters input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--border-focus);
  cursor: pointer;
}

/* ─── Action Buttons ──────────────────────────── */
.console-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.console-actions .icon-btn {
  width: auto;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s var(--ease-spring);
  box-shadow: var(--shadow-xs);
}

.console-actions .icon-btn:hover {
  border-color: var(--border-focus);
  color: var(--text-main);
  background: var(--bg-body);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.console-actions .icon-btn:active {
  transform: translateY(0) scale(0.97);
}

/* Export button gets a subtle accent */
#btn-export-log {
  border-color: rgba(99, 102, 241, 0.35);
  color: #6366F1;
  background: rgba(99, 102, 241, 0.05);
}

#btn-export-log:hover {
  border-color: #6366F1;
  background: rgba(99, 102, 241, 0.1);
  color: #6366F1;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] #btn-export-log {
  border-color: rgba(129, 140, 248, 0.35);
  color: #818CF8;
  background: rgba(129, 140, 248, 0.08);
}

[data-theme="dark"] #btn-export-log:hover {
  border-color: #818CF8;
  background: rgba(129, 140, 248, 0.15);
  color: #818CF8;
}

/* ─── Log Output Body ────────────────────────── */
.console-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  margin: 0;
  padding: 20px 28px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text-main);
  background: var(--bg-body);
  white-space: pre-wrap;
  word-break: break-all;
  counter-reset: none;
  scroll-behavior: smooth;
}

/* Subtle grid texture for terminal feel */
.console-body::before {
  content: none;
}

/* Scrollbar styling */
.console-body::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.console-body::-webkit-scrollbar-track {
  background: transparent;
}

.console-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.console-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ─── Log Level Color Coding (via JS-injected spans) ─── */
/* These apply when JS outputs HTML instead of plain text */
.log-line-info {
  color: var(--text-main);
}

.log-line-error {
  color: #F87171;
}

.log-line-warn {
  color: #FBBF24;
}

.log-line-debug {
  color: var(--text-muted);
}

/* Empty state */
.console-body:empty::after {
  content: '— 暂无运行日志，启动任务后此处将实时显示输出 —';
  display: block;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 60px;
  font-family: var(--font-sans);
}

/* ─── Log Level Badge (toolbar info) ─────────── */
.console-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.log-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
}

/* ============================================
   Onboarding Wizard
   ============================================ */
.wizard-modal {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-color);
  border: 1px solid var(--border-color);
  animation: modalBounceIn 0.5s var(--ease-spring);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Progress dots */
.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.wizard-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-color);
  border: 2px solid var(--border-color);
  transition: background 0.3s, transform 0.3s, border-color 0.3s;
  flex-shrink: 0;
}

.wizard-dot.active {
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  transform: scale(1.3);
  box-shadow: 0 0 0 4px var(--primary-light, rgba(37, 99, 235, 0.15));
}

.wizard-dot.done {
  background: var(--success, #22c55e);
  border-color: var(--success, #22c55e);
}

.wizard-line {
  flex: 1;
  height: 2px;
  background: var(--border-color);
  margin: 0 4px;
  max-width: 60px;
  transition: background 0.3s;
}

.wizard-line.done {
  background: var(--success, #22c55e);
}

/* Step content */
.wizard-step {
  display: none;
  flex-direction: column;
  gap: 12px;
  animation: overlayFadeIn 0.25s var(--ease-out);
}

.wizard-step.active {
  display: flex;
}

.wizard-icon {
  font-size: 36px;
  line-height: 1;
  text-align: center;
}

.wizard-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
}

.wizard-desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
  text-align: center;
}

.wizard-hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.wizard-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--primary-light, rgba(37, 99, 235, 0.12));
  color: var(--primary, #2563eb);
  margin-left: 4px;
  vertical-align: middle;
}

/* Step 0 preview list */
.wizard-steps-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  padding: 16px;
  background: var(--bg-body);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.wizard-preview-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-main);
}

.wizard-preview-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary, #2563eb);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Step 3 account hint */
.wizard-account-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-body);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.wizard-account-hint svg {
  flex-shrink: 0;
  color: var(--primary, #2563eb);
}

/* Footer */
.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.wizard-footer-btns {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.wizard-no-remind {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.wizard-no-remind input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--primary, #2563eb);
}

/* Buff step action row */
.wizard-buff-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.wizard-buff-actions .btn {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}