:root {
  --purple-deep: #1a0e2e;
  --purple-mid: #2d1854;
  --purple-vivid: #6b2fa0;
  --purple-light: #9b59c6;
  --purple-glow: rgba(155, 89, 198, 0.25);
  --glass: rgba(26, 14, 46, 0.55);
  --glass-heavy: rgba(26, 14, 46, 0.75);
  --glass-light: rgba(255, 255, 255, 0.06);
  --white: #ffffff;
  --text: #f0eaf5;
  --muted: rgba(240, 234, 245, 0.6);
  --border: rgba(155, 89, 198, 0.25);
  --border-light: rgba(255, 255, 255, 0.12);
  --success: #34d399;
  --danger: #fb7185;
  --radius: 12px;
  --radius-sm: 8px;
}

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

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

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background-color: var(--purple-deep);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--text); }

/* ── Main content area ── */
.page-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
}

/* ── Card ── */
.card {
  background: var(--glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 44px;
  width: 100%;
  max-width: 520px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(155, 89, 198, 0.08) inset,
    0 1px 0 rgba(255, 255, 255, 0.05) inset;
}

.card-logo {
  display: block;
  height: 36px;
  margin: 0 auto 28px;
  opacity: 0.95;
}

.card h1 {
  font-size: 26px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.card .subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 32px;
  line-height: 1.65;
}

/* ── Status indicator ── */
.status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--glass-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 22px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.4);
}

.status.error .status-dot {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(251, 113, 133, 0.4);
}

/* ── Buttons ── */
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.25s ease;
}

.button-primary {
  background: linear-gradient(135deg, var(--purple-vivid), var(--purple-light));
  color: var(--white);
  box-shadow: 0 4px 20px var(--purple-glow);
}

.button-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(155, 89, 198, 0.4);
}

.button-primary:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border-light);
}

.button-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border);
}

/* ── Support panel ── */
.support-panel {
  position: absolute;
  left: calc(50% + 280px);
  top: 50%;
  transform: translateY(-50%) translateX(20px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 260px;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s ease;
}

.support-panel.open {
  transform: translateY(-50%) translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.support-info {
  background: rgba(107, 47, 160, 0.15);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.support-info-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 8px;
}

.support-info ul {
  margin: 0;
  padding-left: 16px;
}

.support-info li {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}

.support-info-hours {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.support-item {
  background: var(--glass-heavy);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s;
}

.support-item:hover {
  border-color: var(--purple-light);
}

.support-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.support-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.support-item a {
  color: var(--purple-light);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.support-item a:hover {
  color: var(--white);
}

.support-hours {
  font-size: 11px;
  color: var(--muted);
}

.support-detail {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 4px;
}

/* ── Debug cog ── */
.debug-cog {
  position: fixed;
  bottom: 18px;
  left: 18px;
  width: 32px;
  height: 32px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10;
}

.debug-cog svg {
  width: 100%;
  height: 100%;
  stroke: var(--muted);
  transition: stroke 0.2s;
}

.debug-cog:hover svg {
  stroke: var(--purple-light);
}

.debug-cog:hover {
  transform: rotate(45deg);
}

.support-panel.open ~ .debug-cog {
  opacity: 1;
  pointer-events: auto;
}

/* ── Debug panel ── */
.debug-panel {
  margin-top: 20px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.debug-panel summary {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: var(--glass-light);
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.debug-panel #log {
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.35);
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 11px;
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--muted);
}

/* ── Spinner ── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.button.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 860px) {
  .support-panel {
    position: static;
    transform: translateX(20px);
    width: 100%;
    max-width: 520px;
    flex-direction: row;
    margin-top: 20px;
  }

  .support-panel.open {
    transform: translateX(0);
  }

  .support-panel .support-item {
    flex: 1;
  }

  .page-body {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .card {
    padding: 28px 22px;
  }

  .card h1 { font-size: 22px; }

  .support-panel {
    flex-direction: column;
  }
}
