/* 工具助手前台样式（独立文件，不影响原有模板） */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.tool-body {
    background: #f8f8f8;
    color: #222;
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-tap-highlight-color: transparent;
}
#toolApp { max-width: 560px; margin: 0 auto; min-height: 100vh; background: #f8f8f8; }

/* 顶部栏 */
.tool-header {
    position: sticky; top: 0; z-index: 20;
    height: calc(52px + env(safe-area-inset-top, 0px)); display: flex; align-items: center;
    padding: 0 12px; padding-top: env(safe-area-inset-top, 0);
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid rgba(0, 0, 0, .05);
    backdrop-filter: blur(8px);
}
.tool-header h1 { flex: 1; margin: 0; font-size: 17px; font-weight: 600; text-align: center; letter-spacing: .5px; }
.tool-head-space, .tool-back { width: 40px; height: 40px; flex: 0 0 40px; }
.tool-back {
    border: 0; background: transparent; padding: 0; position: relative; cursor: pointer; border-radius: 50%;
}
.tool-back::before {
    content: ""; position: absolute; left: 12px; top: 50%; width: 10px; height: 10px;
    border-left: 2px solid #333; border-bottom: 2px solid #333;
    transform: translateY(-50%) rotate(45deg); border-radius: 1px;
}
.tool-back:active { background: rgba(0, 0, 0, .06); }

.tool-main { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }

/* 工具面板 */
.panel-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 10px; padding: 16px 14px 8px;
}
.tool-card {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    background: #fff; border-radius: 16px; padding: 10px 6px 12px;
    text-decoration: none; color: #333;
    box-shadow: 0 4px 14px rgba(31, 42, 84, .06);
    border: 1px solid rgba(46, 69, 144, .05);
    transition: transform .12s ease;
}
.tool-card:active { transform: scale(.96); }
.tool-card img { width: 78%; max-width: 96px; aspect-ratio: 1 / 1; object-fit: contain; display: block; }
.tool-card span { margin-top: 8px; font-size: 13px; line-height: 18px; font-weight: 500; white-space: nowrap; }

/* 年份筛选 */
.year-bar {
    display: flex; align-items: center; gap: 10px;
    background: #fff; padding: 12px 14px; margin: 10px 10px 0; border-radius: 14px;
    box-shadow: 0 2px 10px rgba(31, 42, 84, .04);
}
.year-bar .year-label { font-size: 13px; color: #8a8f9c; flex: 0 0 auto; }
.year-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.year-chips::-webkit-scrollbar { display: none; }
.year-chip {
    flex: 0 0 auto; border: 1px solid #d9dde8; background: #fff; color: #4a5060;
    height: 30px; padding: 0 12px; border-radius: 15px; font-size: 13px; cursor: pointer;
}
.year-chip.active {
    color: #7a5212; border-color: #e2c089;
    background: linear-gradient(135deg, #fdf4e0, #f6e3bd);
    font-weight: 600;
}

/* 号码分组 */
.assistant-groups { padding: 10px; }
.num-group {
    background: #fff; border-radius: 14px; padding: 12px 14px 8px; margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(31, 42, 84, .04);
}
.num-group h3 {
    display: flex; align-items: center; gap: 8px;
    margin: 0 0 8px; font-size: 15px; font-weight: 600; color: #2c3244;
}
.num-group h3::before {
    content: ""; width: 3px; height: 14px; border-radius: 2px;
    background: linear-gradient(180deg, #e7c98a, #c8a063);
}
.balls { display: flex; flex-wrap: wrap; gap: 7px; padding-bottom: 4px; }
.ball {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; flex: 0 0 34px;
    background-repeat: no-repeat; background-position: center; background-size: 100% 100%;
    color: #243b6b; font-size: 14px; font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.ball.b1 { background-image: url("./ball_1.png"); }
.ball.b2 { background-image: url("./ball_2.png"); }
.ball.b3 { background-image: url("./ball_3.png"); }
.ball.b4 { background-image: url("./ball_4.png"); color: #6b4510; }
.ball.sm { width: 30px; height: 30px; flex-basis: 30px; font-size: 13px; }
.ball.empty { color: #c2c6d0; background: #f1f2f6; text-shadow: none; font-weight: 500; }

/* 挑码助手 */
.pick-wrap { display: flex; flex-direction: column; height: calc(100vh - 52px - env(safe-area-inset-top, 0px)); }
.pick-top { flex: 0 0 auto; padding: 10px 10px 0; }
.pick-result-card {
    background: #fff; border-radius: 14px; padding: 12px 14px;
    box-shadow: 0 2px 10px rgba(31, 42, 84, .04);
}
.pick-result-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px; font-size: 13px; color: #8a8f9c;
}
.pick-result-head b { color: #2c3244; font-size: 15px; }
.pick-result { display: flex; flex-wrap: wrap; gap: 6px; max-height: 132px; overflow-y: auto; }
.pick-kill {
    margin-top: 8px; padding-top: 8px; border-top: 1px dashed #e7e9ef;
    font-size: 12px; color: #8a8f9c; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.pick-kill .kball {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px;
    background: #f3f4f8; color: #6b7183; font-size: 12px;
}
.pick-actions { display: flex; gap: 8px; padding: 10px 0; overflow-x: auto; scrollbar-width: none; }
.pick-actions::-webkit-scrollbar { display: none; }
.pick-btn {
    flex: 1 0 auto; height: 38px; padding: 0 14px; border-radius: 19px; border: 0;
    background: #fff; color: #3b4255; font-size: 13px; font-weight: 500; cursor: pointer;
    box-shadow: 0 2px 8px rgba(31, 42, 84, .06);
}
.pick-btn.primary {
    color: #6b4510; background: linear-gradient(135deg, #fbeccd, #edcf95);
    font-weight: 600;
}
.pick-btn:active { transform: scale(.97); }
.pick-conds { flex: 1; overflow-y: auto; padding: 0 10px 20px; -webkit-overflow-scrolling: touch; }
.pick-line { background: #fff; border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; }
.pick-line.two { display: flex; gap: 10px; }
.pick-line.two > div { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; }
.pick-line.all { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    min-width: 52px; height: 34px; padding: 0 10px; border-radius: 8px;
    border: 1px solid #dfe3ec; background: #fff; color: #3b4255; font-size: 13px;
    cursor: pointer; flex: 0 0 auto;
}
.chip.active {
    border-color: #2e4590; background: #2e4590; color: #fff; font-weight: 600;
}
.chip.zodiac { min-width: 46px; }

/* 底部弹层 */
.tool-sheet { position: fixed; inset: 0; z-index: 60; }
.tool-sheet-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.tool-sheet-body {
    position: absolute; left: 0; right: 0; bottom: 0;
    max-width: 560px; margin: 0 auto; background: #fff;
    border-radius: 18px 18px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    max-height: 78vh; overflow-y: auto;
    animation: sheetUp .2s ease;
}
@keyframes sheetUp { from { transform: translateY(30px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
.tool-sheet-body h3 { margin: 0 0 4px; font-size: 16px; }
.tool-sheet-body .sheet-tip { margin: 0 0 12px; font-size: 12px; color: #8a8f9c; }
.sheet-actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet-actions button { flex: 1; height: 42px; border-radius: 21px; border: 0; font-size: 14px; cursor: pointer; }
.sheet-actions .ghost { background: #f2f3f7; color: #5b6172; }
.sheet-actions .gold { background: linear-gradient(135deg, #fbeccd, #edcf95); color: #6b4510; font-weight: 600; }

/* 每日运势 */
.fortune-list { padding: 12px 10px; }
.fortune-date {
    text-align: center; font-size: 13px; color: #8a8f9c; padding: 4px 0 10px;
}
.fortune-card {
    background: #fff; border-radius: 16px; padding: 14px 16px; margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(31, 42, 84, .04);
}
.fortune-head { display: flex; align-items: center; gap: 12px; }
.fortune-zodiac {
    width: 46px; height: 46px; border-radius: 50%; flex: 0 0 46px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700; color: #6b4510;
    background: radial-gradient(circle at 30% 25%, #fff5dd, #f0d49b);
    border: 1px solid rgba(200, 160, 99, .5);
}
.fortune-score { flex: 1; }
.fortune-score b { font-size: 16px; }
.fortune-score .bar { height: 6px; border-radius: 3px; background: #f0f1f5; margin-top: 6px; overflow: hidden; }
.fortune-score .bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #e7c98a, #c8a063); }
.fortune-rows { margin-top: 10px; display: grid; gap: 6px; font-size: 13px; color: #4a5060; line-height: 20px; }
.fortune-rows span { color: #a8863f; font-weight: 600; margin-right: 4px; }
.fortune-meta { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: #6b7183; }
.fortune-meta i {
    font-style: normal; padding: 4px 10px; border-radius: 10px; background: #f7f8fb;
}

/* 查询助手 */
.panel-card {
    background: #fff; border-radius: 14px; padding: 14px 16px; margin: 10px;
    box-shadow: 0 2px 10px rgba(31, 42, 84, .04);
}
.panel-card h3 { margin: 0 0 10px; font-size: 15px; }
.form-row { display: flex; gap: 8px; }
.form-row input, .form-row select {
    flex: 1; min-width: 0; height: 40px; border-radius: 10px; border: 1px solid #e2e5ee;
    padding: 0 12px; font-size: 14px; background: #fafbfd; color: #2c3244; outline: none;
}
.form-row input:focus, .form-row select:focus { border-color: #c8a063; background: #fff; }
.form-row button {
    flex: 0 0 auto; height: 40px; padding: 0 18px; border-radius: 10px; border: 0;
    background: #2e4590; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}
.query-match { margin-top: 12px; font-size: 13px; color: #4a5060; line-height: 22px; }
.query-match .val { color: #a8863f; font-weight: 700; }
.draw-row { padding: 10px 0; border-top: 1px solid #f0f1f5; }
.draw-row:first-child { border-top: 0; }
.draw-row .issue { font-size: 13px; color: #6b7183; display: flex; justify-content: space-between; margin-bottom: 6px; }

/* 复试计算 */
.calc-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 8px; }
.calc-num {
    height: 34px; border-radius: 8px; border: 1px solid #e2e5ee; background: #fff;
    font-size: 13px; color: #3b4255; cursor: pointer; padding: 0;
}
.calc-num.active { background: #2e4590; border-color: #2e4590; color: #fff; font-weight: 600; }
.calc-seg { display: flex; gap: 8px; flex-wrap: wrap; }
.calc-seg button {
    height: 32px; padding: 0 14px; border-radius: 16px; border: 1px solid #dfe3ec;
    background: #fff; color: #4a5060; font-size: 13px; cursor: pointer;
}
.calc-seg button.active { border-color: #c8a063; background: #fdf6e6; color: #7a5212; font-weight: 600; }
.calc-result {
    margin-top: 12px; padding: 14px; border-radius: 12px;
    background: linear-gradient(135deg, #fdf7ea, #f7ebd2);
    display: flex; align-items: baseline; gap: 8px;
}
.calc-result b { font-size: 26px; color: #8a5c16; }
.calc-result span { font-size: 13px; color: #8a7343; }

/* 提示 */
.tool-toast {
    position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(10px);
    background: rgba(30, 34, 46, .9); color: #fff; font-size: 13px;
    padding: 9px 16px; border-radius: 18px; opacity: 0; pointer-events: none;
    transition: opacity .2s ease, transform .2s ease; z-index: 99; max-width: 80vw; text-align: center;
}
.tool-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty-tip { text-align: center; color: #9aa0af; font-size: 13px; padding: 30px 0; }

@media (min-width: 561px) {
    #toolApp { box-shadow: 0 0 30px rgba(0, 0, 0, .06); }
}
