:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-muted: #eef0f4;
  --surface-strong: #17181c;
  --ink: #17181c;
  --muted: #666a73;
  --faint: #8e939e;
  --line: #dfe2e8;
  --line-strong: #c7cbd4;
  --accent: #5a46df;
  --accent-strong: #4631c5;
  --accent-soft: #ece9ff;
  --success: #147a55;
  --success-soft: #e5f6ef;
  --warning: #9b5c00;
  --warning-soft: #fff2d6;
  --danger: #c03543;
  --danger-soft: #ffeaed;
  --code-bg: #15161a;
  --code-ink: #e9eaf0;
  --shadow-sm: 0 1px 2px rgb(23 24 28 / 0.05);
  --shadow-md: 0 16px 48px rgb(23 24 28 / 0.14);
  --radius-sm: 7px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --header-height: 68px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101114;
  --surface: #18191d;
  --surface-raised: #1d1f24;
  --surface-muted: #23252b;
  --surface-strong: #f0f1f4;
  --ink: #f0f1f4;
  --muted: #a9adb7;
  --faint: #828792;
  --line: #30333a;
  --line-strong: #444852;
  --accent: #9a89ff;
  --accent-strong: #b3a7ff;
  --accent-soft: #2a2549;
  --success: #6dd3a9;
  --success-soft: #17382d;
  --warning: #f4b75c;
  --warning-soft: #3d2d15;
  --danger: #ff8791;
  --danger-soft: #442128;
  --code-bg: #0b0c0f;
  --code-ink: #edf0f6;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.25);
  --shadow-md: 0 20px 64px rgb(0 0 0 / 0.48);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
  min-width: 280px;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--accent-strong);
  border-radius: var(--radius-sm);
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.site-header {
  position: sticky;
  z-index: 40;
  top: 0;
  height: var(--header-height);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1480px, calc(100% - 40px));
  height: 100%;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent-strong) 60%, transparent);
  border-radius: 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand > span:last-child {
  display: grid;
  line-height: 1.1;
}

.brand strong {
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-control,
.dialog-close {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.icon-control:hover,
.dialog-close:hover {
  background: var(--surface-muted);
  border-color: var(--line-strong);
}

.icon-control svg,
.dialog-close svg {
  width: 20px;
  height: 20px;
}

:root[data-theme="light"] .moon-icon,
:root[data-theme="dark"] .sun-icon {
  display: none;
}

main {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
}

.intro {
  display: grid;
  grid-template-columns: minmax(300px, 1.1fr) minmax(360px, 0.9fr);
  gap: 64px;
  align-items: end;
  padding: clamp(58px, 8vw, 112px) 0 48px;
  border-bottom: 1px solid var(--line);
}

.intro-copy {
  max-width: 760px;
}

.eyebrow,
.result-label {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.intro h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(44px, 5vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.065em;
  text-wrap: balance;
}

.intro h1 span {
  color: var(--muted);
}

.intro h1 .intro-line {
  display: block;
  white-space: nowrap;
}

.intro-copy > p:last-child {
  max-width: 620px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 1.4vw, 18px);
}

.search-panel {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.search-panel > label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 750;
}

.search-box {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  padding: 0 14px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.search-box svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  min-width: 0;
  height: 52px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.search-box input::placeholder {
  color: var(--faint);
}

.search-box kbd {
  min-width: 28px;
  padding: 2px 8px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
}

.search-panel > p {
  margin: 9px 0 0;
  color: var(--faint);
  font-size: 12px;
}

.catalog-stats {
  grid-column: 1 / -1;
  display: flex;
  gap: clamp(26px, 5vw, 76px);
  margin: 12px 0 0;
}

.catalog-stats div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.catalog-stats dt {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 750;
}

.catalog-stats dd {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.catalog-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 38px;
  padding: 44px 0 80px;
}

.category-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  align-self: start;
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow: auto;
  scrollbar-width: thin;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sidebar-heading h2 {
  margin: 0;
  font-size: 14px;
}

.text-button {
  min-height: 36px;
  padding: 4px 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button:hover {
  color: var(--accent);
}

.category-list {
  display: grid;
  gap: 4px;
}

.category-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 9px 10px 9px 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
}

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

.category-button[aria-current="true"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
  font-weight: 720;
}

.category-button span:last-child {
  min-width: 28px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: right;
}

.catalog-main {
  min-width: 0;
}

.catalog-toolbar {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 22px;
}

.catalog-toolbar .result-label {
  margin-bottom: 3px;
}

.catalog-toolbar h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.035em;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 9px;
}

.toolbar-controls label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.toolbar-controls select {
  min-height: 44px;
  padding: 0 34px 0 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mobile-category,
.mobile-category-label {
  display: none;
}

.active-filter {
  margin: -6px 0 20px;
  padding: 10px 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.active-filter strong {
  color: var(--ink);
}

.component-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.component-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 300px;
  grid-template-rows: 126px 1fr;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.component-card:hover {
  z-index: 1;
  border-color: var(--line-strong);
  box-shadow: 0 10px 30px rgb(23 24 28 / 0.09);
  transform: translateY(-2px);
}

.component-card:active {
  transform: translateY(0);
}

.card-open {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: inherit;
}

.card-open:hover,
.card-open:active {
  background: transparent;
}

.card-open:focus-visible {
  outline-offset: -4px;
}

.card-preview {
  position: relative;
  display: grid;
  min-width: 0;
  place-items: center;
  overflow: hidden;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
  pointer-events: none;
}

.card-copy {
  display: grid;
  align-content: start;
  padding: 16px;
}

.card-meta {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.card-category {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-category span {
  color: var(--muted);
}

.placement-chip {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  overflow-wrap: anywhere;
  color: var(--ink);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.35;
}

.placement-chip > span:first-child {
  color: var(--accent-strong);
  font-weight: 800;
}

.placement-chip > span[lang="en"] {
  color: var(--muted);
}

.card-copy h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: -0.025em;
}

.card-copy h3 > span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
}

.card-copy h3 .card-name-en {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.card-name-en b {
  padding: 1px 4px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
}

.card-copy > p:last-child {
  display: -webkit-box;
  margin: 9px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-placement-map {
  position: absolute;
  z-index: 1;
  top: 8px;
  right: 8px;
  display: grid;
  gap: 2px;
  padding: 2px;
  place-items: center;
  background: color-mix(in srgb, var(--surface-muted) 86%, transparent);
  border: 0;
  border-radius: 4px;
  box-shadow: none;
}

.card-placement-map small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: 0.05em;
}

.placement-map {
  display: inline-grid;
  width: 86px;
  height: 58px;
  place-items: stretch;
}

.placement-map--compact {
  width: 44px;
  height: 30px;
}

.placement-map__screen {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--surface-muted);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
}

.placement-map__screen::before {
  position: absolute;
  inset: 18% 16%;
  background: repeating-linear-gradient(to bottom, var(--line) 0 2px, transparent 2px 7px);
  content: '';
  opacity: 0.8;
}

.placement-map__marker {
  position: absolute;
  display: block;
  background: var(--accent);
  border: 1px solid var(--accent-strong);
  border-radius: 2px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent);
}

.placement-map[data-placement="top"] .placement-map__marker {
  top: 2px;
  right: 2px;
  left: 2px;
  height: 15%;
}

.placement-map[data-placement="bottom"] .placement-map__marker {
  right: 2px;
  bottom: 2px;
  left: 2px;
  height: 15%;
}

.placement-map[data-placement="side"] .placement-map__marker {
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: 22%;
}

.placement-map[data-placement="inline"] .placement-map__marker {
  top: 50%;
  left: 50%;
  width: 28%;
  height: 15%;
  transform: translate(-50%, -50%);
}

.placement-map[data-placement="overlay"] .placement-map__marker {
  top: 50%;
  left: 50%;
  width: 54%;
  height: 46%;
  transform: translate(-50%, -50%);
}

.placement-map[data-placement="content"] .placement-map__marker {
  inset: 24% 12% 12% 24%;
}

.placement-map[data-placement="anywhere"] .placement-map__marker,
.placement-map[data-placement="system"] .placement-map__marker {
  inset: 3px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 2px dashed var(--accent);
}

.placement-map[data-placement="system"] .placement-map__marker {
  inset: 1px;
  background: transparent;
  border-radius: 4px;
}

.empty-results {
  display: grid;
  min-height: 420px;
  padding: 64px 20px;
  place-items: center;
  align-content: center;
  text-align: center;
}

.empty-symbol {
  display: grid;
  width: 72px;
  height: 72px;
  margin-bottom: 18px;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 20px;
}

.empty-results h2 {
  margin: 0;
  font-size: 21px;
}

.empty-results p {
  margin: 8px 0 22px;
  color: var(--muted);
}

.primary-control,
.copy-control {
  min-height: 44px;
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  font-weight: 750;
}

.primary-control:hover,
.copy-control:hover {
  background: var(--accent-strong);
}

.scope-note {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 38px;
  padding: 42px 0;
  border-top: 1px solid var(--line);
}

.scope-note h2 {
  margin: 0;
  font-size: 24px;
}

.scope-note > p {
  max-width: 800px;
  margin: 0;
  color: var(--muted);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 42px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.site-footer p {
  margin: 0;
}

/* Dialog */
.component-dialog {
  width: min(1120px, calc(100vw - 32px));
  max-width: none;
  max-height: min(900px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.component-dialog::backdrop {
  background: rgb(7 8 10 / 0.64);
  backdrop-filter: blur(3px);
}

.dialog-frame {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(900px, calc(100vh - 32px));
}

.dialog-header {
  display: flex;
  gap: 24px;
  align-items: start;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.dialog-category {
  margin: 0 0 4px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.dialog-header h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.2;
  letter-spacing: -0.045em;
}

.dialog-english {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 6px 0 0;
}

.dialog-english > span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dialog-english strong {
  color: var(--ink);
  font-size: 14px;
}

.dialog-content {
  overflow: auto;
  overscroll-behavior: contain;
}

.detail-overview {
  display: grid;
  grid-template-columns: minmax(230px, 0.7fr) minmax(420px, 1.3fr);
  gap: 30px;
  padding: 28px 24px;
}

.detail-copy h3,
.code-header h3 {
  margin: 0;
  font-size: 18px;
}

.detail-copy > p {
  margin: 10px 0 20px;
  color: var(--muted);
  font-size: 14px;
}

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

.detail-subheading {
  margin-top: 22px !important;
  font-size: 13px !important;
}

.detail-subheading span {
  margin-left: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.alias-list span,
.platform-list span {
  padding: 4px 8px;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 11px;
}


.placement-detail {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  margin-top: 9px;
  padding: 12px;
  align-items: center;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.dialog-placement-map {
  display: grid;
  place-items: center;
}

.placement-detail p {
  margin: 0;
}

.placement-name {
  color: var(--ink);
  font-size: 13px;
}

.placement-name span {
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 10px;
}

#dialog-placement-detail {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

#dialog-placement-detail-en {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.detail-copy > .placement-note {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.platform-heading {
  margin-top: 24px !important;
  font-size: 13px !important;
}

.platform-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.platform-list span[data-kind="input"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
}

.detail-preview-wrap {
  min-width: 0;
  overflow: hidden;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 39px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10px;
}

.detail-preview {
  display: grid;
  min-height: 290px;
  padding: 32px;
  place-items: center;
  overflow: hidden;
}

.code-section {
  padding: 28px 24px 32px;
  background: color-mix(in srgb, var(--surface-muted) 55%, var(--surface));
  border-top: 1px solid var(--line);
}

.code-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.code-header .result-label {
  margin-bottom: 2px;
}

.copy-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.code-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

.copy-control.secondary-copy {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}

.copy-control.secondary-copy:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.copy-control svg {
  width: 17px;
  height: 17px;
}

.copy-control[data-copied="true"] {
  color: var(--success);
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 50%, var(--line));
}

.code-tabs {
  display: flex;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px 9px 0 0;
  border-bottom: 0;
  scrollbar-width: thin;
}

.code-tabs button {
  min-height: 40px;
  padding: 0 14px;
  flex: 0 0 auto;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.code-tabs button[aria-selected="true"] {
  color: var(--ink);
  background: var(--surface-muted);
  border-color: var(--line);
}

.code-panel {
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid #30323a;
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
}

.code-meta {
  display: flex;
  justify-content: space-between;
  padding: 9px 14px;
  color: #9da1ad;
  border-bottom: 1px solid #292b31;
  font-family: var(--font-mono);
  font-size: 10px;
}

.code-panel pre {
  max-height: 440px;
  margin: 0;
  padding: 20px;
  overflow: auto;
  scrollbar-color: #464953 #15161a;
}

.code-panel code {
  color: var(--code-ink);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  tab-size: 2;
  white-space: pre;
}

.code-note {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: 11px;
}

.noscript {
  margin: 0;
  padding: 14px;
  color: #fff;
  background: var(--danger);
  text-align: center;
}

/* Preview primitives */
.preview-stage {
  position: relative;
  display: grid;
  width: min(100%, 520px);
  min-height: 88px;
  place-items: center;
  color: #202126;
  font-family: var(--font-sans);
}

.preview-stage.compact {
  width: 125%;
  transform: scale(0.8);
  transform-origin: center;
}

:root[data-theme="dark"] .preview-stage {
  color: #e9eaf0;
}

.preview-row {
  display: flex;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.preview-column {
  display: grid;
  width: min(100%, 320px);
  gap: 9px;
}

.p-button {
  min-height: 38px;
  padding: 0 15px;
  color: #fff;
  background: #5a46df;
  border: 1px solid #4631c5;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 750;
}

.p-button.secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}

.p-button.ghost {
  color: var(--accent-strong);
  background: transparent;
  border-color: transparent;
}

.p-button.danger {
  background: #c03543;
  border-color: #a32634;
}

.p-button.round {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
}

.p-icon {
  width: 16px;
  height: 16px;
}

.p-field {
  display: grid;
  width: min(100%, 290px);
  gap: 5px;
}

.p-field label,
.p-label {
  color: var(--ink);
  font-size: 10px;
  font-weight: 750;
}

.p-input,
.p-select,
.p-textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  font-size: 11px;
}

.p-textarea {
  min-height: 68px;
  resize: none;
}

.p-help {
  color: var(--muted);
  font-size: 9px;
}

.p-check {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 11px;
}

.p-check-box,
.p-radio-dot {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  color: #fff;
  background: #5a46df;
  border: 1px solid #4631c5;
  border-radius: 4px;
  font-size: 10px;
}

.p-radio-dot {
  border-radius: 50%;
}

.p-radio-dot::after {
  width: 5px;
  height: 5px;
  background: #fff;
  border-radius: 50%;
  content: "";
}

.p-switch {
  position: relative;
  width: 38px;
  height: 22px;
  background: #5a46df;
  border-radius: 999px;
}

.p-switch::after {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.22);
  content: "";
}

.p-slider {
  position: relative;
  width: min(100%, 230px);
  height: 5px;
  background: var(--line-strong);
  border-radius: 999px;
}

.p-slider::before {
  position: absolute;
  inset: 0 38% 0 0;
  background: #5a46df;
  border-radius: inherit;
  content: "";
}

.p-slider::after {
  position: absolute;
  top: 50%;
  left: 62%;
  width: 16px;
  height: 16px;
  background: #fff;
  border: 2px solid #5a46df;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  content: "";
}

.p-card {
  width: min(100%, 260px);
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 5px 16px rgb(23 24 28 / 0.08);
}

.p-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.p-card h4,
.p-card p {
  margin: 0;
}

.p-card h4 {
  color: var(--ink);
  font-size: 12px;
}

.p-card p {
  color: var(--muted);
  font-size: 9px;
}

.p-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: #5a46df;
  border: 2px solid var(--surface);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}

.p-avatar-group {
  display: flex;
}

.p-avatar-group .p-avatar + .p-avatar {
  margin-left: -9px;
}

.p-badge,
.p-chip {
  display: inline-flex;
  min-height: 23px;
  padding: 2px 8px;
  align-items: center;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 999px;
  font-size: 9px;
  font-weight: 750;
}

.p-badge.status {
  color: var(--success);
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 24%, var(--line));
}

.p-nav {
  display: flex;
  width: min(100%, 420px);
  min-height: 48px;
  padding: 7px 10px;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.p-nav-logo {
  color: var(--ink);
  font-size: 11px;
  font-weight: 850;
}

.p-nav-links {
  display: flex;
  gap: 11px;
  color: var(--muted);
  font-size: 9px;
}

.p-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.p-tab {
  padding: 6px 11px;
  color: var(--muted);
  border-radius: 5px;
  font-size: 9px;
}

.p-tab.active {
  color: var(--ink);
  background: var(--surface-muted);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 750;
}

.p-sidebar {
  display: grid;
  grid-template-columns: 76px 1fr;
  width: min(100%, 330px);
  min-height: 94px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.p-sidebar nav {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 10px 7px;
  background: var(--surface-muted);
  border-right: 1px solid var(--line);
}

.p-sidebar nav span,
.p-list-row {
  min-height: 16px;
  background: var(--line);
  border-radius: 3px;
}

.p-sidebar main {
  display: grid;
  width: auto;
  margin: 0;
  padding: 12px;
  align-content: start;
  gap: 7px;
}

.p-line {
  height: 7px;
  background: var(--line);
  border-radius: 999px;
}

.p-line.short {
  width: 58%;
}

.p-alert {
  display: flex;
  width: min(100%, 360px);
  gap: 10px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 8px;
}

.p-alert.warning {
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 35%, var(--line));
}

.p-alert.danger {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
}

.p-alert-icon {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: #5a46df;
  border-radius: 50%;
  font-size: 10px;
}

.p-alert strong,
.p-alert p {
  display: block;
  margin: 0;
}

.p-alert strong {
  font-size: 10px;
}

.p-alert p {
  color: var(--muted);
  font-size: 9px;
}

.p-dialog {
  width: min(100%, 310px);
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgb(23 24 28 / 0.22);
}

.p-dialog h4,
.p-dialog p {
  margin: 0;
}

.p-dialog h4 {
  color: var(--ink);
  font-size: 13px;
}

.p-dialog p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

.p-dialog .preview-row {
  margin-top: 13px;
  justify-content: end;
}

.p-table {
  width: min(100%, 420px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.p-table-row {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.6fr;
  gap: 8px;
  min-height: 27px;
  padding: 6px 9px;
  align-items: center;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 8px;
}

.p-table-row:last-child {
  border-bottom: 0;
}

.p-table-row.header {
  color: var(--ink);
  background: var(--surface-muted);
  font-weight: 750;
}

.p-progress {
  width: min(100%, 280px);
}

.p-progress-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 9px;
}

.p-progress-track {
  height: 7px;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}

.p-progress-track::after {
  display: block;
  width: 68%;
  height: 100%;
  background: #5a46df;
  border-radius: inherit;
  content: "";
}

.p-spinner {
  width: 31px;
  height: 31px;
  border: 3px solid var(--line);
  border-top-color: #5a46df;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.p-skeleton {
  display: grid;
  width: min(100%, 270px);
  grid-template-columns: 42px 1fr;
  gap: 11px;
}

.p-skeleton-circle,
.p-skeleton-line {
  background: var(--line);
  border-radius: 999px;
}

.p-skeleton-circle {
  width: 42px;
  height: 42px;
}

.p-skeleton-lines {
  display: grid;
  gap: 7px;
  align-content: center;
}

.p-skeleton-line {
  height: 7px;
}

.p-skeleton-line:last-child {
  width: 64%;
}

.p-media {
  position: relative;
  display: grid;
  width: min(100%, 300px);
  aspect-ratio: 16 / 9;
  place-items: center;
  overflow: hidden;
  color: #fff;
  background: #262936;
  border: 1px solid #3d4151;
  border-radius: 9px;
}

.p-media::before,
.p-media::after {
  position: absolute;
  border-radius: 50%;
  content: "";
}

.p-media::before {
  width: 130px;
  height: 130px;
  background: #5a46df;
  opacity: 0.65;
  transform: translate(-65px, 46px);
}

.p-media::after {
  width: 95px;
  height: 95px;
  background: #f091b2;
  opacity: 0.58;
  transform: translate(70px, -40px);
}

.p-play {
  z-index: 1;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  background: rgb(255 255 255 / 0.92);
  border-radius: 50%;
  color: #1e2028;
  font-size: 12px;
}

.p-product {
  display: grid;
  width: min(100%, 320px);
  grid-template-columns: 100px 1fr;
  gap: 13px;
  padding: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.p-product-image {
  min-height: 86px;
  background: #dad5ff;
  border-radius: 6px;
}

:root[data-theme="dark"] .p-product-image {
  background: #3c356f;
}

.p-product-copy {
  display: grid;
  align-content: center;
  gap: 5px;
}

.p-product-copy strong {
  color: var(--ink);
  font-size: 11px;
}

.p-product-copy span {
  color: var(--muted);
  font-size: 9px;
}

.p-price {
  color: var(--ink) !important;
  font-family: var(--font-mono);
  font-size: 13px !important;
  font-weight: 800;
}

.p-chat {
  display: grid;
  width: min(100%, 330px);
  gap: 8px;
}

.p-bubble {
  max-width: 78%;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px 10px 10px 3px;
  font-size: 9px;
}

.p-bubble.me {
  justify-self: end;
  color: #fff;
  background: #5a46df;
  border-color: #4631c5;
  border-radius: 10px 10px 3px 10px;
}

.p-kanban {
  display: grid;
  width: min(100%, 430px);
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.p-kanban-col {
  min-height: 95px;
  padding: 7px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.p-kanban-col > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
}

.p-task {
  min-height: 24px;
  margin-bottom: 5px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.p-layout {
  display: grid;
  width: min(100%, 390px);
  min-height: 90px;
  gap: 7px;
}

.p-layout.cols-2 {
  grid-template-columns: 1fr 1fr;
}

.p-layout.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.p-layout.sidebar-layout {
  grid-template-columns: 0.5fr 1.5fr;
}

.p-layout-box {
  min-height: 34px;
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  border-radius: 6px;
}

.p-phone {
  display: grid;
  width: 156px;
  height: 102px;
  overflow: hidden;
  background: var(--surface);
  border: 2px solid var(--line-strong);
  border-radius: 14px;
}

.p-phone-top {
  height: 24px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
}

.p-phone-body {
  display: grid;
  padding: 8px;
  align-content: center;
  gap: 5px;
}

.p-phone-bottom {
  align-self: end;
  display: grid;
  height: 24px;
  grid-template-columns: repeat(4, 1fr);
  place-items: center;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.p-phone-bottom i {
  width: 10px;
  height: 10px;
  background: var(--line-strong);
  border-radius: 3px;
}

.p-phone-bottom i.active {
  background: #5a46df;
}

.p-focus-demo {
  display: inline-flex;
  min-height: 40px;
  padding: 0 14px;
  align-items: center;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent);
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 1180px) {
  .component-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 880px) {
  .intro {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-top: 60px;
  }

  .catalog-stats {
    grid-column: auto;
  }

  .catalog-shell {
    grid-template-columns: 1fr;
  }

  .category-sidebar {
    display: none;
  }

  .mobile-category,
  .mobile-category-label {
    display: block;
  }

  .catalog-toolbar {
    align-items: start;
    flex-direction: column;
  }

  .toolbar-controls {
    display: grid;
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 180px);
  }

  .toolbar-controls select {
    width: 100%;
  }

  .detail-overview {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  :root {
    --header-height: 60px;
  }

  .header-inner,
  main,
  .site-footer {
    width: min(100% - 24px, 1480px);
  }

  .brand small {
    display: none;
  }

  .intro {
    gap: 30px;
    padding: 40px 0 34px;
  }

  .intro h1 {
    font-size: clamp(32px, 9vw, 44px);
    letter-spacing: -0.06em;
  }

  .intro h1 br {
    display: none;
  }

  .intro h1 .intro-line {
    display: block;
    white-space: normal;
  }

  .intro-copy > p:last-child {
    margin-top: 20px;
    font-size: 14px;
  }

  .search-panel {
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .search-box kbd {
    display: none;
  }

  .catalog-stats {
    gap: 22px;
    justify-content: space-between;
  }

  .catalog-stats div {
    display: grid;
    gap: 0;
  }

  .catalog-stats dt {
    font-size: 20px;
  }

  .catalog-shell {
    padding: 32px 0 54px;
  }

  .catalog-toolbar {
    align-items: start;
    flex-direction: column;
  }

  .toolbar-controls {
    display: grid;
    width: 100%;
    grid-template-columns: auto 1fr;
  }

  .toolbar-controls select {
    width: 100%;
  }

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

  .component-card {
    min-height: 286px;
    grid-template-rows: 112px 1fr;
  }

  .scope-note {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .site-footer {
    display: grid;
    gap: 6px;
  }

  .component-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .dialog-frame {
    max-height: 100dvh;
  }

  .dialog-header,
  .detail-overview,
  .code-section {
    padding-right: 16px;
    padding-left: 16px;
  }

  .dialog-header {
    padding-top: max(16px, env(safe-area-inset-top));
  }

  .detail-preview {
    min-height: 230px;
    padding: 20px 12px;
  }

  .code-header {
    align-items: start;
    flex-direction: column;
  }

  .copy-control {
    width: 100%;
    justify-content: center;
  }

  .code-actions {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .code-tabs {
    display: flex;
    width: 100%;
  }

  .code-panel {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
