/* Page Scrollbar
   Safari can show the page's emerald background through transparent scrollbar tracks,
   so keep the VD page scrollbar track opaque and scoped to the document. */
    html::-webkit-scrollbar,
    body::-webkit-scrollbar {
      width: 6px;
    }
    html::-webkit-scrollbar-track,
    body::-webkit-scrollbar-track {
      background: #f8fafc;
    }
    html::-webkit-scrollbar-thumb,
    body::-webkit-scrollbar-thumb {
      background: #cbd5e1;
      border-radius: 10px;
    }
    html::-webkit-scrollbar-thumb:hover,
    body::-webkit-scrollbar-thumb:hover {
      background: #94a3b8;
    }
    
    /* Keep the guide mascot compact and optically centered above the timeline. */
    .vd-guide-illustration {
      display: block;
      width: 12rem;
      max-width: 100%;
      height: auto;
      aspect-ratio: 5 / 4;
      object-fit: cover;
      object-position: 85% center;
      margin: 12px auto 0;
    }
    @media (min-width: 768px) {
      .vd-guide-illustration {
        width: 14rem;
      }
    }

    .vd-guide-progress .vd-guide-progress-label {
      transform: none;
      translate: -50% 0;
    }
    @media (max-width: 639px) {
      .vd-guide-progress {
        padding-top: 24px;
      }
      .vd-guide-progress .vd-guide-progress-track {
        padding-inline: 0;
      }
      .vd-guide-progress .vd-guide-progress-nodes {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: start;
        gap: 8px;
      }
      .vd-guide-progress-nodes > div.relative {
        width: auto;
        height: auto;
        min-width: 0;
        flex-direction: column;
        gap: 12px;
      }
      .vd-guide-progress .vd-guide-progress-label {
        position: static;
        transform: none;
        translate: none;
        min-height: 2.7em;
        font-size: 12px;
        line-height: 1.35;
        letter-spacing: 0;
        white-space: normal;
      }
      .vd-guide-progress-nodes > div.absolute {
        top: auto;
        bottom: 12px;
        left: calc(100% / 6);
        right: calc(100% / 6);
        transform: none;
        translate: none;
      }
    }

    /* Equalizer Animation for active player */
    @keyframes equalize {
      0% { height: 20%; }
      50% { height: 100%; }
      100% { height: 20%; }
    }
    .playing .bar {
      animation: equalize 1s infinite;
    }
    .bar:nth-child(1) { animation-delay: 0.1s; }
    .bar:nth-child(2) { animation-delay: 0.4s; }
    .bar:nth-child(3) { animation-delay: 0.2s; }
    .bar:nth-child(4) { animation-delay: 0.5s; }
    .bar:nth-child(5) { animation-delay: 0.3s; }
    .bar:nth-child(6) { animation-delay: 0.6s; }
    .bar:nth-child(7) { animation-delay: 0.1s; }
    .bar:nth-child(8) { animation-delay: 0.4s; }
    .bar:nth-child(9) { animation-delay: 0.2s; }
    .bar:nth-child(10) { animation-delay: 0.5s; }

    .glass-nav {
      background: rgba(255, 255, 255, 0.95);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }

    .bg-grid-pattern {
      background-image: linear-gradient(to right, rgba(16, 185, 129, 0.03) 1px, transparent 1px), linear-gradient(to bottom, rgba(16, 185, 129, 0.03) 1px, transparent 1px);
      background-size: 32px 32px;
    }
    
    /* Hide default summary arrow */
    details > summary {
      list-style: none;
    }
    details > summary::-webkit-details-marker {
      display: none;
    }

    /* New Information Sections Extensions */
    .vibrant-gradient-bg {
      background:
        radial-gradient(circle at 10% 20%, rgba(29, 181, 132, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(96, 165, 250, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(167, 139, 250, 0.05) 0%, transparent 60%);
    }
    .floating-particle { animation: float 6s ease-in-out infinite; }
    @keyframes float {
      0%, 100% { transform: translateY(0) rotate(0); }
      50% { transform: translateY(-20px) rotate(5deg); }
    }
    .equalize-vibrant { animation: equalize-v 1s ease-in-out infinite; }
    @keyframes equalize-v {
      0%, 100% { height: 20%; }
      50% { height: 100%; }
    }
    .glass-card {
      backdrop-filter: blur(12px);
      background: rgba(255, 255, 255, 0.7);
      border: 1px solid rgba(255, 255, 255, 0.4);
    }
    .text-gradient-green {
      background: linear-gradient(135deg, #1DB584 0%, #059669 100%);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    .kiki-badge {
      background: linear-gradient(135deg, #1DB584 0%, #059669 100%);
    }
    @keyframes fadeIn_Custom {
      from { opacity: 0; transform: translateY(10px); }
      to { opacity: 1; transform: translateY(0); }
    }
    .fade-in { animation: fadeIn_Custom 0.8s ease-out forwards; }
    .fade-in-delay { animation: fadeIn_Custom 1s ease-out 0.5s forwards; opacity: 0; }
    .step-connector {
      background: repeating-linear-gradient(90deg, #1DB584 0, #1DB584 4px, transparent 4px, transparent 10px);
    }

    .vd-template-grid {
      background-image:
        linear-gradient(to right, rgba(52, 211, 153, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(52, 211, 153, 0.08) 1px, transparent 1px);
      background-size: 40px 40px;
      mask-image: radial-gradient(circle at center, black 28%, transparent 85%);
      -webkit-mask-image: radial-gradient(circle at center, black 28%, transparent 85%);
    }
    .vd-flow-card {
      position: relative;
      padding: 2rem;
      border-radius: 1.75rem;
      border: 1px solid rgba(51, 65, 85, 0.85);
      background: linear-gradient(180deg, rgba(15, 23, 42, 0.9) 0%, rgba(10, 18, 24, 0.96) 100%);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
      transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
    }
    .vd-flow-card:hover {
      transform: translateY(-6px);
      border-color: rgba(52, 211, 153, 0.35);
      box-shadow: 0 20px 40px rgba(2, 8, 23, 0.28);
    }
    .vd-flow-card-result {
      background: linear-gradient(180deg, rgba(9, 24, 21, 0.96) 0%, rgba(10, 18, 24, 0.96) 100%);
      border-color: rgba(52, 211, 153, 0.24);
    }
    .vd-flow-orb {
      width: 4rem;
      height: 4rem;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 1.25rem;
      border-width: 1px;
      margin-bottom: 1.5rem;
      box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
    }
    .vd-template-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
      padding: 0.875rem 0.9rem;
      border-radius: 1rem;
      border: 1px solid rgba(51, 65, 85, 0.95);
      background: rgba(15, 23, 42, 0.72);
      transition: border-color 0.25s ease, transform 0.25s ease, background 0.25s ease;
    }
    .vd-template-item:hover,
    .vd-template-item.is-active {
      border-color: rgba(52, 211, 153, 0.35);
      background: rgba(15, 23, 42, 0.96);
      transform: translateY(-1px);
    }
    .vd-flow-connector {
      width: 4rem;
      height: 2px;
      position: relative;
      background: rgba(71, 85, 105, 0.8);
      overflow: hidden;
    }
    .vd-flow-connector::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, transparent, rgba(52, 211, 153, 0.95), transparent);
      animation: vd-scan-right 2.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    }
    @keyframes vd-scan-right {
      0% { transform: translateX(-120%); }
      100% { transform: translateX(200%); }
    }
    .vd-wave-bar {
      width: 0.375rem;
      height: 24%;
      border-radius: 999px 999px 0 0;
      background: #34d399;
      opacity: 0.95;
      animation: vd-wave-bounce 1.2s ease-in-out infinite;
    }
    @keyframes vd-wave-bounce {
      0%, 100% { height: 24%; }
      50% { height: 100%; }
    }
    .vd-value-card {
      padding: 1.5rem;
      border-radius: 1.5rem;
      border: 1px solid rgba(51, 65, 85, 0.85);
      background: rgba(15, 23, 42, 0.6);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      transition: border-color 0.25s ease, transform 0.25s ease;
    }
    .vd-value-card:hover {
      transform: translateY(-4px);
      border-color: rgba(52, 211, 153, 0.28);
    }
    .vd-scene-pill {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0.75rem 1rem;
      border-radius: 999px;
      border: 1px solid rgba(51, 65, 85, 0.95);
      background: rgba(15, 23, 42, 0.78);
      color: #cbd5e1;
      font-size: 0.95rem;
      font-weight: 600;
      transition: border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
    }
    .vd-scene-pill:hover {
      border-color: rgba(148, 163, 184, 0.7);
      color: #ffffff;
      transform: translateY(-1px);
    }
    .vd-scene-pill-active {
      border-color: rgba(52, 211, 153, 0.3);
      background: rgba(52, 211, 153, 0.12);
      color: #86efac;
      box-shadow: 0 0 20px rgba(52, 211, 153, 0.12);
    }

    @media (max-width: 768px) {
      .vd-flow-card {
        padding: 1.5rem;
      }
      .vd-value-card {
        padding: 1.25rem;
      }
      .vd-scene-pill {
        font-size: 0.875rem;
      }
    }

/* ===================================
   Page Mode: VD night / high_contrast
   =================================== */
html[data-kiki-page-mode="night"] #interactive-background,
html[data-kiki-page-mode="high_contrast"] #interactive-background {
    opacity: 0.3;
}

html[data-kiki-page-mode="night"] {
    background: var(--kiki-night-page-bg);
}

html[data-kiki-page-mode="night"] body {
    background: transparent !important;
    isolation: isolate;
}

html[data-kiki-page-mode="night"] #interactive-background {
    position: fixed;
    inset: -2rem;
    z-index: -1;
    pointer-events: none;
    opacity: 0.72;
    background:
        radial-gradient(680px circle at var(--mouse-x, 18%) var(--mouse-y, 12%), rgba(74, 222, 165, 0.08), transparent 68%),
        linear-gradient(to right, rgba(110, 231, 183, 0.065) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(110, 231, 183, 0.065) 1px, transparent 1px);
    background-size: auto, 48px 48px, 48px 48px;
    animation: vd-night-background-drift 72s ease-in-out infinite;
    will-change: transform;
}

@keyframes vd-night-background-drift {
    0%,
    100% {
        transform: translate3d(-5px, -3px, 0);
    }
    50% {
        transform: translate3d(6px, 4px, 0);
    }
}

html[data-kiki-page-mode="high_contrast"] #interactive-background {
    display: none;
}

html[data-kiki-page-mode="night"] #voice-design-manager-app,
html[data-kiki-page-mode="night"] #voice-design-manager-app .bg-white,
html[data-kiki-page-mode="night"] #voice-design-manager-app .rounded-2xl {
    background-color: var(--kiki-night-surface) !important;
    color: var(--kiki-night-text-primary) !important;
    border-color: var(--kiki-night-border) !important;
}

html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app {
    background-color: var(--kiki-hc-surface) !important;
    color: var(--kiki-hc-text-primary) !important;
}

html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app .bg-white {
    background-color: var(--kiki-hc-surface) !important;
    color: var(--kiki-hc-text-primary) !important;
    border: 2px solid var(--kiki-hc-border) !important;
}

html[data-kiki-page-mode="night"] #voice-design-manager-app textarea,
html[data-kiki-page-mode="night"] #voice-design-manager-app input:not([type="checkbox"]):not([type="radio"]) {
    background: var(--kiki-night-surface-soft) !important;
    color: var(--kiki-night-text-primary) !important;
    border-color: var(--kiki-night-border) !important;
}

html[data-kiki-page-mode="night"] #voice-design-manager-app .bg-slate-50\/50,
html[data-kiki-page-mode="night"] #voice-design-manager-app .bg-slate-50\/30,
html[data-kiki-page-mode="night"] #voice-design-manager-app .bg-slate-50\/60,
html[data-kiki-page-mode="night"] #voice-design-manager-app .bg-slate-50\/80 {
    background-color: var(--kiki-night-surface-soft) !important;
}

html[data-kiki-page-mode="night"] #voice-design-manager-app .ring-white {
    --tw-ring-color: var(--kiki-night-surface) !important;
}

html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app textarea,
html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app input:not([type="checkbox"]):not([type="radio"]) {
    background: var(--kiki-hc-surface) !important;
    color: var(--kiki-hc-text-primary) !important;
    border: 2px solid var(--kiki-hc-border) !important;
}

html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app .bg-slate-50\/50,
html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app .bg-slate-50\/30,
html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app .bg-slate-50\/60,
html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app .bg-slate-50\/80 {
    background-color: #000000 !important;
}

html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app .ring-white {
    --tw-ring-color: #000000 !important;
}

html[data-kiki-page-mode="night"] #voice-design-manager-app .vd-choice-checkbox {
    background-color: var(--kiki-night-surface-soft) !important;
    border: 2px solid var(--kiki-night-border) !important;
    color: var(--kiki-night-accent) !important;
    box-shadow: none !important;
}

html[data-kiki-page-mode="night"] #voice-design-manager-app .vd-choice-checkbox:checked {
    background-color: var(--kiki-night-accent) !important;
    border-color: var(--kiki-night-accent) !important;
}

html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app .vd-choice-checkbox {
    background-color: #000000 !important;
    border: 2px solid #ffffff !important;
    color: var(--kiki-hc-accent) !important;
    box-shadow: none !important;
}

html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app .vd-choice-checkbox:checked {
    background-color: var(--kiki-hc-accent) !important;
    border-color: var(--kiki-hc-accent) !important;
}

html[data-kiki-page-mode="night"] #voice-design-manager-app .vd-result-card,
html[data-kiki-page-mode="night"] #voice-design-manager-app .vd-result-prompt {
    background: var(--kiki-night-surface-soft) !important;
    border-color: var(--kiki-night-border) !important;
    box-shadow: none !important;
}

html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app .vd-result-card,
html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app .vd-result-prompt {
    background: #000000 !important;
    border-color: #ffffff !important;
    box-shadow: none !important;
}

html[data-kiki-page-mode="night"] #voice-design-manager-app .vd-result-next-action,
html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app .vd-result-next-action {
    background: var(--kiki-hc-accent) !important;
    border-color: var(--kiki-hc-accent) !important;
    color: #000000 !important;
    box-shadow: none !important;
}

html[data-kiki-page-mode="night"] #voice-design-manager-app .vd-primary-action,
html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app .vd-primary-action {
    box-shadow: none !important;
}

html[data-kiki-page-mode="night"] section.bg-\[\#fafafa\],
html[data-kiki-page-mode="night"] footer,
html[data-kiki-page-mode="night"] .glass-card {
    background: var(--kiki-night-surface) !important;
    border-color: var(--kiki-night-border) !important;
    color: var(--kiki-night-text-primary) !important;
    box-shadow: none !important;
}

html[data-kiki-page-mode="night"] .bg-\[\#60A5FA\],
html[data-kiki-page-mode="night"] .bg-\[\#A78BFA\] {
    background: var(--kiki-night-surface-soft) !important;
    border: 1px solid var(--kiki-night-border) !important;
    color: var(--kiki-night-text-primary) !important;
}

html[data-kiki-page-mode="night"] .vibrant-gradient-bg {
    background:
        radial-gradient(circle at 12% 18%, rgba(52, 211, 153, 0.08), transparent 35%),
        radial-gradient(circle at 88% 78%, rgba(96, 165, 250, 0.06), transparent 34%),
        var(--kiki-night-page-bg) !important;
}

html[data-kiki-page-mode="night"] html::-webkit-scrollbar-track,
html[data-kiki-page-mode="night"] body::-webkit-scrollbar-track {
    background: var(--kiki-night-page-bg);
}

html[data-kiki-page-mode="night"] .bg-emerald-500 {
    background-color: var(--kiki-night-accent) !important;
    color: #101512 !important;
}

html[data-kiki-page-mode="night"] #voice-design-manager-app button:focus-visible,
html[data-kiki-page-mode="night"] #voice-design-manager-app input:focus-visible,
html[data-kiki-page-mode="night"] #voice-design-manager-app textarea:focus-visible,
html[data-kiki-page-mode="night"] #voice-design-manager-app select:focus-visible {
    outline: 2px solid var(--kiki-night-accent) !important;
    outline-offset: 2px;
}

html[data-kiki-page-mode="high_contrast"] section.bg-\[\#fafafa\],
html[data-kiki-page-mode="high_contrast"] footer,
html[data-kiki-page-mode="high_contrast"] .glass-card,
html[data-kiki-page-mode="high_contrast"] .vibrant-gradient-bg {
    background: #000000 !important;
    border-color: #ffffff !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

html[data-kiki-page-mode="high_contrast"] .bg-\[\#60A5FA\],
html[data-kiki-page-mode="high_contrast"] .bg-\[\#A78BFA\] {
    background: #000000 !important;
    border: 1px solid #ffffff !important;
    color: var(--kiki-hc-accent) !important;
}

html[data-kiki-page-mode="high_contrast"] html::-webkit-scrollbar-track,
html[data-kiki-page-mode="high_contrast"] body::-webkit-scrollbar-track {
    background: #000000;
}

html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app button:focus-visible,
html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app input:focus-visible,
html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app textarea:focus-visible,
html[data-kiki-page-mode="high_contrast"] #voice-design-manager-app select:focus-visible {
    outline: 3px solid var(--kiki-hc-focus-ring) !important;
    outline-offset: 2px;
}

html[data-kiki-page-mode="high_contrast"] .vd-flow-card,
html[data-kiki-page-mode="high_contrast"] .vd-template-item,
html[data-kiki-page-mode="high_contrast"] .vd-value-card,
html[data-kiki-page-mode="high_contrast"] .vd-scene-pill {
    background: #000000 !important;
    border-color: #ffffff !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

html[data-kiki-page-mode="high_contrast"] .vd-template-item.is-active,
html[data-kiki-page-mode="high_contrast"] .vd-scene-pill-active {
    border: 2px solid var(--kiki-hc-accent) !important;
    color: var(--kiki-hc-accent) !important;
}

.vd-template-count {
    color: #d1fae5;
}

html[data-kiki-page-mode="night"] .vd-template-count {
    color: var(--kiki-night-accent);
}

html[data-kiki-page-mode="high_contrast"] .vd-template-count {
    color: var(--kiki-hc-accent);
}

html[data-kiki-page-mode="high_contrast"] .text-gradient-green {
    background: none !important;
    color: var(--kiki-hc-accent) !important;
    -webkit-text-fill-color: var(--kiki-hc-accent) !important;
}

html[data-kiki-page-mode="high_contrast"] .floating-particle {
    display: none !important;
}

html[data-kiki-page-mode="high_contrast"] .vd-commercial-section {
    background: #000000 !important;
    border-top: 2px solid #ffffff !important;
    border-bottom: 2px solid #ffffff !important;
}

html[data-kiki-page-mode="high_contrast"] .vd-commercial-section > .bg-gradient-to-br,
html[data-kiki-page-mode="high_contrast"] .vd-commercial-section > .mix-blend-screen,
html[data-kiki-page-mode="high_contrast"] .vd-commercial-section > .absolute.inset-0.z-0 {
    display: none !important;
}

html[data-kiki-page-mode="high_contrast"] .vd-commercial-section .bg-white\/5,
html[data-kiki-page-mode="high_contrast"] .vd-commercial-section .bg-\[\#064e3b\]\/40 {
    background: #000000 !important;
    border-color: #ffffff !important;
    box-shadow: none !important;
}

html[data-kiki-page-mode="high_contrast"] .vd-commercial-section .text-emerald-100\/60,
html[data-kiki-page-mode="high_contrast"] .vd-commercial-section .text-emerald-100\/70,
html[data-kiki-page-mode="high_contrast"] .vd-commercial-section .text-emerald-100\/80 {
    color: #ffffff !important;
}

html[data-kiki-page-mode="high_contrast"] .vd-commercial-section .bg-rose-500\/20,
html[data-kiki-page-mode="high_contrast"] .vd-commercial-section .bg-amber-500\/20,
html[data-kiki-page-mode="high_contrast"] .vd-commercial-section .bg-blue-500\/20,
html[data-kiki-page-mode="high_contrast"] .vd-commercial-section .bg-emerald-500\/20 {
    background: #000000 !important;
    color: var(--kiki-hc-accent) !important;
}

@media (max-width: 640px) {
    .vd-hero-workflow > .absolute {
        display: none !important;
    }

    .vd-hero-workflow > .flex {
        flex-direction: column;
        gap: 0.75rem;
    }

    .vd-hero-workflow > .flex > div {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 2.75rem minmax(0, 1fr);
        grid-template-rows: auto auto;
        column-gap: 0.75rem;
        row-gap: 0.2rem;
        align-items: center !important;
        padding: 0.75rem;
        text-align: left !important;
        opacity: 1 !important;
        border-radius: 0.75rem;
    }

    .vd-hero-workflow > .flex > div > div:first-child {
        grid-column: 1;
        grid-row: 1 / span 2;
        width: 2.75rem !important;
        height: 2.75rem !important;
        margin: 0 !important;
        border-width: 2px !important;
    }

    .vd-hero-workflow > .flex > div > h3 {
        grid-column: 2;
        grid-row: 1;
        margin: 0 !important;
        font-size: 0.875rem !important;
    }

    .vd-hero-workflow > .flex > div > div:nth-of-type(2) {
        grid-column: 2;
        grid-row: 2;
        padding: 0 !important;
    }

    .vd-hero-workflow > .flex > div > div:nth-of-type(2) > p:first-child {
        font-size: 0.75rem !important;
        line-height: 1.35 !important;
    }

    html[data-kiki-page-mode="night"] .vd-hero-workflow > .flex > div {
        background: var(--kiki-night-surface-soft);
        border: 1px solid var(--kiki-night-border);
    }

    html[data-kiki-page-mode="high_contrast"] .vd-hero-workflow > .flex > div {
        background: #000000;
        border: 1px solid #ffffff;
    }
}

html[data-kiki-page-mode="night"] .border-emerald-500\/10,
html[data-kiki-page-mode="night"] .border-blue-500\/10,
html[data-kiki-page-mode="night"] .border-purple-500\/10,
html[data-kiki-page-mode="night"] .border-slate-800 {
    border-color: var(--kiki-night-border) !important;
}

html[data-kiki-page-mode="night"] .bg-slate-900\/80 {
    background: var(--kiki-night-surface) !important;
    box-shadow: none !important;
}

html[data-kiki-page-mode="night"] .bg-white\/5 {
    background: var(--kiki-night-surface) !important;
}

html[data-kiki-page-mode="night"] .border-white\/10,
html[data-kiki-page-mode="night"] .border-emerald-400\/20 {
    border-color: var(--kiki-night-border) !important;
}

html[data-kiki-page-mode="high_contrast"] .border-emerald-500\/10,
html[data-kiki-page-mode="high_contrast"] .border-blue-500\/10,
html[data-kiki-page-mode="high_contrast"] .border-purple-500\/10,
html[data-kiki-page-mode="high_contrast"] .border-slate-800 {
    border-color: #ffffff !important;
}

html[data-kiki-page-mode="high_contrast"] .bg-slate-900\/80 {
    background: #000000 !important;
    box-shadow: none !important;
}

html[data-kiki-page-mode="high_contrast"] .bg-white\/5,
html[data-kiki-page-mode="high_contrast"] .hover\:bg-white\/10:hover {
    background: #000000 !important;
}

html[data-kiki-page-mode="high_contrast"] .border-white\/10,
html[data-kiki-page-mode="high_contrast"] .border-emerald-400\/20 {
    border-color: #ffffff !important;
}

@media (max-width: 768px), (prefers-reduced-motion: reduce) {
    html[data-kiki-page-mode="night"] #interactive-background {
        animation: none;
        will-change: auto;
    }
}

/* Compact tool controls for small phones; desktop geometry stays in Tailwind. */
@media (max-width: 639px) {
    #voice-design-manager-app > section,
    #voice-design-manager-app .voice-design-manager-container > section {
        padding-inline: 12px;
    }

    #voice-design-manager-app section > .grid {
        gap: 16px;
    }

    #voice-design-manager-app section > .grid > div {
        min-width: 0;
        min-height: 0;
    }

    #voice-design-manager-app .vd-input-panel,
    #voice-design-manager-app .vd-results-panel {
        border-radius: 20px;
        box-shadow: none;
    }

    #voice-design-manager-app .vd-input-panel > div {
        padding: 16px;
    }

    #voice-design-manager-app .vd-input-panel h2 {
        min-width: 0;
        font-size: 18px;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    #voice-design-manager-app button {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }

    #voice-design-manager-app input:not([type="checkbox"]):not([type="radio"]),
    #voice-design-manager-app textarea,
    #voice-design-manager-app select {
        min-width: 0;
        font-size: 16px;
        line-height: 1.5;
    }

    #voice-design-manager-app input:not([type="checkbox"]):not([type="radio"]),
    #voice-design-manager-app select {
        min-height: 44px;
    }

    #voice-design-manager-app .vd-input-panel textarea {
        min-height: 200px;
        padding: 14px 14px 64px;
    }

    #voice-design-manager-app .vd-input-panel textarea[maxlength="200"] {
        min-height: 160px;
    }

    #voice-design-manager-app .vd-input-panel textarea + button.absolute {
        top: auto;
        bottom: 12px;
        right: 12px;
        width: 44px;
        height: 44px;
        opacity: 1;
    }

    #voice-design-manager-app .vd-input-panel textarea + button + div.absolute {
        left: 14px;
        right: 64px;
        bottom: 20px;
    }

    #voice-design-manager-app .vd-prompt-label,
    #voice-design-manager-app .vd-examples-heading {
        flex-wrap: wrap;
        gap: 8px;
    }

    #voice-design-manager-app .vd-prompt-label > label {
        flex-basis: 100%;
    }

    #voice-design-manager-app .vd-examples-heading > div {
        flex: 1 1 auto;
        min-width: 0;
        flex-wrap: wrap;
        letter-spacing: 0;
    }

    #voice-design-manager-app .vd-input-panel button,
    #voice-design-manager-app .vd-input-panel label {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    #voice-design-manager-app .vd-input-panel label > div:last-child {
        min-width: 0;
    }

    #voice-design-manager-app .vd-primary-action {
        padding-inline: 16px;
        min-height: 48px;
    }

    #voice-design-manager-app .vd-preview-language-menu {
        width: min(240px, calc(100vw - 64px));
    }

    #voice-design-manager-app .vd-preview-language-menu .overflow-y-auto {
        max-height: min(220px, 40vh);
        max-height: min(220px, 40dvh);
        overscroll-behavior: contain;
    }

    #voice-design-manager-app .vd-results-panel {
        padding: 12px;
    }

    #voice-design-manager-app .vd-results-panel > div:first-child {
        padding: 4px 4px 12px;
        gap: 8px;
        flex-wrap: wrap;
    }

    #voice-design-manager-app .vd-results-panel h3 {
        min-width: 0;
        font-size: 18px;
        line-height: 1.35;
    }

    #voice-design-manager-app #vd-generated-results-container {
        padding-inline: 0;
        overscroll-behavior-y: contain;
    }

    #voice-design-manager-app .vd-result-card {
        padding: 12px;
        border-radius: 16px;
        box-shadow: none;
    }

    #voice-design-manager-app .vd-result-main {
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr);
        gap: 8px;
    }

    #voice-design-manager-app .vd-result-main > button {
        grid-column: 1;
        grid-row: 2;
        margin-top: 0;
        align-self: center;
    }

    #voice-design-manager-app .vd-result-info {
        display: contents;
    }

    #voice-design-manager-app .vd-result-heading {
        grid-column: 1 / -1;
        grid-row: 1;
        padding: 12px 0 0;
        margin-bottom: 0;
        min-width: 0;
    }

    #voice-design-manager-app .vd-result-heading h4 {
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    #voice-design-manager-app .vd-result-heading button {
        padding-inline: 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    #voice-design-manager-app .vd-result-prompt {
        grid-column: 2;
        grid-row: 2;
        min-width: 0;
        padding: 8px;
        margin-bottom: 0;
        gap: 4px;
    }

    #voice-design-manager-app .vd-result-prompt p {
        min-width: 0;
        overflow-wrap: anywhere;
        font-size: 13px;
    }

    #voice-design-manager-app .vd-result-prompt button {
        margin-top: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Keep the slim track but give seeking a full finger-height target. */
    #voice-design-manager-app .vd-result-seek {
        grid-column: 1 / -1;
        grid-row: 3;
        height: 44px;
        padding-block: 19px;
        background-clip: content-box;
        margin-bottom: 0;
        touch-action: manipulation;
    }

    #voice-design-manager-app .vd-result-info > .flex:last-child {
        grid-column: 1 / -1;
        min-width: 0;
        overflow-wrap: anywhere;
    }

    #voice-design-manager-app .vd-result-next-action {
        padding-inline: 8px;
        line-height: 1.4;
    }

    #voice-design-manager-app #vd-processing-terminal .terminal-header {
        gap: 8px;
        flex-wrap: wrap;
        padding: 12px;
    }

    #voice-design-manager-app #vd-processing-terminal .terminal-header > div:first-child {
        min-width: 0;
        flex-wrap: wrap;
    }

    #voice-design-manager-app #vd-processing-terminal .terminal-header span {
        min-width: 0;
        margin-left: 0;
        overflow-wrap: anywhere;
    }

    #voice-design-manager-app #vd-processing-terminal > .p-8 {
        padding: 16px 12px;
        overflow-wrap: anywhere;
        font-size: 12px;
    }

    #voice-design-manager-app .vd-mobile-modal {
        padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
        align-items: flex-start;
        overflow-y: auto;
        overscroll-behavior: contain;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    #voice-design-manager-app .vd-mobile-modal > .absolute {
        position: fixed;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    #voice-design-manager-app .vd-mobile-modal-card {
        margin: auto 0;
        max-height: calc(100vh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    #voice-design-manager-app .vd-mobile-modal-card.p-8 {
        padding: 24px 16px;
    }

    #voice-design-manager-app .vd-mobile-modal-card > .px-6 {
        padding-inline: 16px;
    }

    #voice-design-manager-app .vd-template-modal-card {
        height: calc(100vh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        overflow: hidden;
    }

    #voice-design-manager-app .vd-template-modal-card > div:first-child {
        padding-block: 8px;
        gap: 8px;
    }

    #voice-design-manager-app .vd-template-modal-card > div:first-child > div {
        min-width: 0;
        gap: 8px;
    }

    #voice-design-manager-app .vd-template-modal-card h3 {
        min-width: 0;
        overflow-wrap: anywhere;
        line-height: 1.35;
    }

    #voice-design-manager-app .vd-template-modal-card .overflow-y-auto {
        overscroll-behavior: contain;
    }

    #voice-design-manager-app .vd-template-modal-card > div:nth-child(2) {
        padding-block: 12px;
    }

    #voice-design-manager-app .vd-template-modal-card > div:nth-child(2) > p {
        line-height: 1.4;
    }

    #voice-design-manager-app .vd-input-panel .blur {
        display: none;
    }
}

@media (max-width: 360px) {
    #voice-design-manager-app .vd-input-panel > div {
        padding: 12px;
    }
}

/* Wider phones can restore space and visible download text before sm starts. */
@media (min-width: 480px) and (max-width: 639px) {
    #voice-design-manager-app > section,
    #voice-design-manager-app .voice-design-manager-container > section {
        padding-inline: 16px;
    }

    #voice-design-manager-app .vd-input-panel > div,
    #voice-design-manager-app .vd-mobile-modal-card > .px-6 {
        padding-inline: 20px;
    }

    #voice-design-manager-app .vd-input-panel > div {
        padding-block: 20px;
    }

    #voice-design-manager-app .vd-prompt-label > label {
        flex: 1 1 auto;
    }

    #voice-design-manager-app .vd-input-panel textarea:not([maxlength="200"]) {
        min-height: 224px;
    }

    #voice-design-manager-app .vd-results-panel,
    #voice-design-manager-app .vd-result-card {
        padding: 20px;
    }

    #voice-design-manager-app .vd-results-panel > div:first-child {
        padding-inline: 0;
    }

    #voice-design-manager-app .vd-result-main {
        column-gap: 12px;
    }

    #voice-design-manager-app .vd-result-prompt {
        padding: 12px;
        gap: 8px;
    }

    #voice-design-manager-app .vd-result-prompt p {
        font-size: 14px;
    }

    #voice-design-manager-app .vd-result-heading .hidden.sm\:inline {
        display: inline;
    }
}

/* Avoid continuous decorative work while scrolling on modest phones. */
@media (max-width: 767px) {
    .floating-particle,
    .vd-flow-connector::after,
    .vd-wave-bar,
    .equalize-vibrant {
        animation: none !important;
    }

    .fade-in,
    .fade-in-delay {
        animation: none !important;
        opacity: 1;
    }

    .vd-value-card,
    .glass-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    #voice-design-manager-app .transition-all,
    #voice-design-manager-app .transition-transform {
        transition-property: color, background-color, border-color, opacity;
        transition-duration: 150ms;
    }
}

/* Shared downloader is appended to body, outside each tool's component root. */
@media (max-width: 767px) {
    #kiki-download-glass-modal {
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    #kiki-download-glass-modal,
    #kiki-download-glass-modal > .absolute,
    #kiki-download-glass-modal .kiki-modal-glass-bg {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    #kiki-download-glass-modal > .relative.flex {
        min-height: 100%;
        box-sizing: border-box;
        padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    }

    #kiki-download-glass-modal .modal-panel {
        min-width: 0;
        padding: 16px;
        max-height: calc(100vh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        overflow-y: auto;
        overscroll-behavior: contain;
        box-shadow: none !important;
    }

    #kiki-download-glass-modal :is(#kiki-dl-close-btn, #kiki-dl-retry-btn) {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }

    #kiki-download-glass-modal .animate-bounce {
        animation: none;
    }

    #kiki-download-glass-modal #kiki-dl-bar {
        box-shadow: none;
    }
}
