:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --ink: #16150f;
  --muted: #6f6b60;
  --line: #e4e0d6;
  --accent: #16150f;
  --accent-ink: #f7f6f2;
  --danger: #b3261e;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 24px;
  background: rgba(247, 246, 242, 0.86);
  backdrop-filter: blur(12px);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.brand .dot {
  color: #c2410c;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}

.pill.zero {
  color: #9a3412;
  border-color: #fed7aa;
  background: #fff7ed;
}

.ghost {
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

.ghost:hover {
  color: var(--ink);
  background: var(--surface);
}

main {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.empty {
  max-width: 720px;
  margin: 14vh auto 0;
  text-align: center;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.sub {
  margin: 0 auto 28px;
  max-width: 540px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.scope-line {
  margin: 16px 0 0;
  color: #a8a294;
  font-size: 12px;
  letter-spacing: 0.01em;
}

.github-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.github-btn:hover {
  opacity: 0.9;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: #9a3412;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.auth-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.auth-row.top-auth {
  flex-direction: row;
  margin-top: 0;
}

.top-auth .github-btn {
  min-width: 0;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.top-user {
  margin: 0;
  white-space: nowrap;
}

/*
 * The Social Bar iframe is fixed at top:10px with the maximum z-index. Keep it
 * below the sticky header so the top-bar sign-in and New button stay clickable.
 */
iframe[id^="container-adbb067b7012dcdfb058fbd5e959f9de"] {
  top: 78px !important;
}

.auth-note {
  color: #a8a294;
  font-size: 12px;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 10px 10px 16px;
  box-shadow:
    0 1px 2px rgba(20, 18, 12, 0.04),
    0 8px 30px rgba(20, 18, 12, 0.04);
}

.composer:focus-within {
  border-color: #c9c3b4;
  box-shadow: 0 0 0 4px rgba(22, 21, 15, 0.06);
}

textarea {
  flex: 1;
  min-height: 40px;
  max-height: 180px;
  padding: 10px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
}

textarea::placeholder {
  color: #a8a294;
}

.send {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 18px;
  cursor: pointer;
}

.send:disabled {
  opacity: 0.4;
  cursor: default;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}

.chips button {
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
}

.chips button:hover {
  color: var(--ink);
  background: var(--surface);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.55fr);
  grid-template-areas:
    "bar bar"
    "thread stage"
    "bottom bottom"
    "composer composer";
  column-gap: 24px;
  max-width: 1224px;
  margin: 24px auto 0;
  align-items: start;
}

.thread {
  grid-area: thread;
}

.repo-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin: 0 auto 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.repo-button:hover {
  border-color: #c9c3b4;
}

.repo-button:disabled {
  opacity: 0.6;
  cursor: default;
}

.repo-mark {
  color: #c2410c;
  font-size: 11px;
}

.repo-chevron {
  color: #a8a294;
  font-size: 10px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 21, 15, 0.45);
  backdrop-filter: blur(2px);
}

.modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(70vh, 640px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(20, 18, 12, 0.24);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
}

.modal-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.repo-search {
  width: calc(100% - 36px);
  margin: 0 18px 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfaf7;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.repo-search:focus {
  outline: none;
  border-color: #c9c3b4;
  background: var(--surface);
}

.repo-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px 8px;
  overflow: auto;
}

.repo-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.repo-item:hover {
  background: #fbfaf7;
}

.repo-item.selected {
  border-color: #f0c9a8;
  background: #fff7ed;
}

.repo-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.repo-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.repo-private {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
}

.repo-desc {
  overflow: hidden;
  color: #a8a294;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repo-empty {
  padding: 22px 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--line);
}

.modal-hint {
  color: #a8a294;
  font-size: 11px;
}

.push-panel {
  width: min(430px, 100%);
  padding-bottom: 16px;
}

.push-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 18px 0;
  color: var(--muted);
  font-size: 12px;
}

.push-field input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.push-field input:focus {
  border-color: #c9c3b4;
  outline: 2px solid rgba(194, 65, 12, 0.12);
}

.push-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px 0;
  font-size: 13px;
}

.push-status {
  min-height: 18px;
  margin: 10px 18px 0;
  color: var(--danger);
  font-size: 12px;
}

.push-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 18px 0;
}

.push-submit {
  padding: 8px 14px;
  border: 1px solid #c2410c;
  border-radius: 9px;
  background: #c2410c;
  color: #fff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.push-submit:disabled {
  opacity: 0.55;
  cursor: wait;
}

.msg-agent {
  align-self: flex-start;
  max-width: 85%;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}

.markdown {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}

.markdown > :first-child {
  margin-top: 0;
}

.markdown > :last-child {
  margin-bottom: 0;
}

.markdown p {
  margin: 0 0 8px;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  margin: 12px 0 6px;
  font-weight: 650;
  line-height: 1.3;
}

.markdown h1,
.markdown h2 {
  font-size: 16px;
}

.markdown h3,
.markdown h4 {
  font-size: 14px;
}

.markdown h5,
.markdown h6 {
  font-size: 13px;
}

.markdown ul,
.markdown ol {
  margin: 4px 0 10px;
  padding-left: 20px;
}

.markdown li {
  margin: 2px 0;
}

.markdown li > p {
  margin: 0;
}

.markdown code {
  padding: 1px 4px;
  border-radius: 4px;
  background: #f2efe7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.markdown pre {
  margin: 8px 0;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.markdown pre code {
  padding: 0;
  background: none;
  font-size: 11px;
  line-height: 1.55;
}

.markdown a {
  color: #9a3412;
  text-decoration: underline;
}

.markdown strong {
  font-weight: 650;
}

.markdown hr {
  margin: 12px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tool-chip {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

.ask-card {
  padding: 14px 16px;
  border: 1px solid #f0c9a8;
  border-radius: 14px;
  background: #fffaf3;
}

.ask {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 24px;
  background: rgba(247, 246, 242, 0.94);
  backdrop-filter: blur(4px);
}

/*
 * When a question and an ad are live at the same time, split the stage: the
 * ad keeps playing (and stays visible) on the left, the question sits on the
 * right. Never cover the ad with the dialog.
 */
.stage.split .ad {
  right: 46%;
}

.stage.split .ask {
  left: 54%;
  padding: 14px;
  background: var(--bg);
  backdrop-filter: none;
}

.stage.split .ask-dialog {
  max-width: 100%;
  box-shadow: none;
}

@media (max-width: 760px) {
  .stage.split .ad {
    right: 0;
    bottom: 54%;
  }

  .stage.split .ask {
    top: 46%;
    left: 0;
    padding: 10px;
  }
}

.ask-dialog {
  width: 100%;
  max-width: 560px;
  padding: 18px 20px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  outline: none;
  box-shadow:
    0 1px 2px rgba(20, 18, 12, 0.05),
    0 18px 50px rgba(20, 18, 12, 0.14);
}

.ask-kicker {
  margin-bottom: 6px;
  color: #9a3412;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.ask-title-text {
  margin-bottom: 14px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.ask-field-title {
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.ask-option-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}

.ask-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.ask-option:hover {
  border-color: #c9c3b4;
  background: #fbfaf7;
}

.ask-option.selected {
  border-color: #9a3412;
  background: #fff7ed;
}

.ask-num {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.ask-option.selected .ask-num {
  border-color: #9a3412;
  color: #9a3412;
}

.ask-custom {
  width: 100%;
  margin: 4px 0 2px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfaf7;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.ask-custom:focus {
  outline: none;
  border-color: #c9c3b4;
  background: var(--surface);
}

.ask-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: #a8a294;
  font-size: 10px;
}

.ask-hints {
  letter-spacing: 0.02em;
}

.ask-submit {
  width: auto;
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.ask-resources {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  word-break: break-all;
}

.ask-reject {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.ask-reject textarea {
  width: 100%;
  min-height: 64px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfaf7;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  resize: vertical;
}

.ask-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ask-title {
  margin-bottom: 6px;
  color: #9a3412;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ask-text {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.ask-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ask-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.ask-field input[type="text"],
.ask-field input[type="number"],
.ask-field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.ask-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.ask-field small {
  color: #a8a294;
}

.ask-submit {
  align-self: flex-start;
  width: auto;
  height: 34px;
  padding: 0 14px;
  font-size: 12px;
}

.ask-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ask-resources {
  margin: -4px 0 10px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  word-break: break-all;
}

.ghost.danger {
  color: #b3261e;
  border-color: #f3c6c2;
}

.diff {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 16px 18px;
}

.diff-summary {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.result-summary {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.result-summary > h3 {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.result-output {
  margin: 7px 0 0;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.diff-file {
  margin-bottom: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.diff-file summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: #fbfaf7;
  cursor: pointer;
  font-size: 12px;
}

.fname {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.stat {
  color: var(--muted);
}

.patch {
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  background: #fff;
  color: #3f3a30;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.pr-link a {
  color: #9a3412;
  font-size: 12px;
  text-decoration: none;
}

.pr-link a:hover {
  text-decoration: underline;
}

.stage-bar {
  grid-area: bar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 8px;
}

.file-name {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.stage-actions {
  display: flex;
  gap: 6px;
}

.stage-actions .ghost {
  padding: 4px 10px;
  font-size: 11px;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 360px;
  max-height: 70vh;
  padding: 14px;
  overflow-y: auto;
  align-self: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.thread-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-user {
  position: relative;
  align-self: flex-end;
  max-width: 80%;
  max-height: 64px;
  padding: 10px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  cursor: pointer;
}

.msg-user.expanded {
  max-height: none;
}

.msg-user:not(.expanded)::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 20px;
  background: linear-gradient(to bottom, transparent, var(--surface));
  content: "";
  pointer-events: none;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c2410c;
  animation: pulse 1.2s ease-in-out infinite;
}

.status.error {
  color: var(--danger);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

.stage {
  grid-area: stage;
  position: relative;
  width: 100%;
  min-height: 480px;
  max-height: 70vh;
  overflow: hidden;
  align-self: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stage.previewing {
  min-height: 570px;
  max-height: 80vh;
}

.stage.ad-live {
  min-height: 520px;
}

.preview {
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f4f2ec;
}

.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf7;
  color: var(--muted);
  font-size: 11px;
}

.preview-tag {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.preview iframe {
  display: block;
  width: calc(100% - 20px);
  height: 420px;
  margin: 10px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(40, 35, 25, 0.08);
}

.diff-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.ad {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: #0a0a0a;
  color: #fff;
}

/* The HilltopAds slider is a separate floating video; hide it during the gate. */
body.ad-gate-active .rmp-container {
  display: none !important;
}

/* And keep it off the workspace/result screens, where it covers the composer. */
body.workspace-active .rmp-container {
  display: none !important;
}

.ad-top {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.ad-badge {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 1px 6px;
}

.ad-wall {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 0;
  padding: 4px 16px;
  overflow-y: auto;
}

.ad-bottom {
  flex: 0 0 auto;
  padding: 8px 18px 4px;
}

.ad-bottom p {
  margin: 0 0 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.bar {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

#ad-bar {
  width: 0;
  height: 100%;
  background: #fff;
  transition: width 0.2s linear;
}

.ad-times {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

.ad-queue {
  min-height: 14px;
  margin-top: 4px;
  color: #fdba74;
  font-size: 11px;
  letter-spacing: 0.01em;
}

.ad-video-shell {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 0;
  padding: 4px 16px;
}

.ad-video-container {
  position: relative;
  width: min(600px, 100%);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 10px;
  background: #000;
}

.ad-video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
}

.ad-video-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: min(600px, 100%);
  min-height: 18px;
}

.ad-video-loading {
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
}

.ad-mute {
  padding: 3px 9px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.ad-skip {
  margin-left: auto;
  padding: 3px 9px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.ad-skip:disabled {
  cursor: default;
  color: rgba(255, 255, 255, 0.35);
}

.ad-mute:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}

.ad-note {
  display: none;
  padding: 10px 16px;
  font-size: 10px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.35);
}

.building {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--line);
  border-top-color: #c2410c;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.composer-slot {
  grid-area: composer;
  margin-top: 16px;
}

.gate-hint {
  margin: 0 0 8px;
  color: #9a3412;
  font-size: 12px;
  text-align: center;
}

/* ---------- placements ---------- */

.workspace-bottom-ad {
  grid-area: bottom;
  margin-top: 12px;
}

.placement-bottom {
  align-items: center;
  margin: 0 auto;
}

.placement-bottom-mobile {
  display: none;
}

.placement {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.placement-label {
  color: #a8a294;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.adlab-note {
  max-width: 720px;
  margin: 0 auto 16px;
  padding: 8px 12px;
  border: 1px dashed #c9c3b4;
  border-radius: 10px;
  background: #fffaf3;
  color: #9a3412;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.support-wall {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 22, 18, 0.76);
  backdrop-filter: blur(6px);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.support-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(420px, 100%);
  padding: 28px 26px;
  border: 1px solid #e6e0d2;
  border-radius: 18px;
  background: #fffdf7;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}

.support-card strong {
  font-size: 18px;
  line-height: 1.3;
}

.support-card .link {
  padding: 9px 18px;
  border: 1px solid #b3261e;
  border-radius: 999px;
  background: #b3261e;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.support-card .link:hover,
.support-card .link:focus-visible {
  border-color: #8f1d17;
  background: #8f1d17;
}

body.adblocked {
  overflow: hidden;
}

.placement-smartlink {
  max-width: 560px;
  margin: 12px auto 0;
}

.placement-link {
  color: var(--ink);
  text-decoration: none;
}

.placement-link:hover {
  border-color: #c9c3b4;
}

.placement-link .placement-cta {
  cursor: pointer;
}

.placement-wall,
.placement-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.placement-wall-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.placement-banner-frame {
  display: block;
  max-width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

.placement[data-banner="728x90"] {
  display: none;
}

.placement[data-banner="468x60"] {
  display: none;
}

.placement[data-banner="160x600"] {
  display: none;
}

.placement-banner-728-90 {
  display: none;
}

.placement-banner-468-60 {
  display: none;
}

.placement-banner-160-600 {
  display: none;
}

@media (min-width: 560px) {
  .placement[data-banner="468x60"],
  .placement-banner-468-60 {
    display: flex;
  }
}

@media (min-width: 820px) {
  .placement[data-banner="728x90"],
  .placement-banner-728-90 {
    display: flex;
  }
}

@media (min-width: 1150px) {
  .placement[data-banner="160x600"],
  .placement-banner-160-600 {
    display: flex;
  }
}

.placement-landing-banner,
.placement-landing-mobile {
  max-width: 560px;
  margin: 8px auto 0;
}

.placement-result {
  align-items: center;
  margin: 10px 0 12px;
}

.placement-result-mobile {
  display: none;
}

@media (max-width: 559px) {
  #placement-result,
  #placement-bottom {
    display: none;
  }

  .placement-result-mobile,
  .placement-bottom-mobile {
    display: flex;
  }
}

.placement-global {
  position: absolute;
  left: -10000px;
  top: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.placement-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 18, 12, 0.03);
}

.placement-media {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  min-height: 110px;
  padding: 13px;
  overflow: hidden;
  border-radius: 10px;
  background:
    radial-gradient(circle at 82% 12%, rgba(194, 65, 12, 0.34), transparent 46%),
    #16150f;
  color: var(--accent-ink);
}

.placement-mark {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.placement-mark .dot {
  color: #fb923c;
}

.placement-tagline {
  color: rgba(247, 246, 242, 0.55);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.placement-kicker {
  color: #9a3412;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.placement-headline {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.placement-body {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.placement-cta {
  align-self: flex-start;
  margin-top: 2px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.placement-cta:hover {
  border-color: #c9c3b4;
  background: var(--surface);
}

.placement-note {
  color: #a8a294;
  font-size: 10px;
}

.placement-landing {
  max-width: 560px;
  margin: 22px auto 0;
  text-align: left;
}

.placement-card.compact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "kicker cta"
    "headline cta"
    "body cta";
  align-items: center;
  gap: 2px 16px;
  padding: 12px 14px;
}

.placement-card.compact .placement-kicker {
  grid-area: kicker;
}

.placement-card.compact .placement-headline {
  grid-area: headline;
  font-size: 15px;
}

.placement-card.compact .placement-body {
  grid-area: body;
}

.placement-card.compact .placement-cta {
  grid-area: cta;
  align-self: center;
}

.placement-build {
  display: flex;
  flex: 0 0 auto;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 16px 0;
}

.placement-build .placement-label {
  display: none;
  color: rgba(255, 255, 255, 0.38);
  white-space: nowrap;
}

.placement-build .placement-card.compact {
  flex: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "kicker headline";
  align-items: center;
  gap: 2px 12px;
  padding: 8px 12px;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.placement-build .placement-kicker {
  grid-area: kicker;
  color: #fb923c;
}

.placement-build .placement-headline {
  grid-area: headline;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}

.placement-build .placement-body {
  display: none;
}

.placement-build .placement-network {
  flex: 1;
}

.placement-network {
  overflow: hidden;
  border-radius: 12px;
}

.placement-network img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.placement-native {
  position: relative;
  overflow: visible;
}

.placement-native-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  align-content: center;
}

.placement-native-container {
  position: relative;
  z-index: 1;
  width: 100%;
  pointer-events: none;
}

.placement-native.has-ad .placement-native-container {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 18, 12, 0.03);
  pointer-events: auto;
}

.placement-native.has-ad .placement-native-fallback {
  display: none;
}

.placement-frame {
  display: block;
  width: 100%;
  height: 250px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
}

@media (max-width: 1150px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "thread"
      "bar"
      "stage"
      "bottom"
      "composer";
    max-width: 900px;
  }

  .thread {
    min-height: 0;
    max-height: 30vh;
    margin-bottom: 16px;
  }
}

.footer {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 28px;
  font-size: 11px;
  color: #a8a294;
}

@media (max-width: 640px) {
  .topbar {
    gap: 10px;
  }

  .top-right {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .top-auth .github-btn {
    padding: 6px 9px;
    font-size: 11px;
  }

  .top-user {
    font-size: 11px;
  }

  .empty {
    margin-top: 8vh;
  }

  .stage {
    min-height: 420px;
    max-height: 70vh;
  }

  .stage.ad-live {
    min-height: 470px;
  }

  .stage.previewing {
    min-height: 520px;
    max-height: 85vh;
  }

  .preview iframe {
    height: 320px;
  }

  .placement-landing {
    margin-top: 18px;
  }

  .placement-card.compact {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "kicker"
      "headline"
      "body"
      "cta";
    gap: 3px;
  }

  .placement-card.compact .placement-cta {
    justify-self: start;
    margin-top: 7px;
  }

  .placement-build {
    gap: 6px;
    padding: 6px 10px 0;
  }

  .placement-build .placement-label,
  .placement-build .placement-kicker {
    display: none;
  }

  .placement-build .placement-card.compact {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "headline";
    padding: 7px 10px;
  }

  .placement-build .placement-headline {
    font-size: 12px;
  }

  .topbar,
  main,
  .footer {
    padding-right: 16px;
    padding-left: 16px;
  }
}
