/* =========================================================
   24点游戏 - 专属样式
   主色调：扑克牌主题（红黑金）
   ========================================================= */

/* ---------- 容器布局 ---------- */
.dg-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 130px);
    min-height: 520px;
    background: var(--bg-secondary, #f4f6fa);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.10);
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* ---------- 工具栏 ---------- */
.dg-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #1a1a2e;
    border-bottom: 2px solid #c9a84c;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.toolbar-title {
    font-size: 15px;
    font-weight: 700;
    color: #c9a84c;
    background: linear-gradient(135deg, #c9a84c 0%, #f5e090 55%, #c9a84c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    white-space: nowrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-group--right {
    margin-left: auto;
}

.dg-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1px solid rgba(201,168,76,0.4);
    border-radius: 6px;
    background: rgba(255,255,255,0.07);
    color: #e0d9c4;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s;
    white-space: nowrap;
    user-select: none;
}

.dg-btn:hover {
    background: rgba(201,168,76,0.2);
    border-color: #c9a84c;
    color: #fff;
}

.dg-btn:active {
    transform: scale(0.96);
}

.dg-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.dg-btn-primary {
    background: linear-gradient(135deg, #c9a84c, #e8c96a);
    border-color: #c9a84c;
    color: #1a1a2e;
    font-weight: 700;
}

.dg-btn-primary:hover {
    background: linear-gradient(135deg, #e8c96a, #f5e090);
    color: #1a1a2e;
}

.dg-btn-danger {
    background: rgba(220, 53, 69, 0.15);
    border-color: rgba(220, 53, 69, 0.5);
    color: #ff6b7a;
}

.dg-btn-danger:hover {
    background: rgba(220, 53, 69, 0.30);
    border-color: #dc3545;
    color: #fff;
}

.dg-btn-skip {
    background: rgba(108,117,125,0.15);
    border-color: rgba(108,117,125,0.4);
    color: #aaa;
    font-size: 12px;
    padding: 4px 10px;
}

.dg-btn-skip:hover {
    background: rgba(108,117,125,0.3);
    color: #fff;
}

/* 得分和连对显示 */
.score-display, .streak-display {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: 20px;
    color: #e0d9c4;
    font-size: 13px;
}

.score-val, .streak-val {
    font-weight: 700;
    font-size: 15px;
    color: #c9a84c;
}

.streak-val {
    color: #ff6b7a;
}

.streak-icon {
    font-size: 14px;
}

/* 积分增加脉冲动效 */
@keyframes scorePulse {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.55); color: #ffe066; }
    100% { transform: scale(1); }
}

.score-val.score-pulse {
    display: inline-block;
    animation: scorePulse 0.55s ease-out;
}

/* ---------- 主内容三栏 ---------- */
.dg-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

/* ---------- 左栏：历史记录 ---------- */
.dg-history-panel {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #141424;
    border-right: 1px solid rgba(201,168,76,0.15);
    overflow: hidden;
}

.history-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px 8px;
    border-bottom: 1px solid rgba(201,168,76,0.15);
    flex-shrink: 0;
}

.history-panel-header h3 {
    margin: 0;
    font-size: 13px;
    color: #c9a84c;
    font-weight: 600;
}

.history-count {
    color: #aaa;
    font-size: 12px;
    margin-left: 4px;
}

.history-clear-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.history-clear-btn:hover {
    color: #ff6b7a;
    background: rgba(220, 53, 69, 0.12);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.history-empty {
    text-align: center;
    color: #555;
    font-size: 12px;
    padding: 20px 8px;
    line-height: 1.6;
}

.history-item {
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(201,168,76,0.12);
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.history-item:hover {
    background: rgba(201,168,76,0.1);
    border-color: rgba(201,168,76,0.35);
}

/* 历史记录条目选中状态（项目规范） */
.history-item.active {
    background: rgba(59,130,246,0.1);
    border-color: rgba(59,130,246,0.35);
    box-shadow: inset 3px 0 0 #3b82f6;
}

.history-item-nums {
    display: flex;
    gap: 5px;
    margin-bottom: 4px;
}

.history-card-badge {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

.history-card-badge.suit-red {
    background: rgba(220,53,69,0.2);
    color: #ff6b7a;
    border: 1px solid rgba(220,53,69,0.4);
}

.history-card-badge.suit-black {
    background: rgba(255,255,255,0.08);
    color: #ddd;
    border: 1px solid rgba(255,255,255,0.15);
}

.history-item-expr {
    font-size: 11px;
    color: #aaa;
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-result {
    font-size: 11px;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.history-item-result.correct {
    color: #52c41a;
}

.history-item-result.wrong {
    color: #ff6b7a;
}

.history-item-result.skipped {
    color: #888;
}

/* ---------- 中栏：游戏区 ---------- */
.dg-game-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 18px;
    background: #1a1a2e;
    overflow-y: auto;
    min-width: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 15px;
    color: #c9a84c;
    font-weight: 700;
}

.timer-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #aaa;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 3px 12px;
}

.timer-val {
    font-family: monospace;
    font-size: 15px;
    font-weight: 700;
    color: #c9a84c;
    letter-spacing: 1px;
    transition: color 0.4s ease;
}

/* 计时器警告状态 */
.timer-val.timer-warn   { color: #faad14; }
.timer-val.timer-danger { color: #ff6b7a; animation: timerPulse 1.1s ease-in-out infinite; }

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}

/* ---------- 牌面展示 ---------- */
.cards-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    flex-shrink: 0;
    padding: 16px 10px;
    border-radius: 16px;
    background: radial-gradient(ellipse at 50% 40%, rgba(201,168,76,0.08) 0%, transparent 65%);
}

.card-deck {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.playing-card {
    width: 72px;
    height: 100px;
    border-radius: 10px;
    background: #fff;
    border: 2px solid rgba(201,168,76,0.6);
    box-shadow: 0 4px 16px rgba(0,0,0,0.35), 0 0 0 1px rgba(201,168,76,0.2);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.playing-card:hover {
    transform: translateY(-6px) scale(1.05);
    box-shadow: 0 10px 28px rgba(0,0,0,0.4), 0 0 0 2px #c9a84c;
}

/* 按花色区分hover光晕 */
.playing-card.red-card:hover {
    box-shadow: 0 10px 28px rgba(0,0,0,0.4), 0 0 0 2px #c9a84c, 0 0 20px rgba(220,53,69,0.28);
}

.playing-card.black-card:hover {
    box-shadow: 0 10px 28px rgba(0,0,0,0.45), 0 0 0 2px #c9a84c, 0 0 20px rgba(120,140,220,0.22);
}

.playing-card.card-selected {
    transform: translateY(-6px) scale(1.05);
    box-shadow: 0 10px 28px rgba(201,168,76,0.5), 0 0 0 3px #c9a84c;
    border-color: #c9a84c;
}

.playing-card.card-used {
    opacity: 0.45;
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.card-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 1px;
}

.card-corner {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.card-corner--tl {
    top: 5px;
    left: 6px;
}

.card-corner--br {
    bottom: 5px;
    right: 6px;
    transform: rotate(180deg);
}

.card-center {
    font-size: 26px;
    font-weight: 900;
    line-height: 1;
}

.playing-card.red-card .card-corner,
.playing-card.red-card .card-center {
    color: #dc3545;
}

.playing-card.black-card .card-corner,
.playing-card.black-card .card-center {
    color: #1a1a1a;
}

.playing-card.card-flip-in {
    animation: cardFlipIn 0.4s ease forwards;
}

@keyframes cardFlipIn {
    0%   { transform: rotateY(90deg) scale(0.8); opacity: 0; }
    60%  { transform: rotateY(-8deg) scale(1.04); }
    100% { transform: rotateY(0deg) scale(1); opacity: 1; }
}

/* 快速数字按钮 */
.quick-nums {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.quick-num-btn {
    padding: 5px 14px;
    border-radius: 6px;
    border: 1px solid rgba(201,168,76,0.4);
    background: rgba(201,168,76,0.1);
    color: #c9a84c;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
    user-select: none;
}

.quick-num-btn:hover {
    background: rgba(201,168,76,0.25);
    transform: scale(1.08);
}

.quick-num-btn:active {
    transform: scale(0.95);
}

/* 快速数字按钮花色类 （JS改用class，不用inline style） */
.quick-num-btn.suit-red {
    color: #dc3545;
    border-color: rgba(220,53,69,0.45);
    background: rgba(220,53,69,0.09);
}

.quick-num-btn.suit-black {
    color: #e0d9c4;
    border-color: rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.07);
}

.quick-num-btn.used-num {
    opacity: 0.3;
    pointer-events: none;
}

/* ---------- 难度和运算符 ---------- */
.difficulty-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.difficulty-label {
    font-size: 13px;
    color: #aaa;
    white-space: nowrap;
}

.difficulty-options {
    display: flex;
    gap: 8px;
}

.diff-opt {
    cursor: pointer;
    user-select: none;
}

.diff-opt input[type="radio"] {
    display: none;
}

.diff-btn {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 12px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    color: #aaa;
    cursor: pointer;
    transition: all 0.15s;
}

.diff-opt input[type="radio"]:checked + .diff-btn.diff-easy {
    background: rgba(82,196,26,0.2);
    border-color: #52c41a;
    color: #52c41a;
}

.diff-opt input[type="radio"]:checked + .diff-btn.diff-normal {
    background: rgba(250,173,20,0.2);
    border-color: #faad14;
    color: #faad14;
}

.diff-opt input[type="radio"]:checked + .diff-btn.diff-hard {
    background: rgba(220,53,69,0.2);
    border-color: #dc3545;
    color: #ff6b7a;
}

.ops-btns {
    display: flex;
    gap: 6px;
    margin-left: auto;
    flex-wrap: wrap;
}

.op-btn {
    width: 36px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    color: #e0d9c4;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.14s, transform 0.12s;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.op-btn:hover {
    background: rgba(201,168,76,0.2);
    border-color: #c9a84c;
    color: #c9a84c;
    transform: scale(1.08);
}

.op-btn--clear {
    background: rgba(220,53,69,0.1);
    border-color: rgba(220,53,69,0.3);
    color: #ff6b7a;
}

.op-btn--clear:hover {
    background: rgba(220,53,69,0.25);
    color: #fff;
}

/* ---------- 算式输入 ---------- */
.expr-input-area {
    margin-bottom: 14px;
    flex-shrink: 0;
}

.expr-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.expr-label label {
    font-size: 13px;
    font-weight: 600;
    color: #c9a84c;
}

.expr-tip {
    font-size: 12px;
    color: #888;
}

.expr-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.dg-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 2px solid rgba(201,168,76,0.3);
    background: rgba(255,255,255,0.05);
    color: #f0e8d0;
    font-size: 16px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-weight: 600;
    letter-spacing: 0.5px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.dg-input:focus {
    border-color: #c9a84c;
    box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}

.dg-input::placeholder {
    color: #555;
    font-size: 13px;
    font-weight: 400;
}

.verify-msg {
    min-height: 26px;
    margin-top: 8px;
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.verify-msg.msg-correct {
    background: rgba(82,196,26,0.12);
    border: 1px solid rgba(82,196,26,0.3);
    color: #52c41a;
}

.verify-msg.msg-wrong {
    background: rgba(220,53,69,0.12);
    border: 1px solid rgba(220,53,69,0.3);
    color: #ff6b7a;
}

.verify-msg.msg-info {
    background: rgba(201,168,76,0.1);
    border: 1px solid rgba(201,168,76,0.3);
    color: #c9a84c;
}

/* 本局不计分提示角标 */
.no-score-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    color: #ff6b7a;
    background: rgba(220,53,69,0.15);
    border: 1px solid rgba(220,53,69,0.45);
    letter-spacing: 0.5px;
    animation: fadeInUp 0.25s ease;
}

/* ---------- 底部操作栏 ---------- */
.game-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(201,168,76,0.12);
    flex-shrink: 0;
}

.pass-count {
    font-size: 13px;
    color: #888;
}

.pass-count strong {
    color: #c9a84c;
}

/* ---------- 右栏：AI反馈 ---------- */
.dg-result-panel {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #0f0f1e;
    border-left: 1px solid rgba(201,168,76,0.15);
    overflow: hidden;
}

.dg-result-panel .panel-header {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(201,168,76,0.15);
    flex-shrink: 0;
    margin-bottom: 0;
}

.result-ts {
    font-size: 11px;
    color: #555;
}

.dg-result-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

/* 占位 */
.result-placeholder {
    text-align: center;
    padding: 30px 10px;
    color: #555;
}

.card-anim {
    margin-bottom: 12px;
}

.floating-card {
    font-size: 48px;
    display: inline-block;
    animation: floatCard 2.5s ease-in-out infinite;
    color: #c9a84c;
}

@keyframes floatCard {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50%       { transform: translateY(-10px) rotate(5deg); }
}

.placeholder-title {
    font-size: 15px;
    color: #888;
    font-weight: 600;
    margin: 0 0 8px;
}

.placeholder-desc {
    font-size: 12px;
    color: #555;
    margin: 4px 0;
    line-height: 1.6;
}

/* 加载动效 */
.result-loading {
    text-align: center;
    padding: 30px 10px;
}

.dg-loading-anim {
    display: flex;
    justify-content: center;
    gap: 7px;
    margin-bottom: 12px;
}

.dg-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #c9a84c;
    animation: dgDotBounce 1.2s infinite ease-in-out;
}

.dg-dot:nth-child(2) { animation-delay: 0.2s; }
.dg-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dgDotBounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40%           { transform: scale(1.2); opacity: 1; }
}

.loading-text {
    font-size: 13px;
    color: #aaa;
}

/* 结果内容 */
.dg-result-content {
    font-size: 13px;
    color: #ccc;
    line-height: 1.7;
    animation: fadeInUp 0.35s ease;
}

/* 结果区代码标签样式 */
.dg-result-content code {
    background: rgba(255,255,255,0.09);
    border: 1px solid rgba(201,168,76,0.3);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    color: #f0e8d0;
    letter-spacing: 0.3px;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.result-section {
    margin-bottom: 14px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    border-left: 3px solid #c9a84c;
}

.result-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #c9a84c;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-section p {
    margin: 4px 0;
    font-size: 13px;
    color: #ccc;
}

.hint-text {
    color: #faad14;
    font-size: 13px;
    line-height: 1.65;
}

.difficulty-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
}

.diff-badge-easy   { background: rgba(82,196,26,0.2); color: #52c41a; border: 1px solid rgba(82,196,26,0.4); }
.diff-badge-normal { background: rgba(250,173,20,0.2); color: #faad14; border: 1px solid rgba(250,173,20,0.4); }
.diff-badge-hard   { background: rgba(220,53,69,0.2);  color: #ff6b7a; border: 1px solid rgba(220,53,69,0.4); }

.tips-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tips-list li {
    font-size: 12px;
    color: #aaa;
    padding: 3px 0;
    padding-left: 14px;
    position: relative;
}

.tips-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #c9a84c;
}

/* 答对动效 */
.correct-flash {
    animation: correctFlash 0.6s ease;
}

@keyframes correctFlash {
    0%   { box-shadow: 0 0 0 0 rgba(82,196,26,0); }
    40%  { box-shadow: 0 0 0 12px rgba(82,196,26,0.3); }
    100% { box-shadow: 0 0 0 0 rgba(82,196,26,0); }
}

/* 错误晃动动效（JS引用） */
.shake-anim {
    animation: shakeInput 0.4s ease;
}

@keyframes shakeInput {
    0%, 100% { transform: translateX(0); }
    15%       { transform: translateX(-8px); }
    30%       { transform: translateX(7px); }
    45%       { transform: translateX(-6px); }
    60%       { transform: translateX(5px); }
    75%       { transform: translateX(-3px); }
    90%       { transform: translateX(2px); }
}

/* 错误提示内内联重试按鈕 */
.dg-inline-retry-btn {
    display: inline-block;
    padding: 1px 10px;
    border-radius: 4px;
    border: 1px solid rgba(220,53,69,0.5);
    background: rgba(220,53,69,0.15);
    color: #ff6b7a;
    font-size: 12px;
    cursor: pointer;
    margin-left: 6px;
    transition: background 0.15s;
    vertical-align: middle;
    line-height: 1.6;
}
.dg-inline-retry-btn:hover {
    background: rgba(220,53,69,0.3);
    color: #fff;
}

/* ---------- 弹窗 ---------- */
.dg-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    backdrop-filter: blur(3px);
}

.dg-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 201;
    background: #1a1a2e;
    border: 1px solid rgba(201,168,76,0.4);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    width: min(90vw, 560px);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dg-modal-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.dg-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(201,168,76,0.2);
    flex-shrink: 0;
    background: rgba(201,168,76,0.05);
}

.dg-modal-header h3 {
    margin: 0;
    font-size: 15px;
    color: #c9a84c;
    font-weight: 700;
}

.dg-modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.dg-modal-close:hover {
    color: #ff6b7a;
    background: rgba(220,53,69,0.12);
}

.dg-modal-body {
    overflow-y: auto;
    padding: 14px 18px;
    flex: 1;
}

/* 示例弹窗卡片 */
.example-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(201,168,76,0.2);
    background: rgba(255,255,255,0.03);
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.example-card:hover {
    background: rgba(201,168,76,0.1);
    border-color: rgba(201,168,76,0.4);
}

.example-card-nums {
    display: flex;
    gap: 6px;
}

.example-num-badge {
    width: 32px;
    height: 42px;
    border-radius: 6px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 900;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.example-num-badge.red  { color: #dc3545; }
.example-num-badge.black { color: #1a1a1a; }

.example-card-info {
    flex: 1;
    min-width: 0;
}

.example-card-label {
    font-size: 13px;
    color: #e0d9c4;
    font-weight: 600;
    margin-bottom: 3px;
}

.example-card-hint {
    font-size: 11px;
    color: #888;
}

/* 解答弹窗 */
.solve-loading {
    text-align: center;
    padding: 30px 10px;
}

.solve-loading p {
    font-size: 13px;
    color: #aaa;
    margin-top: 10px;
}

.solve-nums-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.solve-card-mini {
    width: 36px;
    height: 46px;
    border-radius: 6px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 900;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.solve-card-mini.red   { color: #dc3545; }
.solve-card-mini.black { color: #1a1a1a; }

.no-solution-tip {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 14px;
}

.solution-count-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 12px;
    background: rgba(82,196,26,0.15);
    color: #52c41a;
    border: 1px solid rgba(82,196,26,0.3);
    margin-bottom: 12px;
}

.solution-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.solution-item {
    padding: 8px 14px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(201,168,76,0.2);
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 15px;
    color: #f0e8d0;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.solution-item:hover {
    background: rgba(201,168,76,0.12);
    border-color: #c9a84c;
}

.solution-item .copy-hint {
    font-size: 11px;
    color: #666;
    font-family: sans-serif;
    font-weight: 400;
}

.solution-explanation {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(201,168,76,0.06);
    border-left: 3px solid #c9a84c;
    font-size: 13px;
    color: #ccc;
    line-height: 1.65;
}

/* ---------- 滚动条 ---------- */
.history-list::-webkit-scrollbar,
.dg-result-body::-webkit-scrollbar,
.dg-modal-body::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-track,
.dg-result-body::-webkit-scrollbar-track,
.dg-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb,
.dg-result-body::-webkit-scrollbar-thumb,
.dg-modal-body::-webkit-scrollbar-thumb {
    background: rgba(201,168,76,0.3);
    border-radius: 2px;
}

.history-list::-webkit-scrollbar-thumb:hover,
.dg-result-body::-webkit-scrollbar-thumb:hover,
.dg-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(201,168,76,0.6);
}

/* 游戏区滚动条 */
.dg-game-panel::-webkit-scrollbar { width: 4px; }
.dg-game-panel::-webkit-scrollbar-track { background: transparent; }
.dg-game-panel::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.3); border-radius: 2px; }
.dg-game-panel::-webkit-scrollbar-thumb:hover { background: rgba(201,168,76,0.6); }

/* =====================================================
   暗黑模式（body.dark 前缀）
   本工具本身就是暗色风格，dark 模式做微调
   ===================================================== */
body.dark .dg-container {
    background: #0d0d1a;
}

body.dark .dg-toolbar {
    background: #0d0d1a;
    border-bottom-color: rgba(201,168,76,0.5);
}

body.dark .dg-history-panel {
    background: #0a0a18;
    border-right-color: rgba(201,168,76,0.1);
}

body.dark .dg-game-panel {
    background: #111122;
}

body.dark .dg-result-panel {
    background: #0a0a18;
    border-left-color: rgba(201,168,76,0.1);
}

body.dark .dg-input {
    background: rgba(255,255,255,0.03);
    border-color: rgba(201,168,76,0.25);
    color: #f0e8d0;
}

body.dark .playing-card {
    border-color: rgba(201,168,76,0.8);
    box-shadow: 0 4px 20px rgba(0,0,0,0.6), 0 0 0 1px rgba(201,168,76,0.3);
}

body.dark .dg-modal {
    background: #0d0d1a;
    border-color: rgba(201,168,76,0.5);
}

body.dark .history-item {
    background: rgba(255,255,255,0.03);
    border-color: rgba(201,168,76,0.08);
}

/* 暗黑模式滚动条轨道显式覆盖（不可依赖亮色默认值） */
body.dark .history-list::-webkit-scrollbar-track,
body.dark .dg-result-body::-webkit-scrollbar-track,
body.dark .dg-modal-body::-webkit-scrollbar-track,
body.dark .dg-game-panel::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.25);
}

/* ---------- 亮色模式覆盖（默认模式） ---------- */
body:not(.dark) .dg-container {
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

body:not(.dark) .dg-history-panel {
    background: #f5f6fa;
    border-right-color: rgba(0,0,0,0.08);
}

body:not(.dark) .history-panel-header {
    border-bottom-color: rgba(0,0,0,0.08);
}

body:not(.dark) .history-panel-header h3 {
    color: #8a6914;
}

body:not(.dark) .history-count {
    color: #999;
}

body:not(.dark) .history-clear-btn {
    color: #888;
}

body:not(.dark) .history-empty {
    color: #bbb;
}

body:not(.dark) .history-item {
    background: #fff;
    border-color: rgba(0,0,0,0.09);
}

body:not(.dark) .history-item:hover {
    background: rgba(201,168,76,0.08);
    border-color: rgba(201,168,76,0.4);
}

body:not(.dark) .history-card-badge.suit-red {
    color: #c0392b;
}

body:not(.dark) .history-card-badge.suit-black {
    background: rgba(0,0,0,0.07);
    color: #333;
    border-color: rgba(0,0,0,0.2);
}

body:not(.dark) .history-item-expr {
    color: #666;
}

body:not(.dark) .dg-game-panel {
    background: #fff;
}

body:not(.dark) .panel-header h3 {
    color: #8a6914;
}

body:not(.dark) .timer-wrap {
    color: #666;
    border-color: rgba(0,0,0,0.1);
    background: rgba(0,0,0,0.04);
}

body:not(.dark) .timer-val {
    color: #8a6914;
}

/* 亮色模式下计时器警告色必须显式覆盖，防止被上方规则吸收 */
body:not(.dark) .timer-val.timer-warn   { color: #d48a00; }
body:not(.dark) .timer-val.timer-danger { color: #e0392a; }

body:not(.dark) .cards-area {
    background: radial-gradient(ellipse at 50% 40%, rgba(201,168,76,0.14) 0%, transparent 65%);
}

body:not(.dark) .quick-num-btn {
    color: #8a6914;
    border-color: rgba(201,168,76,0.5);
    background: rgba(201,168,76,0.1);
}

/* 定制花色优先级颜色与 hover 状态（高于上方通用近程） */
body:not(.dark) .quick-num-btn.suit-red {
    color: #c0392b;
    border-color: rgba(220,53,69,0.5);
    background: rgba(220,53,69,0.1);
}

body:not(.dark) .quick-num-btn:hover {
    background: rgba(201,168,76,0.28);
    transform: scale(1.08);
}

body:not(.dark) .quick-num-btn.suit-red:hover {
    background: rgba(220,53,69,0.22);
}

body:not(.dark) .quick-num-btn.suit-black {
    color: #333;
    border-color: rgba(0,0,0,0.18);
    background: rgba(0,0,0,0.06);
}

body:not(.dark) .difficulty-label {
    color: #666;
}

body:not(.dark) .diff-btn {
    border-color: rgba(0,0,0,0.12);
    background: rgba(0,0,0,0.04);
    color: #666;
}

body:not(.dark) .op-btn {
    border-color: rgba(0,0,0,0.12);
    background: rgba(0,0,0,0.04);
    color: #555;
}

body:not(.dark) .op-btn:hover {
    background: rgba(201,168,76,0.15);
    border-color: #c9a84c;
    color: #8a6914;
    transform: scale(1.08);
}

body:not(.dark) .op-btn--clear {
    background: rgba(220,53,69,0.07);
    border-color: rgba(220,53,69,0.25);
    color: #c0392b;
}

body:not(.dark) .op-btn--clear:hover {
    background: rgba(220,53,69,0.18);
    color: #c0392b;
}

body:not(.dark) .expr-label label {
    color: #8a6914;
}

body:not(.dark) .expr-tip {
    color: #999;
}

body:not(.dark) .dg-input {
    background: #fff;
    border-color: rgba(201,168,76,0.45);
    color: #333;
}

body:not(.dark) .dg-input:focus {
    border-color: #c9a84c;
    box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}

body:not(.dark) .dg-input::placeholder {
    color: #bbb;
}

body:not(.dark) .game-bottom-bar {
    border-top-color: rgba(0,0,0,0.08);
}

body:not(.dark) .pass-count {
    color: #666;
}

body:not(.dark) .pass-count strong {
    color: #8a6914;
}

body:not(.dark) .dg-result-panel {
    background: #f5f6fa;
    border-left-color: rgba(0,0,0,0.08);
}

body:not(.dark) .dg-result-panel .panel-header {
    border-bottom-color: rgba(0,0,0,0.08);
}

body:not(.dark) .result-ts {
    color: #999;
}

body:not(.dark) .result-placeholder {
    color: #aaa;
}

body:not(.dark) .placeholder-title {
    color: #888;
}

body:not(.dark) .placeholder-desc {
    color: #aaa;
}

body:not(.dark) .loading-text {
    color: #888;
}

body:not(.dark) .dg-result-content {
    color: #444;
}

body:not(.dark) .dg-result-content code {
    background: rgba(0,0,0,0.05);
    border-color: rgba(201,168,76,0.4);
    color: #333;
}

body:not(.dark) .result-section {
    background: rgba(0,0,0,0.025);
}

body:not(.dark) .result-section p {
    color: #555;
}

body:not(.dark) .hint-text {
    color: #a07820;
}

body:not(.dark) .tips-list li {
    color: #666;
}

body:not(.dark) .solve-loading p {
    color: #888;
}

body:not(.dark) .no-solution-tip {
    color: #666;
}

body:not(.dark) .solution-item {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.1);
    color: #333;
}

body:not(.dark) .solution-item:hover {
    background: rgba(201,168,76,0.1);
    border-color: #c9a84c;
}

body:not(.dark) .solution-item .copy-hint {
    color: #999;
}

body:not(.dark) .solution-explanation {
    background: rgba(201,168,76,0.05);
    color: #555;
}

body:not(.dark) .dg-modal {
    background: #fff;
    border-color: rgba(0,0,0,0.12);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

body:not(.dark) .dg-modal-header {
    border-bottom-color: rgba(0,0,0,0.08);
    background: rgba(201,168,76,0.04);
}

body:not(.dark) .dg-modal-header h3 {
    color: #8a6914;
}

body:not(.dark) .dg-modal-close {
    color: #999;
}

body:not(.dark) .example-card {
    background: rgba(0,0,0,0.02);
    border-color: rgba(0,0,0,0.09);
}

body:not(.dark) .example-card:hover {
    background: rgba(201,168,76,0.08);
    border-color: rgba(201,168,76,0.4);
}

body:not(.dark) .example-card-label {
    color: #333;
}

body:not(.dark) .example-card-hint {
    color: #999;
}

body:not(.dark) .history-list::-webkit-scrollbar-track,
body:not(.dark) .dg-result-body::-webkit-scrollbar-track,
body:not(.dark) .dg-modal-body::-webkit-scrollbar-track,
body:not(.dark) .dg-game-panel::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.04);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
    .dg-history-panel {
        width: 180px;
    }
    .dg-result-panel {
        width: 240px;
    }
}

@media (max-width: 639px) {
    .dg-main-content {
        flex-direction: column;
        overflow-y: auto;
    }

    .dg-history-panel {
        width: 100%;
        height: 160px;
        border-right: none;
        border-bottom: 1px solid rgba(201,168,76,0.15);
    }

    .dg-history-panel .history-list {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 6px;
        gap: 8px;
    }

    .history-item {
        min-width: 140px;
        flex-shrink: 0;
        margin-bottom: 0;
    }

    .dg-result-panel {
        width: 100%;
        height: 200px;
        border-left: none;
        border-top: 1px solid rgba(201,168,76,0.15);
    }

    .dg-container {
        height: auto;
    }

    .toolbar-group--right {
        margin-left: 0;
    }

    .ops-btns {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .dg-toolbar {
        padding: 6px 10px;
    }

    .card-deck {
        gap: 10px;
    }

    .playing-card {
        width: 60px;
        height: 84px;
    }

    .card-center {
        font-size: 22px;
    }
}

/* ---------- 网页全屏模式 ---------- */
body.dg-web-fullscreen {
    overflow: hidden;
}

body.dg-web-fullscreen .head-nav,
body.dg-web-fullscreen .breadcrumbs-panel,
body.dg-web-fullscreen .bar-panel,
body.dg-web-fullscreen .foot {
    display: none !important;
}

body.dg-web-fullscreen .dg-container {
    position: fixed;
    inset: 0;
    z-index: 100;
    border-radius: 0;
    height: 100vh !important;
    width: 100vw;
}
