:root {
    --tts-bg: #f8fafc;
    --tts-bg-secondary: #f3f7ff;
    --tts-panel: rgba(255, 255, 255, 0.95);
    --tts-border: rgba(37, 99, 235, 0.12);
    --tts-shadow: 0 20px 50px rgba(37, 99, 235, 0.12);
    --tts-shadow-soft: 0 12px 28px rgba(15, 23, 42, 0.08);
    --tts-text: #1f2937;
    --tts-muted: #6b7280;
    --tts-accent: #2563eb;
    --tts-accent-strong: #1d4ed8;
    --tts-line: rgba(148, 163, 184, 0.24);
    --tts-success-bg: #edf9f1;
    --tts-success-text: #1d7f58;
    --tts-error-bg: #fff2f2;
    --tts-error-text: #c0392b;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body.tts-page {
    margin: 0;
    color: var(--tts-text);
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.22), transparent 30%),
        radial-gradient(circle at top right, rgba(118, 75, 162, 0.16), transparent 28%),
        linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.tts-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 20px 48px;
}

.tts-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) 300px;
    gap: 22px;
    padding: 26px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: var(--tts-shadow);
    color: #ffffff;
}

.tts-hero-copy {
    min-width: 0;
}

.tts-badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.92);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tts-title {
    margin: 14px 0 10px;
    font-size: 34px;
    line-height: 1.15;
    font-weight: 700;
}

.tts-intro {
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 16px;
    line-height: 1.85;
}

.tts-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.tts-meta-card {
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
}

.tts-meta-card strong,
.tts-meta-card em,
.tts-meta-card span {
    display: block;
}

.tts-meta-card span {
    margin-bottom: 8px;
    color: rgba(239, 246, 255, 0.82);
    font-size: 12px;
}

.tts-meta-card strong {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
}

.tts-meta-card em {
    margin-top: 6px;
    color: rgba(239, 246, 255, 0.84);
    font-style: normal;
    font-size: 13px;
    line-height: 1.6;
}

.tts-hero-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tts-switch-link {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
    text-align: center;
    line-height: 1.6;
    transition: transform 0.18s ease, background 0.18s ease;
}

.tts-switch-link:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.tts-account-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 46px;
    margin: 0;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    background: #eff6ff;
    color: var(--tts-accent-strong);
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.2);
    cursor: pointer;
}

.tts-account-button:hover {
    color: var(--tts-accent-strong);
    background: #dbeafe;
}

.tts-side-card {
    padding: 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
}

.tts-side-card-title {
    margin: 0 0 10px;
    font-size: 16px;
    color: #ffffff;
}

.tts-side-list {
    margin: 0;
    padding-left: 18px;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.8;
}

.tts-side-list li + li {
    margin-top: 6px;
}

.tts-flash {
    display: none;
    margin: 18px 0 0;
    padding: 14px 18px;
    border-radius: 8px;
    line-height: 1.7;
    box-shadow: var(--tts-shadow-soft);
}

.tts-flash.show {
    display: block;
}

.tts-flash.ok {
    background: var(--tts-success-bg);
    color: var(--tts-success-text);
}

.tts-flash.bad {
    background: var(--tts-error-bg);
    color: var(--tts-error-text);
}

.tts-layout {
    display: block;
    margin-top: 18px;
}

.tts-panel {
    border: 1px solid var(--tts-border);
    border-radius: 12px;
    background: var(--tts-panel);
    box-shadow: var(--tts-shadow-soft);
}

.tts-panel-main {
    padding: 24px;
}

.tts-panel-side,
.tts-panel-guide {
    padding: 20px;
}

.tts-panel-spaced {
    margin-top: 18px;
}

.tts-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.tts-section-kicker {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--tts-accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tts-section-head h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
    color: #1f2937;
}

.tts-section-head p {
    /*max-width: 360px;*/
    margin: 0;
    color: var(--tts-muted);
    line-height: 1.8;
    font-size: 14px;
}

.tts-field-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 18px;
}

.tts-field-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tts-field {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 18px 0;
    border-top: 1px solid var(--tts-line);
}

.tts-field-grid .tts-field {
    padding: 0;
    border-top: 0;
}

.tts-field:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.tts-field-label {
    color: #1f2937;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.6;
}

.tts-field-control {
    min-width: 0;
}

.tts-field-control .tts-select,
.tts-field-control .tts-textarea {
    width: 100%;
}

.tts-textarea {
    min-height: 148px;
    padding: 16px 18px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    background: #ffffff;
    color: var(--tts-text);
    font-size: 15px;
    line-height: 1.8;
    font-family: inherit;
    resize: vertical;
    outline: 0;
}

.tts-select {
    width: 100%;
    height: 48px;
    padding: 0 42px 0 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    background:
        linear-gradient(45deg, transparent 50%, #64748b 50%) calc(100% - 20px) calc(50% - 2px) / 8px 8px no-repeat,
        linear-gradient(135deg, #64748b 50%, transparent 50%) calc(100% - 14px) calc(50% - 2px) / 8px 8px no-repeat,
        #ffffff;
    color: var(--tts-text);
    font-size: 15px;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    outline: 0;
}

.tts-textarea:focus,
.tts-select:focus {
    border-color: rgba(37, 99, 235, 0.44);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.tts-field-help {
    margin: 10px 0 0;
    color: var(--tts-muted);
    font-size: 13px;
    line-height: 1.7;
}

.tts-field-foot {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-top: 10px;
}

.tts-field-foot .tts-field-help {
    flex: 1 1 auto;
    margin: 0;
}

.tts-text-limit-meta {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    min-width: 0;
    color: var(--tts-muted);
    font-size: 12px;
    line-height: 1.7;
    text-align: right;
}

.tts-text-limit-note.is-warning,
.tts-text-counter.is-limit {
    color: var(--tts-error-text);
    font-weight: 700;
}

.tts-voice-row {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex-wrap: wrap;
}

.tts-voice-row .tts-select {
    flex: 0 0 calc((100% - 32px) / 3);
    max-width: calc((100% - 32px) / 3);
    min-width: 260px;
}

.tts-preview-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 84px;
    height: 48px;
    padding: 0 16px;
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 8px;
    background: #ffffff;
    color: var(--tts-accent-strong);
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}

.tts-preview-btn:hover {
    background: #eff6ff;
}

.tts-preview-note {
    color: var(--tts-muted);
    font-size: 12px;
    line-height: 1.7;
    white-space: nowrap;
}

.tts-audio-player {
    display: none;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.tts-static-card {
    display: grid;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 8px;
    background: var(--tts-bg-secondary);
    border: 1px solid rgba(37, 99, 235, 0.08);
}

.tts-static-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    color: var(--tts-muted);
    line-height: 1.7;
}

.tts-static-row strong {
    color: var(--tts-text);
    font-weight: 700;
    text-align: right;
}

.tts-rate-wrap {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    min-height: 48px;
}

.tts-radio-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--tts-text);
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
}

.tts-radio-option input[type="radio"] {
    margin: 0;
    accent-color: var(--tts-accent);
}

.tts-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 22px;
    border-top: 1px solid var(--tts-line);
}

.tts-primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 180px;
    height: 46px;
    margin: 0;
    padding: 0 20px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--tts-accent) 0%, var(--tts-accent-strong) 100%);
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    color: #ffffff;
    cursor: pointer;
}

.tts-primary-btn:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

.tts-action-note {
    margin: 0;
    color: var(--tts-muted);
    font-size: 13px;
    line-height: 1.8;
}

.tts-panel-title {
    margin: 0 0 10px;
    color: #1f2937;
    font-size: 20px;
    font-weight: 700;
}

.tts-panel-copy {
    margin: 0;
    color: var(--tts-muted);
    line-height: 1.8;
    font-size: 14px;
}

.tts-result-box {
    display: none;
    width: 100%;
    margin-top: 16px;
    padding: 18px;
    border-radius: 8px;
    background: linear-gradient(135deg, #1f2937 0%, #1d4ed8 100%);
    color: #eff6ff;
    line-height: 1.8;
    word-break: break-word;
}

.tts-result-box.show {
    display: block;
}

.tts-result-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.tts-result-summary {
    color: #dbeafe;
    font-size: 14px;
    line-height: 1.8;
}

.tts-result-summary strong {
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
}

.tts-secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    margin: 0;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    box-shadow: none;
    cursor: pointer;
}

.tts-secondary-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
}

.tts-result-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.tts-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
}

.tts-result-item-main {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 12px;
    width: 0;
    min-width: 0;
}

.tts-result-item-index {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    line-height: 30px;
    text-align: center;
}

.tts-result-item-copy {
    flex: 1 1 auto;
    width: 0;
    min-width: 0;
    overflow: hidden;
}

.tts-result-item-copy strong,
.tts-result-item-copy span {
    display: block;
}

.tts-result-item-copy strong {
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tts-result-item-copy span {
    margin-top: 2px;
    color: #cbd5e1;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tts-result-item-actions {
    flex: 0 0 auto;
}

.tts-result-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 74px;
    height: 34px;
    padding: 0 14px;
    border-radius: 8px;
    background: #eff6ff;
    color: var(--tts-accent-strong);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.tts-result-link:hover {
    color: var(--tts-accent-strong);
    background: #dbeafe;
    text-decoration: none;
}

.tts-rule-list,
.tts-use-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tts-rule-list li,
.tts-use-list li {
    position: relative;
    padding-left: 18px;
    color: var(--tts-muted);
    line-height: 1.9;
    font-size: 14px;
}

.tts-rule-list li + li,
.tts-use-list li + li {
    margin-top: 10px;
}

.tts-rule-list li::before,
.tts-use-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 11px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--tts-accent);
}

.tts-guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.tts-guide-card {
    padding: 18px;
    border-radius: 10px;
    background: var(--tts-bg-secondary);
    border: 1px solid rgba(37, 99, 235, 0.08);
}

.tts-guide-card h3 {
    margin: 0 0 12px;
    color: #1f2937;
    font-size: 18px;
}

.tts-guide-card p {
    margin: 0 0 12px;
    color: var(--tts-muted);
    line-height: 1.8;
    font-size: 14px;
}

.tts-pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--tts-text);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 14px;
    line-height: 1.9;
}

.tts-account-panel {
    padding: 16px;
}

.tts-account-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    color: #49566a;
}

.tts-account-value {
    color: #16304f;
    font-weight: 400;
}

.tts-account-note {
    margin: -2px 0 12px;
    color: #7b8794;
    font-size: 12px;
    line-height: 1.6;
    text-align: right;
}

.tts-account-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}

.tts-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    background: #ffffff;
    color: var(--tts-accent-strong);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}

.tts-modal-btn:hover {
    background: #eff6ff;
}

.tts-modal-btn-primary {
    border-color: transparent;
    background: linear-gradient(135deg, var(--tts-accent) 0%, var(--tts-accent-strong) 100%);
    color: #ffffff;
}

.tts-modal-btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

@media (max-width: 1100px) {
    .tts-shell {
        max-width: 960px;
    }

    .tts-hero {
        grid-template-columns: 1fr;
    }

    .tts-field-grid-three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tts-voice-row .tts-select {
        flex-basis: calc((100% - 16px) / 2);
        max-width: calc((100% - 16px) / 2);
    }
}

@media (max-width: 760px) {
    .tts-shell {
        padding: 18px 14px 36px;
    }

    .tts-hero,
    .tts-panel-main,
    .tts-panel-side,
    .tts-panel-guide {
        padding: 18px;
        border-radius: 12px;
    }

    .tts-title {
        font-size: 28px;
    }

    .tts-meta-grid,
    .tts-guide-grid,
    .tts-field-grid-three {
        grid-template-columns: 1fr;
    }

    .tts-section-head {
        flex-direction: column;
    }

    .tts-section-head p {
        max-width: none;
    }

    .tts-static-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .tts-static-row strong {
        text-align: left;
    }

    .tts-actions {
        align-items: stretch;
    }

    .tts-field-foot {
        flex-direction: column;
    }

    .tts-text-limit-meta {
        width: 100%;
        justify-content: space-between;
        text-align: left;
    }

    .tts-primary-btn {
        width: 100%;
    }

    .tts-result-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .tts-result-item-actions,
    .tts-result-link {
        width: 100%;
    }

    .tts-voice-row .tts-select,
    .tts-preview-btn {
        width: 100%;
        max-width: none;
        min-width: 0;
        flex-basis: 100%;
    }

    .tts-preview-note {
        width: 100%;
        white-space: normal;
    }
}
