/* =========================
   挑战模式通关奖励 - 玩家页
   依赖 css/cdkey.css 的 .cdkey-wrapper / .cdkey-title / .cdkey-card
========================= */

/* 顶部公告 */
.cr-notice {
    background: #fff8e1;
    border-left: 4px solid #f0ad4e;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    color: #8a6d3b;
    font-size: 14px;
}

.cr-section-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.cr-muted { color: #999; }
.cr-empty { text-align: center; color: #999; padding: 30px 0; }

/* =========================
   奖品预览
========================= */
.cr-prize-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.cr-prize {
    flex: 1 1 300px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8edf3 100%);
    border: 1px solid #dde3ea;
    border-radius: 8px;
    padding: 16px;
}

.cr-prize-off { opacity: 0.55; }

.cr-prize-ep {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 8px;
}

.cr-prize-req {
    font-size: 12px;
    font-weight: normal;
    color: #7f8c8d;
    margin-left: 8px;
}

.cr-prize-name {
    font-size: 15px;
    color: #c0392b;
    margin-bottom: 6px;
}

.cr-prize-item {
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    color: #7f8c8d;
    word-break: break-all;
}

.cr-prize-time { font-size: 12px; color: #7f8c8d; margin-top: 6px; }
.cr-prize-closed { font-size: 13px; color: #e74c3c; margin-top: 6px; }

/* =========================
   角色卡片
========================= */
.cr-char-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
    margin-bottom: 14px;
}

.cr-char-name { font-size: 18px; font-weight: bold; color: #2c3e50; }
.cr-char-meta { font-size: 13px; color: #7f8c8d; }

/* =========================
   章节区块
========================= */
.cr-ep-block {
    padding: 12px 0;
    border-bottom: 1px dashed #eee;
}

.cr-ep-block:last-child { border-bottom: none; }

.cr-ep-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.cr-ep-label {
    font-weight: bold;
    color: #34495e;
    min-width: 36px;
}

.cr-bar {
    flex: 1 1 160px;
    height: 10px;
    background: #ecf0f1;
    border-radius: 5px;
    overflow: hidden;
    min-width: 120px;
}

.cr-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #27ae60);
    transition: width 0.3s;
}

.cr-ep-count { font-size: 13px; color: #7f8c8d; min-width: 40px; }
.cr-ep-total { font-size: 13px; color: #16a085; font-weight: bold; }

/* =========================
   关卡格子
========================= */
.cr-stages {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.cr-stage {
    flex: 0 0 auto;
    min-width: 74px;
    padding: 6px 8px;
    border-radius: 4px;
    text-align: center;
    font-size: 11px;
    border: 1px solid transparent;
}

.cr-stage-label { font-weight: bold; margin-bottom: 2px; }
.cr-stage-time { font-family: Consolas, Monaco, monospace; }

/* 绿=有效 红=无效时间 灰=未通关 */
.cr-stage-ok   { background: #e8f8f0; border-color: #a9dfc4; color: #1e8449; }
.cr-stage-bad  { background: #fdecea; border-color: #f5b7b1; color: #c0392b; }
.cr-stage-todo { background: #f4f6f7; border-color: #e5e8ea; color: #aab2b8; }

/* =========================
   操作区
========================= */
.cr-action {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cr-btn {
    padding: 7px 18px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.cr-btn-claim { background: #27ae60; color: #fff; }
.cr-btn-claim:hover { background: #219150; }

.cr-btn-copy {
    background: #3498db;
    color: #fff;
    padding: 5px 12px;
    font-size: 12px;
}
.cr-btn-copy:hover { background: #2980b9; }

.cr-btn-disabled {
    background: #dfe4e6;
    color: #95a5a6;
    cursor: not-allowed;
}

/* 重置挑战记录按钮(次要危险操作, 不与主按钮抢视觉) */
.cr-btn-reset {
    background: transparent;
    color: #e74c3c;
    border: 1px solid #f1b7b1;
    padding: 5px 12px;
    font-size: 12px;
}
.cr-btn-reset:hover {
    background: #fdecea;
}
.cr-btn-reset:disabled {
    color: #f5b7b1;
    cursor: not-allowed;
}

/* 轮次标记 */
.cr-attempt-tag {
    font-size: 11px;
    color: #fff;
    background: #8e44ad;
    border-radius: 3px;
    padding: 2px 6px;
}

/* =========================
   各角色独立的兑换记录清单
========================= */
.cr-history {
    margin-top: 12px;
    padding: 10px 12px;
    background: #fafbfc;
    border: 1px solid #ecf0f1;
    border-radius: 6px;
}

.cr-history-title {
    font-size: 13px;
    font-weight: bold;
    color: #7f8c8d;
    margin-bottom: 8px;
}

.cr-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.cr-history-table th {
    text-align: left;
    color: #95a5a6;
    font-weight: normal;
    padding: 4px 8px;
    border-bottom: 1px solid #ecf0f1;
}

.cr-history-table td {
    padding: 5px 8px;
    border-bottom: 1px dashed #f0f3f4;
    color: #555;
    vertical-align: middle;
}

.cr-history-table tr:last-child td {
    border-bottom: none;
}

.cr-cdkey-sm {
    font-size: 12px;
    padding: 2px 8px;
    margin-right: 6px;
}

.cr-claimed-tag { color: #27ae60; font-weight: bold; font-size: 14px; }

.cr-cdkey {
    font-family: Consolas, Monaco, monospace;
    font-size: 15px;
    letter-spacing: 1px;
    background: #2c3e50;
    color: #f1c40f;
    padding: 5px 12px;
    border-radius: 4px;
}

.cr-claim-time { font-size: 12px; color: #95a5a6; }
.cr-hint { font-size: 12px; color: #95a5a6; }
.cr-hint-bad { color: #e74c3c; }

/* =========================
   使用说明
========================= */
.cr-howto {
    margin: 0;
    padding-left: 22px;
    color: #555;
    font-size: 14px;
    line-height: 1.9;
}

/* =========================
   奖品选择弹框(SweetAlert2 radio)
   默认 label 是行内块会挤在一行, 改为纵向卡片式
========================= */
.swal2-radio {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin: 16px auto 4px !important;
    max-width: 380px;
}

.swal2-radio label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid #dde3ea;
    border-radius: 6px;
    background: #f8fafc;
    cursor: pointer;
    font-size: 15px;
    color: #2c3e50;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
    margin: 0 !important;
}

.swal2-radio label:hover {
    border-color: #27ae60;
    background: #eef8f2;
}

.swal2-radio input[type="radio"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    accent-color: #27ae60;
}

/* =========================
   GM 后台
========================= */
.cr-cfg-state { font-size: 13px; font-weight: normal; margin-left: 8px; }
.cr-cfg-on  { color: #27ae60; }
.cr-cfg-off { color: #95a5a6; }

.cr-admin-form {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.cr-field {
    flex: 0 0 auto;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cr-field-wide { flex: 1 1 100%; }

.cr-field label {
    font-size: 12px;
    color: #7f8c8d;
    font-weight: normal;
    margin: 0;
}

.cr-field input,
.cr-field select {
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.cr-field input:focus,
.cr-field select:focus {
    border-color: #3498db;
    outline: none;
}

.cr-item-input { font-family: Consolas, Monaco, monospace; }

.cr-item-preview {
    font-size: 13px;
    color: #95a5a6;
    padding: 6px 0;
}
.cr-preview-ok  { color: #16a085; font-weight: bold; }
.cr-preview-bad { color: #e74c3c; }

/* =========================
   多奖品: 活动设置小节 + 选项行
========================= */
.cr-subsection {
    flex: 1 1 100%;
    font-size: 15px;
    font-weight: bold;
    color: #34495e;
    padding: 10px 0 4px;
    margin-top: 6px;
    border-top: 1px dashed #e0e4e8;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cr-items-container {
    flex: 1 1 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cr-item-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e3e8ee;
    border-radius: 6px;
}

.cr-row-actions {
    justify-content: flex-end;
    align-items: flex-end;
}

.cr-row-remove {
    background: #e74c3c;
}
.cr-row-remove:hover {
    background: #c0392b;
}

.cr-btn-sm { padding: 5px 12px; font-size: 12px; background: #7f8c8d; color: #fff; }
.cr-btn-sm:hover { background: #6c7a7d; }

.cr-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: center;
}

.cr-toolbar input,
.cr-toolbar select {
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.cr-toolbar input { flex: 1 1 220px; }

.cr-tag-on  { color: #27ae60; font-weight: bold; }
.cr-tag-off { color: #95a5a6; }

/* =========================
   窄屏
========================= */
@media (max-width: 768px) {
    .cr-prize-grid { flex-direction: column; }
    .cr-stage { min-width: 64px; font-size: 10px; }
    .cr-char-head { flex-direction: column; gap: 4px; }
    .cr-field { flex: 1 1 100%; }
}

/* =========================
   分页 tab(玩家页角色 / GM页区块共用)
   服务端渲染全部内容, 前端切换显隐
========================= */
.cr-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.cr-tab {
    padding: 9px 16px;
    border: 1px solid #dde3ea;
    border-radius: 6px;
    background: #f5f7fa;
    color: #555;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.cr-tab:hover {
    border-color: #3498db;
    color: #3498db;
}

.cr-tab-active {
    background: #2c3e50;
    border-color: #2c3e50;
    color: #fff;
}
.cr-tab-active:hover {
    color: #fff;
}

.cr-tab-badge {
    font-size: 11px;
    background: #27ae60;
    color: #fff;
    border-radius: 9px;
    padding: 1px 7px;
}

/* 玩家页: 角色卡显隐。
   注意: cdkey.css 的 .cdkey-card 带 display:block !important,
   隐藏规则必须同级 !important 才能生效(显示时交由 block!important 自然展示) */
.cr-char-card:not(.cr-char-shown) { display: none !important; }

/* 玩家页: 兑换记录折叠开关 */
.cr-hist-toggle {
    background: transparent;
    border: 1px dashed #bdc3c7;
    color: #7f8c8d;
    padding: 4px 12px;
    font-size: 12px;
    margin-top: 6px;
    border-radius: 4px;
    cursor: pointer;
}
.cr-hist-toggle:hover {
    color: #3498db;
    border-color: #3498db;
}

/* GM页: 区块面板显隐。
   同上, 需 !important 压过 cdkey.css 的 display:block !important */
.cr-admin-panel:not(.cr-admin-shown) { display: none !important; }

/* GM页: 表格分页器 */
.cr-pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 10px 4px 0;
    font-size: 13px;
    color: #7f8c8d;
}

.cr-pager button {
    border: 1px solid #dde3ea;
    background: #f5f7fa;
    color: #555;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 12px;
}
.cr-pager button:hover:not(:disabled) {
    border-color: #3498db;
    color: #3498db;
}
.cr-pager button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.cr-pager .cr-pager-cur {
    border-color: #2c3e50;
    background: #2c3e50;
    color: #fff;
}
