.ksp-standalone-body {
  --ksp-color-primary: #4b4be6;
  --ksp-color-secondary: #f952a5;
  --ksp-color-background: #f4f6fc;
  --ksp-color-surface: #ffffff;
  --ksp-color-text: #1f2a44;
  --ksp-color-muted: #6f7b98;
  --ksp-color-border: #e2e7f3;
  --ksp-color-success: #1fba70;
  --ksp-color-warning: #ffb648;
  --ksp-color-danger: #f25b6e;
  --ksp-card-radius: 18px;
  --ksp-card-shadow: 0 14px 40px rgba(12, 34, 88, 0.08);
  --ksp-button-radius: 12px;
  --ksp-menu-radius: 12px;
  --ksp-menu-button-bg: var(--ksp-color-primary);
  --ksp-menu-button-text: #ffffff;
  --ksp-menu-button-hover-bg: var(--ksp-color-secondary);
  --ksp-menu-button-hover-text: #ffffff;
  --ksp-header-bg: var(--ksp-color-surface);
  --ksp-header-text: var(--ksp-color-text);
  --ksp-header-border: var(--ksp-color-border);
  --ksp-footer-bg: var(--ksp-color-surface);
  --ksp-footer-text: var(--ksp-color-text);
  --ksp-footer-border: var(--ksp-color-border);
  margin: 0;
  background: var(--ksp-color-background);
  color: var(--ksp-color-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ksp-standalone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 32px;
  background: var(--ksp-header-bg);
  border-bottom: 1px solid var(--ksp-header-border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.ksp-standalone-brand,
.ksp-standalone-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ksp-header-text);
  text-decoration: none;
  font-weight: 800;
}

.ksp-standalone-brand img,
.ksp-standalone-footer-brand img {
  max-height: 42px;
  width: auto;
}

.ksp-standalone-footer-brand {
  color: var(--ksp-footer-text);
}

.ksp-standalone-logo {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--ksp-menu-radius);
  background: linear-gradient(135deg, var(--ksp-color-primary), var(--ksp-color-secondary));
  color: #fff;
}

.ksp-standalone-menu,
.ksp-standalone-footer-menu {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.ksp-standalone-menu a,
.ksp-standalone-footer-menu a {
  --ksp-item-bg: var(--ksp-menu-button-bg);
  --ksp-item-text: var(--ksp-menu-button-text);
  --ksp-item-hover-bg: var(--ksp-menu-button-hover-bg);
  --ksp-item-hover-text: var(--ksp-menu-button-hover-text);
  color: var(--ksp-item-text);
  text-decoration: none;
  font-weight: 800;
  padding: 9px 14px;
  border-radius: var(--ksp-menu-radius);
  background: var(--ksp-item-bg);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--ksp-item-bg) 20%, transparent);
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

.ksp-standalone-menu a:hover,
.ksp-standalone-footer-menu a:hover,
.ksp-standalone-menu a:focus,
.ksp-standalone-footer-menu a:focus {
  background: var(--ksp-item-hover-bg);
  color: var(--ksp-item-hover-text);
  transform: translateY(-1px);
}

.ksp-standalone-main {
  max-width: var(--ksp-max-width, 1180px);
  margin: 0 auto;
  padding: 42px 18px 80px;
  width: 100%;
  box-sizing: border-box;
  flex: 1 0 auto;
}

.ksp-standalone-hero {
  text-align: center;
  margin: 0 auto 28px;
  max-width: 760px;
}

.ksp-standalone-eyebrow {
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ksp-color-primary);
  font-size: 12px;
  font-weight: 900;
}

.ksp-standalone-hero h1,
.ksp-tester-intro h1 {
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  margin: 0 0 14px;
  color: var(--ksp-color-text);
}

.ksp-standalone-hero p,
.ksp-tester-intro p,
.ksp-tester-actions,
.ksp-score-card p,
.ksp-tester-intro small {
  color: var(--ksp-color-muted);
}

.ksp-standalone-hero p,
.ksp-tester-intro p {
  font-size: 18px;
}

.ksp-standalone-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 32px;
  background: var(--ksp-footer-bg);
  border-top: 1px solid var(--ksp-footer-border);
}

.ksp-tester-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 42px 18px 80px;
  width: 100%;
  box-sizing: border-box;
  flex: 1 0 auto;
}

.ksp-tester-intro {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 30px;
}

.ksp-tester-input-card,
.ksp-score-card,
.ksp-result-panel,
.ksp-improved-prompt {
  background: var(--ksp-color-surface);
  border: 1px solid var(--ksp-color-border);
  border-radius: var(--ksp-card-radius);
  box-shadow: var(--ksp-card-shadow);
}

.ksp-tester-input-card {
  padding: 16px;
  margin: 0 auto 34px;
  max-width: 820px;
}

.ksp-tester-faq {
  max-width: 900px;
  margin: 0 auto 36px;
}

.ksp-tester-faq h2 {
  margin: 0 0 16px;
  text-align: center;
  color: var(--ksp-color-text);
  font-size: 26px;
}

.ksp-tester-faq-grid {
  display: grid;
  gap: 12px;
}

.ksp-tester-faq-item {
  background: var(--ksp-color-surface);
  border: 1px solid var(--ksp-color-border);
  border-radius: var(--ksp-card-radius);
  box-shadow: var(--ksp-card-shadow);
  padding: 0;
  overflow: hidden;
}

.ksp-tester-faq-item summary {
  cursor: pointer;
  color: var(--ksp-color-text);
  font-weight: 900;
  padding: 16px 18px;
}

.ksp-tester-faq-item p {
  margin: 0;
  padding: 0 18px 18px;
  color: var(--ksp-color-muted);
  line-height: 1.65;
}

.ksp-tester-input-card textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--ksp-color-border);
  border-radius: var(--ksp-button-radius);
  padding: 14px;
  font: inherit;
  color: var(--ksp-color-text);
  background: color-mix(in srgb, var(--ksp-color-surface) 96%, var(--ksp-color-background));
  resize: vertical;
}

.ksp-tester-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  font-size: 13px;
}

.ksp-tester-actions button {
  border: 0;
  border-radius: var(--ksp-button-radius);
  background: linear-gradient(135deg, var(--ksp-color-primary), var(--ksp-color-secondary));
  color: #fff;
  font-weight: 800;
  padding: 12px 22px;
  cursor: pointer;
}

.ksp-tester-actions button[disabled] {
  opacity: .6;
  cursor: wait;
}

.ksp-tester-results h2 {
  margin: 32px 0 14px;
  font-size: 24px;
  color: var(--ksp-color-text);
}

.ksp-analysis-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.ksp-score-card,
.ksp-result-panel,
.ksp-improved-prompt {
  padding: 18px;
}

.ksp-score-card {
  border-top: 4px solid var(--ksp-color-warning);
  min-height: 170px;
}

.ksp-score-card:nth-child(3) {
  border-top-color: var(--ksp-color-danger);
}

.ksp-score-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.ksp-score-card p {
  min-height: 54px;
}

.ksp-score-card strong {
  display: block;
  text-align: center;
  font-size: 42px;
  color: var(--ksp-color-warning);
}

.ksp-score-card:nth-child(3) strong {
  color: var(--ksp-color-danger);
}

.ksp-score-card small {
  display: block;
  font-size: 12px;
  color: var(--ksp-color-muted);
}

.ksp-tips-list {
  list-style: none;
  margin: 0;
  padding: 18px;
}

.ksp-tips-list li {
  margin: 0 0 10px;
  padding-left: 26px;
  position: relative;
}

.ksp-tips-list li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--ksp-color-success);
  font-weight: 900;
}

.ksp-improved-prompt {
  white-space: pre-wrap;
  background: color-mix(in srgb, var(--ksp-color-primary) 10%, var(--ksp-color-surface));
  border-left: 4px solid var(--ksp-color-primary);
  color: var(--ksp-color-text);
  overflow: auto;
}

.ksp-token-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  text-align: center;
}

.ksp-token-grid strong {
  display: block;
  font-size: 24px;
}

.ksp-error {
  color: var(--ksp-color-danger);
  background: color-mix(in srgb, var(--ksp-color-danger) 12%, var(--ksp-color-surface));
  border: 1px solid color-mix(in srgb, var(--ksp-color-danger) 28%, var(--ksp-color-surface));
  border-radius: var(--ksp-button-radius);
  padding: 12px;
}

@media (max-width: 900px) {
  .ksp-standalone-header,
  .ksp-standalone-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .ksp-analysis-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .ksp-analysis-grid,
  .ksp-token-grid {
    grid-template-columns: 1fr;
  }

  .ksp-tester-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
