/*
 * [站点注释 Site Note]
 * 文件: D:\Documents\GitHub\whwdzg.github.io\css\component.css
 * 作用: 主站组件样式（提示框、对话框、输入框、按钮等）。
 * English: Component styles for dialogs, toasts, inputs, and buttons.
 */
:root {
  --component-card-bg: var(--card-bg, rgba(255, 255, 255, 0.95));
  --component-shadow: 0 16px 40px var(--shadow-color, rgba(15, 23, 42, 0.18));
  --component-radius: 14px;
  --component-gap: 1rem;
}

body.component-demo {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-sans);
  margin: 0;
  padding: 0;
}

body:has(.component-demo-page) {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-sans);
  margin: 0;
  padding: 0;
}

.component-demo a,
.component-demo button,
.component-demo input,
.component-demo textarea,
.component-demo select,
.component-demo [role="button"] {
  -webkit-tap-highlight-color: transparent !important;
}

.component-demo-page {
  width: min(1200px, calc(100vw - 2.5rem));
  margin: 0 auto;
  display: grid;
  gap: 1.5rem;
}

.component-demo-page h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.02em;
}

.component-theme-swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  transition: transform 220ms cubic-bezier(.2,.8,.2,1), box-shadow 220ms cubic-bezier(.2,.8,.2,1);
}

.component-theme-swatch.active {
  box-shadow: 0 0 0 2px var(--primary-color), inset 0 0 0 1px rgba(255,255,255,0.45);
}

.component-theme-swatch:hover {
  transform: translateY(-1px);
}

.component-theme-swatch:active {
  transform: scale(0.96);
}

.component-theme-swatch--custom {
  width: 32px;
  height: 32px;
  background: #b6b6b6;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.component-theme-swatch--custom i {
  font-size: 16px;
}

.component-hex-row {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.component-hex-input {
  width: 120px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--secondary-bg);
  color: var(--text-color);
  padding: 0.42rem 0.6rem;
}

.component-hex-input:focus {
  outline: none;
  background: var(--input-focus-bg);
  box-shadow: 0 -2px 0 0 var(--primary-color) inset, 0 0 0 1px var(--hover-bg);
}

.component-section {
  background: var(--component-card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--component-radius);
  box-shadow: var(--component-shadow);
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
}

.component-section-title {
  margin: 0;
  font-size: 1.2rem;
}

.component-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.component-row--between {
  justify-content: space-between;
}

.component-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* Toast / floating tip */
.component-toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translate(-50%, 16px);
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--toast-border, var(--border-color));
  background: var(--component-card-bg);
  color: var(--text-color);
  box-shadow: var(--component-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(.2,.8,.2,1), transform 240ms cubic-bezier(.2,.8,.2,1);
  z-index: 2400;
}

.component-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.component-toast__icon {
  font-size: 1.1rem;
}

.component-toast__message {
  max-width: min(280px, 60vw);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.component-toast__close {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  transition: background 220ms cubic-bezier(.2,.8,.2,1), transform 180ms cubic-bezier(.2,.8,.2,1);
}

.component-toast__close:hover {
  background: var(--hover-bg);
}

.component-toast__close:active {
  transform: scale(0.95);
  background: var(--active-bg);
}

.component-toast--success { --toast-border: rgba(16, 185, 129, 0.65); }
.component-toast--warning { --toast-border: rgba(245, 158, 11, 0.7); }
.component-toast--error { --toast-border: rgba(239, 68, 68, 0.7); }
.component-toast--info { --toast-border: rgba(59, 130, 246, 0.7); }

/* Dialog */
.component-dialog {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2300;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(.2,.8,.2,1), visibility 220ms cubic-bezier(.2,.8,.2,1);
}

.component-dialog.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.component-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 220ms cubic-bezier(.2,.8,.2,1);
}

.component-dialog.is-open .component-dialog__backdrop {
  opacity: 1;
}

.component-dialog__panel {
  position: relative;
  width: min(520px, calc(100vw - 2rem));
  background: var(--component-card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 30px 60px var(--shadow-color);
  padding: 1.25rem 1.5rem;
  display: grid;
  gap: 0.85rem;
  z-index: 1;
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: transform 220ms cubic-bezier(.2,.8,.2,1), opacity 200ms cubic-bezier(.2,.8,.2,1);
}

.component-dialog.is-open .component-dialog__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.component-dialog__title {
  margin: 0;
  font-size: 1.2rem;
}

.component-dialog__text {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.component-dialog__input {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  background: var(--secondary-bg);
  color: var(--text-color);
}

.component-dialog__input:focus {
  outline: none;
  background: var(--input-focus-bg);
  box-shadow: 0 -2px 0 0 var(--primary-color) inset, 0 0 0 1px var(--hover-bg);
}

.component-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.component-dialog__actions .component-btn {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

/* Input and search bottom line */
.component-input,
.component-search-wrap {
  position: relative;
}

.component-input {
  display: grid;
  gap: 0.6rem;
}

.component-input__tools {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  display: inline-flex;
  gap: 0.35rem;
  z-index: 2;
}

.component-textarea {
  width: 100%;
  min-height: 140px;
  padding: 2.8rem 0.9rem 0.9rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-color);
  resize: none;
  font-family: var(--font-mono);
  font-size: 1rem;
  box-shadow: 0 10px 24px var(--shadow-color);
  transition: border 220ms cubic-bezier(.2,.8,.2,1), box-shadow 220ms cubic-bezier(.2,.8,.2,1), background 220ms cubic-bezier(.2,.8,.2,1);
  box-sizing: border-box;
}

.component-textarea::-webkit-resizer,
.component-textarea::-moz-resizer {
  display: none;
}

.component-textarea:focus {
  outline: none;
  border-color: var(--border-color);
  background: var(--input-focus-bg);
  box-shadow: 0 -2px 0 0 var(--primary-color) inset, 0 0 0 1px var(--hover-bg);
}

.component-textarea--fixed {
  height: 140px;
  min-height: 140px;
  max-height: 140px;
  overflow-y: auto;
}

/* Search input */
.component-search {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--component-card-bg);
  box-shadow: 0 10px 24px var(--shadow-color);
}

.component-search__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-color);
  font-size: 1rem;
  outline: none;
}

.component-search:focus-within {
  box-shadow: 0 -2px 0 0 var(--primary-color) inset, 0 0 0 1px var(--hover-bg);
}

/* Range slider */
.component-slider {
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: linear-gradient(90deg,
    rgba(var(--primary-color-rgb, 51, 204, 153), 0.78) 0%,
    rgba(var(--primary-color-rgb, 51, 204, 153), 0.42) 45%,
    rgba(148, 163, 184, 0.28) 100%);
}

.component-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f8fbff;
  border: 1px solid rgba(8, 10, 18, 0.65);
  box-shadow: none;
}

.component-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f8fbff;
  border: 1px solid rgba(8, 10, 18, 0.65);
  box-shadow: none;
}

.search-results {
  margin-top: 0.55rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 10px 30px var(--shadow-color);
  backdrop-filter: blur(6px);
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
  width: 100%;
  box-sizing: border-box;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s ease;
  line-height: 1.5;
}

.search-result-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-item:hover .search-result-text {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.search-result-item:hover {
  background: var(--hover-bg);
}

.search-result-item:active {
  background: var(--active-bg);
}

.search-result-indicator {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-color, #4A90E2);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.search-result-item:hover .search-result-indicator {
  transform: translateX(2px) scale(1.05);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.search-result-item.hidden {
  display: none;
}

/* Switch */
.component-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
}

.component-switch__input {
  position: absolute;
  opacity: 0;
}

.component-switch__track {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #d0d0d0;
  border: 1px solid var(--border-color);
  display: inline-block;
  position: relative;
  transition: background 200ms cubic-bezier(.2,.8,.2,1), box-shadow 180ms ease;
}

.component-switch__thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translateY(-50%) translateX(0);
  transition: transform 220ms cubic-bezier(.2,.8,.2,1), box-shadow 160ms ease;
}

.component-switch__input:checked + .component-switch__track {
  background: var(--primary-color, #33cc99);
  box-shadow: 0 8px 26px rgba(0,0,0,0.10), inset 0 1px 0 rgba(255,255,255,0.02);
}

.component-switch__input:checked + .component-switch__track .component-switch__thumb {
  transform: translateY(-50%) translateX(21px) scale(1.02);
  box-shadow: 0 6px 18px rgba(0,0,0,0.14);
}

.component-switch__input:focus-visible + .component-switch__track {
  box-shadow: 0 8px 24px rgba(var(--primary-color-rgb, 51,204,153), 0.08);
}

.component-switch__label {
  font-weight: 600;
}

/* Dropdown floating */
.component-dropdown {
  position: relative;
  width: min(300px, 100%);
}

.component-dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  padding-right: 40px;
  position: relative;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-color);
  transition: background 220ms cubic-bezier(.2,.8,.2,1), border-color 220ms cubic-bezier(.2,.8,.2,1), transform 220ms cubic-bezier(.2,.8,.2,1), box-shadow 220ms cubic-bezier(.2,.8,.2,1);
}

.component-dropdown-toggle:hover {
  background: var(--hover-bg);
  transform: translateY(-1px);
}

.component-dropdown-toggle .toggle-label {
  flex: 1;
  text-align: left;
  line-height: 20px;
  padding-right: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.component-dropdown-toggle .toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  transform-origin: 50% 50%;
  transition: transform 220ms cubic-bezier(.2,.8,.2,1);
  width: 20px;
  height: 20px;
  line-height: 1;
  font-size: 14px;
  color: var(--text-muted);
}

.component-dropdown-toggle[aria-expanded="true"] .toggle-icon,
.component-dropdown.open .component-dropdown-toggle .toggle-icon {
  transform: translateY(-50%) rotate(180deg);
}

.component-dropdown-list {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: max-content;
  min-width: 100%;
  max-width: min(520px, calc(100vw - 24px));
  max-height: min(320px, 52vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  box-shadow: 0 20px 46px var(--shadow-color);
  padding: 6px;
  opacity: 0;
  transform: translateY(-4px) scale(0.99);
  pointer-events: none;
  transition: opacity 180ms cubic-bezier(.2,.8,.2,1), transform 200ms cubic-bezier(.2,.8,.2,1);
}

.component-dropdown.open .component-dropdown-list {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.component-dropdown.dropup .component-dropdown-list {
  top: auto;
  bottom: calc(100% + 8px);
  transform: translateY(4px) scale(0.99);
}

.component-dropdown.dropup.open .component-dropdown-list {
  transform: translateY(0) scale(1);
}

.component-dropdown-list.component-dropdown-list--portal {
  display: block;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1900;
  min-width: 0;
}

.component-dropdown-list.component-dropdown-list--portal.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.component-dropdown-list.component-dropdown-list--portal.dropup {
  transform: translateY(4px) scale(0.99);
}

.component-dropdown-list.component-dropdown-list--portal.dropup.is-open {
  transform: translateY(0) scale(1);
}

.component-dropdown-item {
  border-radius: 8px;
  margin: 4px 0;
  padding: 8px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 220ms cubic-bezier(.2,.8,.2,1), transform 180ms cubic-bezier(.2,.8,.2,1), box-shadow 180ms cubic-bezier(.2,.8,.2,1);
  cursor: pointer;
  position: relative;
}

.component-dropdown-item:hover {
  background: var(--hover-bg);
  transform: translateY(-0.5px);
}

.component-dropdown-item.selected {
  background: var(--hover-bg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  padding-left: 14px;
}

.component-dropdown-item.selected::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 4px;
  background: var(--primary-color);
}

/* Palette section */
.component-palette {
  position: relative;
  display: grid;
  gap: 0.85rem;
}

.component-palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
  gap: 0.55rem;
  max-width: 360px;
}

.component-palette-grid .component-theme-swatch {
  width: 100%;
  height: 32px;
}

/* Pills */
.component-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--secondary-bg);
  font-weight: 600;
}

.component-pill--author {
  gap: 0.5rem;
  padding: 0.25rem 0.9rem;
}

.component-pill--author img {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  object-fit: cover;
  object-position: 50% 50%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.component-pill--author-link {
  text-decoration: none;
  color: inherit;
  transition: transform 220ms cubic-bezier(.2,.8,.2,1), box-shadow 220ms cubic-bezier(.2,.8,.2,1), background 220ms cubic-bezier(.2,.8,.2,1);
}

.component-pill--author-link:hover {
  transform: translateY(-0.7px);
  background: var(--hover-bg);
  box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}

.component-pill--author-link:active {
  transform: scale(0.97);
  background: var(--active-bg);
}

/* Avatar frame */
.component-avatar {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: none;
  transition: transform 220ms cubic-bezier(.2,.8,.2,1), box-shadow 220ms cubic-bezier(.2,.8,.2,1), background 220ms cubic-bezier(.2,.8,.2,1);
}

.component-avatar:hover {
  transform: translateY(-0.7px);
  background: transparent;
  box-shadow: none;
}

.component-avatar:active {
  transform: scale(0.96);
  background: transparent;
}

.component-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

a.component-avatar {
  text-decoration: none;
  color: inherit;
}

/* Comment list */
.component-comment-list {
  display: grid;
  gap: 0.75rem;
}

.component-comment-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 0.65rem 0.85rem;
  align-items: flex-start;
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.75rem;
}

.component-comment-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
}

.component-comment-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 48px;
  justify-content: center;
}

.component-comment-author {
  margin: 0;
  font-weight: 600;
}

.component-comment-date {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.component-comment-text {
  grid-column: 1 / span 2;
  margin: 0;
  line-height: 1.55;
}

.component-comment-reply {
  grid-column: 1 / span 2;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 0.5rem 0.65rem;
  padding: 0.65rem 0.75rem;
  margin-top: 0.35rem;
  border-left: 3px solid var(--primary-color, var(--border-color));
  background: rgba(148, 163, 184, 0.07);
  border-radius: 10px;
}

.component-comment-reply img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.component-comment-reply-text {
  grid-column: 1 / span 2;
  margin: 0;
  line-height: 1.55;
}

/* Directory */
.component-directory {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1rem;
  display: grid;
  gap: 0.6rem;
}

.component-directory__title {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.component-directory__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.component-directory__item {
  position: relative;
  padding-left: 0.8rem;
}

.component-directory__item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.7);
  transform: translateY(-50%);
}

.component-directory__item.level-4 {
  padding-left: 1.45rem;
}

.component-directory__item.level-5 {
  padding-left: 2.2rem;
}

.component-directory__link {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid transparent;
  background: transparent;
  padding: 0.28rem 0.4rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-color);
  font-weight: 400;
  text-align: left;
  transition: background 220ms cubic-bezier(.2,.8,.2,1), transform 180ms cubic-bezier(.2,.8,.2,1);
}

.component-directory__link:hover {
  background: var(--hover-bg);
  transform: translateY(-0.4px);
}

/* Filter bar */
.component-filter-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.component-filter-status {
  color: var(--text-muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

.component-filter-chip {
  border: 1px solid var(--border-color);
  background: var(--secondary-bg);
  color: var(--text-color);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition: background 220ms cubic-bezier(.2,.8,.2,1), box-shadow 220ms cubic-bezier(.2,.8,.2,1), color 220ms cubic-bezier(.2,.8,.2,1), transform 180ms cubic-bezier(.2,.8,.2,1);
  font-weight: 600;
}

.component-filter-chip:hover {
  transform: none;
}

.component-filter-chip.active {
  background: linear-gradient(135deg, rgba(var(--primary-color-rgb, 51,204,153), 0.95), rgba(var(--primary-color-rgb, 51,204,153), 0.72));
  color: #fff;
  border-color: transparent;
  box-shadow: none;
}

/* Display bar */
.component-display-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
}

.component-display-card {
  border: 1px solid var(--border-color);
  background: var(--secondary-bg);
  border-radius: 12px;
  padding: 0.8rem;
  box-shadow: 0 10px 24px var(--shadow-color);
}

.component-display-title {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.component-display-value {
  margin: 0.2rem 0 0;
  font-size: 1.4rem;
  font-weight: 700;
}

/* Buttons */
.component-btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.6rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  transition: transform 220ms cubic-bezier(.2,.8,.2,1), box-shadow 220ms cubic-bezier(.2,.8,.2,1), background 220ms cubic-bezier(.2,.8,.2,1), color 220ms cubic-bezier(.2,.8,.2,1), border-color 220ms cubic-bezier(.2,.8,.2,1);
}

.component-btn i {
  font-size: 1rem;
}

.component-btn--standard {
  background: var(--secondary-bg);
  color: var(--text-color);
  border-color: var(--border-color);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.component-btn--standard:hover {
  background: var(--hover-bg);
}

.component-btn--standard:active {
  transform: scale(0.96);
  background: var(--active-bg);
}

.component-btn--flat {
  background: var(--component-flat-bg, rgba(var(--primary-color-rgb, 51, 204, 153), 0.14));
  color: var(--component-flat-color, var(--text-color));
  border-color: var(--component-flat-border, rgba(var(--primary-color-rgb, 51, 204, 153), 0.36));
}

.component-btn--flat:hover {
  background: color-mix(in srgb, var(--component-flat-bg, rgba(var(--primary-color-rgb, 51, 204, 153), 0.14)) 70%, var(--hover-bg));
}

.component-btn--flat:active {
  transform: scale(0.96);
  background: color-mix(in srgb, var(--component-flat-bg, rgba(var(--primary-color-rgb, 51, 204, 153), 0.14)) 55%, var(--active-bg));
}

.component-btn--immersive {
  background: transparent;
  color: var(--text-color);
  border-color: transparent;
  box-shadow: none;
}

.component-btn--immersive:hover {
  transform: translateY(-1px);
  background: var(--hover-bg);
}

.component-btn--immersive:active {
  background: var(--active-bg);
  transform: scale(0.96);
}

.component-btn--immersive-tint {
  background: transparent;
  color: var(--btn-text, var(--text-color));
  border-color: transparent;
}

.component-btn--immersive-tint:hover {
  background: var(--hover-bg);
}

.component-btn--immersive-tint:active,
.component-btn--immersive-tint.is-feedback {
  background: rgba(var(--btn-rgb, var(--primary-color-rgb, 51,204,153)), 0.34);
  transform: scale(0.95);
  border-color: rgba(var(--btn-rgb, var(--primary-color-rgb, 51,204,153)), 0.45);
}

.component-icon-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 8px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.component-btn--raised {
  background: var(--bg-color);
  color: var(--text-color);
  border-color: var(--border-color);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.15);
}

.component-btn--raised:hover {
  transform: translateY(-1px);
}

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

/* Menu (sidebar-like) */
.component-menu {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  width: min(420px, 100%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--card-bg);
  box-shadow: 0 10px 30px var(--shadow-color);
}

.component-menu li {
  margin: 0;
}

.component-menu-link,
.component-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 42px;
  padding: 0.5rem 0.55rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-color);
  text-decoration: none;
  text-align: left;
  font: inherit;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  transition: background 220ms cubic-bezier(.2,.8,.2,1), transform 180ms cubic-bezier(.2,.8,.2,1), box-shadow 180ms cubic-bezier(.2,.8,.2,1);
  position: relative;
}

.component-menu-link:hover,
.component-menu-toggle:hover {
  background: var(--hover-bg);
  transform: translateY(-0.6px);
}

.component-menu-link:active,
.component-menu-toggle:active {
  transform: scale(0.98);
  background: var(--active-bg);
}

.component-menu-link.current,
.component-menu-toggle.current {
  background: var(--hover-bg);
}

.component-menu-link.current::before,
.component-menu-toggle.current::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: calc(100% - 16px);
  border-radius: 3px;
  background: rgba(var(--primary-color-rgb, 51,204,153), 0.95);
}

.component-menu .item-icon {
  width: 20px;
  height: 20px;
  margin-right: 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.component-menu-toggle .toggle-icon {
  margin-left: auto;
  color: var(--text-muted);
  transition: transform 220ms cubic-bezier(.2,.8,.2,1);
}

.component-menu-item.open > .component-menu-toggle .toggle-icon {
  transform: rotate(180deg);
}

.component-submenu {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.1rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 240ms cubic-bezier(.2,.8,.2,1);
}

.component-submenu .component-submenu {
  padding-left: 1rem;
}

.component-menu-item.open > .component-submenu {
  max-height: 700px;
}

/* Media items */
.component-media-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.component-media-card {
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  box-shadow: none;
}

.component-media-card img,
.component-media-card video {
  width: 100%;
  height: auto;
  display: block;
}

.component-media-card-body {
  padding: 0.75rem;
  display: grid;
  gap: 0.5rem;
}

.component-audio-dock {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(920px, calc(100vw - 1.2rem));
  z-index: 1590;
  padding: 0.7rem 0.9rem;
  background: color-mix(in srgb, var(--card-bg) 84%, transparent);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 14px 30px var(--shadow-color);
  backdrop-filter: blur(10px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 0.7rem;
  align-items: stretch;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 10px) scale(0.98);
  transition: opacity 220ms cubic-bezier(.2,.8,.2,1), transform 240ms cubic-bezier(.2,.8,.2,1), visibility 220ms cubic-bezier(.2,.8,.2,1);
}

body.no-scroll-lightbox .component-audio-dock,
body.settings-modal-open .component-audio-dock {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.component-audio-dock.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}

.component-audio-dock.is-closing {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 12px) scale(0.98);
}

.component-audio-main {
  display: grid;
  gap: 0.16rem;
  min-width: 0;
}

.component-audio-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
}

.component-audio-info {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.component-audio-symbol {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--hover-bg) 70%, transparent);
  color: var(--primary-color);
}

.component-audio-symbol i {
  font-size: 18px;
}

.component-audio-symbol.has-cover i {
  display: none;
}

.component-audio-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.component-audio-symbol.has-cover .component-audio-cover {
  display: block;
}

.component-audio-name {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-audio-author {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-audio-album {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-audio-time {
  color: var(--text-muted);
  font-size: 0.88rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-audio-progress {
  width: 100%;
}

.component-audio-actions {
  width: auto;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: nowrap;
  align-items: center;
  margin: 0;
}

.component-video-controls {
  margin-top: 0.55rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--secondary-bg);
  padding: 0.5rem;
  display: grid;
  gap: 0.45rem;
}

.component-video-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.12rem 0.28rem 0.04rem;
}

.component-video-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-left: 0.12rem;
}

.component-video-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-left: auto;
}

.component-video-time {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.component-video-seek-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
}

.component-video-progress {
  width: 100%;
}

.component-spectrum-panel {
  display: grid;
  gap: 0.5rem;
  max-width: 520px;
}

.component-spectrum-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 68px;
  gap: 0.55rem;
  align-items: center;
}

.component-spectrum-row input[type="range"] {
  width: 100%;
  accent-color: var(--primary-color);
}

.component-spectrum-row input[type="number"] {
  width: 100%;
  min-width: 0;
}

.component-slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 0.55rem;
  align-items: center;
}

.component-range-value {
  text-align: center;
}

.component-color-floating-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: min(420px, calc(100vw - 3rem));
  max-height: min(74vh, 560px);
  overflow: auto;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 20px 46px var(--shadow-color);
  padding: 0.8rem;
  display: grid;
  gap: 0.6rem;
  z-index: 2100;
}

.component-panel-header {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.component-color-preview {
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--primary-color);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2);
}

.component-hex-row--actions {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.45rem;
  align-items: center;
}

[hidden].component-color-floating-panel {
  display: none;
}

/* Progress bar style (slider-like) */
.component-range-slider,
.component-audio-progress,
.component-video-progress {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  --slider-pct: 0%;
  --slider-right-bg: rgba(148, 163, 184, 0.45);
  background: linear-gradient(
    90deg,
    rgba(var(--primary-color-rgb, 51,204,153), 0.34) 0%,
    rgba(var(--primary-color-rgb, 51,204,153), 0.98) var(--slider-pct),
    var(--slider-right-bg) var(--slider-pct),
    var(--slider-right-bg) 100%
  );
  outline: none;
  touch-action: pan-x;
}

.component-range-slider::-webkit-slider-thumb,
.component-audio-progress::-webkit-slider-thumb,
.component-video-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.component-range-slider::-moz-range-thumb,
.component-audio-progress::-moz-range-thumb,
.component-video-progress::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.component-btn,
.component-btn:hover,
.component-btn:focus,
.component-btn:active {
  text-decoration: none;
}

@media (max-width: 560px) {
  .component-hex-row--actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Shared clickable animation */
.component-demo a,
.component-demo button,
.component-demo .component-filter-chip,
.component-demo .component-dropdown-item,
.component-demo .component-menu-toggle,
.component-demo .component-menu-link,
.component-demo .component-directory__link,
.component-demo .component-pill--author-link,
.component-demo .component-avatar,
.component-demo .component-theme-swatch {
  transition-timing-function: cubic-bezier(.2,.8,.2,1);
}

@media (max-width: 720px) {
  body.component-demo {
    padding: 1.2rem 0 3rem;
  }
  .component-demo-page {
    width: calc(100vw - 2rem);
  }
  .component-dialog__panel {
    padding: 1rem 1.1rem;
  }
  .component-dialog__actions {
    flex-wrap: wrap;
  }
  .component-dialog__actions .component-btn {
    width: 100%;
    justify-content: center;
  }
  .component-demo-controls {
    min-width: 0;
    width: 100%;
  }

  .component-audio-dock {
    left: calc(env(safe-area-inset-left, 0px) + 0.85rem);
    right: calc(env(safe-area-inset-right, 0px) + 0.85rem);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    width: auto;
    max-width: none;
    padding: 0.52rem 0.72rem 0.62rem;
    transform: translateY(10px) scale(0.98);
    row-gap: 0.52rem;
    overflow: hidden;
  }

  .component-audio-dock.show {
    transform: translateY(0) scale(1);
  }

  .component-audio-dock.is-closing {
    transform: translateY(12px) scale(0.98);
  }

  .component-audio-symbol {
    display: inline-flex;
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .component-audio-main {
    display: grid;
    gap: 0.16rem;
    min-width: 0;
  }

  .component-audio-name,
  .component-audio-author,
  .component-audio-album,
  .component-audio-time {
    padding-right: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .component-audio-progress {
    width: 100%;
    margin: 0;
    height: 10px;
    border-radius: 999px;
  }

  .component-audio-top {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.52rem;
    align-items: start;
  }

  .component-audio-info {
    gap: 0.52rem;
    align-items: start;
  }

  .component-audio-actions {
    width: auto;
    justify-content: flex-end;
    gap: 0.22rem;
    flex-wrap: nowrap;
    align-items: center;
    margin: 0;
  }

  .component-audio-actions .component-btn {
    min-width: 30px;
    width: 30px;
    height: 30px;
    padding: 0;
  }

  .component-audio-actions .component-btn.component-icon-btn {
    width: 30px;
    min-width: 30px;
    padding: 0;
  }

  .component-audio-actions a[href*="/media/music.html"],
  .component-audio-actions a[href*="/media/video.html"] {
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    gap: 0;
    justify-content: center;
    font-size: 0;
    overflow: hidden;
    white-space: nowrap;
  }

  .component-audio-actions a[href*="/media/music.html"] i,
  .component-audio-actions a[href*="/media/video.html"] i {
    margin: 0;
    font-size: 16px;
  }

  .component-video-meta a[href*="/media/video.html"] {
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    gap: 0;
    justify-content: center;
    font-size: 0;
    overflow: hidden;
    white-space: nowrap;
  }

  .component-video-meta a[href*="/media/video.html"] i {
    margin: 0;
    font-size: 16px;
  }
}

@media (max-width: 420px) {
  .component-audio-dock {
    left: calc(env(safe-area-inset-left, 0px) + 0.62rem);
    right: calc(env(safe-area-inset-right, 0px) + 0.62rem);
    padding: 0.46rem 0.56rem 0.56rem;
    row-gap: 0.44rem;
  }

  .component-audio-symbol {
    width: 36px;
    height: 36px;
    border-radius: 9px;
  }

  .component-audio-info {
    gap: 0.44rem;
  }

  .component-audio-actions .component-btn,
  .component-audio-actions .component-btn.component-icon-btn,
  .component-audio-actions a[href*="/media/music.html"],
  .component-audio-actions a[href*="/media/video.html"] {
    width: 28px;
    min-width: 28px;
    height: 28px;
  }

  .component-audio-actions a[href*="/media/music.html"] i,
  .component-audio-actions a[href*="/media/video.html"] i {
    font-size: 15px;
  }

  .component-video-meta a[href*="/media/video.html"] {
    width: 28px;
    min-width: 28px;
    height: 28px;
  }

  .component-video-meta a[href*="/media/video.html"] i {
    font-size: 15px;
  }
}
