/* 定制剧场 · 预设管理（仅作用于 #custom-theater-app） */
#custom-theater-app .ctp-loading {
    min-height: 180px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 12px;
    color: var(--ct-ink-soft);
    font-size: 11px;
    letter-spacing: 0.06em;
}

#custom-theater-app .ctp-loading span {
    width: 27px;
    height: 27px;
    border: 2px solid rgba(49, 56, 68, 0.17);
    border-top-color: var(--ct-navy);
    border-radius: 50%;
    animation: ctp-spin 800ms linear infinite;
}

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

#custom-theater-app .ctp-error {
    padding: 25px 12px;
    text-align: center;
}

#custom-theater-app .ctp-error strong {
    display: block;
    color: #774f55;
    font-size: 15px;
}

#custom-theater-app .ctp-error p {
    margin: 8px auto 16px;
    max-width: 31em;
    color: var(--ct-ink-soft);
    font-size: 10px;
    line-height: 1.65;
}

#custom-theater-app .ctp-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 12px;
}

#custom-theater-app .ctp-summary > div {
    min-width: 0;
    padding: 10px 8px;
    border: 1px solid rgba(49, 56, 68, 0.14);
    border-radius: 3px 9px 3px 9px;
    background: rgba(255, 250, 243, 0.42);
    text-align: center;
}

#custom-theater-app .ctp-summary span,
#custom-theater-app .ctp-summary strong {
    display: block;
}

#custom-theater-app .ctp-summary span {
    overflow: hidden;
    color: var(--ct-ink-soft);
    font-size: 8px;
    letter-spacing: 0.06em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#custom-theater-app .ctp-summary strong {
    margin-top: 5px;
    color: var(--ct-navy);
    font: 760 19px/1 "Courier New", monospace;
}

#custom-theater-app .ctp-toolbar {
    position: relative;
    display: grid;
    grid-template-columns: 1.25fr 1fr 1fr;
    gap: 7px;
}

#custom-theater-app .ctp-toolbar .ct-button {
    min-width: 0;
    padding-right: 7px;
    padding-left: 7px;
    font-size: 11px;
}

#custom-theater-app .ctp-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

#custom-theater-app .ctp-order-hint {
    margin: 10px 1px 15px;
    color: var(--ct-ink-soft);
    font-size: 9px;
    line-height: 1.65;
}

#custom-theater-app.ct-presets-view .ct-main {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#custom-theater-app.ct-presets-view .ct-main::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
    background: transparent;
}

#custom-theater-app .ctp-sections {
    display: grid;
    gap: 13px;
}

#custom-theater-app .ctp-section {
    overflow: hidden;
    border: 1px solid rgba(49, 56, 68, 0.15);
    border-radius: 8px 3px 8px 3px;
    background: rgba(255, 250, 243, 0.3);
}

#custom-theater-app .ctp-section-head {
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(49, 56, 68, 0.13);
    background: rgba(196, 184, 168, 0.24);
}

#custom-theater-app .ctp-section-head > div {
    min-width: 0;
}

#custom-theater-app .ctp-section-title,
#custom-theater-app .ctp-section-note {
    display: block;
}

#custom-theater-app .ctp-section-title {
    color: var(--ct-ink);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

#custom-theater-app .ctp-section-note {
    margin-top: 3px;
    overflow: hidden;
    color: var(--ct-ink-soft);
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#custom-theater-app .ctp-section-order {
    flex: 0 0 auto;
    color: var(--ct-navy);
    font: 700 8px/1.3 "Courier New", monospace;
    text-align: right;
}

#custom-theater-app .ctp-section-empty {
    margin: 0;
    padding: 14px 10px;
    color: rgba(49, 56, 68, 0.5);
    font-size: 9px;
    text-align: center;
}

#custom-theater-app .ctp-preset-row {
    min-height: 64px;
    display: grid;
    grid-template-columns: 37px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    padding: 7px 8px;
    border-bottom: 1px solid rgba(49, 56, 68, 0.1);
    transition: background-color 140ms ease;
}

#custom-theater-app .ctp-preset-row.is-builtin {
    grid-template-columns: 37px minmax(0, 1fr);
}

#custom-theater-app .ctp-preset-row:last-child {
    border-bottom: 0;
}

#custom-theater-app .ctp-preset-row.is-enabled {
    background: rgba(244, 206, 206, 0.19);
}

#custom-theater-app .ctp-switch {
    position: relative;
    width: 34px;
    height: 22px;
    display: block;
    cursor: pointer;
    touch-action: manipulation;
}

#custom-theater-app .ctp-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

#custom-theater-app .ctp-switch span {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(49, 56, 68, 0.27);
    border-radius: 999px;
    background: rgba(196, 184, 168, 0.53);
    transition: background-color 140ms ease, border-color 140ms ease;
}

#custom-theater-app .ctp-switch span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fffaf3;
    box-shadow: 0 1px 4px rgba(49, 56, 68, 0.22);
    transition: transform 140ms ease;
}

#custom-theater-app .ctp-switch input:checked + span {
    border-color: var(--ct-navy);
    background: var(--ct-navy);
}

#custom-theater-app .ctp-switch input:checked + span::after {
    transform: translateX(12px);
}

#custom-theater-app .ctp-row-main {
    min-width: 0;
    min-height: 46px;
    padding: 5px 2px;
    border: 0;
    color: inherit;
    background: transparent;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
}

#custom-theater-app .ctp-row-main--static {
    cursor: default;
    touch-action: auto;
}

#custom-theater-app .ctp-row-name {
    display: block;
    overflow: hidden;
    font-size: 11px;
    font-weight: 760;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#custom-theater-app .ctp-row-meta {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    color: var(--ct-ink-soft);
    font-size: 8px;
}

#custom-theater-app .ctp-row-meta > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#custom-theater-app .ctp-badge {
    flex: 0 0 auto;
    padding: 2px 5px;
    border-radius: 999px;
    color: #6e5960;
    background: rgba(244, 206, 206, 0.48);
    font-size: 7px;
    font-weight: 760;
}

#custom-theater-app .ctp-badge--builtin {
    color: #fffaf3;
    background: var(--ct-navy);
}

#custom-theater-app .ctp-row-actions {
    display: flex;
    gap: 4px;
}

#custom-theater-app .ctp-icon-button,
#custom-theater-app .ctp-back-button {
    width: 38px;
    min-width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(49, 56, 68, 0.18);
    border-radius: 50%;
    color: var(--ct-navy);
    background: rgba(255, 250, 243, 0.55);
    font: 760 10px/1 "Microsoft YaHei", sans-serif;
    cursor: pointer;
    touch-action: manipulation;
}

#custom-theater-app .ctp-icon-button--danger {
    color: #8b555d;
}

#custom-theater-app .ctp-editor-head {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(49, 56, 68, 0.14);
}

#custom-theater-app .ctp-back-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    font: 400 28px/1 sans-serif;
}

#custom-theater-app .ctp-editor-head span {
    display: block;
    color: var(--ct-ink-soft);
    font: 700 8px/1.2 "Courier New", monospace;
    letter-spacing: 0.13em;
}

#custom-theater-app .ctp-editor-head h3 {
    margin: 4px 0 0;
    font-size: 18px;
    letter-spacing: 0.08em;
}

#custom-theater-app .ctp-editor-form .ct-form-textarea.ctp-content-input {
    min-height: min(42vh, 360px);
    line-height: 1.65;
}

#custom-theater-app .ctp-section-select {
    appearance: auto;
}

#custom-theater-app .ctp-new-section-field[hidden] {
    display: none !important;
}

#custom-theater-app .ctp-switch input:focus-visible + span,
#custom-theater-app .ctp-row-main:focus-visible,
#custom-theater-app .ctp-icon-button:focus-visible,
#custom-theater-app .ctp-back-button:focus-visible {
    outline: 3px solid rgba(70, 81, 96, 0.34);
    outline-offset: 2px;
}

@media (max-width: 350px) {
    #custom-theater-app .ctp-toolbar {
        grid-template-columns: 1fr 1fr;
    }
    #custom-theater-app .ctp-toolbar .ct-button:first-child {
        grid-column: 1 / -1;
    }
    #custom-theater-app .ctp-preset-row {
        grid-template-columns: 35px minmax(0, 1fr) auto;
        padding-right: 6px;
        padding-left: 6px;
    }
    #custom-theater-app .ctp-icon-button {
        width: 36px;
        min-width: 36px;
        height: 36px;
    }
    #custom-theater-app .ctp-section-note {
        max-width: 20em;
    }
}

@media (prefers-reduced-motion: reduce) {
    #custom-theater-app .ctp-loading span {
        animation: none;
    }
    #custom-theater-app .ctp-preset-row,
    #custom-theater-app .ctp-switch span,
    #custom-theater-app .ctp-switch span::after {
        transition: none;
    }
}

@media (prefers-contrast: more) {
    #custom-theater-app .ctp-section,
    #custom-theater-app .ctp-summary > div,
    #custom-theater-app .ctp-icon-button,
    #custom-theater-app .ctp-back-button {
        border-color: rgba(49, 56, 68, 0.5);
    }
}
