/* ============================================================
   互动汤（互动模式）—— 与标准模式同一套视觉语言
   · 满屏对局布局：聊天区撑满中间，输入区固定在底部（汤面折叠只影响聊天区高度）
   · 玩家发言一律在右、AI 主持在左（与标准模式一致）
   · 提问的回答做成问题下方的小气泡（靠右），不再占用一个大框
   ============================================================ */

/* 创建页：互动模式只保留房间名/房间号 */
#page-create.it-create-mode .form-box > .form-field:not(#it-common-name):not(#it-common-id):not(#it-private-field):not(#it-spectate-field):not(#c-spectate-limit-field) { display: none !important; }

#page-interaction { max-width: 860px; margin: 0 auto; overflow-wrap: anywhere; }

/* 满屏列布局：头部 / 汤面 固定，聊天区弹性撑满，输入与操作区贴底 */
.app-container.game-mode #page-interaction.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 12px 16px 16px;
    gap: 6px;
    overflow: hidden;
}
#page-interaction .game-header,
#page-interaction .game-puzzle-desc,
#page-interaction #it-notice,
#page-interaction .input-area,
#page-interaction .game-actions,
#page-interaction .judge-bar { flex-shrink: 0; }
#page-interaction .chat-area {
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    max-height: none;
    margin: 2px 0 4px;
}
#page-interaction .input-area { margin: 0; }
#page-interaction .game-actions { margin-top: 2px; }
#page-interaction .game-timer { font-variant-numeric: tabular-nums; }
#page-interaction .game-sub-row { margin-top: 2px; }
#page-interaction .q-count-info { margin-left: 0; white-space: nowrap; color: var(--teal-bright); font-weight: 600; }

/* 玩家条带：沿用标准 .strip-player / .strip-avatar（头像 20px） */
#it-players .strip-player.offline { opacity: .55; }
#it-players .strip-player .it-ap-tag { font-size: 11px; color: var(--brass-bright); margin-left: 2px; }
#it-players .strip-player.give-target { cursor: pointer; }
#it-players .strip-player.give-target:hover { border-color: var(--brass); }

/* 气泡：复用标准 .chat-message，只补「行动」的色调 */
.chat-message.it-act { background: linear-gradient(135deg, var(--brass-bright), var(--brass)); color: #211505; }
.chat-message.it-act .msg-sender { color: rgba(33, 21, 5, .7); }

/* 提问：问题气泡 + 紧贴下方的小回答气泡（整体靠右，和自由发言模式一致） */
.it-ask-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    max-width: 88%;
    align-self: flex-end;
}
.it-ask-group .chat-message { max-width: 100%; }
.it-verdict {
    padding: 2px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .24);
    font-size: 13px;
    line-height: 1.4;
    color: var(--ink-text);
}
.it-verdict.key { background: var(--brass-bright); border-color: var(--brass-bright); color: #211505; font-weight: 600; }

/* 输入模式按钮（讨论 / 行动 / 询问 / 还原） */
.it-mode {
    flex: 0 0 auto; height: 44px; padding: 0 14px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--surface-raised);
    color: var(--ink-text-soft); font: inherit; font-size: 14px; cursor: pointer;
}
.it-mode[data-mode="action"] { background: rgba(201, 151, 75, .22); border-color: var(--brass); color: var(--brass-bright); }
.it-mode[data-mode="ask"] { background: rgba(155, 111, 208, .22); border-color: #7a5aa8; color: #cbb3ea; }
.it-mode[data-mode="guess"] { background: rgba(79, 157, 146, .2); border-color: var(--teal); color: var(--teal-bright); }

#it-notice { min-height: 16px; margin: 0; line-height: 1.4; }
#it-result p { white-space: pre-wrap; margin: 6px 0; }

/* 汤面折叠 */
#it-intro-body { transition: max-height .25s ease, opacity .2s ease; overflow: hidden; max-height: 260px; opacity: 1; }
#it-intro-body.collapsed { max-height: 0; opacity: 0; }
#it-intro-body .field-tip { margin-top: 4px; }

@media (max-width: 520px) {
    .app-container.game-mode #page-interaction.active { padding: 8px 10px 10px; gap: 4px; }
    .it-mode { height: 40px; padding: 0 10px; font-size: 13px; }
    .it-verdict { font-size: 12px; padding: 2px 8px; }
}

/* ============ 创建页：剧本选择 + 参数 ============ */
.it-pick-btn {
    width: 100%; text-align: left; padding: 10px 14px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg); color: var(--ink-text);
    font: inherit; font-size: 15px; cursor: pointer;
}
.it-pick-btn:hover { border-color: var(--brass); }
.it-cfg-row { display: flex; flex-wrap: wrap; gap: 0 12px; }
.it-cfg-row > .form-field { flex: 1 1 44%; min-width: 0; }
.it-cfg-row input[disabled] { opacity: .55; cursor: not-allowed; }

/* ============ 剧本选择弹窗 ============ */
#it-story-modal .modal-box { max-width: 460px; }
#it-story-modal input[type="text"] {
    width: 100%; height: 42px; padding: 8px 12px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg); color: var(--ink-text); font: inherit;
}
.it-story-list {
    display: flex; flex-direction: column; gap: 8px;
    max-height: 44vh; overflow-y: auto; margin: 12px 0;
}
.it-story-item {
    display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%;
    padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface); color: var(--ink-text); font: inherit; cursor: pointer;
}
.it-story-item strong { font-size: 15px; font-weight: 600; }
.it-story-item span { font-size: 12px; color: var(--ink-text-mute); }
.it-story-item.active { border-color: var(--brass); background: rgba(201, 151, 75, .12); }
.it-story-item:hover { border-color: var(--brass-dim); }

/* ============ 创建页：剧本抽取方式（内嵌，仿题库选择） ============ */
.it-radio-row { display: flex; gap: 18px; flex-wrap: wrap; }
.it-radio-row .radio-item { display: inline-flex; align-items: center; gap: 6px; }
.it-radio-row input[type="radio"] { width: 16px; height: 16px; accent-color: #c9974b; }
.it-search-row { display: flex; gap: 8px; }
.it-search-row input {
    flex: 1; height: 42px; padding: 8px 12px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg); color: var(--ink-text); font: inherit;
}
/* 自选剧本的「清除」按钮：与标准模式（#c-pick-clear）同款绿色 .code-btn */
.it-search-row .btn-back,
.it-search-row .code-btn { flex: 0 0 auto; width: auto; padding: 0 18px; height: 42px; }
#it-pick-wrap { margin-bottom: 12px; }
#it-pick-wrap .it-story-list {
    max-height: 220px; margin: 6px 0 0; padding: 0; overflow-y: auto;
    border: 1px solid var(--border); border-radius: 6px; background: var(--bg);
}

/* ============ 房间等待页：房间号居中 + 房间信息链接 ============ */
#page-room .page-head { text-align: center; }
.room-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.room-info-link {
    font-size: 14px; color: var(--ink-text-mute); background: none; border: none;
    padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.room-info-link:hover { color: var(--brass-bright); }

/* ============ 结算页评分 ============ */
.itr-rate-head { display: flex; align-items: baseline; justify-content: center; gap: 10px; margin-bottom: 8px; }
.itr-rate-label { font-size: 14px; color: var(--ink-text-soft); }
.itr-rate-avg { font-size: 12.5px; color: var(--ink-text-mute); }
.itr-stars { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.itr-stars i {
    font-size: 24px; color: var(--ink-text-mute); cursor: pointer;
    transition: color .12s, transform .12s;
}
.itr-stars i:hover { transform: scale(1.12); }
.itr-stars i.on { color: var(--brass-bright); }

/* 选剧本列表里的评分 */
.it-story-rate { margin-left: 10px; font-size: 12.5px; color: var(--brass-bright); }

/* ============ 气泡配色：讨论绿 / 行动紫 / 提问蓝 / 还原黄 ============ */
.chat-message.player.it-act {
    background: rgba(150, 110, 220, .16);
    border: 1px solid rgba(150, 110, 220, .45);
    color: #e6dcf7;
}
.chat-message.player.it-act .msg-sender { color: #b98cf0; }
.chat-message.player.it-ask {
    background: rgba(91, 143, 214, .16);
    border: 1px solid rgba(91, 143, 214, .45);
    color: #dbe8f8;
}
.chat-message.player.it-ask .msg-sender { color: #8cb6e6; }

/* ============ 额度条（建房页 / 局内） ============ */
.it-quota-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.it-quota-bar {
    flex: 1; height: 6px; border-radius: 3px; overflow: hidden;
    background: var(--border);
}
.it-quota-fill {
    height: 100%; width: 0;
    background: linear-gradient(90deg, var(--brass-bright), var(--brass));
    transition: width .3s var(--ease);
}
.it-quota-text { font-size: 12px; color: var(--ink-text-mute); white-space: nowrap; }
.it-quota-fill.over { background: linear-gradient(90deg, #ff6b6b, #c0392b); }
.it-quota-text.over { color: #ff6b6b; }
.it-quota-plus {
    flex: 0 0 auto; width: 22px; height: 22px; line-height: 1;
    border: 1px solid var(--brass-dim); border-radius: 50%;
    background: transparent; color: var(--brass-bright);
    font-size: 15px; cursor: pointer; padding: 0;
}
.it-quota-plus:hover { background: rgba(201,151,75,.16); }
.it-host-quota {
    display: inline-flex; align-items: center; gap: 6px;
    margin-left: 10px; font-size: 12px; color: var(--ink-text-mute);
}

/* 额度提示语：低于 50% 变红 */
.it-quota-box { margin-top: 8px; }
.it-quota-tip { font-size: 12px; color: var(--ink-text-mute); margin: 6px 0 0; line-height: 1.5; }
.it-quota-tip.peak { color: #e0a23c; }
.it-quota-tip.low { color: #e0726a; }

/* ============ 剧本评论页 ============ */
.srp-write {
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
    padding: 12px; margin-bottom: 14px;
}
.srp-write-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.srp-write-label { font-size: 14px; color: var(--ink-text-soft); }
.srp-stars { justify-content: flex-start; margin-bottom: 0; }
.srp-write textarea {
    width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--bg); color: var(--ink-text); font: inherit; resize: vertical;
    margin-bottom: 10px;
}
.srp-write .btn-primary { width: 100%; }
.srp-list { display: flex; flex-direction: column; gap: 10px; }
.srp-item {
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
    padding: 10px 12px;
}
.srp-item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.srp-item-name { font-size: 13.5px; color: var(--ink-text-soft); }
.srp-item-stars { font-size: 12px; color: var(--brass-bright); letter-spacing: 1px; }
.srp-item-text { font-size: 13.5px; color: var(--ink-text); line-height: 1.6; word-break: break-word; }
.srp-empty { text-align: center; color: var(--ink-text-mute); font-size: 13px; padding: 18px 0; }

/* ============ 结算页排版（与标准模式对齐） ============ */
/* 【多结局】剧本自定义的结算正文 */
.result-ending {
    margin: 10px 0 0; padding: 12px 14px;
    border: 1px dashed var(--border); border-radius: 8px; background: var(--surface);
    color: var(--ink-text-soft); font-size: 15px; line-height: 1.85;
    text-align: left; white-space: pre-wrap; word-break: break-word;
}
#page-interaction-result .result-players-box { margin: 14px 0 0; }
#page-interaction-result .result-answer { margin-top: 16px; }
#page-interaction-result .result-rating { margin-top: 18px; }
#page-interaction-result .result-actions { margin-top: 22px; }
#page-interaction-result .result-rating .btn-rating { min-width: 60%; }

/* 等待页「房间信息」与左侧标题齐平 */
.room-card-top { align-items: flex-start; }
.room-info-link { line-height: 1.2; }

/* 登录页：注册 / 找回密码加下划线 */
#page-login a#login-to-register,
#page-login a#login-to-forgot {
    text-decoration: underline !important;
    text-underline-offset: 3px;
    color: var(--brass-bright);
    border-bottom: 1px solid rgba(201,151,75,.55);
}
