/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Variables ───────────────────────────────────────────── */
:root {
  --gold:         #c8a85a;
  --gold-light:   #e8c870;
  --gold-dark:    #a08040;
  --bg:           #080812;
  --bg-card:      #10101e;
  --bg-card2:     #14142a;
  --border:       #1e1e38;
  --border-light: #2a2a48;
  --text:         #d8d8f0;
  --text-muted:   #606080;
  --text-dim:     #404060;
  --green:        #3db86a;
  --green-bg:     #0d2a18;
  --red:          #e05050;
  --red-bg:       #2a0d0d;
  --amber:        #e0a030;
  --amber-bg:     #2a1a0d;
  --radius:       14px;
  --radius-sm:    8px;
}

/* ── Base ────────────────────────────────────────────────── */
html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem 4rem;
  overflow-x: hidden;
}

/* ── Background orbs ─────────────────────────────────────── */
.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  animation: orb-drift 20s ease-in-out infinite alternate;
}
.orb-1 { width: 500px; height: 500px; background: #4040c0; top: -100px; left: -100px; }
.orb-2 { width: 400px; height: 400px; background: #c8a85a; bottom: 0; right: -100px; animation-delay: -7s; }
.orb-3 { width: 300px; height: 300px; background: #2060a0; top: 40%; left: 40%; animation-delay: -14s; }

@keyframes orb-drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 30px) scale(1.1); }
}

/* ── Container ───────────────────────────────────────────── */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 660px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Header ──────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0 0.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.header-icon { font-size: 2rem; }

h1 {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.header-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ── Badge ───────────────────────────────────────────────── */
.badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.4s ease;
  white-space: nowrap;
}

.badge-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge--up       { background: var(--green-bg); color: var(--green);  border-color: #1e5a30; }
.badge--up       .badge-dot { background: var(--green);  box-shadow: 0 0 6px var(--green); animation: pulse-dot 2s infinite; }
.badge--down     { background: var(--red-bg);   color: var(--red);    border-color: #5a1e1e; }
.badge--down     .badge-dot { background: var(--red); }
.badge--locked   { background: var(--amber-bg); color: var(--amber);  border-color: #5a3a1e; }
.badge--locked   .badge-dot { background: var(--amber); }
.badge--checking { background: #12122a; color: var(--text-muted); border-color: var(--border-light); }
.badge--checking .badge-dot { background: var(--text-muted); animation: pulse-dot 1s infinite; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Status bar ──────────────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  border: 1px solid transparent;
  transition: all 0.4s ease;
}
.status-bar--checking { background: #12122a; color: var(--text-muted); border-color: var(--border); }
.status-bar--up       { background: var(--green-bg); color: #6fdc90; border-color: #1e5a30; }
.status-bar--down     { background: var(--red-bg);   color: #f07070; border-color: #5a1e1e; }
.status-bar--locked   { background: var(--amber-bg); color: #f0c060; border-color: #5a3a1e; }
.status-bar-time      { color: var(--text-muted); font-size: 0.72rem; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-light), transparent);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.card-icon {
  font-size: 1.5rem;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card2);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  flex-shrink: 0;
}

h2 {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.2rem;
}

.card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── Button ──────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #0a0a14;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.02em;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.btn-primary:hover  { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(200,168,90,0.3); }
.btn-primary:hover::after { opacity: 1; }
.btn-primary:active { transform: translateY(0); }

.btn-icon { font-size: 1.1rem; }

.cleared-at {
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Charge cards ────────────────────────────────────────── */
.charges {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.charge-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s, background 0.3s;
}

.charge-card--ready {
  border-color: var(--green);
  background: var(--green-bg);
}

.charge-card-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at left, rgba(200,168,90,0.05), transparent 70%);
  pointer-events: none;
}

.charge-card-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.charge-number {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #0a0a14;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.charge-card--ready .charge-number {
  background: linear-gradient(135deg, var(--green), #2a9050);
}

.charge-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.charge-time {
  font-family: 'Inter', monospace;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.charge-card-right { text-align: right; }

.charge-countdown {
  font-family: 'Inter', monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold);
  transition: color 0.3s;
}

.charge-card--ready .charge-countdown {
  color: var(--green);
  animation: ready-pulse 1.5s ease-in-out infinite;
}

.charge-countdown-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@keyframes ready-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* ── Timeline ────────────────────────────────────────────── */
.timeline-section { user-select: none; }

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.timeline-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.timeline-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  padding: 0 2px;
}

.timeline {
  position: relative;
  height: 48px;
  background: var(--bg-card2);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  margin-bottom: 0.4rem;
}

.timeline-track {
  position: absolute;
  top: 50%; left: 16px; right: 16px;
  height: 3px;
  background: var(--border-light);
  transform: translateY(-50%);
  border-radius: 2px;
}

.timeline-progress {
  position: absolute;
  top: 50%; left: 16px;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  transform: translateY(-50%);
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s ease;
}

.timeline-ticks {
  display: flex;
  justify-content: space-between;
  padding: 0 14px;
}

.tick {
  width: 1px;
  height: 4px;
  background: var(--border-light);
}

.dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #0a0a14;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: grab;
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 2px 12px rgba(200,168,90,0.4);
  z-index: 3;
  transition: box-shadow 0.15s, transform 0.15s;
}

.dot:active {
  cursor: grabbing;
  box-shadow: 0 4px 20px rgba(200,168,90,0.6);
  transform: translate(-50%, -50%) scale(1.15) !important;
}

.dot.ready {
  background: linear-gradient(135deg, #6fdc90, var(--green));
  box-shadow: 0 2px 16px rgba(61,184,106,0.5);
  animation: dot-ready 1.5s ease-in-out infinite;
}

@keyframes dot-ready {
  0%, 100% { box-shadow: 0 2px 16px rgba(61,184,106,0.5); }
  50%       { box-shadow: 0 2px 28px rgba(61,184,106,0.9); }
}

.dot-label { position: relative; z-index: 1; }

.dot-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  opacity: 0;
  animation: dot-pulse-ring 2s ease-out infinite;
}

@keyframes dot-pulse-ring {
  0%   { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.4; }
.empty-sub  { font-size: 0.78rem; color: var(--text-dim); margin-top: 0.3rem; }

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  padding-top: 0.5rem;
}

.footer-sep { opacity: 0.4; }

.sse-status { font-weight: 500; }
.sse-status--connected    { color: var(--green); }
.sse-status--connecting   { color: var(--amber); }
.sse-status--disconnected { color: var(--red); }

/* ── Toasts ──────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.1rem;
  font-size: 0.82rem;
  color: var(--text);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  animation: toast-in 0.3s ease;
  max-width: 300px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast--success { border-color: var(--green); }
.toast--error   { border-color: var(--red); }
.toast--warning { border-color: var(--amber); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
  h1 { font-size: 1.2rem; }
  .card { padding: 1.1rem; }
  .charge-countdown { font-size: 0.9rem; }
}
