:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding: 2rem 1rem;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

h1 {
  font-size: 1.75rem;
}

.section-title {
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.list-header .section-title {
  margin-bottom: 0;
}

.poll-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.api-config {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

input,
button {
  font: inherit;
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
}

input {
  background: var(--bg);
  color: var(--text);
}

input:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}

button {
  cursor: pointer;
  font-weight: 500;
  border: none;
  transition: opacity 0.15s;
}

button:hover:not(:disabled) {
  opacity: 0.9;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-success {
  background: var(--success);
  color: #052e16;
}

.btn-warning {
  background: var(--warning);
  color: #451a03;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-ghost {
  background: var(--border);
  color: var(--text);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.empty-state {
  text-align: center;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  align-items: end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--muted);
}

.checkbox-group {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
}

.giveaway-list {
  display: grid;
  gap: 1rem;
}

.giveaway-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.owner-name {
  font-size: 1.1rem;
}

.giveaway-id {
  color: var(--muted);
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

.badge {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-running {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.badge-stopped {
  background: rgba(148, 163, 184, 0.2);
  color: var(--muted);
}

.meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.meta strong {
  color: var(--text);
}

.winner-banner {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--warning);
  color: #fde68a;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-weight: 600;
}

.error-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: #fca5a5;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-delete {
  margin-left: auto;
}

#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  background: var(--danger);
  color: #ffffff;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  display: none;
  z-index: 100;
}

dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 450px;
  width: 90%;
  margin: auto;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.participant-list {
  max-height: 250px;
  overflow-y: auto;
  margin: 1rem 0;
  padding-left: 1.25rem;
  color: var(--muted);
}

.modal-actions {
  text-align: right;
}
