/* ============================================================
   数字华容道挑战台 · 专属样式
   tool_key: huarongdao
   ============================================================ */

/* ---------- 三栏布局 ---------- */
.hrd-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 220px;
    gap: 16px;
    align-items: start;
    margin-bottom: 18px;
}

.hrd-panel {
    background: #f8fbff;
    border: 2px solid #e3eef8;
    border-radius: 18px;
    padding: 16px 14px;
}

.hrd-panel-title {
    font-size: .95rem;
    font-weight: 800;
    color: #0d2b3e;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---------- 难度选择 ---------- */
.hrd-select {
    width: 100%;
    padding: 10px 12px;
    font-size: .95rem;
    font-weight: 700;
    color: #0d2b3e;
    border: 2px solid #cfe2f5;
    border-radius: 12px;
    background: #fff;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%2352627a' d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}
.hrd-select:focus { border-color: #64b5f6; }

.hrd-level-desc {
    margin-top: 8px;
    font-size: .8rem;
    color: #7a8ba0;
    line-height: 1.6;
    min-height: 2.4em;
}

.hrd-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 11px 0;
    font-size: .95rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #5c6bc0, #42a5f5);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: .18s;
}
.hrd-btn:hover { filter: brightness(1.06); }
.hrd-btn:active { transform: scale(.98); }
.hrd-btn.hrd-btn-ghost {
    background: #fff;
    color: #52627a;
    border: 2px solid #dbe7f3;
}
.hrd-btn.hrd-btn-ghost:hover { background: #f2f7fd; }
.hrd-btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 结束挑战按钮 ---------- */
.hrd-btn.hrd-btn-end {
    margin-top: 8px;
    color: #c62828;
    border-color: #ffcdd2;
    background: #fff6f6;
}
.hrd-btn.hrd-btn-end:hover {
    background: #ffecec;
    border-color: #ef9a9a;
    color: #b71c1c;
}
.hrd-btn.hrd-btn-end i { color: #e53935; }
.hrd-btn.hrd-btn-end[disabled] {
    color: #b0bec5;
    border-color: #e3eef8;
    background: #f7fbfe;
}
.hrd-btn.hrd-btn-end[disabled] i { color: #b0bec5; }

.hrd-key-tip {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #dbe7f3;
    font-size: .78rem;
    color: #90a2b8;
    line-height: 1.7;
}
.hrd-keys {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.hrd-key {
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    color: #52627a;
    background: #fff;
    border: 1px solid #dbe7f3;
    border-radius: 6px;
    box-shadow: 0 1px 0 #e8f1fa;
}

/* ---------- 棋盘区 ---------- */
.hrd-board-wrap {
    background: #fff;
    border: 2px solid #e3eef8;
    border-radius: 20px;
    padding: 14px;
    box-shadow: 0 6px 20px rgba(64, 120, 180, .08);
}

.hrd-board {
    display: grid;
    gap: 8px;
    width: 100%;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.hrd-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(150deg, #6fa8dc 0%, #5b9bd5 45%, #4f9ad9 100%);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12), 0 2px 6px rgba(60, 110, 160, .25);
    transition: transform .12s ease, box-shadow .12s ease;
    will-change: transform;
}
.hrd-tile:hover { filter: brightness(1.05); }
.hrd-tile:active { transform: scale(.96); }

/* 就位方块（在正确位置） */
.hrd-tile.correct {
    background: linear-gradient(150deg, #66bb6a 0%, #4caf50 100%);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .14), 0 2px 6px rgba(70, 150, 80, .25);
}

/* 空格 */
.hrd-tile.blank {
    background: #eef4fa;
    box-shadow: inset 0 0 0 2px #e0ebf5;
    cursor: default;
    pointer-events: none;
}

/* 移动动画用类 */
.hrd-tile.slide { z-index: 3; }

.hrd-tile-num {
    font-size: 1.5rem;
    line-height: 1;
    text-shadow: 0 1px 3px rgba(30, 70, 110, .35);
}

/* ---------- 进度条 ---------- */
.hrd-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    font-size: .8rem;
    color: #7a8ba0;
}
.hrd-progress-bar {
    flex: 1;
    height: 8px;
    background: #e8f1fa;
    border-radius: 6px;
    overflow: hidden;
}
.hrd-progress-fill {
    height: 100%;
    width: 0;
    border-radius: 6px;
    background: linear-gradient(90deg, #5c6bc0, #42a5f5);
    transition: width .2s;
}

/* ---------- 右栏统计 ---------- */
.hrd-stat {
    text-align: center;
    padding: 8px 0 10px;
}
.hrd-stat + .hrd-stat { border-top: 1px dashed #e3eef8; }
.hrd-stat-label {
    font-size: .76rem;
    color: #90a2b8;
    margin-bottom: 4px;
}
.hrd-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0d2b3e;
    letter-spacing: .5px;
    font-variant-numeric: tabular-nums;
}
.hrd-stat-value.time { color: #1e88e5; }
.hrd-stat-value.score { color: #f57c00; }

.hrd-best-box {
    margin-top: 12px;
    padding: 10px 12px;
    background: #eef4fa;
    border-radius: 12px;
    font-size: .8rem;
    color: #52627a;
    line-height: 1.7;
}
.hrd-best-box b { color: #0d2b3e; }

/* ---------- 状态徽标 ---------- */
.hrd-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 700;
    background: #eef4fa;
    color: #7a8ba0;
}
.hrd-state.playing { background: #e3f2fd; color: #1565c0; }
.hrd-state.done    { background: #e8f5e9; color: #2e7d32; }
.hrd-state-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: currentColor;
}

/* ---------- 结果提示 ---------- */
.hrd-msg {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: .9rem;
    font-weight: 700;
    text-align: center;
    display: none;
}
.hrd-msg.show { display: block; }
.hrd-msg.ok  { background: #e8f5e9; color: #2e7d32; }
.hrd-msg.warn{ background: #fff8e1; color: #b26a00; }

/* ---------- 得分标准表 ---------- */
.hrd-rules-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: .86rem;
}
.hrd-rules-table th,
.hrd-rules-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e8f1fa;
    text-align: center;
}
.hrd-rules-table th {
    background: #f2f8ff;
    color: #52627a;
    font-weight: 800;
    white-space: nowrap;
}
.hrd-rules-table td:first-child { font-weight: 700; color: #0d2b3e; }
.hrd-rules-table tr:last-child td { border-bottom: none; }

/* ---------- 得分榜 ---------- */
.hrd-rank-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.hrd-rank-tab {
    padding: 6px 12px;
    border-radius: 20px;
    background: #f2f8ff;
    border: 2px solid #e3eef8;
    color: #52627a;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    transition: .15s;
}
.hrd-rank-tab:hover { background: #e8f2fc; }
.hrd-rank-tab.active {
    background: linear-gradient(135deg, #5c6bc0, #42a5f5);
    border-color: transparent;
    color: #fff;
}

.hrd-rank-list { min-height: 60px; }
.hrd-rank-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 12px;
    font-size: .86rem;
    color: #3f4f63;
}
.hrd-rank-row + .hrd-rank-row { border-top: 1px solid #f0f6fc; }
.hrd-rank-row.me { background: #fff8e1; }
.hrd-rank-no {
    width: 26px;
    text-align: center;
    font-weight: 800;
    color: #90a2b8;
    flex: 0 0 auto;
}
.hrd-rank-row:nth-child(1) .hrd-rank-no { color: #f9a825; }
.hrd-rank-row:nth-child(2) .hrd-rank-no { color: #90a4ae; }
.hrd-rank-row:nth-child(3) .hrd-rank-no { color: #bf8970; }
.hrd-rank-name {
    flex: 1;
    font-weight: 700;
    color: #0d2b3e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hrd-rank-me-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: .7rem;
    border-radius: 8px;
    background: #ffcc80;
    color: #8a4b00;
}
.hrd-rank-meta {
    font-size: .76rem;
    color: #90a2b8;
    flex: 0 0 auto;
}
.hrd-rank-score {
    font-weight: 800;
    color: #f57c00;
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}
.hrd-rank-empty {
    padding: 28px 10px;
    text-align: center;
    color: #a0b0c0;
    font-size: .88rem;
}
.hrd-rank-empty::before {
    content: '🏆';
    display: block;
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: .6;
}
.hrd-rank-foot {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e3eef8;
    font-size: .82rem;
    color: #52627a;
    line-height: 1.7;
}
.hrd-rank-foot a { color: #e67e22; text-decoration: underline; }

/* ---------- 使用说明 ---------- */
.hrd-howto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-top: 10px;
}
.hrd-howto-item {
    background: #f8fbff;
    border: 2px solid #e3eef8;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: .84rem;
    color: #52627a;
    line-height: 1.7;
}
.hrd-howto-item b { display: block; color: #0d2b3e; margin-bottom: 4px; font-size: .9rem; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .hrd-layout {
        grid-template-columns: 1fr;
    }
    .hrd-board-wrap { order: -1; }
}
@media (max-width: 480px) {
    .hrd-tile-num { font-size: 1.15rem; }
    .hrd-board { gap: 5px; }
    .hrd-board-wrap { padding: 10px; }
    .hrd-stat-value { font-size: 1.25rem; }
    .hrd-rules-table { font-size: .78rem; }
    .hrd-rules-table th, .hrd-rules-table td { padding: 6px 5px; }
}