:root {
  --bg: #0d0e14;
  --surface: #15171f;
  --surface-2: #1c1f2a;
  --surface-3: #242836;
  --border: #272b39;
  --border-strong: #353a4c;
  --text: #eceef5;
  --muted: #9aa0b4;
  --faint: #6b7189;
  --accent: #7c6cff;
  --accent-hover: #8f82ff;
  --discord: #5865f2;
  --discord-hover: #4752c4;
  --danger: #ff6b6b;
  --ok: #4ade80;
  --twitch: #9146ff;
  --kick: #53fc18;
  --radius: 12px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 32px -12px rgba(0, 0, 0, .6);

  /* Discord's own dark theme, for the message previews. */
  --dc-bg: #313338;
  --dc-embed: #2b2d31;
  --dc-text: #dbdee1;
  --dc-muted: #949ba4;
  --dc-link: #00a8fc;
  --dc-mention-bg: rgba(88, 101, 242, .3);
  --dc-mention-text: #c9cdfb;
  --dc-button: #4e5058;
}

* { box-sizing: border-box; }

/* Components set their own display, which would otherwise override the hidden attribute. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 1rem; }
a { color: var(--accent-hover); }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em;
  background: var(--surface-3); padding: .05rem .3rem; border-radius: 4px;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--text); text-decoration: none; font-weight: 650; letter-spacing: -.01em;
}
.brand .logo { width: 28px; height: 28px; flex: none; }

/* --- buttons ------------------------------------------------------------ */

.btn {
  border: 1px solid transparent; border-radius: 8px; padding: .5rem .9rem;
  font: inherit; font-weight: 550; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  color: var(--text); background: var(--surface-2); white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; border-color: var(--border); color: var(--danger); padding: .35rem .7rem; font-size: .85rem; }
.btn-danger:hover { background: rgba(255, 107, 107, .08); border-color: rgba(255, 107, 107, .4); }
.btn-sm { padding: .4rem .8rem; font-size: .9rem; }
.btn-lg { padding: .85rem 1.4rem; font-size: 1.02rem; border-radius: 10px; }
.btn-discord { background: var(--discord); color: #fff; box-shadow: 0 8px 24px -8px rgba(88, 101, 242, .7); }
.btn-discord:hover { background: var(--discord-hover); transform: translateY(-1px); }
.btn .icon { width: 22px; height: 22px; }

/* ======================================================================
   Landing
   ====================================================================== */

.landing { position: relative; min-height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

.glow {
  position: absolute; inset: -20% -10% auto; height: 80vh; pointer-events: none; z-index: 0;
  background:
    radial-gradient(40% 50% at 25% 30%, rgba(145, 70, 255, .22), transparent 70%),
    radial-gradient(35% 45% at 80% 20%, rgba(83, 252, 24, .10), transparent 70%),
    radial-gradient(45% 55% at 60% 60%, rgba(88, 101, 242, .14), transparent 70%);
}

.landing > :not(.glow) { position: relative; z-index: 1; }

.landing-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 72rem; width: 100%; margin: 0 auto; padding: 1.25rem 1.5rem;
}

.landing main { max-width: 72rem; width: 100%; margin: 0 auto; padding: 0 1.5rem; flex: 1; }

.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 3.5rem; align-items: center;
  padding: 4rem 0 5rem;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border); border-radius: 999px; padding: .3rem .8rem;
}
.eyebrow .dot, .toast-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #f23f43;
  box-shadow: 0 0 0 0 rgba(242, 63, 67, .6); animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(242, 63, 67, .55); }
  70% { box-shadow: 0 0 0 8px rgba(242, 63, 67, 0); }
  100% { box-shadow: 0 0 0 0 rgba(242, 63, 67, 0); }
}

.hero h1 {
  font-size: clamp(2.2rem, 4.6vw, 3.6rem); font-weight: 750; letter-spacing: -.03em;
  margin: 1.25rem 0 1rem;
  background: linear-gradient(180deg, #fff 30%, #b9bdd0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { color: var(--muted); font-size: 1.12rem; max-width: 34rem; margin: 0 0 2rem; }
.cta { display: flex; gap: .75rem; flex-wrap: wrap; }
.fine { color: var(--faint); font-size: .85rem; margin-top: 1.25rem; max-width: 30rem; }
.fine strong { color: var(--muted); font-weight: 600; }

/* The mock Discord message in the hero. */
.hero-visual { position: relative; }
.mock {
  background: var(--dc-bg); border: 1px solid rgba(255, 255, 255, .06); border-radius: 14px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(0, 0, 0, .3);
  overflow: hidden; transform: perspective(1400px) rotateY(-6deg) rotateX(2deg);
}
.mock-bar {
  padding: .7rem 1rem; border-bottom: 1px solid rgba(0, 0, 0, .25);
  color: #f2f3f5; font-weight: 600; font-size: .92rem; background: #2b2d31;
}
.mock-bar .hash { color: var(--dc-muted); font-weight: 400; margin-right: .2rem; }
.mock .dmsg { padding: 1rem 1rem 1.2rem; }

.toast {
  position: absolute; right: -1.5rem; bottom: -1.75rem;
  display: flex; align-items: center; gap: .75rem;
  background: rgba(21, 23, 31, .92); backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong); border-radius: 12px; padding: .75rem 1rem;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7); font-size: .88rem;
}
.toast span:not(.toast-dot) { color: var(--muted); font-size: .8rem; }
.toast-dot { flex: none; background: var(--kick); animation-name: pulse-kick; }
@keyframes pulse-kick {
  0% { box-shadow: 0 0 0 0 rgba(83, 252, 24, .5); }
  70% { box-shadow: 0 0 0 8px rgba(83, 252, 24, 0); }
  100% { box-shadow: 0 0 0 0 rgba(83, 252, 24, 0); }
}

.features {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; padding-bottom: 4.5rem;
}
.feature {
  background: linear-gradient(180deg, var(--surface), rgba(21, 23, 31, .6));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem;
}
.feature h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }
.feature-icon {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: rgba(124, 108, 255, .14); color: #b4aaff;
}
.feature-icon svg { width: 20px; height: 20px; }

.steps {
  text-align: center; padding: 3rem 1.5rem; margin-bottom: 4rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
}
.steps h2 { font-size: 1.6rem; margin: 0 0 2rem; }
.steps ol {
  list-style: none; margin: 0 auto 2.25rem; padding: 0; max-width: 56rem;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; text-align: left;
}
.steps li { display: flex; gap: .9rem; align-items: flex-start; }
.steps li p { color: var(--muted); font-size: .9rem; margin: .2rem 0 0; }
.step-n {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-3); border: 1px solid var(--border-strong); font-weight: 700; font-size: .9rem;
}

.landing-footer {
  text-align: center; color: var(--faint); font-size: .82rem;
  padding: 1.5rem; border-top: 1px solid var(--border);
}

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 3rem; padding-top: 2.5rem; }
  .mock { transform: none; }
  .toast { right: .75rem; bottom: -1.75rem; }
  .features { grid-template-columns: repeat(2, 1fr); }
  .steps ol { grid-template-columns: 1fr; max-width: 22rem; }
}
@media (max-width: 560px) {
  .landing-nav, .landing main { padding-left: 1rem; padding-right: 1rem; }
  .brand span { font-size: .95rem; }
  .features { grid-template-columns: 1fr; }
  .cta .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ======================================================================
   Dashboard
   ====================================================================== */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1.25rem; background: rgba(21, 23, 31, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
  position: sticky; top: 0; z-index: 5;
}
.topbar-right { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.topbar select { width: auto; min-width: 12rem; }
.user-chip { color: var(--muted); font-size: .9rem; padding: 0 .25rem; }

.main { max-width: 76rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; display: grid; gap: 1.25rem; }
#guild-view { display: grid; gap: 1.25rem; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); gap: 1.25rem; align-items: start; }
.editor-main { display: grid; gap: 1.25rem; }
.editor-side { position: sticky; top: 4.5rem; }
@media (max-width: 1080px) {
  .editor { grid-template-columns: 1fr; }
  .editor-side { position: static; }
}

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.35rem; box-shadow: var(--shadow);
}
.empty { text-align: center; }
.empty p { color: var(--muted); }

/* --- forms -------------------------------------------------------------- */

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0 1rem; }
.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.1rem; }
.field.grow { flex: 1 1 14rem; }
.field > label:not(.toggle), .label {
  display: block; font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
}
.label { margin-bottom: .5rem; }

select, input[type="text"], textarea {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: .55rem .65rem; font: inherit; width: 100%;
  transition: border-color .15s;
}
select:hover, input[type="text"]:hover, textarea:hover { border-color: var(--border-strong); }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }
select:focus, input:focus-visible, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="text"]:disabled { opacity: .5; }

.hint { color: var(--muted); font-size: .82rem; margin: .1rem 0 0; }
.error { color: var(--danger); font-size: .88rem; }
.warning {
  margin: .25rem 0 0; padding: .6rem .75rem; border-radius: 8px; font-size: .84rem;
  background: rgba(250, 166, 26, .1); border: 1px solid rgba(250, 166, 26, .35); color: #f5c878;
}
.warning a { color: #ffd899; font-weight: 600; }
.watch-actions { display: flex; gap: .4rem; flex: none; }
.btn-announce { background: transparent; border-color: var(--border); color: var(--text); padding: .35rem .7rem; font-size: .85rem; }
.btn-announce:hover { border-color: var(--accent); background: rgba(124, 108, 255, .1); }
#watch-status:empty { display: none; }

.actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .25rem; }
.status { font-size: .85rem; color: var(--muted); }
.status.ok { color: var(--ok); }
.status.bad { color: var(--danger); }

.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: .2rem .6rem; font-size: .8rem; font-family: ui-monospace, monospace;
  cursor: pointer; color: var(--muted);
}
.chip:hover { color: var(--text); border-color: var(--accent); }

/* Segmented control built from radio buttons. */
.segmented {
  display: inline-flex; padding: 3px; gap: 3px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border); align-self: flex-start;
}
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block; padding: .4rem .9rem; border-radius: 6px; font-size: .9rem; font-weight: 550;
  color: var(--muted); transition: background-color .15s, color .15s;
}
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.segmented.small span { padding: .25rem .65rem; font-size: .8rem; }

/* Switch-style checkboxes. */
.toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .6rem 1rem; margin-bottom: 1.1rem; }
.toggle { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .92rem; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-strong); transition: background-color .15s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #cfd3e1; transition: transform .15s;
}
.toggle input:checked + .switch { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .switch::after { transform: translateX(14px); background: #fff; }
.toggle input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

.color-row { display: flex; align-items: center; gap: 1rem; min-height: 2.4rem; }
input[type="color"] {
  width: 44px; height: 32px; padding: 0; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface-2); cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
input[type="color"]:disabled { opacity: .4; cursor: not-allowed; }
.swatches { display: flex; gap: .4rem; flex-wrap: wrap; }
.swatch {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}
.swatch:hover { transform: scale(1.1); }
.swatch.active { border-color: #fff; }

.button-field { flex-direction: row; align-items: center; gap: 1rem; flex-wrap: wrap; }
.button-field input[type="text"] { flex: 1 1 12rem; width: auto; }

.add-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.add-form .field { margin-bottom: 0; }
.add-form .btn { margin-bottom: 0; }

/* --- watch list --------------------------------------------------------- */

#watch-list { margin: 1rem 0 .5rem; }
.watch-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem .25rem; border-bottom: 1px solid var(--border);
}
.watch-row:last-child { border-bottom: 0; }
.watch-name { font-weight: 550; min-width: 0; overflow-wrap: break-word; }
@media (max-width: 560px) { .watch-row { flex-wrap: wrap; } }
.watch-name a { color: inherit; text-decoration: none; }
.watch-name a:hover { text-decoration: underline; }
.watch-meta { color: var(--muted); font-size: .85rem; margin-left: auto; }

.badge {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  padding: .15rem .5rem; border-radius: 999px; font-weight: 700; color: #0b0b0f;
}
.badge.twitch { background: var(--twitch); color: #fff; }
.badge.kick { background: var(--kick); }

/* --- invites ------------------------------------------------------------ */

.invite-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .25rem; border-bottom: 1px solid var(--border);
}
.invite-row:last-child { border-bottom: 0; }
.invite-name { font-weight: 550; margin-right: auto; min-width: 0; overflow-wrap: anywhere; }
.guild-icon {
  width: 2rem; height: 2rem; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--surface-2);
  color: var(--muted); font-weight: 600; font-size: .9rem;
}
#invite-card .hint { margin-top: .75rem; }

/* ======================================================================
   Discord message rendering (hero mock and live preview)
   ====================================================================== */

.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.preview-head h2 { margin: 0; }
.preview {
  background: var(--dc-bg); border-radius: 10px; padding: 1rem .9rem; margin-bottom: .75rem;
  border: 1px solid rgba(0, 0, 0, .25);
}

.dmsg { display: flex; gap: .85rem; color: var(--dc-text); font-size: .95rem; line-height: 1.375; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; }
.avatar svg { width: 100%; height: 100%; display: block; }
.dmsg-body { min-width: 0; flex: 1; }
.dmsg-head { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin-bottom: .1rem; }
.dmsg-head .author { color: #f2f3f5; font-weight: 600; }
.bot-tag {
  background: var(--discord); color: #fff; font-size: .62rem; font-weight: 700;
  padding: .05rem .3rem; border-radius: 3px; letter-spacing: .02em;
}
.dmsg-head .time { color: var(--dc-muted); font-size: .75rem; margin-left: .15rem; }
.dmsg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.dmsg-text a, .dlink { color: var(--dc-link); text-decoration: none; }
.mention { background: var(--dc-mention-bg); color: var(--dc-mention-text); border-radius: 3px; padding: 0 .15rem; font-weight: 500; }

.dembed {
  margin-top: .35rem; max-width: 26rem; display: flex; gap: 1rem;
  background: var(--dc-embed); border-left: 4px solid var(--bar, var(--discord));
  border-radius: 4px; padding: .6rem 1rem .9rem .75rem;
}
.dembed-main { min-width: 0; flex: 1; display: grid; gap: .4rem; }
.dembed-author { display: flex; align-items: center; gap: .45rem; font-size: .85rem; font-weight: 600; color: #f2f3f5; }
.mini-avatar {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #f0a, #fa0);
}
.dembed-title { color: var(--dc-link); font-weight: 600; font-size: .98rem; overflow-wrap: anywhere; }
.dembed-fields { display: flex; gap: 1.75rem; flex-wrap: wrap; font-size: .87rem; }
.dembed-fields .fname { color: #f2f3f5; font-weight: 600; margin-bottom: .1rem; }
.dembed-thumb {
  flex: none; width: 72px; height: 72px; border-radius: 6px;
  background: linear-gradient(135deg, #f0a, #fa0);
}
.dembed-image {
  position: relative; aspect-ratio: 16 / 9; border-radius: 6px; margin-top: .3rem; overflow: hidden;
  background:
    radial-gradient(60% 80% at 30% 30%, rgba(255, 255, 255, .18), transparent 60%),
    linear-gradient(135deg, #3b1f7a, #1a3d6e 55%, #1b5e3a);
}
.dembed-image::after {
  content: "Stream preview"; position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(255, 255, 255, .45); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
}
.mock .dembed-image::after { content: none; }
.live-badge {
  position: absolute; left: .6rem; top: .6rem; z-index: 1;
  background: #e91916; color: #fff; font-size: .68rem; font-weight: 800;
  padding: .12rem .4rem; border-radius: 4px; letter-spacing: .06em;
}
.dembed-footer { color: var(--dc-muted); font-size: .75rem; }

.dbuttons { display: flex; gap: .5rem; margin-top: .5rem; }
.dbutton {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--dc-button); color: #fff; font-size: .87rem; font-weight: 500;
  padding: .35rem 1rem; border-radius: 8px; min-height: 32px;
}
.dbutton svg { width: 14px; height: 14px; }
