.swab {
  --swab-accent: var(--sw-accent, #43DECB);
  --swab-accent-2: var(--sw-accent-2, #63A9E9);
  --swab-panel: var(--sw-panel, #101824);
  --swab-edge: var(--sw-edge, #344457);
  --swab-muted: var(--sw-muted, #8797AE);
  --swab-text: #F5F5F5;
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  color: var(--swab-text);
}

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

.swab-scene {
  position: relative;
  min-width: 0;
  padding: 1rem;
  background: var(--swab-panel);
  border: 1px solid var(--swab-edge);
  border-radius: 14px;
}

.swab-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  line-height: 1.3;
  font-weight: 600;
  color: var(--swab-text);
}

.swab-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
}

.swab-play {
  flex: 0 0 auto;
  min-width: 7rem;
  min-height: 48px;
  padding: 0 1.25rem;
  font: inherit;
  font-weight: 600;
  color: #04110F;
  background: var(--swab-accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

.swab-play.is-playing { background: var(--swab-accent-2); }
.swab-play.is-loading { cursor: progress; opacity: 0.75; }

.swab-switch {
  position: relative;
  flex: 1 1 16rem;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
  gap: 4px;
  padding: 4px;
  background: #0B121B;
  border: 1px solid var(--swab-edge);
  border-radius: 12px;
}

.swab-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(135deg, var(--swab-accent), var(--swab-accent-2));
  border-radius: 9px;
  opacity: 0;
}

.swab-thumb.is-ready {
  opacity: 1;
  transition: transform 160ms ease, width 160ms ease, height 160ms ease;
}

.swab-ver {
  position: relative;
  z-index: 1;
  min-height: 44px;
  padding: 0.4rem 0.6rem;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.2;
  color: var(--swab-text);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.swab-ver.is-active { color: #04110F; font-weight: 600; }

.swab-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.swab-track {
  flex: 1 1 auto;
  height: 6px;
  overflow: hidden;
  background: #0B121B;
  border: 1px solid var(--swab-edge);
  border-radius: 999px;
}

.swab-bar {
  display: block;
  width: 0;
  height: 100%;
  background: var(--swab-accent);
}

.swab-time {
  flex: 0 0 auto;
  min-width: 5.5rem;
  font-size: 0.78rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--swab-muted);
}

.swab-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.swab-tool {
  min-height: 44px;
  padding: 0 1rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--swab-text);
  background: transparent;
  border: 1px solid var(--swab-edge);
  border-radius: 10px;
  cursor: pointer;
}

.swab-tool.is-on {
  color: var(--swab-accent);
  border-color: var(--swab-accent);
}

.swab-tool[hidden],
.swab-error[hidden] { display: none; }

.swab-error {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: #FFB4A8;
}

.swab-caption,
.swab-meta,
.swab-hint {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.swab-caption { color: var(--swab-text); }
.swab-meta,
.swab-hint { margin-top: 0.35rem; font-size: 0.78rem; color: var(--swab-muted); }

.swab-live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

.swab-ver:focus-visible { outline-offset: -2px; }

@media (hover: hover) {
  .swab-ver:not(.is-active):hover { background: rgba(255, 255, 255, 0.07); }
  .swab-tool:hover { border-color: var(--swab-muted); }
}

@media (max-width: 420px) {
  .swab-scene { padding: 0.85rem; }
  .swab-play { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .swab-thumb.is-ready { transition: none; }
}
