.demo-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(13, 60, 132, 0.6);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.25s ease, color 0.25s ease;
}

@media (hover: hover) {
  .demo-tab:not(.is-active):hover {
    color: #0D3C84;
    background: rgba(255, 255, 255, 0.6);
  }
}

.demo-tab.is-active {
  color: #fff;
  background: #0D3C84;
  box-shadow: 0 8px 20px -8px rgba(13, 60, 132, 0.6);
}

.demo-tab:focus-visible {
  outline: 2px solid #4FA8FF;
  outline-offset: 2px;
}

.demo-panel { display: none; }
.demo-panel.is-active { display: block; }

.demo-field {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #EAF5FF;
  color: #0D3C84;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.6;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.demo-field::placeholder { color: rgba(13, 60, 132, 0.35); }

.demo-field:focus {
  outline: none;
  border-color: #4FA8FF;
  box-shadow: 0 0 0 3px rgba(79, 168, 255, 0.18);
}

select.demo-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230D3C84' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
}

.demo-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: rgba(13, 60, 132, 0.75);
  cursor: pointer;
  user-select: none;
}

.demo-check input {
  width: 1rem;
  height: 1rem;
  accent-color: #4FA8FF;
  cursor: pointer;
}

.demo-slider label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(13, 60, 132, 0.7);
  margin-bottom: 0.5rem;
}

.demo-slider output {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #4FA8FF;
}

.demo-slider input[type="range"] {
  width: 100%;
  accent-color: #4FA8FF;
  cursor: pointer;
}

.demo-accordion > summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(13, 60, 132, 0.65);
  cursor: pointer;
  list-style: none;
  border-top: 1px solid #EAF5FF;
  transition: color 0.2s ease;
}

.demo-accordion > summary::-webkit-details-marker { display: none; }
.demo-accordion > summary:hover { color: #0D3C84; }

.demo-accordion > summary:focus-visible {
  outline: 2px solid #4FA8FF;
  outline-offset: 2px;
  border-radius: 0.5rem;
}

.demo-chevron { transition: rotate 0.25s ease; }
.demo-accordion[open] .demo-chevron { rotate: 180deg; }

.demo-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.5rem;
  border-radius: 999px;
  border: none;
  background: #0D3C84;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 10px 24px -12px rgba(13, 60, 132, 0.8);
  transition: background-color 0.25s ease, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.25s ease, opacity 0.25s ease;
}

@media (hover: hover) {
  .demo-btn:not(:disabled):hover {
    background: #4FA8FF;
    transform: translateY(-2px);
    box-shadow: 0 16px 32px -14px rgba(79, 168, 255, 0.9);
  }
}

.demo-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.demo-btn:focus-visible {
  outline: 2px solid #4FA8FF;
  outline-offset: 3px;
}

.demo-btn-label,
.demo-btn-busy {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.demo-btn-busy { display: none; }
.demo-btn.is-busy .demo-btn-label { display: none; }
.demo-btn.is-busy .demo-btn-busy { display: inline-flex; }

.demo-spinner {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: demo-spin 0.7s linear infinite;
}

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

.demo-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.25rem;
  border-radius: 1.25rem;
  border: 2px dashed rgba(79, 168, 255, 0.4);
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

@media (hover: hover) {
  .demo-drop:hover {
    border-color: #4FA8FF;
    background: rgba(255, 255, 255, 0.75);
  }
}

.demo-drop.is-dragging {
  border-color: #4FA8FF;
  border-style: solid;
  background: rgba(142, 207, 255, 0.18);
}

.demo-drop:focus-within {
  outline: 2px solid #4FA8FF;
  outline-offset: 2px;
}

.demo-status {
  margin-top: 1.25rem;
  padding: 0.7rem 1rem;
  border-radius: 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.45;
}

.demo-status:empty { display: none; }

.demo-status[data-state="working"] {
  color: #0D3C84;
  background: rgba(142, 207, 255, 0.22);
  border: 1px solid rgba(79, 168, 255, 0.3);
}

.demo-status[data-state="ok"] {
  color: #15803d;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.28);
}

.demo-status[data-state="error"] {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.24);
}

.ri-select { position: relative; }

.ri-select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #EAF5FF;
  color: #0D3C84;
  font-size: 0.95rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ri-select-btn:hover { border-color: #8ECFFF; }

.ri-select-btn:focus-visible,
.ri-select.is-open .ri-select-btn {
  outline: none;
  border-color: #4FA8FF;
  box-shadow: 0 0 0 3px rgba(79, 168, 255, 0.18);
}

.ri-select-chevron { transition: rotate 0.25s ease; flex: none; }
.ri-select.is-open .ri-select-chevron { rotate: 180deg; }

.ri-select-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.4rem);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 40px -18px rgba(13, 60, 132, 0.45);
  opacity: 0;
  translate: 0 -6px;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, translate 0.2s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0s linear 0.2s;
}

.ri-select.is-open .ri-select-list {
  opacity: 1;
  translate: 0 0;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.2s ease, translate 0.2s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0s;
}

.ri-select-option {
  padding: 0.6rem 0.85rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  color: rgba(13, 60, 132, 0.8);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.ri-select-option:hover,
.ri-select-option.is-active { background: rgba(142, 207, 255, 0.25); color: #0D3C84; }

.ri-select-option[aria-selected="true"] {
  background: #4FA8FF;
  color: #fff;
  font-weight: 600;
}

.ri-segment {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #EAF5FF;
}

.ri-segment button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(13, 60, 132, 0.6);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.ri-segment button.is-active { background: #0D3C84; color: #fff; }
.ri-segment button:focus-visible { outline: 2px solid #4FA8FF; outline-offset: 2px; }

.ri-record {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 2rem 1.25rem;
  border-radius: 1.25rem;
  border: 2px dashed rgba(79, 168, 255, 0.4);
  background: rgba(255, 255, 255, 0.5);
}

.ri-record-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border: none;
  border-radius: 50%;
  background: #4FA8FF;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 26px -12px rgba(79, 168, 255, 0.9);
  transition: background-color 0.25s ease, scale 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) {
  .ri-record-btn:hover { scale: 1.06; }
}

.ri-record-btn:focus-visible { outline: 2px solid #0D3C84; outline-offset: 3px; }
.ri-record.is-recording .ri-record-btn { background: #dc2626; animation: ri-pulse 1.6s ease-in-out infinite; }

@keyframes ri-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  50%      { box-shadow: 0 0 0 14px rgba(220, 38, 38, 0); }
}

.ri-record-time {
  font-variant-numeric: tabular-nums;
  font-size: 1.5rem;
  font-weight: 600;
  color: #0D3C84;
}

.ri-record-hint { font-size: 0.8rem; color: rgba(13, 60, 132, 0.5); text-align: center; }

.seg-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.seg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.seg-speaker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  color: var(--seg-fg, #0D3C84);
  background: var(--seg-bg, rgba(142, 207, 255, 0.25));
}

.seg-time {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: rgba(13, 60, 132, 0.45);
}

.seg-text {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(13, 60, 132, 0.9);
}

.seg-time.is-solo {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  color: #1d6fd0;
  background: rgba(79, 168, 255, 0.16);
}
