:root {
  color-scheme: light;

  --bg: #232c3d;
  --card-bg: #ffffff;

  --text: #0f172a;
  --muted: #64748b;

  --primary: #d70651;
  --primary-hover: #ad0442;
  --primary-active: #810332;

  --border: rgba(15, 23, 42, 0.12);
  --ring: rgba(155, 6, 105, 0.38);

  --btn-label: #ffffff;

  --radius: 8px;
  --shadow: 0 18px 50px #00000047;

  --page-pad: 24px;

  --btn-pad-y: 0px;
  --btn-pad-x: 16px;
  --btn-radius: 8px;

  /* Neutral surfaces derived from your theme */
  --surface-1: rgba(0, 0, 0, 0.04);
  --surface-2: rgba(0, 0, 0, 0.06);
  --divider: rgba(0, 0, 0, 0.12);

  /* Embed layout */
  --embed-pad: 14px;
  --embed-pad-bottom: 18px;
  --embed-head-h: 46px;
  --embed-title-size: 14px;
  --embed-sub-size: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: var(--page-pad);

  background-color: var(--bg);
  background-image: url("/images/background-pattern.png");
  background-repeat: no-repeat;
  background-position: top center;
  background-size: auto;

  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
}

/* Shell centers content by default */
.auth-shell {
  width: 100%;
  min-height: calc(100vh - (var(--page-pad) * 2));
  display: grid;
  place-items: center;
}

/* Internal app pages: top-align with spacing */
.auth-shell.top {
  place-items: start center;
  margin-top: 48px;
}

/* Cards */
.auth-card {
  width: min(420px, 92vw);
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);

  padding: 28px 32px 32px;
  display: grid;
  gap: 18px;

  text-align: left;
}

.app-card {
  width: min(900px, 92vw);
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);

  padding: 28px 32px 32px;
  display: grid;
  gap: 18px;

  text-align: left;
}

/* Logo */
.auth-img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
}

/* Titles */
.auth-title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.auth-subtitle {
  margin: -8px 0 8px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

/* Text blocks */
.normal-text {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  text-align: left;
}

.normal-text.emphasis {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
  font-size: 13px;
}

/* Buttons */
.main-btn {
  width: 100%;
  height: 36px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: var(--btn-pad-y) var(--btn-pad-x);
  text-decoration: none;
  border-radius: var(--btn-radius);

  background: var(--primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;

  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.main-btn:hover {
  background: var(--primary-hover);
}

.main-btn:active {
  transform: translateY(1px);
  background: var(--primary-active);
}

.main-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

/* Smaller button variant */
.main-btn.small {
  width: auto;
  height: 32px;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  box-shadow: none;
  border-radius: var(--btn-radius);
}

/* Compact fixed-size button (use max-width, not hard width) */
.main-btn.small.fixed {
  max-width: 150px;
  height: 28px;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  border-radius: var(--btn-radius);
}

/* Button label */
.label {
  font-size: 14px;
  font-weight: 600;
  color: var(--btn-label);
}

.main-btn.small.fixed .label,
.main-btn.small.fixed .label span {
  font-size: 12px;
}

/* Navbar */
.navbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
}

.nav-left,
.nav-right {
  display: flex;
  gap: 20px;
}

.navbar a {
  color: var(--muted);
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
}

.navbar a:hover {
  color: var(--primary);
}

.navbar a.selected {
  color: var(--primary);
  font-weight: 600;
}

/* Embed container on app pages */
.embed-wrap {
  width: 100%;
  margin-top: 12px;
  display: grid;
  place-items: center;
}

.embed-box {
  width: 100%;
  height: 500px;
  border-radius: var(--radius);
  background: var(--card-bg);
  overflow: hidden;
}

.embed-box iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

@media (max-width: 560px) {
  .embed-box {
    width: 100%;
    height: min(500px, 70vh);
  }
}

/* JSON/code output box */
.code-box {
  width: 100%;
  max-width: 100%;

  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;

  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--divider);
  background: var(--surface-1);

  text-align: left;
}

/* Page 3: settings (CSP-safe, no inline styles) */
.settings-grid {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.settings-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 12px;
}

.settings-label {
  margin: 0;
}

.settings-input {
  width: 160px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: var(--card-bg);
  color: var(--text);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 6px;
}

#themeOut.code-out {
  margin-top: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Expandable block */
.expand-block {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  text-align: left;
}

.expand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

/* Hidden content box */
.expand-content {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--divider);
  background: var(--surface-1);
}

/* ------------------------------------------------------------
   Feature lists (Usage + Competitors aligned)
   ------------------------------------------------------------ */

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.feature-list li {
  text-align: left;
}

.feature-list strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.feature-list p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.feature-list > li > a {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 4px;
}

.feature-list:not(.numbered) > li > a {
  display: block;
}

.feature-list > li > a:hover {
  text-decoration: underline;
}

.feature-sublist {
  margin: 0;
  padding-left: 18px;
  list-style: disc;
}

.feature-sublist > li {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 6px 0;
}

.feature-list.numbered {
  counter-reset: item;
}

.feature-list.numbered > li {
  counter-increment: item;
}

.feature-list.numbered > li::before {
  content: counter(item) ". ";
  font-weight: 600;
  color: var(--text);
}

.feature-list.numbered > li > a {
  display: inline-block;
}

.feature-title {
  font-weight: 600;
}

/* Competitor name (title link) */
.feature-list.competitor-list .competitor-content > a {
  display: inline-block;
  font-size: 16px;     /* make it clearly visible */
  font-weight: 700;    /* slightly stronger */
  margin: 0 0 6px 0;
  color: var(--primary);
  text-decoration: none;
}

.feature-list.competitor-list .competitor-content > a:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}

/* ------------------------------------------------------------
   Embed pages (iframes): transparent so parent container shows through
   ------------------------------------------------------------ */

html:has(body.embed-body),
body.embed-body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;

  background: transparent;
  color: var(--text);
}

body.embed-body .embed-stage {
  width: 100%;
  height: 100vh;
  box-sizing: border-box;

  padding: var(--embed-pad) var(--embed-pad) var(--embed-pad-bottom);
  background: transparent;
}

body.embed-body .embed-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

body.embed-body .embed-title {
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: var(--embed-title-size);
}

body.embed-body .embed-sub {
  font-size: var(--embed-sub-size);
  opacity: 0.75;
}

body.embed-body .embed-chart {
  width: 100%;
  height: calc(100vh - var(--embed-head-h));
}

body.embed-body .embed-svg {
  display: block;
  width: 100%;
  height: 100%;
}

body.embed-body .embed-error {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  font-size: 12px;
  overflow: auto;

  border: 1px solid var(--divider);
  background: var(--surface-2);
}

/* ------------------------------------------------------------
   Competitor
   ------------------------------------------------------------ */

.competitor-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 1.25rem;
  align-items: flex-start;
}

.competitor-logo {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.competitor-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ------------------------------------------------------------
   Image
   ------------------------------------------------------------ */

.img {
  display: block;
  margin: 30px auto 0;
  max-width: 100%;
  object-fit: contain;

  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--surface-1);
}
