:root,
[data-webbi-theme="dark"] {
  color-scheme: dark;
  --bg: var(--webbi-bg-canvas);
  --panel: var(--webbi-bg-surface);
  --panel-strong: var(--webbi-bg-raised);
  --line: var(--webbi-border-subtle);
  --text: var(--webbi-text-primary);
  --muted: var(--webbi-text-secondary);
  --soft: var(--webbi-text-muted);
  --accent: #7bdcb5;
  --accent-strong: #4fc89d;
  --warn: var(--webbi-status-warning);
  --brand-blue: var(--webbi-color-photon-cyan);
  --brand-gold: var(--webbi-color-utility-gold);
  --shadow: var(--webbi-shadow-lifted);
  font-family: var(--webbi-font-ui);
}

[data-webbi-theme="light"] {
  color-scheme: light;
  --bg: var(--webbi-bg-canvas);
  --panel: var(--webbi-bg-surface);
  --panel-strong: var(--webbi-bg-raised);
  --line: var(--webbi-border-subtle);
  --text: var(--webbi-text-primary);
  --muted: var(--webbi-text-secondary);
  --soft: var(--webbi-text-muted);
  --accent: var(--webbi-status-success);
  --accent-strong: #075d3c;
  --warn: var(--webbi-status-warning);
  --brand-blue: var(--webbi-link);
  --brand-gold: #7a5200;
  --shadow: var(--webbi-shadow-lifted);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(123, 220, 181, 0.08), transparent 32rem),
    var(--bg);
  color: var(--text);
}

@supports (padding: env(safe-area-inset-top)) {
  body {
    padding:
      env(safe-area-inset-top)
      env(safe-area-inset-right)
      env(safe-area-inset-bottom)
      env(safe-area-inset-left);
  }
}

button,
textarea,
.button-link {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.workbench {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 20, 27, 0.92);
  box-shadow: 0 24px 80px var(--shadow);
  overflow: hidden;
}

.site-signature {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin: 18px 0 4px;
  color: var(--webbi-signature-blue, #b8dfff);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-align: center;
}

.site-signature a {
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.site-signature a:hover,
.site-signature a:focus {
  color: var(--accent, #00b8ff);
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: #080b10;
}

.brand-lockup {
  min-width: 0;
  flex: 1 1 680px;
}

.brand-home-link {
  display: block;
  width: min(100%, 650px);
  margin-left: 50px;
  border-radius: 8px;
}

.brand-hero {
  display: block;
  width: 100%;
  height: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.eyebrow,
.card-label {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

h2 {
  font-size: 1.1rem;
}

.tagline {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.trust-meter {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.topbar > .trust-meter {
  margin-right: 0;
}

.topbar-side,
.help-actions {
  display: grid;
  justify-items: end;
  gap: 12px;
}

.topbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.theme-toggle {
  flex: 0 0 auto;
  min-width: 7.25rem;
}

.trust-meter span {
  border: 1px solid rgba(123, 220, 181, 0.32);
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--text);
  background: rgba(123, 220, 181, 0.08);
  font-size: 0.85rem;
}

.trust-meter span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 999px;
  background: var(--accent);
}

.language-picker {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
}

.language-picker select {
  min-height: 44px;
  border: 1px solid rgba(42, 168, 255, 0.78);
  border-radius: 8px;
  padding: 8px 34px 8px 12px;
  color: var(--brand-gold);
  background: #0b1722;
  font: inherit;
  font-weight: 700;
}

.language-picker select:focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: 3px;
}

.workspace-panel {
  display: grid;
}

.phase {
  grid-area: 1 / 1;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.phase-active {
  opacity: 1;
  transform: translateY(0);
}

.input-panel {
  padding: 28px;
  border-bottom: 1px solid var(--line);
}

.input-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.input-panel label {
  color: var(--text);
  font-size: 1.12rem;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--text);
  background: #090c12;
  line-height: 1.55;
  font-size: 1rem;
  outline: none;
}

textarea:focus {
  border-color: rgba(123, 220, 181, 0.72);
  box-shadow: 0 0 0 3px rgba(123, 220, 181, 0.11);
}

textarea::placeholder {
  color: #677386;
}

.panel-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.panel-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-notice {
  margin: 10px 0 0;
  color: var(--soft);
  font-size: 0.88rem;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid rgba(42, 168, 255, 0.78);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--brand-gold);
  background: rgba(24, 115, 181, 0.12);
  box-shadow: inset 0 0 0 1px rgba(42, 168, 255, 0.08);
  font-weight: 700;
  text-decoration: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-link:link,
.button-link:visited,
.button-link:hover,
.button-link:active {
  color: var(--brand-gold);
}

.button-link .button-label {
  color: var(--brand-gold);
}

.primary-button {
  border-color: rgba(64, 183, 255, 0.96);
  background: rgba(24, 115, 181, 0.34);
  color: #ffe08a;
  font-weight: 800;
}

.ghost-button,
.step-button {
  border-color: rgba(42, 168, 255, 0.7);
  background: rgba(24, 115, 181, 0.1);
}

.ghost-button:hover,
.step-button:hover,
.primary-button:hover:not(:disabled),
.button-link:hover {
  border-color: #65c5ff;
  background: rgba(24, 115, 181, 0.24);
  box-shadow: 0 0 0 2px rgba(42, 168, 255, 0.13);
  filter: brightness(1.1);
}

button:focus-visible,
.button-link:focus-visible,
.brand-home-link:focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: 3px;
}

.inspection-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 0;
}

.card {
  min-width: 0;
  padding: 24px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(16, 20, 27, 0.64);
}

.card:nth-child(2n) {
  border-right: 0;
}

.detection-card p:not(.card-label),
.preview-note {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.detection-card.warning-card {
  border-color: rgba(246, 196, 69, 0.76);
  background: linear-gradient(135deg, rgba(246, 196, 69, 0.12), rgba(16, 20, 27, 0.72));
  box-shadow: inset 4px 0 0 rgba(246, 196, 69, 0.9);
}

.detection-card.warning-card h2,
.warning-note {
  color: var(--brand-gold);
}

.warning-note {
  margin: 0;
  font-weight: 800;
  line-height: 1.45;
}

.file-notice.warning-note {
  margin-top: 10px;
}

.preview-note {
  margin: 0 0 12px;
  font-size: 0.92rem;
}

.result-meta {
  margin: 0 0 10px;
  color: var(--soft);
  font-size: 0.86rem;
}

.inspection-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.inspection-list li {
  border-left: 2px solid rgba(123, 220, 181, 0.7);
  padding-left: 10px;
}

.muted {
  margin: 0;
  color: var(--muted);
}

.step-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 44px;
}

.step-button[data-primary="true"] {
  border-color: rgba(64, 183, 255, 0.96);
  background: rgba(24, 115, 181, 0.28);
  box-shadow: inset 0 0 0 1px rgba(42, 168, 255, 0.2);
  font-weight: 800;
}

.profile-label {
  flex: 0 0 100%;
  margin: 8px 0 -2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-button {
  border-style: dashed;
  background: rgba(24, 115, 181, 0.06);
}

.help-button {
  flex: 0 0 auto;
}

.help-shell {
  width: min(1020px, calc(100% - 32px));
}

.help-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: #080b10;
}

.help-brand-link {
  display: block;
  width: 430px;
  max-width: 100%;
  min-width: 0;
}

.help-brand {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.help-content {
  padding: 34px;
}

.help-content > h1 {
  color: var(--brand-gold);
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
}

.help-intro {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.help-section {
  margin-top: 34px;
}

.help-section h2,
.help-card h2 {
  color: var(--brand-gold);
}

.help-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  counter-reset: help-step;
  list-style: none;
}

.help-steps li {
  min-width: 0;
  border: 1px solid rgba(42, 168, 255, 0.34);
  border-radius: 8px;
  padding: 16px;
  background: rgba(24, 115, 181, 0.08);
  counter-increment: help-step;
}

.help-steps li::before {
  content: counter(help-step);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  border: 1px solid var(--brand-blue);
  border-radius: 999px;
  color: var(--brand-gold);
  font-weight: 800;
}

.help-steps strong,
.help-steps span {
  display: block;
}

.help-steps span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.help-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: rgba(16, 20, 27, 0.64);
}

.help-card p,
.help-card li {
  color: var(--muted);
  line-height: 1.55;
}

.help-card p:last-child {
  margin-bottom: 0;
}

.help-card ul {
  margin: 14px 0 0;
  padding-left: 20px;
}

.mobile-install-card {
  grid-column: 1 / -1;
}

.install-steps {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.55;
}

.install-note {
  font-size: 0.92rem;
}

.help-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 30px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.help-footer p {
  margin: 0;
  color: var(--muted);
}

.error-shell {
  width: min(1120px, calc(100% - 32px));
}

.error-content {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  align-items: center;
  gap: 34px;
  padding: 34px;
}

.error-artwork {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--webbi-border-strong);
  border-radius: 10px;
  background: var(--webbi-color-deep-space);
  box-shadow: var(--webbi-elevation-panel);
}

.error-artwork img {
  display: block;
  width: 100%;
  height: auto;
}

.error-code {
  color: var(--webbi-signature-blue);
}

.error-copy h1 {
  margin: 12px 0 0;
  color: var(--brand-gold);
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  line-height: 1.05;
}

.error-copy > p:not(.eyebrow) {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

[data-webbi-theme="light"] body {
  background:
    radial-gradient(circle at top left, rgb(11 107 69 / 8%), transparent 32rem),
    var(--bg);
}

[data-webbi-theme="light"] .workbench,
[data-webbi-theme="light"] .card,
[data-webbi-theme="light"] .result-panel,
[data-webbi-theme="light"] .help-card {
  background: var(--panel);
}

[data-webbi-theme="light"] textarea {
  background: #ffffff;
}

[data-webbi-theme="light"] textarea::placeholder {
  color: var(--soft);
}

[data-webbi-theme="light"] button:not(.theme-toggle),
[data-webbi-theme="light"] .button-link {
  border-color: var(--webbi-border-strong);
  background: var(--webbi-bg-raised);
  color: var(--brand-gold);
}

[data-webbi-theme="light"] .button-link .button-label {
  color: var(--brand-gold);
}

[data-webbi-theme="light"] .primary-button,
[data-webbi-theme="light"] .step-button[data-primary="true"] {
  border-color: var(--webbi-action-primary);
  background: var(--webbi-action-primary);
  color: var(--webbi-text-inverse);
}

[data-webbi-theme="light"] .ghost-button:hover,
[data-webbi-theme="light"] .step-button:hover,
[data-webbi-theme="light"] .primary-button:hover:not(:disabled),
[data-webbi-theme="light"] .button-link:hover {
  border-color: var(--webbi-action-primary-hover);
  background: var(--webbi-bg-interactive);
}

[data-webbi-theme="light"] .topbar,
[data-webbi-theme="light"] .help-topbar {
  border-bottom-color: #17324a;
  background: var(--webbi-color-deep-space);
}

[data-webbi-theme="light"] .trust-meter span {
  color: var(--webbi-color-soft-white);
}

[data-webbi-theme="light"] .language-picker select {
  color: var(--webbi-color-utility-gold);
  background: #0b1722;
}

[data-webbi-theme="light"] .detection-card.warning-card {
  background: linear-gradient(135deg, rgb(217 167 45 / 14%), var(--panel));
}

.primary-link {
  flex: 0 0 auto;
  border-color: rgba(64, 183, 255, 0.96);
  background: rgba(24, 115, 181, 0.34);
}

.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

#outputText {
  min-height: 0;
  height: 15.8rem;
  max-height: 15.8rem;
  overflow: auto;
}

#outputText.result-expanded {
  height: 34rem;
  max-height: min(62vh, 34rem);
}

.result-panel {
  padding: 28px;
  background: rgba(16, 20, 27, 0.64);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.report-section {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

#reportList {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

#reportList li::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 9px;
  border-radius: 999px;
  background: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 780px) {
  .shell {
    width: min(100% - 18px, 1180px);
    padding: 9px 0;
  }

  .topbar,
  .panel-actions,
  .card-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-action-group,
  .panel-action-group > button {
    width: 100%;
  }

  .topbar {
    gap: 12px;
  }

  .topbar-side,
  .help-actions {
    justify-items: stretch;
  }

  .topbar-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .theme-toggle,
  .topbar-controls .language-picker,
  .topbar-controls .language-picker select {
    width: 100%;
  }

  .brand-lockup {
    flex: 0 1 auto;
  }

  .topbar,
  .input-panel,
  .card {
    padding: 18px;
  }

  .trust-meter {
    justify-content: center;
    gap: 4px;
  }

  .topbar > .trust-meter {
    margin-right: 0;
  }

  .language-picker,
  .language-picker select {
    width: 100%;
  }

  .topbar > .language-picker {
    position: static;
  }

  .trust-meter span {
    padding: 7px 5px;
    font-size: 0.72rem;
  }

  .trust-meter span::before {
    width: 6px;
    height: 6px;
    margin-right: 5px;
  }

  .brand-home-link {
    margin-left: 0;
  }

  .error-content {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 18px;
  }

  .error-actions,
  .error-actions .button-link {
    width: 100%;
  }

  .input-heading,
  .help-topbar,
  .help-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .input-heading {
    gap: 12px;
  }

  .help-button,
  .help-topbar .button-link,
  .primary-link {
    width: 100%;
    align-self: stretch;
  }

  .step-button {
    flex: 1 1 130px;
  }

  .help-content {
    padding: 22px 18px;
  }

  .help-steps,
  .help-grid {
    grid-template-columns: 1fr;
  }

  .inspection-grid {
    grid-template-columns: 1fr;
  }

  .card {
    grid-column: span 1;
    border-right: 0;
  }

  .result-panel {
    padding: 18px;
  }
}

@media (max-width: 340px) {
  .trust-meter {
    flex-wrap: wrap;
  }
}
