:root {
  --demo-bg: #f4f6fb;
  --demo-surface: #ffffff;
  --demo-border: #e2e8f0;
  --demo-text: #0f172a;
  --demo-muted: #64748b;
  --demo-accent: #2563eb;
  --demo-accent-soft: #eff6ff;
  --demo-radius: 12px;
  --demo-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --demo-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --demo-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --demo-space-xs: 8px;
  --demo-space-sm: 12px;
  --demo-space-md: 16px;
  --demo-space-lg: 20px;
  --demo-space-xl: 24px;
  --demo-space-2xl: 32px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--demo-bg);
}

body.demo-body {
  margin: 0;
  min-height: 100vh;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  font-family: var(--demo-font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--demo-text);
  background: var(--demo-bg);
}

.demo-layout {
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--demo-space-md) var(--demo-space-md) var(--demo-space-2xl);
}

@media (min-width: 640px) {
  .demo-layout {
    padding-left: var(--demo-space-xl);
    padding-right: var(--demo-space-xl);
  }
}

.demo-header {
  background: var(--demo-surface);
  border: 1px solid var(--demo-border);
  border-radius: var(--demo-radius);
  padding: var(--demo-space-lg) var(--demo-space-lg) var(--demo-space-md);
  box-shadow: var(--demo-shadow);
  margin-bottom: var(--demo-space-lg);
}

.demo-header__brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--demo-space-sm) 14px;
  margin-bottom: var(--demo-space-xs);
}

.demo-header__title {
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.demo-header__badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--demo-accent);
  background: var(--demo-accent-soft);
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 4px 10px;
}

.demo-header__desc {
  margin: 0;
  font-size: 14px;
  color: var(--demo-muted);
}

.demo-header a {
  color: var(--demo-accent);
  text-decoration: none;
}

.demo-header a:hover {
  text-decoration: underline;
}

.demo-header__tagline {
  margin: 0 0 var(--demo-space-sm);
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  letter-spacing: 0.02em;
}

#demo-home {
  margin-bottom: var(--demo-space-md);
}

.demo-spotlight {
  background: linear-gradient(145deg, #ffffff 0%, #f0f7ff 55%, #eef2ff 100%);
  border: 1px solid var(--demo-border);
  border-radius: var(--demo-radius);
  padding: var(--demo-space-lg) var(--demo-space-md) var(--demo-space-lg);
  box-shadow: var(--demo-shadow);
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .demo-spotlight {
    padding: var(--demo-space-xl) var(--demo-space-lg) var(--demo-space-xl);
  }
}

.demo-spotlight__title {
  margin: 0 0 var(--demo-space-sm);
  font-size: 1rem;
  font-weight: 800;
  color: var(--demo-text);
  letter-spacing: -0.02em;
}

.demo-spotlight__lead {
  margin: 0 0 var(--demo-space-lg);
  font-size: 14px;
  color: var(--demo-muted);
  line-height: 1.55;
}

.demo-spotlight__lead a {
  color: var(--demo-accent);
  font-weight: 600;
  text-decoration: none;
}

.demo-spotlight__lead a:hover {
  text-decoration: underline;
}

.demo-spotlight__grid {
  display: grid;
  gap: var(--demo-space-md);
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .demo-spotlight__grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--demo-space-lg);
  }
}

.demo-spot-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e0e7ff;
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  min-height: 0;
}

.demo-spot-card__accent {
  height: 4px;
  flex-shrink: 0;
  width: 100%;
}

.demo-spot-card--captcha .demo-spot-card__accent {
  background: linear-gradient(90deg, #4338ca, #6366f1 45%, #a5b4fc);
}

.demo-spot-card--push .demo-spot-card__accent {
  background: linear-gradient(90deg, #0369a1, #2563eb 50%, #38bdf8);
}

.demo-spot-card__body {
  min-width: 0;
  flex: 1;
  padding: var(--demo-space-md) var(--demo-space-md) var(--demo-space-lg);
}

@media (min-width: 720px) {
  .demo-spot-card__body {
    padding: var(--demo-space-lg) var(--demo-space-lg) var(--demo-space-xl);
  }
}

.demo-spot-card__name {
  margin: 0 0 var(--demo-space-xs);
  font-size: 15px;
  font-weight: 800;
  color: var(--demo-text);
}

.demo-spot-card__text {
  margin: 0 0 var(--demo-space-sm);
  font-size: 13px;
  color: var(--demo-muted);
  line-height: 1.55;
}

.demo-spot-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--demo-space-xs);
}

.demo-spot-card__links a {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--demo-accent-soft);
  color: var(--demo-accent);
  text-decoration: none;
  border: 1px solid #bfdbfe;
}

.demo-spot-card__links a:hover {
  background: #dbeafe;
}

.demo-demo-entry {
  margin-top: var(--demo-space-xl);
  padding-top: var(--demo-space-2xl);
  padding-bottom: var(--demo-space-xs);
  border-top: 1px solid var(--demo-border);
}

@media (min-width: 640px) {
  .demo-demo-entry {
    margin-top: var(--demo-space-2xl);
    padding-top: clamp(28px, 4vw, 40px);
  }
}

.demo-demo-entry__title {
  margin: 0 0 var(--demo-space-sm);
  font-size: clamp(1.05rem, 3vw, 1.2rem);
  font-weight: 800;
  color: var(--demo-text);
  letter-spacing: -0.02em;
}

.demo-demo-entry__lead {
  margin: 0 0 var(--demo-space-xl);
  max-width: 42rem;
  font-size: 14px;
  line-height: 1.6;
  color: var(--demo-muted);
}

.demo-module-promo {
  margin: 0 0 var(--demo-space-lg);
  padding: var(--demo-space-lg) var(--demo-space-md) var(--demo-space-lg) var(--demo-space-lg);
  border-radius: 12px;
  border: 1px solid var(--demo-border);
  background: #f8fafc;
}

.demo-module-promo--captcha {
  border-left: 4px solid #6366f1;
}

.demo-module-promo--webpush {
  border-left: 4px solid #2563eb;
}

.demo-module-promo__content {
  font-size: 14px;
  color: #334155;
  line-height: 1.6;
}

.demo-module-promo__content strong {
  color: var(--demo-text);
}

.demo-module-promo__list {
  margin: var(--demo-space-sm) 0 0;
  padding-left: 1.25em;
  font-size: 13px;
  color: var(--demo-muted);
}

.demo-module-promo__list li {
  margin-bottom: var(--demo-space-xs);
}

.demo-module-promo__list code {
  font-family: var(--demo-mono);
  font-size: 12px;
  background: #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
}

.demo-module-promo__docs {
  margin: var(--demo-space-md) 0 0;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--demo-space-xs);
}

.demo-module-promo__docs-label {
  font-weight: 700;
  color: var(--demo-text);
  width: 100%;
}

@media (min-width: 640px) {
  .demo-module-promo__docs-label {
    width: auto;
  }
}

.demo-module-promo__docs a {
  display: inline-block;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #cbd5e1;
  color: var(--demo-accent);
  text-decoration: none;
}

.demo-module-promo__docs a:hover {
  border-color: var(--demo-accent);
  background: var(--demo-accent-soft);
}

.demo-hub {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--demo-space-md);
}

@media (min-width: 640px) {
  .demo-hub {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--demo-space-lg);
  }
}

.demo-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--demo-space-xs);
  text-align: left;
  padding: var(--demo-space-lg) var(--demo-space-lg) var(--demo-space-md);
  border-radius: var(--demo-radius);
  border: 1px solid var(--demo-border);
  background: var(--demo-surface);
  box-shadow: var(--demo-shadow);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.demo-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}

.demo-card:focus-visible {
  outline: 2px solid var(--demo-accent);
  outline-offset: 2px;
}

.demo-card--accent {
  border-color: #bfdbfe;
  background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
}

.demo-card__kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--demo-muted);
}

.demo-card__name {
  font-size: 1.1rem;
  font-weight: 700;
}

.demo-card__hint {
  font-size: 13px;
  color: var(--demo-muted);
  line-height: 1.45;
}

.demo-main {
  margin-top: var(--demo-space-xs);
}

.demo-panel {
  background: var(--demo-surface);
  border: 1px solid var(--demo-border);
  border-radius: var(--demo-radius);
  padding: var(--demo-space-lg) var(--demo-space-md) var(--demo-space-xl);
  box-shadow: var(--demo-shadow);
}

@media (min-width: 768px) {
  .demo-panel {
    padding: var(--demo-space-xl) var(--demo-space-xl) 28px;
  }
}

.demo-panel__head {
  display: flex;
  flex-direction: column;
  gap: var(--demo-space-md);
  margin-bottom: var(--demo-space-lg);
  padding-bottom: var(--demo-space-md);
  border-bottom: 1px solid var(--demo-border);
}

@media (min-width: 640px) {
  .demo-panel__head {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--demo-space-lg);
  }
}

.demo-back {
  flex-shrink: 0;
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--demo-border);
  background: #f8fafc;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  color: var(--demo-text);
}

.demo-back:hover {
  background: #f1f5f9;
}

.demo-panel__title {
  margin: 0 0 var(--demo-space-sm);
  font-size: clamp(1.2rem, 3.5vw, 1.35rem);
}

.demo-panel__intro {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--demo-muted);
}

.demo-panel__intro code {
  font-family: var(--demo-mono);
  font-size: 0.9em;
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
}

.demo-major {
  margin-top: var(--demo-space-xl);
  padding-top: var(--demo-space-xl);
  border-top: 1px solid var(--demo-border);
}

.demo-panel__head + .demo-major {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.demo-major__label {
  margin: 0 0 var(--demo-space-md);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--demo-accent);
}

.demo-section {
  margin-bottom: var(--demo-space-xl);
}

.demo-section:last-child {
  margin-bottom: 0;
}

.demo-section__title {
  margin: 0 0 var(--demo-space-sm);
  font-size: 15px;
  font-weight: 700;
}

.demo-callout {
  margin: 0 0 var(--demo-space-lg);
  padding: var(--demo-space-md) var(--demo-space-md);
  border-radius: 10px;
  border: 1px solid #fcd34d;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  font-size: 13px;
  line-height: 1.55;
  color: #78350f;
}

.demo-callout strong {
  color: #451a03;
}

.demo-callout p {
  margin: var(--demo-space-sm) 0 0;
}

.demo-callout p:first-of-type {
  margin-top: var(--demo-space-xs);
}

.demo-callout__foot {
  margin-top: var(--demo-space-sm) !important;
  font-size: 12px;
  color: #92400e;
}

.demo-callout code {
  font-family: var(--demo-mono);
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid #fbbf24;
}

.demo-section--toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--demo-space-sm);
}

.demo-section--toolbar .demo-section__title {
  margin: 0;
}

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--demo-space-sm);
  margin-top: var(--demo-space-xs);
}

.demo-actions--center {
  justify-content: center;
}

.demo-field {
  display: flex;
  flex-direction: column;
  gap: var(--demo-space-xs);
  margin-bottom: var(--demo-space-md);
}

.demo-field--row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 14px;
}

.demo-field--row .dsc {
  flex: 1 1 200px;
  padding-left: 0;
  margin: 0;
}

.demo-label {
  margin: 0 0 var(--demo-space-xs);
  font-size: 13px;
  font-weight: 600;
  color: var(--demo-muted);
}

.data-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--demo-text);
}

.data-title--with-hint {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.data-title__hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--demo-muted);
  line-height: 1.45;
  max-width: 36rem;
}

.dsc {
  margin: 0;
  font-size: 12px;
  color: var(--demo-muted);
  line-height: 1.45;
}

.dsc--block {
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
}

input[type="text"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  max-width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--demo-border);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  background: #fff;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus {
  outline: none;
  border-color: var(--demo-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input[type="button"] {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--demo-text);
}

input[type="button"]:hover {
  background: #f8fafc;
}

.info-show {
  border: 1px solid #93c5fd;
  background: #f8fafc;
  border-radius: 8px;
  line-height: 1.5;
  min-height: 48px;
  padding: var(--demo-space-sm) var(--demo-space-md);
  margin-bottom: var(--demo-space-sm);
  max-height: 200px;
  overflow: auto;
  font-family: var(--demo-mono);
  font-size: 13px;
}

.code {
  white-space: pre-wrap;
  color: #1d4ed8;
}

.api-warp {
  padding: var(--demo-space-md) 0 var(--demo-space-sm);
  border-bottom: 1px solid var(--demo-border);
}

.api-warp:last-of-type {
  border-bottom: none;
}

.captch-wrap {
  min-height: 48px;
  margin-top: var(--demo-space-sm);
}

.warp {
  text-align: center;
  padding-top: 8px;
}

.warp > .data {
  padding-top: 8px;
  font-size: 12px;
  color: var(--demo-accent);
  word-break: break-all;
}

.demo-warp-card {
  background: #f8fafc;
  border-radius: 8px;
  padding: var(--demo-space-md) var(--demo-space-sm);
  border: 1px dashed var(--demo-border);
}

.test-warp {
  margin-top: var(--demo-space-md);
}

.test-warp > input {
  margin: var(--demo-space-sm) auto;
  width: 100%;
  max-width: 420px;
  display: block;
}

.test-warp > div[role="button"],
.test-warp > div#msg_local_test {
  margin: var(--demo-space-md) auto var(--demo-space-xl);
  width: 100%;
  max-width: 420px;
  height: auto;
  min-height: 44px;
  line-height: 1.3;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #1e293b;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.15s ease;
}

.test-warp > div#msg_local_test:hover {
  background: #e2e8f0;
}

.demo-footer {
  margin-top: var(--demo-space-xl);
  padding-top: var(--demo-space-md);
  font-size: 12px;
  color: var(--demo-muted);
  text-align: center;
  line-height: 1.75;
}

.demo-footer a {
  color: var(--demo-accent);
  font-weight: 600;
  text-decoration: none;
}

.demo-footer a:hover {
  text-decoration: underline;
}

.demo-footer__sep {
  margin: 0 0.25em;
}

.demo-debug-fab {
  position: fixed;
  z-index: 2147483000;
  left: max(24px, calc(12px + env(safe-area-inset-left, 0px)));
  bottom: max(22px, calc(12px + env(safe-area-inset-bottom, 0px)));
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-family: var(--demo-font);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: #fff;
  background: #2563eb;
  box-shadow:
    0 6px 20px rgba(37, 99, 235, 0.45),
    0 2px 6px rgba(15, 23, 42, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.demo-debug-fab:hover {
  background: #1d4ed8;
  box-shadow:
    0 8px 24px rgba(37, 99, 235, 0.5),
    0 2px 8px rgba(15, 23, 42, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.22) inset;
}

.demo-debug-fab:active {
  transform: scale(0.96);
  background: #1e40af;
}

.demo-debug-fab:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 4px;
}

.demo-debug-fab__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.demo-debug-fab__line {
  display: block;
}

@media (min-width: 640px) {
  .demo-debug-fab {
    left: max(28px, calc(16px + env(safe-area-inset-left, 0px)));
    bottom: max(26px, calc(14px + env(safe-area-inset-bottom, 0px)));
  }
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track-piece {
  background-color: #f1f5f9;
  border-radius: 8px;
}

::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}
