:root {
  --bg: #0f1620;
  --card: #182231;
  --ink: #eef2f7;
  --muted: #9fb0c3;
  --line: #2a3646;
  --accent: #e5a00d;      /* Plex-ish amber */
  --accent-ink: #1a1205;
  --ok: #3ecf8e;
  --fail: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(1200px 600px at 50% -10%, #1b2740, var(--bg));
  color: var(--ink);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 18px 40px;
}

.card {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px 30px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.brand .logo {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 10px;
  font-size: 20px;
  font-weight: 700;
}
.brand h1 {
  font-size: 1.15rem;
  margin: 0;
  letter-spacing: 0.2px;
}

.lead { color: var(--muted); margin: 4px 0 18px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { color: var(--muted); font-size: 0.9rem; }
input {
  width: 100%;
  padding: 13px 14px;
  font-size: 1rem;
  color: var(--ink);
  background: #0f1826;
  border: 1px solid var(--line);
  border-radius: 10px;
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(229, 160, 13, 0.2);
}
.code-input {
  letter-spacing: 0.5em;
  text-align: center;
  font-size: 1.4rem;
}

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 13px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px); }
/* Anchors styled as buttons (e.g. "Back to the panel" on the error page). */
a.btn { display: inline-block; text-decoration: none; text-align: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #f2ad1f; }
.btn.primary:disabled { opacity: 0.6; cursor: default; }
.btn.link {
  background: none;
  color: var(--muted);
  padding: 6px 8px;
}
.btn.link:hover { color: var(--ink); }
.btn.retry {
  background: #24344a;
  color: var(--ink);
  border-color: var(--line);
  margin-top: 12px;
}

.resend-form { margin: 14px 0 0; }

.error {
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: #ffd6d6;
  padding: 11px 14px;
  border-radius: 10px;
  margin: 0 0 16px;
}

/* Panel */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.hello { color: var(--muted); }
.inline { margin: 0; }

.action {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  background: #14202f;
}
.action h2 { margin: 0 0 4px; font-size: 1.1rem; }
.action .desc { color: var(--muted); margin: 0 0 16px; font-size: 0.95rem; }
.run-btn { width: 100%; }

/* "Who's watching Plex" panel */
.streams {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
  background: #14202f;
}
.streams h2 { margin: 0 0 12px; font-size: 1.05rem; }
.stream-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.stream-list li { line-height: 1.4; padding-left: 22px; position: relative; }
.stream-list li::before {
  content: "";
  position: absolute; left: 3px; top: 7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
}
.stream-meta { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.stream-empty { color: var(--muted); margin: 0; }

.status {
  margin-top: 18px;
  border-top: 1px dashed var(--line);
  padding-top: 16px;
  max-height: 320px;
  overflow-y: auto;
}
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.steps li {
  color: var(--ink);
  padding-left: 26px;
  position: relative;
  animation: fade 0.25s ease;
}
.steps li::before {
  content: "";
  position: absolute;
  left: 4px; top: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
/* dim all but the most recent step, so the current one stands out */
.steps li { opacity: 0.55; }
.steps li:last-child { opacity: 1; font-weight: 600; }

.final {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: 10px;
  font-weight: 600;
}
.final.ok { background: rgba(62, 207, 142, 0.14); border: 1px solid rgba(62, 207, 142, 0.4); color: #c7f6e2; }
.final.fail { background: rgba(255, 107, 107, 0.12); border: 1px solid rgba(255, 107, 107, 0.4); color: #ffd6d6; }

@keyframes fade { from { opacity: 0; transform: translateY(3px); } }

@media (max-width: 480px) {
  body { padding: 3vh 12px 30px; }
  .card { padding: 22px 18px 24px; }
}
