/* Mode tabs */
.mode-tab {
    color: #9ca3af;
    position: relative;
    transition: color .2s;
}

.mode-tab:hover {
    color: #fff;
}

.mode-tab.active {
    color: #fff;
}

.mode-tab.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 1rem;
    bottom: 0;
    height: 3px;
    border-radius: 9999px;
    background: linear-gradient(90deg, #a855f7, #ec4899);
}

/* Toggle switch */
.toggle-checkbox {
    top: 0;
    transition: right .2s, border-color .2s;
    border-color: #374151;
}

.toggle-checkbox:checked {
    right: 0;
    border-color: #a855f7;
}

.toggle-checkbox:checked + .toggle-label {
    background: #a855f7;
}

.scrollbar-custom::-webkit-scrollbar {
    width: 6px;
}

.scrollbar-custom::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 9999px;
}

textarea {
    resize: vertical;
    color: #fff;
}

textarea.auto-grow {
    overflow: hidden;
    resize: none;
}

textarea::placeholder, input::placeholder {
    color: #9ca3af;
}

textarea::placeholder {
    font-size: .875rem;
    line-height: 1.6;
}

/* Chips */
.chip {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .25rem .65rem;
    background: rgba(75, 85, 99, .9);
    border: 1px solid #6b7280;
    border-radius: .5rem;
    font-size: .8125rem;
    color: #fff;
    white-space: nowrap;
    transition: background .2s, border-color .2s;
}

.chip:hover {
    background: #6b7280;
}

.chip.selected {
    background: #7c3aed;
    border-color: #a855f7;
}

.chip.own-chip {
    background: transparent;
    border-style: dashed;
    color: #c4b5fd;
}

.chip.own-chip:hover {
    background: rgba(168, 85, 247, .12);
}

/* Segmented pills */
.pill {
    padding: .4rem 1.1rem;
    border-radius: 9999px;
    font-size: .875rem;
    color: #fff;
    background: #4b5563;
    border: 1px solid #6b7280;
    transition: all .2s;
}

.pill:hover {
    border-color: #a855f7;
}

.pill.active {
    background: #9333ea;
    border-color: #9333ea;
}

/* Variety slider */
.variety-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 9999px;
    background: linear-gradient(90deg, #a855f7 var(--fill, 25%), #4b5563 var(--fill, 25%));
    outline: none;
}

.variety-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #a855f7;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(168, 85, 247, .6);
}

.variety-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #a855f7;
    cursor: pointer;
}

.variety-group {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    padding: 3px;
    background: #374151;
    border: 1px solid #4b5563;
    border-radius: .7rem;
}

.variety-opt {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: .4rem .3rem;
    background: transparent;
    border: 0;
    border-radius: .5rem;
    color: #9ca3af;
    font-size: .75rem;
    line-height: 1.2;
    text-align: center;
    transition: all .2s;
    cursor: pointer;
}

.variety-opt:hover {
    color: #fff;
    background: rgba(255, 255, 255, .05);
}

@media (max-width: 640px) {
    .variety-opt {
        font-size: .75rem;
        padding: .35rem 0;
    }
}

.variety-opt.active {
    background: linear-gradient(90deg, #a855f7, #ec4899);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(168, 85, 247, .35);
}

/* Tooltip */
.tip {
    position: relative;
    display: inline-flex;
    cursor: help;
    color: #9ca3af;
}

.tip .tiptext {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 20;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    width: 240px;
    padding: .5rem .75rem;
    border-radius: .5rem;
    background: #111827;
    border: 1px solid #374151;
    color: #e5e7eb;
    font-size: .75rem;
    line-height: 1.4;
    text-align: left;
    transition: opacity .2s;
    font-weight: 400;
}

.tip:hover .tiptext, .tip.open .tiptext {
    visibility: visible;
    opacity: 1;
}

.tip .tiptext {
    max-width: calc(100vw - 24px);
    transform: translateX(calc(-50% + var(--shift, 0px)));
}

.tip .tiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: calc(50% - var(--shift, 0px));
    margin-left: -5px;
    border: 5px solid transparent;
    border-top-color: #374151;
}

.field-error {
    color: #f87171;
    font-size: .8rem;
    text-align: left;
    margin-top: .25rem;
    display: none;
}

.field-error.show {
    display: block;
}

details summary::-webkit-details-marker {
    display: none;
}

/* Demo audio players */
.demo-player {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .75rem;
}

.demo-play {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    display: grid;
    place-items: center;
    background: linear-gradient(90deg, #a855f7, #ec4899);
    color: #fff;
    box-shadow: 0 4px 14px -4px rgba(168, 85, 247, .6);
    transition: transform .15s;
}

.demo-play:hover {
    transform: scale(1.06);
}

.demo-play svg {
    width: 1rem;
    height: 1rem;
}

.demo-play .i-play {
    margin-left: 2px;
}

.demo-play .i-pause, .demo-player.playing .demo-play .i-play {
    display: none;
}

.demo-player.playing .demo-play .i-pause {
    display: block;
}

.demo-wave {
    flex: 1;
    height: 28px;
    display: flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    outline: none;
}

.demo-wave i {
    flex: 1;
    border-radius: 2px;
    background: #4b5563;
    transition: background .15s;
}

.demo-wave i.on {
    background: linear-gradient(180deg, #ec4899, #a855f7);
}

.demo-time {
    flex-shrink: 0;
    min-width: 2.5rem;
    text-align: right;
    font-size: .75rem;
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
}

.demo-player.unavailable .demo-play {
    background: #4b5563;
    box-shadow: none;
    cursor: not-allowed;
}

.demo-player.unavailable .demo-time {
    font-size: .7rem;
    min-width: auto;
}

/* Comparison table */
.cmp-head tr {
    background: #374151;
}

.cmp-head th:nth-child(2) {
    color: #fff;
}

.cmp-head th:nth-child(2), table tbody td:first-of-type {
    background: rgba(168, 85, 247, .08);
}

/* Prompt examples */
.prompt-ex {
    position: relative;
    border-radius: .75rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.prompt-ex.bad {
    background: #1f2937;
    border: 1px dashed #4b5563;
}

.prompt-ex.good {
    background: linear-gradient(135deg, rgba(168, 85, 247, .14), rgba(236, 72, 153, .08));
    border: 1px solid rgba(168, 85, 247, .55);
    box-shadow: 0 8px 30px -12px rgba(168, 85, 247, .45);
}

.prompt-badge {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .6rem .2rem .45rem;
    border-radius: 9999px;
    font-size: .75rem;
    font-weight: 600;
}

.prompt-badge svg {
    width: 14px;
    height: 14px;
}

.bad .prompt-badge {
    background: rgba(248, 113, 113, .12);
    color: #fca5a5;
}

.good .prompt-badge {
    background: rgba(74, 222, 128, .12);
    color: #86efac;
}

.prompt-quote {
    font-size: .95rem;
    line-height: 1.9;
}

.bad .prompt-quote {
    color: #9ca3af;
    text-decoration: line-through;
    text-decoration-color: rgba(248, 113, 113, .5);
}

.good .prompt-quote {
    color: #f3f4f6;
}

.prompt-quote mark {
    background: none;
    color: inherit;
    border-bottom: 2px solid;
    padding-bottom: 1px;
    position: relative;
}

.prompt-quote mark::after {
    content: attr(data-k);
    font-size: .6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-left: .25rem;
    padding: 0 .3rem;
    border-radius: .25rem;
    vertical-align: .15em;
    color: #111827;
}

mark[data-k="topic"] {
    border-color: #a78bfa;
}

mark[data-k="topic"]::after {
    background: #a78bfa;
}

mark[data-k="voice"] {
    border-color: #f472b6;
}

mark[data-k="voice"]::after {
    background: #f472b6;
}

mark[data-k="pace"] {
    border-color: #fbbf24;
}

mark[data-k="pace"]::after {
    background: #fbbf24;
}

mark[data-k="setting"] {
    border-color: #34d399;
}

mark[data-k="setting"]::after {
    background: #34d399;
}

mark[data-k="music"] {
    border-color: #60a5fa;
}

mark[data-k="music"]::after {
    background: #60a5fa;
}

.prompt-missing {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    color: #6b7280;
}

.prompt-missing em {
    font-style: normal;
    padding: .05rem .45rem;
    border-radius: 9999px;
    border: 1px dashed #4b5563;
    color: #9ca3af;
}

details[open] .faq-icon {
    transform: rotate(45deg);
}
