* { box-sizing: border-box; }
html, body {
    height: 100%; margin: 0; padding: 0; overflow: hidden;
    background: #08060a; color: #ece3d4;
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    user-select: none; -webkit-user-select: none;
}
#ac-app { display: flex; flex-direction: column; width: 100vw; height: 100vh; height: 100dvh; }

/* ============ 头部 ============ */
#ac-header {
    flex: 0 0 auto;
    background: linear-gradient(180deg, #1a1210 0%, #0d0908 100%);
    border-bottom: 1px solid rgba(255, 200, 120, 0.18);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.65);
    position: relative; z-index: 20;
}
.ac-toolbar { display: flex; align-items: center; gap: 10px; padding: 6px 12px; min-height: 50px; }
.ac-icon-btn {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 9px;
    border: 1px solid rgba(255, 200, 120, 0.22);
    background: rgba(255, 200, 120, 0.05); color: #d8c8a8;
    font-size: 15px; cursor: pointer; transition: all 0.16s ease; text-decoration: none;
}
.ac-icon-btn:hover, .ac-icon-btn:focus {
    background: rgba(255, 200, 120, 0.16); color: #fff3d8;
    border-color: rgba(255, 200, 120, 0.5); outline: none; text-decoration: none;
}
.ac-icon-btn:active { transform: scale(0.94); }
.ac-brand { flex: 0 0 auto; display: flex; flex-direction: column; line-height: 1.05; margin-right: 4px; }
h1.ac-brand-cn {
    margin: 0; font-size: 17px; font-weight: 700; letter-spacing: 2px;
    color: #ffdca0; font-family: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", serif;
    text-shadow: 0 0 12px rgba(255, 180, 90, 0.35);
}
.ac-brand-en { font-size: 9px; letter-spacing: 2px; color: rgba(232, 220, 200, 0.45); margin-top: 2px; }
.ac-metrics { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 2px; min-width: 0; overflow: hidden; }
.ac-metric {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px;
    border-radius: 8px; background: rgba(255, 255, 255, 0.03);
    white-space: nowrap; font-size: 12px; color: #b8a890;
}
.ac-metric > i { font-size: 13px; color: #e0a14a; }
.ac-metric > b { font-size: 14px; color: #fff3d8; font-variant-numeric: tabular-nums; min-width: 20px; text-align: center; }
.ac-metric > span { color: rgba(232, 220, 200, 0.55); }
.ac-metric.metric-lives > b { color: #ff8f86; }
.ac-metric.metric-streak > b { color: #ffcf5a; }
.ac-metric.metric-acc > b { color: #8fe0a8; }
.ac-actions { flex: 0 0 auto; display: flex; gap: 6px; }
.ac-progress { height: 3px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.ac-progress > i {
    display: block; height: 100%; width: 0%;
    background: linear-gradient(90deg, #b3302a, #e0a14a, #ffd27a);
    box-shadow: 0 0 10px rgba(255, 190, 100, 0.7);
    transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ============ 主区 ============ */
#ac-main {
    flex: 1 1 auto; position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: #08060a; min-height: 0;
}
#ac-canvas { display: block; box-shadow: 0 0 60px rgba(0, 0, 0, 0.8) inset; border-radius: 3px; }

/* ============ 模态框 ============ */
.ac-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(4, 3, 2, 0.78);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    z-index: 1000; opacity: 0; visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease; padding: 16px;
}
.ac-modal.open { opacity: 1; visibility: visible; }
.ac-modal-card {
    width: 100%; max-width: 540px; max-height: 88vh; overflow-y: auto;
    background: linear-gradient(180deg, #201812 0%, #100b08 100%);
    border: 1px solid rgba(255, 190, 110, 0.3); border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(0, 0, 0, 0.55) inset;
    padding: 24px 26px; transform: scale(0.94);
    transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
    color: #ece3d4;
}
.ac-modal.open .ac-modal-card { transform: scale(1); }
.ac-modal-card h3 {
    margin: 0 0 14px; font-size: 22px;
    font-family: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", serif;
    color: #ffdca0; letter-spacing: 2px; text-align: center;
    text-shadow: 0 0 14px rgba(255, 180, 90, 0.28);
}
.ac-modal-card h3::after {
    content: ""; display: block; width: 44px; height: 2px;
    margin: 10px auto 0;
    background: linear-gradient(90deg, transparent, #b3302a, transparent);
}
.ac-modal-card .ac-note { font-size: 13px; line-height: 1.85; color: #cdbfa8; margin-bottom: 14px; }
.ac-modal-card .ac-note b { color: #ffd27a; }
.ac-modal-card .ac-note .k {
    display: inline-block; padding: 1px 7px; margin: 0 1px;
    border-radius: 5px; border: 1px solid rgba(255, 200, 120, 0.35);
    background: rgba(255, 200, 120, 0.08); color: #ffe6b8;
    font-size: 12px; font-family: Consolas, monospace;
}
.ac-modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.ac-btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 7px; padding: 10px 22px; border-radius: 9px;
    border: 1px solid transparent; font-size: 14px; font-weight: 600;
    cursor: pointer; text-decoration: none; transition: all 0.16s ease;
    white-space: nowrap;
}
.ac-btn:hover, .ac-btn:focus { outline: none; text-decoration: none; }
.ac-btn:active { transform: translateY(1px) scale(0.98); }
.ac-btn-gold {
    background: linear-gradient(180deg, #f0b45a, #c07a24);
    color: #2a1606; border-color: #ffd27a;
    box-shadow: 0 6px 18px rgba(200, 120, 30, 0.35);
}
.ac-btn-gold:hover { background: linear-gradient(180deg, #ffc26a, #d08a30); color: #2a1606; }
.ac-btn-ghost {
    background: rgba(255, 255, 255, 0.04); color: #d8c8a8;
    border-color: rgba(255, 200, 120, 0.25);
}
.ac-btn-ghost:hover { background: rgba(255, 200, 120, 0.12); color: #fff3d8; }
.ac-btn-quiet { background: transparent; color: rgba(216, 200, 168, 0.7); border-color: transparent; }
.ac-btn-quiet:hover { color: #fff3d8; background: rgba(255, 255, 255, 0.04); }
.ac-result-list {
    list-style: none; padding: 0; margin: 6px 0 2px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px;
}
.ac-result-list li {
    display: flex; align-items: center; justify-content: space-between;
    gap: 6px; padding: 8px 12px; border-radius: 8px;
    background: rgba(255, 255, 255, 0.035); font-size: 13px; color: #b8a890;
}
.ac-result-list li i { color: #e0a14a; margin-right: 5px; }
.ac-result-list li b { color: #fff3d8; font-size: 14px; }
.ac-result-list li.wide { grid-column: 1 / -1; }
.ac-setting { margin-bottom: 14px; }
.ac-setting > label {
    display: block; font-size: 12px; color: rgba(232, 220, 200, 0.6);
    margin-bottom: 6px; letter-spacing: 1px;
}
.ac-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.ac-seg > button {
    flex: 1 1 0; min-width: 90px; padding: 9px 10px;
    border-radius: 8px; border: 1px solid rgba(255, 200, 120, 0.22);
    background: rgba(255, 255, 255, 0.03); color: #c8b898;
    font-size: 13px; cursor: pointer; transition: all 0.16s ease;
}
.ac-seg > button:hover { border-color: rgba(255, 200, 120, 0.5); color: #fff3d8; }
.ac-seg > button.active {
    background: linear-gradient(180deg, rgba(240, 180, 90, 0.25), rgba(192, 122, 36, 0.2));
    border-color: #ffd27a; color: #ffe6b8;
    box-shadow: 0 0 14px rgba(255, 180, 90, 0.25) inset;
}
.ac-seg > button small {
    display: block; font-size: 10px; color: rgba(216, 200, 168, 0.55);
    margin-top: 2px; font-weight: 400;
}
.ac-switch-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 12px; border-radius: 8px;
    background: rgba(255, 255, 255, 0.035); margin-bottom: 8px;
}
.ac-switch-row span { font-size: 13px; color: #cdbfa8; }
.ac-switch-row span i { color: #e0a14a; margin-right: 6px; }
.ac-switch {
    position: relative; width: 46px; height: 24px;
    border-radius: 12px; background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 200, 120, 0.25);
    cursor: pointer; transition: all 0.18s ease; flex: 0 0 auto;
}
.ac-switch::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #c8b898; transition: all 0.18s ease;
}
.ac-switch.on { background: rgba(240, 180, 90, 0.45); border-color: #ffd27a; }
.ac-switch.on::after { left: 24px; background: #ffe6b8; box-shadow: 0 0 8px rgba(255, 200, 100, 0.8); }
@media (max-width: 900px) {
    .ac-metric > span { display: none; }
    .ac-metric { padding: 4px 7px; }
}
@media (max-width: 680px) {
    .ac-toolbar { padding: 5px 8px; min-height: 44px; gap: 6px; }
    .ac-brand-en { display: none; }
    h1.ac-brand-cn { font-size: 14px; letter-spacing: 1px; }
    .ac-icon-btn { width: 32px; height: 32px; font-size: 13px; }
    .ac-metric:nth-child(3), .ac-metric:nth-child(5), .ac-metric:nth-child(6) { display: none; }
    .ac-result-list { grid-template-columns: 1fr; }
}
@media (max-height: 420px) {
    .ac-modal-card { padding: 16px 18px; max-height: 94vh; }
    .ac-modal-card h3 { font-size: 18px; margin-bottom: 10px; }
    .ac-modal-card .ac-note { font-size: 12px; line-height: 1.7; margin-bottom: 10px; }
    .ac-modal-actions { margin-top: 12px; }
    .ac-btn { padding: 8px 16px; font-size: 13px; }
}
.ac-modal-card.result-win h3 { color: #ffe6a0; }
.ac-modal-card.result-lose h3 { color: #ffb0a0; }
.ac-modal-card.result-win { border-color: rgba(255, 220, 130, 0.5); }
.ac-modal-card.result-lose { border-color: rgba(200, 90, 80, 0.45); }