/* ====================================================================
   情境语音交互 — 实验系统样式
   ==================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --c-accent: #4f46e5;
    --c-accent-hover: #4338ca;
    --c-accent-light: #eef2ff;
    --c-text: #1e293b;
    --c-text-2: #64748b;
    --c-text-3: #94a3b8;
    --c-bg: #f8fafc;
    --c-surface: #ffffff;
    --c-border: #e8ecf1;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,.06), 0 1px 4px rgba(0,0,0,.04);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body {
    font-family: var(--font);
    color: var(--c-text);
    background: var(--c-bg);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ====================================================================
   断开连接浮层
   ==================================================================== */
.disconnect-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: disconnectFadeIn 0.3s ease;
}

@keyframes disconnectFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.disconnect-card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 48px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: disconnectSlideUp 0.35s ease;
}

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

.disconnect-icon {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}

.disconnect-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--c-text);
    margin-bottom: 8px;
}

.disconnect-desc {
    font-size: 15px;
    color: var(--c-text-2);
    line-height: 1.7;
}

/* ====================================================================
   注册页
   ==================================================================== */
.register-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    background: linear-gradient(160deg, #f1f5f9 0%, #e8ecf1 30%, #eef2ff 70%, #f8fafc 100%);
}

.register-card {
    width: 100%;
    max-width: 440px;
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 28px 28px 26px;
    border: 1px solid var(--c-border);
}

.card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.logo-icon svg { width: 26px; height: 26px; display: block; }

.register-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--c-text);
    letter-spacing: -0.3px;
}

.card-desc {
    background: #f8fafc;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 20px;
    font-size: 13.5px;
    color: var(--c-text-2);
    line-height: 1.6;
}

.card-desc p { margin-bottom: 0; }

/* --- 表单 --- */
.register-form {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.1px;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    color: var(--c-text-3);
    pointer-events: none;
    transition: color .2s;
}

.input-wrap input,
.input-wrap select {
    width: 100%;
    height: 40px;
    padding: 0 12px 0 36px;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: var(--font);
    color: var(--c-text);
    background: #fff;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.input-wrap input::placeholder { color: var(--c-text-3); }

.input-wrap input:focus,
.input-wrap select:focus {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(79,70,229,.10), 0 0 0 1px rgba(79,70,229,.08);
}

.input-wrap:focus-within .input-icon { color: var(--c-accent); }

.select-wrap select {
    appearance: none;
    cursor: pointer;
    padding-right: 36px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 10.5 3.5 6h9z'/%3E%3C/svg%3E") no-repeat right 12px center;
}

/* --- 提交按钮 --- */
.submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 42px;
    margin-top: 2px;
    background: var(--c-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: background .2s, transform .15s, box-shadow .2s;
    box-shadow: 0 2px 8px rgba(79,70,229,.25);
}

.submit-btn:hover {
    background: var(--c-accent-hover);
    box-shadow: 0 4px 14px rgba(79,70,229,.35);
    transform: translateY(-1px);
}

.submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(79,70,229,.2);
}

/* ====================================================================
   实验页 — 极简居中布局
   ==================================================================== */
.exp-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background: linear-gradient(160deg, #f1f5f9 0%, #eef2ff 50%, #f8fafc 100%);
}

/* --- 顶部状态条 --- */
.exp-status {
    position: fixed;
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 24px;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--c-border);
    z-index: 10;
}

.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #facc15;
    flex-shrink: 0;
    transition: background .3s;
}

.status-dot.connected  { background: #22c55e; }
.status-dot.speaking   { background: #3b82f6; animation: dotPulse 1s infinite; }
.status-dot.listening  { background: #f59e0b; animation: dotPulse .8s infinite; }
.status-dot.error      { background: #ef4444; }
.status-dot.connecting { background: #facc15; animation: dotPulse .8s infinite; }

@keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
    50%      { box-shadow: 0 0 0 8px transparent; opacity: .4; }
}

.status-label {
    font-size: 15px;
    color: var(--c-text-2);
}

/* --- 情境内容 --- */
.exp-scenario {
    max-width: 640px;
    width: 100%;
    animation: fadeIn .5s ease;
}

.scenario-text {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 40px 44px;
    font-size: 22px;
    line-height: 2.2;
    color: var(--c-text);
    white-space: pre-wrap;
    box-shadow: var(--shadow-md);
    text-align: center;
}

/* --- 情境确认 --- */
.exp-confirm {
    max-width: 640px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    margin-top: 48px;
    animation: fadeIn .4s ease;
}

.confirm-question {
    font-size: 20px;
    font-weight: 600;
    color: var(--c-text);
    text-align: center;
}

.confirm-buttons {
    display: flex;
    gap: 24px;
}

.confirm-btn {
    width: 120px;
    height: 48px;
    border: 2px solid var(--c-border);
    border-radius: var(--radius-md);
    font-size: 18px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all .2s;
    background: var(--c-surface);
    color: var(--c-text);
    box-shadow: var(--shadow-sm);
}

.confirm-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.confirm-yes:hover {
    border-color: #22c55e;
    color: #16a34a;
    background: #f0fdf4;
}

.confirm-no:hover {
    border-color: #ef4444;
    color: #dc2626;
    background: #fef2f2;
}
/* ====================================================================
   音频波纹动画
   ==================================================================== */
.waveform-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 60px 20px;
}

.waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 50px;
    width: 100%;
}

.waveform span {
    display: block;
    width: 4px;
    height: 20px;
    border-radius: 4px;
    animation: wave 1.2s ease-in-out infinite;
}

/* 语音助手波纹 — 紫色系 */
.doubao-wave span { background: var(--c-accent); }

/* 被试波纹 — 绿色系（与语音助手区分） */
.participant-wave span { background: #22c55e; }

.waveform span:nth-child(1)  { animation-delay: 0.0s; height: 12px; }
.waveform span:nth-child(2)  { animation-delay: 0.1s; height: 24px; }
.waveform span:nth-child(3)  { animation-delay: 0.2s; height: 36px; }
.waveform span:nth-child(4)  { animation-delay: 0.3s; height: 48px; }
.waveform span:nth-child(5)  { animation-delay: 0.4s; height: 56px; }
.waveform span:nth-child(6)  { animation-delay: 0.5s; height: 56px; }
.waveform span:nth-child(7)  { animation-delay: 0.4s; height: 48px; }
.waveform span:nth-child(8)  { animation-delay: 0.3s; height: 36px; }
.waveform span:nth-child(9)  { animation-delay: 0.2s; height: 24px; }
.waveform span:nth-child(10) { animation-delay: 0.1s; height: 12px; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); opacity: 0.4; }
    50%      { transform: scaleY(1.0); opacity: 1.0; }
}

.waveform-label {
    font-size: 14px;
    color: var(--c-text-2);
    margin: 0;
}

.doubao-label { color: var(--c-accent); font-weight: 600; }
.participant-label { color: #16a34a; font-weight: 600; }

/* --- 等待占位 --- */
.exp-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    color: var(--c-text-2);
    font-size: 18px;
}

.wait-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--c-border);
    border-top-color: var(--c-accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

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

/* --- 通用说明页/过渡页宽度 --- */
.pretest-instruction,
.pretest-transition,
.questionnaire-instruction,
.scenario-transition,
.ug-instruction,
.exp-complete {
    max-width: 520px;
    width: 100%;
    animation: fadeIn .5s ease;
}

/* --- 过渡页卡片 --- */
.transition-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 56px 52px 48px;
    box-shadow: 0 8px 30px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.03);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    position: relative;
    overflow: hidden;
}

.transition-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4f46e5, #818cf8, #4f46e5);
    border-radius: 4px 4px 0 0;
}

.transition-icon {
    width: 72px;
    height: 72px;
    background: var(--c-accent-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.transition-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--c-text);
    letter-spacing: -0.3px;
}

.transition-desc {
    font-size: 16px;
    color: var(--c-text-2);
    margin: 0;
}

.transition-guide {
    font-size: 16px;
    color: #334155;
    line-height: 1.8;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid #e0e7ff;
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin: 4px 0 4px;
    width: 100%;
    text-align: center;
}

.transition-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 32px;
    margin-top: 8px;
    background: var(--c-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: background .2s, transform .15s, box-shadow .2s;
    box-shadow: 0 2px 8px rgba(79,70,229,.25);
}

.transition-btn:hover {
    background: var(--c-accent-hover);
    box-shadow: 0 4px 14px rgba(79,70,229,.35);
    transform: translateY(-1px);
}

.transition-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(79,70,229,.2);
}

/* --- 完成页 --- */
.exp-complete {
    animation-duration: .6s;
}

/* --- 过渡动画 --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- 响应式 --- */
@media (max-width: 640px) {
    .register-card { padding: 28px 24px 24px; }
    .input-row { grid-template-columns: 1fr; }
    .scenario-text { padding: 24px 20px; font-size: 18px; }
    .exp-container { padding: 60px 16px 32px; }
}

/* ====================================================================
   问卷页面样式
   ==================================================================== */

.questionnaire-page {
    max-width: 680px;
    width: 100%;
    animation: fadeIn .5s ease;
}

.questionnaire-container {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 32px 36px;
}

/* --- 进度条 --- */
.q-progress {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.q-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--c-border);
    border-radius: 3px;
    overflow: hidden;
}

.q-progress-fill {
    height: 100%;
    background: var(--c-accent);
    border-radius: 3px;
    transition: width .35s ease;
}

.q-progress-text {
    font-size: 13px;
    color: var(--c-text-2);
    white-space: nowrap;
}

/* --- 量表标题与说明 --- */
.q-scale-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--c-accent);
    margin-bottom: 8px;
}

.q-scale-instruction {
    font-size: 14px;
    color: var(--c-text-2);
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--c-border);
    line-height: 1.7;
}

/* --- 题目列表 --- */
.q-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.q-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background .15s;
}

.q-item:hover {
    background: #f8fafc;
}

.q-item-num {
    width: 32px;
    flex-shrink: 0;
    font-size: 13px;
    color: var(--c-text-3);
    font-weight: 500;
}

.q-item-text {
    flex: 1;
    font-size: 14px;
    color: var(--c-text);
    line-height: 1.5;
    padding-right: 12px;
}

.q-item-adjective {
    font-weight: 600;
    color: var(--c-accent);
}

.q-options {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.q-opt {
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--c-border);
    border-radius: 8px;
    background: var(--c-surface);
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-2);
    cursor: pointer;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.q-opt:hover {
    border-color: var(--c-accent);
    color: var(--c-accent);
    background: var(--c-accent-light);
}

.q-opt.selected {
    background: var(--c-accent);
    border-color: var(--c-accent);
    color: #fff;
}

/* --- 量表选项标签行 --- */
.q-options-labels {
    display: flex;
    align-items: center;
    padding: 4px 12px 10px 12px;
    font-size: 11px;
    color: var(--c-text-3);
}

.q-labels-num {
    width: 32px;
    flex-shrink: 0;
}

.q-labels-text {
    flex: 1;
    padding-right: 12px;
}

.q-labels-opts {
    display: flex;
    justify-content: space-between;
    flex-shrink: 0;
}

/* --- 导航按钮 --- */
.q-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--c-border);
}

.q-nav-btn {
    padding: 10px 32px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    border: 1.5px solid var(--c-border);
    background: var(--c-surface);
    color: var(--c-text);
}

.q-nav-btn:hover {
    border-color: var(--c-accent);
    color: var(--c-accent);
}

.q-nav-next,
.q-nav-submit {
    background: var(--c-accent);
    border-color: var(--c-accent);
    color: #fff;
}

.q-nav-next:hover,
.q-nav-submit:hover {
    background: var(--c-accent-hover);
    border-color: var(--c-accent-hover);
    color: #fff;
}

/* --- 问卷响应式 --- */
@media (max-width: 640px) {
    .questionnaire-container { padding: 20px 16px; }
    .q-item { flex-wrap: wrap; gap: 6px; }
    .q-item-text { flex: 1 1 100%; }
    .q-opt { width: 32px; height: 32px; font-size: 12px; }
    .q-options-labels { flex-wrap: wrap; gap: 6px; }
    .q-labels-text { flex: 1 1 100%; }
    .q-labels-opts { width: auto !important; }
}

/* ====================================================================
   UG（独裁者游戏）
   ==================================================================== */
#ug-instruction, #ug-trial, #ug-feedback {
    max-width: 520px;
    width: 100%;
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn .4s ease;
}

.ug-instruction-card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 36px 32px;
    text-align: center;
    line-height: 1.8;
}

.ug-instruction-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--c-accent);
    margin-bottom: 16px;
}

.ug-instruction-card p {
    font-size: 15px;
    color: var(--c-text-2);
    margin-bottom: 10px;
}

.ug-instruction-card .ug-btn-start {
    margin-top: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 36px;
    background: var(--c-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .15s;
}

.ug-instruction-card .ug-btn-start:hover {
    background: var(--c-accent-hover);
    transform: translateY(-1px);
}

/* --- UG 试次卡 --- */
.ug-trial-card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 48px 40px;
    text-align: center;
}

.ug-trial-progress {
    font-size: 15px;
    color: var(--c-text-3);
    margin-bottom: 24px;
}

.ug-offer-display {
    background: var(--c-accent-light);
    border-radius: var(--radius-md);
    padding: 44px 32px;
    margin-bottom: 36px;
}

.ug-offer-label {
    font-size: 17px;
    color: var(--c-text-2);
    margin-bottom: 16px;
}

.ug-split {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    font-size: 16px;
    font-weight: 600;
}

.ug-party {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ug-avatar {
    font-size: 52px;
    line-height: 1;
}

.ug-name {
    font-size: 16px;
    color: var(--c-text-2);
    font-weight: 500;
}

.ug-amount, .ug-party-amount {
    font-size: 36px;
    font-weight: 700;
    color: var(--c-text);
}

.ug-party-label {
    font-size: 12px;
    color: var(--c-text-3);
    font-weight: 400;
}

.ug-split-divider {
    font-size: 24px;
    color: var(--c-text-3);
}

.ug-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.ug-btn {
    flex: 1;
    max-width: 200px;
    padding: 16px 32px;
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    border: 1.5px solid var(--c-border);
}

.ug-accept {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.ug-accept:hover {
    background: #059669;
    border-color: #059669;
}

.ug-reject {
    background: var(--c-surface);
    border-color: #ef4444;
    color: #ef4444;
}

.ug-reject:hover {
    background: #fef2f2;
}

/* --- UG 反馈卡 --- */
.ug-feedback-card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 48px 40px;
    text-align: center;
}

.ug-fb-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.ug-fb-text {
    font-size: 19px;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 12px;
}

.ug-fb-split {
    font-size: 16px;
    color: var(--c-text-2);
}
