/* ======================================
   创建剧本页面样式
   ====================================== */

body {
    overflow-y: auto !important;
    justify-content: flex-start !important;
}

.create-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 20px 40px;
}

/* 步骤指示条 */
.steps-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 30px;
}

.step-dot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-dim, #a89080);
    border: 1px solid rgba(212, 168, 83, 0.1);
    background: rgba(30, 20, 15, 0.4);
    transition: all 0.3s;
}

.step-dot.active {
    color: var(--gold-light, #f0d68a);
    border-color: rgba(212, 168, 83, 0.5);
    background: rgba(212, 168, 83, 0.12);
}

.step-dot.done {
    color: #27ae60;
    border-color: rgba(39, 174, 96, 0.3);
}

/* 阶段面板 */
.step-panel {
    display: none;
    animation: fadeInUp 0.4s ease-out;
}

.step-panel.active {
    display: block;
}

.panel-title {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.8rem;
    color: var(--gold, #d4a853);
    margin-bottom: 8px;
}

.panel-desc {
    color: var(--text-dim, #a89080);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* 输入区 */
.idea-textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(212, 168, 83, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-light, #f5e6d0);
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}

.idea-textarea::placeholder {
    color: rgba(168, 144, 128, 0.5);
}

.idea-textarea:focus {
    outline: none;
    border-color: rgba(212, 168, 83, 0.5);
    box-shadow: 0 0 20px rgba(212, 168, 83, 0.1);
}

/* 按钮 */
.btn-row {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-primary {
    padding: 12px 28px;
    border: 2px solid var(--gold, #d4a853);
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.15), rgba(160, 120, 48, 0.25));
    color: var(--gold-light, #f0d68a);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.3), rgba(160, 120, 48, 0.4));
    box-shadow: 0 0 25px rgba(212, 168, 83, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-outline {
    padding: 12px 28px;
    border: 1px solid var(--text-dim, #a89080);
    background: transparent;
    color: var(--text-dim, #a89080);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-outline:hover {
    border-color: var(--text-light, #f5e6d0);
    color: var(--text-light, #f5e6d0);
}

/* 剧本预览 */
.script-preview {
    max-height: 400px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin: 15px 0;
}

.script-line {
    padding: 8px 0;
    border-bottom: 1px solid rgba(212, 168, 83, 0.08);
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.script-line:last-child {
    border-bottom: none;
}

.script-char {
    color: var(--gold, #d4a853);
    font-weight: bold;
    white-space: nowrap;
    min-width: 60px;
}

.script-text {
    color: var(--text-light, #f5e6d0);
    flex: 1;
}

.script-emoji {
    font-size: 0.8rem;
    color: var(--text-dim);
    opacity: 0.6;
}

/* 角色卡片 */
.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin: 15px 0;
}

.char-card {
    background: rgba(30, 20, 15, 0.6);
    border: 1px solid rgba(212, 168, 83, 0.15);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s;
}

.char-card.generating {
    opacity: 0.7;
}

.char-card-name {
    color: var(--gold-light, #f0d68a);
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 8px;
}

.char-card-img {
    width: 140px;
    height: 200px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.2);
    margin: 8px auto;
    display: block;
}

.char-card-img.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: rgba(212, 168, 83, 0.3);
}

.char-card-voice {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 6px;
}

.char-card-voice select {
    margin-top: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(212, 168, 83, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-light);
    font-size: 0.8rem;
    width: 100%;
}

/* 角色预览容器 — 内部使用和播放页完全相同的 .character-container > .char-body + .char-face 结构 */
.char-preview-container {
    width: 220px;
    margin: 8px auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

.char-preview-container .char-body {
    filter: none;  /* 预览不需要阴影 */
}

/* 重新生成按钮 */
.btn-regen-single {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s;
    vertical-align: middle;
}

.btn-regen-single:hover {
    background: rgba(212, 168, 83, 0.2);
}

/* 步骤条可点击 */
.step-dot {
    cursor: pointer;
}

/* 背景图/封面预览 */
.image-preview-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 15px 0;
}

.image-preview-card {
    background: rgba(30, 20, 15, 0.6);
    border: 1px solid rgba(212, 168, 83, 0.15);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.image-preview-card h4 {
    color: var(--gold-light);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.image-preview-img {
    width: 100%;
    height: 150px;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(0, 0, 0, 0.2);
}

/* faceOffset D-pad 控制器 */
.offset-controls {
    margin-top: 6px;
    display: flex;
    justify-content: center;
}

.dpad-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dpad {
    display: grid;
    grid-template-areas:
        ".    up   ."
        "left mid  right"
        ".    down .";
    grid-template-columns: 28px 28px 28px;
    grid-template-rows: 28px 28px 28px;
    gap: 2px;
}

.dpad-up    { grid-area: up; }
.dpad-down  { grid-area: down; }
.dpad-left  { grid-area: left; }
.dpad-right { grid-area: right; }
.dpad-center {
    grid-area: mid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    opacity: 0.4;
}

.dpad-btn {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(212, 168, 83, 0.25);
    border-radius: 6px;
    background: rgba(212, 168, 83, 0.08);
    color: rgba(212, 168, 83, 0.7);
    cursor: pointer;
    font-size: 0.6rem;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
}

.dpad-btn:hover {
    background: rgba(212, 168, 83, 0.2);
    border-color: rgba(212, 168, 83, 0.5);
    color: rgba(212, 168, 83, 1);
    transform: scale(1.12);
}

.dpad-btn:active {
    transform: scale(0.9);
    background: rgba(212, 168, 83, 0.3);
}

.zoom-btns {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.zoom-btn {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    font-size: 0.85rem !important;
    font-weight: bold;
}

/* 加载状态 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(212, 168, 83, 0.2);
    border-top-color: var(--gold, #d4a853);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

.status-text {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin: 10px 0;
}

/* 发布选项 */
.publish-options {
    background: rgba(30, 20, 15, 0.6);
    border: 1px solid rgba(212, 168, 83, 0.15);
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.toggle-row label {
    color: var(--text-light);
    font-size: 0.95rem;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(100, 80, 60, 0.4);
    border-radius: 13px;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-dim);
    bottom: 3px;
    left: 3px;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: rgba(212, 168, 83, 0.4);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
    background: var(--gold);
}

/* Toast */
#toast-container {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
