/* refrace dashboard — loaded after landing.css and join.css. */

/* Match .rf-wrap (header/footer) so the page doesn't step in and out. */
.jn-main.db-main { width: 100%; max-width: 1080px; min-width: 0; }
#shell {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  background: transparent;
}

/* One sheet per tab — same box Overview uses, every time. */
.db-panel {
  display: flex;
  flex-direction: column;
  gap: 28px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-raised);
}
.db-panel > *,
#app,
#board-app,
#brand-app,
.db-identity,
.db-quests,
.db-board {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
#board-app,
#brand-app {
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: transparent;
}

.db-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.db-head > div { min-width: 0; }

/* Tabs: social-style chips, transparent strip, no nested scroller. */
.db-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0 0 28px;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
.db-tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 8px;
  margin: 0;
  padding: 11px 20px;
  min-height: 42px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 1px 2px rgba(0,0,0,0.3),
    0 4px 12px -4px rgba(0,0,0,0.4);
  cursor: pointer;
  white-space: nowrap;
}
.db-tab:hover { color: var(--text); }
.db-tab[aria-selected="true"] {
  color: var(--gold);
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(242,193,78,0.18), rgba(242,193,78,0.05));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.14),
    0 2px 4px rgba(0,0,0,0.3),
    0 10px 20px -6px rgba(242,193,78,0.28);
}
.db-tab:active {
  box-shadow:
    inset 0 1px 2px rgba(0,0,0,0.3),
    0 1px 2px rgba(0,0,0,0.2);
}
.db-tab:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.db-help { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; margin-left: 6px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 0.62em; font-weight: 700; text-decoration: none; vertical-align: middle; }
.db-help:hover { color: var(--text); border-color: var(--text); }
.db-setup { margin-bottom: 18px; }
.cb-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px 14px; margin-top: 12px; }
.cb-form label { display: grid; gap: 4px; }
.cb-form input, .cb-form select { width: 100%; box-sizing: border-box; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.cb-form .cb-wide { grid-column: 1 / -1; }
.cb-form [hidden] { display: none; }
.cb-actions { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; }
.pd-list.cb-list li { grid-template-columns: minmax(0, 1fr) auto auto auto; }
.pd-list.cb-list .pd-name { white-space: normal; }
.db-setup-list { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.db-setup-list li { display: grid; grid-template-columns: 1.6em 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--text) 4%, transparent); }
.db-setup-list li.is-done { color: var(--muted); }
.db-setup-mark { display: inline-grid; place-items: center; width: 1.4em; height: 1.4em; border: 1px solid var(--line); border-radius: 50%; color: var(--lime, #b8f25c); font-weight: 700; }
.db-setup-list .jn-ghost { padding: 6px 12px; font-size: 0.85rem; }
.db-subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: -12px 0 22px; }
.db-subtabs[hidden] { display: none; }
.db-subtab { padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.db-subtab:hover { color: var(--text); }
.db-subtab[aria-current="true"] { color: #0b0b10; background: var(--gold); border-color: var(--gold); }
.db-tab-empty {
  margin: 0;
  padding: 8px 0 12px;
  max-width: none;
  color: var(--soft);
  font-size: 1.05rem;
}

#app,
.db-identity,
.db-quests,
.db-board {
  padding: 0;
  border: 0;
  background: transparent;
}

#widget,
#app,
.db-panel > .db-identity,
#board-app > .db-board:first-child,
#brand-app > .db-board:first-child { margin-top: 0; }
.db-quests { margin-top: 0; }
#nopage[hidden] + #app[hidden] + .db-quests { margin-top: 0; }
.db-pagelink { font-family: var(--mono); font-size: 0.85rem; color: var(--gold); text-decoration: none; overflow-wrap: anywhere; }
.db-pagelink:hover { text-decoration: underline; }
.jn-status a { color: var(--gold); }

/* Saved-key check. Does not write the key. */
.db-connection {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  align-items: center;
  margin-bottom: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.db-connection h2 {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.db-connection .db-sub { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.db-connection .db-sub img { width: 22px; height: 22px; border-radius: 6px; }
.db-connection-actions { display: flex; align-items: center; gap: 14px; }
.db-connection .jn-note { grid-column: 1 / -1; min-height: 1.2em; }
@media (max-width: 640px) {
  .db-connection { grid-template-columns: 1fr; }
  .db-connection-actions { margin-top: 8px; }
}

/* Tiles */
.db-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; min-width: 0; width: 100%; }
.db-tile { padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.db-tile h2 {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.db-big { margin-top: 8px; font-size: 2.4rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.db-sub { margin-top: 8px; font-size: 0.85rem; color: var(--muted); }

/* Bar charts */
.db-charts { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 12px; margin-top: 12px; min-width: 0; width: 100%; }
.db-chart { margin: 0; padding: 16px 18px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); min-width: 0; }
.db-chart figcaption { font-weight: 700; color: var(--text); }
.db-chart figcaption span { margin-left: 6px; font-weight: 400; font-size: 0.8rem; color: var(--muted); }
.db-plot {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 120px;
  margin-top: 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(to bottom, var(--line) 1px, transparent 1px) top / 100% 50% repeat-y;
}
.db-max { position: absolute; top: -20px; left: 0; font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.db-bar {
  flex: 1 1 0;
  display: flex;
  align-items: flex-end;
  height: 100%;
  padding: 0;
  background: none;
  border: 0;
  cursor: default;
}
.db-bar i { display: block; width: 100%; border-radius: 3px 3px 0 0; background: var(--gold); transition: opacity 0.15s; }
.db-plot:hover .db-bar i { opacity: 0.55; }
.db-plot .db-bar:hover i, .db-bar:focus-visible i { opacity: 1; }
.db-bar:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.db-axis { display: flex; justify-content: space-between; margin-top: 6px; font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.db-tip {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -100%);
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #1a1d27;
  font-size: 0.85rem;
  white-space: nowrap;
  pointer-events: none;
}
.db-tip b { color: var(--text); font-variant-numeric: tabular-nums; }
.db-tip span { display: block; font-size: 0.75rem; color: var(--muted); }

.db-daily table { width: 100%; max-width: 420px; margin-top: 10px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.db-daily th, .db-daily td { padding: 4px 8px 4px 0; text-align: left; border-bottom: 1px solid var(--line); }
.db-daily th { font-weight: 600; color: var(--muted); }

/* Leaderboard */
.db-board { margin-top: 0; }
.db-board-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.db-board h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; }
.db-board .jn-ghost { min-height: 40px; }
.db-private { margin-top: 10px; }
.db-tablewrap { margin-top: 16px; overflow-x: auto; min-width: 0; max-width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.db-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.db-table th, .db-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.db-table tr:last-child td { border-bottom: 0; }
.db-table th { font-family: var(--mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.db-table td:first-child { width: 3ch; color: var(--muted); }
.db-table .is-prize td:first-child { color: var(--gold); font-weight: 700; }
.db-num { text-align: right !important; white-space: nowrap; }
.db-user { font-family: var(--mono); font-size: 0.9rem; overflow-wrap: break-word; user-select: all; }
@media (max-width: 520px) {
  .db-table th, .db-table td { padding: 9px 8px; }
  .db-table td { font-size: 0.85rem; }
  .db-user { font-size: 0.82rem; }
  .db-table th { letter-spacing: 0.04em; }
}
.db-empty { color: var(--muted); text-align: center !important; padding: 28px !important; }

/* Widget / browser-source block */
.db-widget-row { display: flex; gap: 10px; margin-top: 14px; align-items: stretch; min-width: 0; width: 100%; }
.db-widget-url { flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); font-family: var(--mono); font-size: 0.88rem; }
.db-widget-url:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.db-widget-opts { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.db-widget-opts code { font-family: var(--mono); background: var(--bg-raised); padding: 1px 6px; border-radius: 6px; }
@media (max-width: 520px) {
  .db-widget-row { flex-direction: column; }
}
.db-widget-label { font-family: var(--mono); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); align-self: center; min-width: 44px; }
.db-widget-help { margin-top: 10px; color: var(--muted); }
@media (max-width: 520px) {
  .db-widget-label { align-self: flex-start; }
}

/* Widget editor */
.db-widget-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; min-width: 0; }
.db-widget-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
.db-widget-grid label.db-widget-check { flex-direction: row; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 0.9rem; color: var(--text); }
.db-widget-grid label.db-widget-check input { width: 16px; height: 16px; accent-color: var(--gold); }
.db-widget-grid input[type="number"],
.db-widget-grid input[type="text"],
.db-widget-grid select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font-family: inherit; font-size: 0.95rem; }
.db-widget-grid input[type="number"]:focus,
.db-widget-grid input[type="text"]:focus,
.db-widget-grid select:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.db-widget-range { display: flex; align-items: center; gap: 10px; }
.db-widget-range input[type="range"] { flex: 1; accent-color: var(--gold); }
.db-widget-range input[type="color"] { width: 44px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-raised); cursor: pointer; }
.db-widget-range output { font-family: var(--mono); font-size: 0.85rem; color: var(--text); min-width: 48px; text-align: right; }

/* Preview iframe */
.db-widget-editor { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; min-width: 0; width: 100%; }
.db-widget-editor .db-widget-grid { grid-column: 1; }
.db-widget-editor .db-widget-row,
.db-widget-editor > .jn-small,
.db-widget-editor > .db-widget-help { grid-column: 1 / -1; }
.db-widget-preview { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; gap: 8px; position: sticky; top: 16px; }
.db-widget-preview-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.db-widget-preview-hint { color: var(--muted); max-width: 60%; text-align: right; }
.db-widget-preview-stage {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; min-height: 320px;
  background-color: #0b0d13;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.06) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.06) 75%),
    linear-gradient(45deg, rgba(255,255,255,0.06) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.06) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
}
.db-widget-preview-stage iframe { width: 100%; height: 420px; border: 0; display: block; background: transparent; color-scheme: dark; }
@media (max-width: 820px) {
  .db-widget-editor { grid-template-columns: 1fr; }
  .db-widget-preview { grid-column: 1; grid-row: auto; position: static; }
  .db-widget-preview-hint { max-width: 100%; text-align: left; }
}

/* Branding editor */
.db-brand-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 18px; margin-top: 14px; min-width: 0; width: 100%; }
.db-brand-field { display: flex; flex-direction: column; gap: 6px; }
.db-brand-label { font-family: var(--mono); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.db-brand-field > input[type="text"],
.db-brand-field > input[type="url"] { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font-family: inherit; font-size: 0.95rem; }
.db-brand-field > input[type="text"]:focus,
.db-brand-field > input[type="url"]:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.db-brand-field .db-widget-range input[type="text"] { flex: 1; min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font-family: var(--mono); font-size: 0.85rem; }
.db-brand-field .jn-small { color: var(--muted); }
.db-brand-upload { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; background: var(--bg); min-height: 72px; min-width: 0; }
.db-brand-upload-body { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.db-brand-upload-body p { margin: 0; color: var(--muted); font-size: 0.82rem; }
.db-brand-upload-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.db-brand-upload-pick { cursor: pointer; display: inline-block; }
.db-brand-upload img { max-width: 90px; max-height: 60px; object-fit: contain; background: #000; border-radius: 6px; padding: 4px; }
.db-brand-upload-bg img { max-width: 120px; max-height: 72px; object-fit: cover; }

/* Stream panel download */
.db-stream {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-top: 14px;
  min-width: 0;
}
.db-stream-preview {
  width: 100%;
  max-width: 320px;
  height: auto;
  aspect-ratio: 320 / 300;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #05060a;
}
.db-stream-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.db-stream-side .rf-button {
  align-self: flex-start;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.db-stream-side .rf-button:disabled { opacity: 0.6; cursor: progress; }
.db-stream-side .db-widget-row { margin-top: 0; }
.db-stream-side .db-widget-label { min-width: 0; white-space: nowrap; }
.db-stream-side .jn-small { color: var(--muted); }
@media (max-width: 720px) {
  .db-stream { grid-template-columns: 1fr; }
}

/* Custom domains */
.db-domain-setup { display: flex; flex-direction: column; gap: 20px; margin-top: 14px; min-width: 0; width: 100%; }
.db-dns-box {
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.db-dns-title {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}
.db-dns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  gap: 10px;
  margin-top: 4px;
}
.db-dns-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.db-dns-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
}
.db-dns-val {
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--text);
  word-break: break-all;
}
.db-dns-hint {
  color: var(--muted);
  margin-top: 4px;
}
.db-domain-form { display: flex; flex-direction: column; gap: 8px; }
.db-domain-form input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
}
.db-domain-form input[type="text"]:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.db-subhead {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.db-domain-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.db-domain-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  flex-wrap: wrap;
}
.db-domain-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.db-domain-link {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--gold);
  text-decoration: none;
  word-break: break-all;
}
.db-domain-link:hover { text-decoration: underline; }
.db-domain-badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  color: #b8f25c;
  background: rgba(184, 242, 92, 0.12);
  border: 1px solid rgba(184, 242, 92, 0.25);
  white-space: nowrap;
}

/* Identity / referral cards */
.db-identity { margin: 0; }
.db-identity-head { margin-bottom: 20px; }
.db-identity-head h2 { margin: 0 0 6px; font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.db-identity-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; min-width: 0; }
.db-identity-item {
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.db-identity-item h3 {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.db-identity-value {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  word-break: break-all;
  flex: 1;
  min-height: 1.5em;
}
.db-identity-empty { color: var(--muted); font-weight: 400; }
.db-identity-warn { display: block; margin: 0 0 10px; color: var(--gold); font-size: 0.85rem; line-height: 1.45; }
.db-identity-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.db-identity-actions:empty { display: none; }

.db-identity h2 { margin: 0 0 6px; font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.db-identity-link {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.db-identity-link h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
}
.db-identity-link .jn-small { margin: 0 0 10px; }

.db-ref-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.db-ref-badge {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  color: #b8f25c;
  background: rgba(184, 242, 92, 0.12);
  border: 1px solid rgba(184, 242, 92, 0.25);
  letter-spacing: 0.02em;
}

.db-gate-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.db-ref-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
  padding: 10px 18px;
  font-size: 0.92rem;
}

.db-ref-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.db-ref-url-row { margin-top: 14px; }
.db-ref-url-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.88rem;
}
.db-ref-url-row input:focus { outline: 2px solid var(--gold); outline-offset: 2px; }

.db-ref-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.db-ref-rank {
  text-decoration: none;
  background: rgba(242, 193, 78, 0.12);
  color: var(--gold, #f2c14e);
  border-color: rgba(242, 193, 78, 0.3);
  transition: opacity 0.15s, transform 0.15s;
}
.db-ref-rank.is-unranked {
  color: var(--muted);
  background: rgba(197, 201, 216, 0.08);
  border-color: var(--line);
}

.db-ref-edit-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.db-ref-edit-input-wrap {
  display: flex;
  align-items: center;
  flex: 1 1 220px;
  min-width: 0;
  max-width: 100%;
  background: rgba(14, 17, 26, 0.9);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 0.9rem;
}
.db-ref-edit-prefix {
  color: var(--muted);
  user-select: none;
}
.db-ref-code-input {
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 8px 4px;
  outline: none;
  min-width: 0;
  flex: 1;
}
.db-ref-edit-hint {
  width: 100%;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Quests */
.db-quests { margin: 0; }
.db-quests-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 24px; }
.db-quests-head h2 { margin-top: 4px; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.db-quests-head .db-sub { margin-top: 4px; max-width: 46ch; }
.db-quests-score { display: flex; flex-wrap: wrap; gap: 8px; }
.db-quests-score div {
  flex: 1 1 88px;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 8, 12, 0.4);
}
.db-quests-score span {
  display: block;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.db-quests-score b { display: block; margin-top: 2px; font-family: var(--mono); font-size: 1.3rem; color: var(--gold); }
.db-quests-progress { display: flex; align-items: center; gap: 12px; margin-top: 20px; font-size: 0.85rem; color: var(--muted); }
.db-quests-bar { flex: 1; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.db-quests-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), var(--lime));
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.db-quests-list { display: grid; gap: 6px; margin-top: 16px; }
.db-quests-list li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 8, 12, 0.35);
}
.db-q-check {
  width: 20px;
  height: 20px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
}
.db-quests-list li.is-done .db-q-check {
  border-color: var(--lime);
  background: var(--lime) center / 12px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.5l2.5 2.5L10 3.5' fill='none' stroke='%2307080c' stroke-width='2'/%3E%3C/svg%3E");
}
.db-quests-list li.is-done .db-q-title { color: var(--muted); }
.db-q-title { font-weight: 600; }
.db-q-title a { color: inherit; text-decoration: none; }
.db-q-title a:hover { color: var(--gold); }
.db-q-title small { margin-left: 8px; font-weight: 500; color: var(--muted); }
.db-q-pts { font-family: var(--mono); font-size: 0.85rem; font-weight: 700; color: var(--lime); white-space: nowrap; }
.db-quests-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; }
.db-quests-actions .jn-ghost { display: inline-flex; align-items: center; min-height: 46px; text-decoration: none; }
.db-quests-actions .rf-button:disabled { opacity: 0.55; cursor: default; transform: none; box-shadow: none; }
@media (max-width: 640px) {
  .db-panel { padding: 16px; gap: 20px; }
  .db-quests-score { width: 100%; }
  .db-quests-score div { flex: 1 1 calc(33% - 8px); }
  .db-tab { font-size: 0.85rem; padding: 10px 12px; min-height: 40px; }
  .db-big { font-size: 1.8rem; }
  .db-widget-row { flex-direction: column; }
  .db-widget-label { align-self: flex-start; }
  .db-brand-upload { flex-direction: column; align-items: flex-start; }
  .db-widget-preview-stage { min-height: 240px; }
  .db-widget-preview-stage iframe { height: 280px; }
  .db-widget-preview-head { flex-wrap: wrap; }
  .db-head { margin-bottom: 16px; }
  .db-tabs { margin-bottom: 20px; }
}
.db-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Past races */
.db-past { margin-top: 10px; }
.db-past summary { cursor: pointer; font-weight: 600; }
.db-past .db-tablewrap { margin-top: 12px; }
.db-past-csv { min-height: 40px; margin-top: 10px; }

/* Milestone rewards */
.db-ms-form { margin-top: 18px; }
.db-ms-head, .db-ms-tier { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: center; }
.db-ms-head { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.db-ms-tiers { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.db-ms-tier input { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); font-family: var(--mono); }
.db-ms-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.db-ms-filter { display: inline-flex; gap: 8px; align-items: center; font-size: 0.9rem; color: var(--muted); }
.db-ms-totals { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; font-size: 0.9rem; color: var(--muted); }
.db-ms-totals b { color: var(--text); font-variant-numeric: tabular-nums; }
.db-ms-totals .is-due b { color: var(--gold); }
.db-ms-tick { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.db-table .is-paid td { color: var(--muted); }
/* Bonus hunt */
.db-bh-new, .db-bh-add { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.db-bh-new input, .db-bh-add input, .db-bh-pick select { padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; }
.db-bh-new input { flex: 1 1 200px; min-width: 0; }
.db-bh-add #bh-add { flex: 1 1 260px; min-width: 0; font-size: 1.05rem; }
.db-bh-bet { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-family: var(--mono); font-size: 0.85rem; }
.db-bh-bet input { width: 6.5em; font-family: var(--mono); }
.db-bh-toggles { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 0.9rem; }
.db-bh-toggles label { display: inline-flex; gap: 6px; align-items: center; }
.db-bh-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 16px 0 0; }
.db-bh-stats div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.db-bh-stats dt { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.db-bh-stats dd { margin: 4px 0 0; font-family: var(--mono); font-weight: 700; font-size: 1.05rem; }
.db-bh-stats .is-up dd { color: var(--lime); }
.db-bh-stats .is-down dd { color: #ff7b72; }
.db-bh-table .db-bh-win { width: 7.5em; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-raised, var(--bg)); color: var(--text); font-family: var(--mono); text-align: right; }
.db-bh-table tr.is-next td { background: color-mix(in srgb, var(--gold) 8%, transparent); }
.db-bh-table tr.is-next .db-bh-win { border-color: var(--gold); }
.db-bh-slot { font-weight: 600; }
.db-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Chat bot */
.db-chat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 16px; }
.db-chat-card { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.db-chat-card h3 { margin: 0 0 6px; font-size: 1rem; }
.db-chat-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.db-chat-commands { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; border: 0; }
.db-chat-commands label { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; cursor: pointer; }
.db-chat-commands span { color: var(--muted); font-size: 0.9rem; }
.db-bh-wincell { white-space: nowrap; }
.db-bh-save { display: inline-block; min-width: 5.5em; margin-left: 8px; font-family: var(--mono); font-size: 0.72rem; color: var(--muted); text-align: left; }
.db-bh-save[data-state="saved"] { color: var(--lime); }
.db-bh-save[data-state="error"], .db-bh-save[data-state="invalid"] { color: #ff7b72; }
.db-bh-save.is-fading { animation: db-bh-fade 1.6s ease-in 0.6s forwards; }
.db-bh-table .db-bh-win[aria-invalid="true"] { border-color: #ff7b72; }
@keyframes db-bh-fade { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .db-bh-save.is-fading { animation: none; } }

/* ---------- Page editor: one form, one save, live preview ---------- */
.db-page-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.db-page-form { display: grid; gap: 18px; min-width: 0; }
.db-page-form > .db-board { margin-top: 0; scroll-margin-top: 80px; }
#pg-domain { margin-top: 18px; scroll-margin-top: 80px; }
.db-page-toc { display: flex; flex-wrap: wrap; gap: 6px; }
.db-page-toc a {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--soft);
  text-decoration: none;
}
.db-page-toc a:hover { color: var(--text); border-color: var(--gold); }
.db-page-form [data-field].has-error input,
.db-page-form [data-field].has-error select { border-color: #ff6b7a; }
.db-page-period, .db-page-form [data-field="prizes"] { margin-top: 18px; }
.db-page-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; margin: 18px 0 8px; }
.db-page-facts dt { font-family: var(--mono); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.db-page-facts dd { margin: 4px 0 0; overflow-wrap: anywhere; color: var(--soft); }
.db-page-facts a { color: var(--text); }
.db-page-savebar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(15, 17, 24, 0.94);
  backdrop-filter: blur(8px);
}
.db-page-savebar .jn-note { margin: 0; }
.db-page-savebar .jn-note[data-state="dirty"] { color: var(--gold); }
.db-page-savebar .jn-note[data-tone="bad"] { color: #ff6b7a; }
.db-page-preview { position: sticky; top: 16px; display: grid; gap: 10px; }
.db-page-preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.db-page-preview-head .db-subhead { margin: 0; }

.db-pv {
  --pv-accent: #f2c14e;
  --pv-bg: #07080c;
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background-color: var(--pv-bg);
  background-size: cover;
  background-position: center;
  color: #eef0f6;
  overflow: hidden;
}
.db-pv-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.db-pv-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; }
.db-pv-brand { display: block; font-weight: 800; overflow-wrap: anywhere; }
.db-pv-tagline { display: block; font-size: 0.78rem; opacity: 0.75; overflow-wrap: anywhere; }
.db-pv-title { margin: 6px 0 0; font-family: var(--display); font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
.db-pv-period { margin: 0; font-family: var(--mono); font-size: 0.75rem; opacity: 0.75; }
.db-pv-prizes { display: grid; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }
.db-pv-prizes li { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.06); font-family: var(--mono); font-size: 0.82rem; }
.db-pv-prizes li:first-child { border: 1px solid var(--pv-accent); }
.db-pv-prizes li:first-child b { color: var(--pv-accent); }
.db-pv-join { justify-self: start; padding: 8px 14px; border-radius: 8px; background: var(--pv-accent); color: #14110a; font-weight: 700; font-size: 0.85rem; }
.db-pv[data-theme="minimal"] { color: #14161c; }
.db-pv[data-theme="minimal"] .db-pv-prizes li { background: rgba(0, 0, 0, 0.06); }
.db-pv[data-theme="terminal"] { font-family: var(--mono); }
.db-pv[data-theme="terminal"] .db-pv-title { font-family: var(--mono); }
.db-pv[data-theme="8bit"] { border-radius: 0; }
.db-pv[data-theme="8bit"] .db-pv-prizes li, .db-pv[data-theme="8bit"] .db-pv-join { border-radius: 0; }

@media (max-width: 960px) {
  .db-page-layout { grid-template-columns: minmax(0, 1fr); }
  .db-page-preview { position: static; order: -1; }
}
.db-page-form select,
.db-page-form .jn-contact input,
.db-page-form .jn-prizes input,
.db-page-form .jn-subfield input {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  min-width: 0;
}
.db-page-form .jn-prizes input { font-family: var(--mono); }
.db-page-form select:focus,
.db-page-form .jn-contact input:focus,
.db-page-form .jn-prizes input:focus,
.db-page-form .jn-subfield input:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.db-page-form > .db-board + .db-board { padding-top: 22px; border-top: 1px solid var(--line); }

/* Creator Studio */
.st-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 14px 0; }
.st-pick, .st-name { display: flex; flex-direction: column; gap: 6px; min-width: min(280px, 100%); }
.st-pick select, .st-name input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.st-name { margin-bottom: 12px; max-width: 420px; }
.st-url-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0 18px; }
.st-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
.st-widgets { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.st-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--bg-raised); }
.st-card.is-on { border-color: var(--gold); }
.st-card header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.st-card h3 { margin: 0; font-size: 1rem; }
.st-card.is-soon { opacity: 0.6; }
.st-upload { display: grid; gap: 6px; grid-column: 1 / -1; }
.st-upload-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.st-plus { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--gold); color: #0b0b10; font-size: 0.72rem; font-weight: 700; text-decoration: none; }
.st-soon { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.st-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.st-fields { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
.st-fields legend { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.st-fields[disabled] { opacity: 0.5; }
.st-box { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.st-side { position: sticky; top: 12px; min-width: 0; }
.st-preview {
  position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; min-height: 120px;
  background-color: #0b0d13;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.06) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.06) 75%),
    linear-gradient(45deg, rgba(255,255,255,0.06) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.06) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
}
.st-stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.st-frame { position: absolute; border: 0; background: transparent; color-scheme: normal; outline: 1px dashed rgba(255,255,255,0.25); }
.st-preview-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: 0.9rem; }
.st-preview-empty[hidden] { display: none; }
.st-savebar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 12px 16px; margin-top: 18px; border: 1px solid var(--line); border-radius: 10px; background: rgba(15, 17, 24, 0.94); }
.st-savebar.is-dirty { border-color: var(--gold); }
@media (max-width: 900px) {
  .st-layout { grid-template-columns: 1fr; }
  .st-side { position: static; order: -1; }
  .st-box { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tips tab */
.tps-switch { display: inline-flex; align-items: center; gap: 10px; margin: 14px 0 6px; font-weight: 700; cursor: pointer; }
.tps-switch input { width: 18px; height: 18px; }
#tp-wallet { overflow-wrap: anywhere; }
#tp-url-row { margin: 12px 0; }
.tps-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px; }
.tps-total { margin: 0; font-weight: 800; }
.tps-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tp-row { display: grid; grid-template-columns: auto auto auto 1fr; gap: 4px 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-raised); }
.tp-row.is-pending { opacity: 0.8; }
.tp-row.is-failed { opacity: 0.6; }
.tp-amt { font-weight: 800; }
.tp-name { font-weight: 700; overflow-wrap: anywhere; }
.tp-msg { overflow-wrap: anywhere; white-space: pre-wrap; }
.tp-none { opacity: 0.6; }
.tp-meta { grid-column: 1 / -1; font-size: 0.8rem; opacity: 0.7; }
.tp-row a { color: inherit; }
@media (max-width: 560px) { .tp-row { grid-template-columns: auto 1fr; } .tp-msg { grid-column: 1 / -1; } }
.tps-alerts { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.tps-alerts h3 { margin: 0 0 6px; font-size: 1.1rem; }
.tps-alert-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 10px 0 6px; }
.tps-min { display: flex; flex-direction: column; gap: 6px; }
.tps-input { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.tps-input input { width: 8ch; padding: 9px 0; border: 0; background: transparent; color: var(--text); font: inherit; outline: none; }
.tps-goal-name { flex: 1 1 220px; min-width: 0; }
.tps-goal-name input { width: 100%; box-sizing: border-box; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }

/* Dashboard → Discord */
.dc-events { display: grid; gap: 8px; margin: 14px 0; padding: 0; border: 0; }
.dc-events legend { font-weight: 700; margin-bottom: 6px; }
.dc-num { width: 6em; }
#dc-status[data-tone="bad"] { color: #ff6b6b; }

/* Free tier: locked paid-only sections (web/src/paid-locks.ts). */
[data-paid].is-locked > :not(.db-locked) { opacity: 0.45; pointer-events: none; }
.db-locked { margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; background: rgba(184, 242, 92, 0.08); border: 1px solid rgba(184, 242, 92, 0.35); font-size: 14px; }
.db-locked-cta { font-weight: 700; color: #b8f25c; }
.db-free { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(184, 242, 92, 0.35); background: rgba(184, 242, 92, 0.06); }
.db-free p { margin: 0; flex: 1 1 260px; }

/* Chat leaderboard */
.db-ca-settings { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin: 8px 0 16px; }
.db-ca-settings input[type="number"] { width: 4.5em; }
.db-ca-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.db-ca-row { display: flex; gap: 10px; align-items: baseline; }
.db-ca-row .ca-rank { min-width: 1.8em; opacity: 0.7; }
.db-ca-row .ca-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.db-ca-row .ca-platform { font-size: 0.8em; opacity: 0.7; }
.db-ca-row .ca-count { font-weight: 700; }

/* A page without a race leaderboard ("stream tools only"): race-only parts are not shown. */
body.is-tools .db-board-only { display: none !important; }
body:not(.is-tools) .db-tools-only { display: none !important; }

/* Dashboard → Bonus hunt → Prediction (!pred) */
.pd-state { margin: 4px 0 10px; font-weight: 600; }
.pd-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 10px 0; }
.pd-row[hidden] { display: none; }
.pd-note { flex: 1 1 240px; min-width: 0; }
.pd-note input { width: 100%; box-sizing: border-box; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.pd-list { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; max-height: 320px; overflow: auto; }
.pd-list li { display: grid; grid-template-columns: 2.2em 1fr auto auto; gap: 10px; align-items: baseline; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--text) 4%, transparent); }
.pd-list li.is-winner { background: color-mix(in srgb, var(--gold, #f2c14e) 18%, transparent); }
.pd-list .pd-rank { color: var(--muted); font-family: var(--mono, monospace); }
.pd-list .pd-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.pd-list .pd-off { color: var(--muted); font-size: 0.85rem; }

/* Studio preview: drag handles over the frames */
.st-frame { pointer-events: none; }
.st-frame.is-full { outline: none; }
.st-handle { z-index: 2; }
.st-handle.is-under { z-index: 1; border-style: dashed; border-color: rgba(255, 255, 255, 0.35); }
.st-template-info:empty { display: none; }
.st-handle { position: absolute; box-sizing: border-box; border: 2px solid transparent; border-radius: 6px; cursor: move; touch-action: none; outline: none; }
.st-handle:hover, .st-handle:focus-visible, .st-handle.is-active { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 8%, transparent); }
.st-handle-name { position: absolute; top: 0; left: 0; transform: translateY(-100%); padding: 6px 14px; border-radius: 10px 10px 0 0; background: var(--gold); color: #0b0b10; font: 700 30px/1.2 var(--display, system-ui); white-space: nowrap; opacity: 0; pointer-events: none; }
.st-handle:hover .st-handle-name, .st-handle:focus-visible .st-handle-name, .st-handle.is-active .st-handle-name { opacity: 1; }
.st-resize { position: absolute; right: -22px; bottom: -22px; width: 44px; height: 44px; border-radius: 10px; background: var(--gold); cursor: nwse-resize; opacity: 0; }
.st-handle:hover .st-resize, .st-handle:focus-visible .st-resize, .st-handle.is-active .st-resize { opacity: 1; }
.st-stage.is-dragging { cursor: grabbing; }
.st-stage.is-dragging .st-handle { cursor: grabbing; }
.st-card.is-picked { box-shadow: 0 0 0 2px var(--gold); }
.st-preview-head { flex-wrap: wrap; gap: 6px 12px; }
.st-preview-tools { display: inline-flex; gap: 8px; margin-left: auto; align-items: center; }
.st-big-only { display: none; }
/* Big editor: settings on the left, a large preview on the right, Save at the bottom */
#st-editor.is-big { position: fixed; inset: 0; z-index: 200; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; padding: 12px 16px; background: var(--bg); }
#st-editor.is-big > .st-name, #st-editor.is-big > #st-urls, #st-editor.is-big > .st-url-actions { display: none; }
#st-editor.is-big .st-layout { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); min-height: 0; height: 100%; align-items: stretch; }
#st-editor.is-big .st-widgets { overflow: auto; min-height: 0; padding-right: 4px; }
#st-editor.is-big .st-side { position: static; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
#st-editor.is-big .st-big-only { display: inline-flex; }
#st-editor.is-big .st-big-only[hidden] { display: none; }
#st-editor.is-big .st-preview { width: min(100%, calc((100vh - 140px) * 16 / 9)); margin: 0 auto; }
#st-editor.is-big .st-savebar { position: static; margin: 0; }
#st-editor:fullscreen { background: var(--bg); }
body.st-big-open { overflow: hidden; }
@media (max-width: 900px) {
  #st-editor.is-big { overflow: auto; grid-template-rows: auto auto; }
  #st-editor.is-big .st-layout { grid-template-columns: 1fr; height: auto; }
  #st-editor.is-big .st-widgets { overflow: visible; }
  #st-editor.is-big .st-preview { width: 100%; }
}

/* Dashboard → Chat bot → Chat queue */
.cq-list li { grid-template-columns: 2.2em 1fr auto auto; }
.md-owner-id { flex: 1 1 280px; }
.md-owner-id input, #md-owner-name { width: 100%; box-sizing: border-box; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.md-owner-list li { grid-template-columns: 7.5em 1fr auto auto; }
.md-owner-list small, #md-owner-log small { color: var(--muted); margin-left: 6px; word-break: break-all; }
.md-owner-logtitle { margin: 18px 0 4px; font-size: 0.95rem; }
.db-mod-banner { margin: 0 0 14px; }
.cq-list li.is-done { opacity: 0.55; }
.cq-list li.is-done .pd-name { text-decoration: line-through; }
.cq-list small { color: var(--muted); font-weight: 400; margin-left: 6px; }

/* Studio, free plan: the starter note and the badge in the preview (1920×1080 canvas pixels). */
.st-free { margin: 0 0 14px; }
.st-badge { position: absolute; right: 22px; bottom: 22px; z-index: 3; padding: 9px 18px; border-radius: 999px; background: rgba(7, 8, 12, 0.86); color: #f4f6fb; font: 700 26px/1 system-ui, sans-serif; box-shadow: 0 0 0 2px rgba(184, 242, 92, 0.55); pointer-events: none; }
.st-badge::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 10px; border-radius: 50%; background: #b8f25c; }
