@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap");

:root {
  --bg: #0a1720;
  --bg-soft: #102433;
  --panel: rgba(10, 22, 33, 0.86);
  --panel-strong: rgba(13, 29, 42, 0.96);
  --panel-muted: rgba(16, 36, 51, 0.74);
  --line: rgba(142, 178, 202, 0.18);
  --line-strong: rgba(142, 178, 202, 0.28);
  --text: #ecf4f8;
  --muted: #9cb6c7;
  --accent: #3fd0a0;
  --accent-strong: #22b482;
  --danger: #ff8467;
  --info: #6cb8ff;
  --success: #43d59d;
  --warning: #f0c86b;
  --shadow: 0 24px 80px rgba(2, 8, 14, 0.45);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(63, 208, 160, 0.14), transparent 24%),
    radial-gradient(circle at 100% 10%, rgba(108, 184, 255, 0.16), transparent 20%),
    linear-gradient(180deg, #09131b 0%, #0b1b27 50%, #09131b 100%);
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 100vh;
  padding: 12px 0 14px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
}

.panel,
.account-bar,
.auth-panel,
.flash,
.stat-card,
.global-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(17, 35, 48, 0.95), rgba(10, 22, 33, 0.92));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel h2,
.panel h3,
.auth-panel h2,
.account-bar h2 {
  margin: 0;
}

.auth-panel h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  line-height: 0.98;
}

.lede,
.auth-panel p,
.empty-state p,
small,
.history-meta,
.account-handle {
  color: var(--muted);
}

.flash,
.meta-card,
.stat-card,
.metric-card,
.entrant-panel,
.history-card,
.connection-badge,
.global-card {
  border-radius: var(--radius-md);
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent);
}

.flash {
  padding: 10px 14px;
}

.flash.hidden {
  display: none;
}

.flash.info {
  border-color: rgba(108, 184, 255, 0.3);
}

.flash.success {
  border-color: rgba(67, 213, 157, 0.35);
}

.flash.error {
  border-color: rgba(255, 132, 103, 0.35);
}

.auth-panel {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  padding: 28px;
  border-radius: var(--radius-lg);
}

.auth-meta {
  display: grid;
  gap: 16px;
}

.meta-card {
  padding: 18px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
}

.dashboard.hidden {
  display: none;
}

.global-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 2px;
}

.global-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
}

.global-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.global-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: clamp(1.1rem, 1.8vw, 1.7rem);
}

.account-bar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
}

.account-summary,
.account-actions,
.panel-heading,
.active-header,
.history-top,
.history-title-block,
.history-details,
.entrant-row,
.subheading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.account-summary,
.account-actions,
.panel-heading,
.active-header,
.subheading,
.entrant-row {
  align-items: center;
}

.avatar {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
}

.connection-badge,
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 0.86rem;
  font-weight: 700;
}

.connection-badge {
  background: rgba(63, 208, 160, 0.08);
  color: var(--text);
  border: 1px solid rgba(63, 208, 160, 0.16);
}

.connection-badge.warning {
  background: rgba(240, 200, 107, 0.12);
  border-color: rgba(240, 200, 107, 0.22);
}

.stats-grid,
.workspace-grid,
.metrics-grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 8px;
}

.stat-card {
  padding: 12px 14px;
}

.stat-card span,
.metric-card span,
.history-details span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card strong,
.metric-card strong {
  display: block;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  margin-bottom: 4px;
}

.metric-card {
  min-width: 0;
}

.metric-card strong {
  font-size: clamp(1rem, 1.8vw, 1.3rem);
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.workspace-grid {
  grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr);
  margin-top: 8px;
}

.panel {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
}

.panel-history {
  margin-top: 8px;
}

.form-stack {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 10px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(7, 16, 24, 0.72);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(63, 208, 160, 0.44);
  box-shadow: 0 0 0 4px rgba(63, 208, 160, 0.12);
}

textarea {
  resize: vertical;
  min-height: 88px;
}

.mini-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(120px, 0.42fr) minmax(0, 1fr);
}

.toggle-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #04120d;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
  box-shadow: 0 12px 24px rgba(34, 180, 130, 0.22);
}

button:hover,
.button-link:hover {
  transform: translateY(-1px);
}

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

.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.active-layout,
.empty-state {
  display: grid;
  gap: 10px;
}

.active-heading-copy {
  min-width: 0;
}

.active-heading-copy h3,
.history-title-block h3 {
  overflow-wrap: anywhere;
}

.support-copy {
  margin: 8px 0 0;
  color: var(--muted);
}

.status-chip {
  width: fit-content;
  background: rgba(63, 208, 160, 0.08);
  border: 1px solid rgba(63, 208, 160, 0.18);
}

.status-chip.ended {
  background: rgba(240, 200, 107, 0.1);
  border-color: rgba(240, 200, 107, 0.26);
}

.history-card.active {
  border-color: rgba(63, 208, 160, 0.18);
}

.history-card.ended {
  border-color: rgba(240, 200, 107, 0.2);
  background:
    linear-gradient(180deg, rgba(16, 36, 51, 0.8), rgba(16, 36, 51, 0.7)),
    linear-gradient(120deg, rgba(240, 200, 107, 0.06), transparent 45%);
}

.metrics-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.metric-card,
.entrant-panel,
.history-card {
  padding: 10px 12px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
}

code {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(108, 184, 255, 0.12);
  color: #d8ecff;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.entrant-table {
  list-style: none;
  margin: 0;
  padding: 0;
  height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.entrant-row {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.entrant-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.entrant-name {
  font-weight: 700;
}

.entrant-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.empty-state {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(108, 184, 255, 0.06);
  border: 1px dashed rgba(108, 184, 255, 0.18);
}

.empty-state.compact {
  padding: 10px 12px;
}

.rule-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(108, 184, 255, 0.12);
  border: 1px solid rgba(108, 184, 255, 0.15);
  color: #d8ecff;
}

.history-list {
  max-height: 62vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.history-row-item {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.history-row-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.history-row-main,
.history-row-title,
.history-row-meta,
.history-row-secondary {
  display: flex;
  gap: 12px;
}

.history-row-main {
  justify-content: space-between;
  align-items: flex-start;
}

.history-row-title {
  flex-direction: column;
  min-width: 0;
}

.history-row-title strong,
.history-row-secondary span {
  overflow-wrap: anywhere;
}

.history-row-channel,
.history-row-meta,
.history-row-secondary {
  color: var(--muted);
  font-size: 0.9rem;
}

.history-row-meta,
.history-row-secondary {
  flex-wrap: wrap;
}

.history-row-secondary {
  padding-top: 6px;
  border-top: 1px solid rgba(142, 178, 202, 0.1);
}

.dashboard {
  min-height: 0;
}

.dashboard-frame {
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 10px;
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(9, 20, 29, 0.98), rgba(11, 24, 35, 0.94));
  box-shadow: var(--shadow);
}

.sidebar-brand h2 {
  margin: 0;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.nav-link {
  justify-content: flex-start;
  min-height: 44px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  box-shadow: none;
}

.nav-link.active {
  background: rgba(63, 208, 160, 0.1);
  color: var(--text);
  border-color: rgba(63, 208, 160, 0.2);
}

.sidebar-card,
.settings-card,
.shortcut-card {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--panel-muted);
  border: 1px solid var(--line);
}

.main-stage {
  min-width: 0;
}

.content-sections {
  margin-top: 8px;
}

.content-section.hidden {
  display: none;
}

.panel-active,
.panel-form {
  min-height: 0;
}

.panel-active {
  display: flex;
  flex-direction: column;
}

#active-giveaway {
  min-height: 0;
}

.settings-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-card span,
.shortcut-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

.settings-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.single-focus {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-copy {
  margin-bottom: 10px;
  color: var(--muted);
}

@media (max-width: 1040px) {
  .dashboard-frame,
  .global-bar,
  .auth-panel,
  .workspace-grid,
  .stats-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    min-height: auto;
    display: block;
  }

  .dashboard {
    display: block;
  }

  .settings-grid,
  .single-focus,
  .mini-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 14px;
    padding-bottom: 18px;
  }

  .account-bar,
  .account-summary,
  .account-actions,
  .panel-heading,
  .active-header,
  .history-row-main,
  .history-row-meta,
  .history-row-secondary,
  .subheading {
    flex-direction: column;
    align-items: flex-start;
  }

  .entrant-table {
    max-height: none;
  }
}
