* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-body: #f0f4fb;
    --bg-card: #ffffff;
    --bg-panel: #f9fbfe;
    --bg-input: #f5f8ff;
    --bg-chip: #eef4ff;
    --bg-chip-hover: #dbe8ff;
    --text-main: #1e2b3c;
    --text-sub: #5c6f8c;
    --text-muted: #7a8ba3;
    --text-label: #3a5a80;
    --border-light: #d9e2ef;
    --border-mid: #e2e8f2;
    --border-track: #dbe4f0;
    --shadow-soft: rgba(0, 0, 0, 0.02);
    --score-bg-1: #f0f7ff;
    --score-bg-2: #e8f0ff;
    --bar-bg: #eef2f8;
    --overlay-bg: rgba(20, 40, 70, 0.55);
}

body.dark {
    --bg-body: #131820;
    --bg-card: #1c2330;
    --bg-panel: #151b26;
    --bg-input: #1f2735;
    --bg-chip: #2a3341;
    --bg-chip-hover: #374256;
    --text-main: #e6ecf5;
    --text-sub: #a5b3c7;
    --text-muted: #7a8ba3;
    --text-label: #c3cedd;
    --border-light: #2a3341;
    --border-mid: #232b38;
    --border-track: #2a3341;
    --shadow-soft: rgba(0, 0, 0, 0.4);
    --score-bg-1: #1c2330;
    --score-bg-2: #212a3a;
    --bar-bg: #232b38;
    --overlay-bg: rgba(0, 0, 0, 0.7);
}

body {
    background: var(--bg-body);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    padding: 12px;
    overflow: hidden;
    transition: background 0.3s;
}

#fireworksCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5000;
    display: none;
}
#fireworksCanvas.active { display: block; }

.login-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1d7df0 0%, #22a06b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.4s, visibility 0.4s;
}
.login-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.hidden { display: none !important; }
.login-card {
    background: #ffffff;
    border-radius: 2rem;
    padding: 36px 32px;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 360px;
    text-align: center;
}
.guest-notice-text {
    font-size: 0.82rem;
    line-height: 1.7;
    color: #4a5a70;
    text-align: center;
    padding: 12px 8px 16px;
}
body.dark .guest-notice-text { color: var(--text-sub); }

.guest-notice-buttons {
    display: flex;
    gap: 8px;
}

.guest-notice-buttons .btn {
    flex: 1;
    padding: 10px 6px;
    font-size: 0.8rem;
}
.login-card .logo { font-size: 2rem; margin-bottom: 4px; }
.login-card h1 { font-size: 1.2rem; color: #1e2b3c; margin-bottom: 6px; font-weight: 700; }
.login-card .subtitle { font-size: 0.8rem; color: #7a8ba3; margin-bottom: 22px; }
.login-card .input-group { margin-bottom: 12px; text-align: left; }
.login-card .input-group label {
    display: block; font-size: 0.75rem; font-weight: 600;
    color: #3a5a80; margin-bottom: 4px; padding-left: 4px;
}
.login-card input {
    width: 100%; padding: 11px 16px;
    font-family: 'Inter', sans-serif; font-size: 0.9rem;
    color: #1e2b3c; background: #f5f8ff;
    border: 1.5px solid #d9e2ef; border-radius: 1rem;
    outline: none; transition: border 0.15s, box-shadow 0.15s;
}
.login-card input:focus {
    border-color: #1d7df0;
    box-shadow: 0 0 0 3px rgba(29, 125, 240, 0.15);
    background: #ffffff;
}
.login-card .login-btn {
    width: 100%; padding: 12px; margin-top: 8px;
    font-size: 0.95rem; font-weight: 700; color: #ffffff;
    background: #1d7df0; border: none; border-radius: 1rem;
    cursor: pointer; transition: background 0.15s, transform 0.1s;
    box-shadow: 0 6px 16px rgba(29, 125, 240, 0.35);
}
.login-card .login-btn:hover { background: #1668d0; }
.login-card .login-btn:active { transform: scale(0.98); }
.login-card .login-btn:disabled { background: #b8c9dc; cursor: not-allowed; }
.login-card .error-msg {
    color: #e53e3e; font-size: 0.75rem;
    min-height: 18px; margin-top: 6px;
}
.login-card .hint {
    font-size: 0.7rem; color: #a0aec0;
    margin-top: 14px; line-height: 1.5;
}

.app {
    display: flex; flex-direction: row; gap: 18px;
    background: var(--bg-card); border-radius: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.06);
    padding: 18px; width: 100%; max-width: 1400px;
    height: calc(100vh - 24px); max-height: 860px;
    align-items: stretch; overflow: hidden;
    transition: background 0.3s;
}

.canvas-section {
    flex: 1 1 60%; min-width: 0;
    display: flex; flex-direction: column;
    background: var(--bg-card); border-radius: 1.6rem;
    box-shadow: inset 0 2px 10px var(--shadow-soft), 0 4px 16px var(--shadow-soft);
    padding: 10px;
    transition: background 0.3s;
}
.canvas-wrapper {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
}
canvas#graphCanvas {
    display: block; width: 100%; height: 100%; max-height: 100%;
    border-radius: 1.2rem; background: var(--bg-card);
    box-shadow: 0 2px 12px var(--shadow-soft);
    object-fit: contain;
}

.controls-section {
    flex: 0 0 380px; display: flex; flex-direction: column;
    gap: 8px; background: var(--bg-panel); border-radius: 1.6rem;
    padding: 12px 12px;
    box-shadow: 0 4px 16px var(--shadow-soft), 0 0 0 1px var(--shadow-soft);
    overflow: hidden; height: 100%;
    transition: background 0.3s;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    padding: 0 2px;
    gap: 6px;
}

.logout-btn {
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: #ffffff;
    background: #e53e3e;
    border: none;
    border-radius: 2rem;
    padding: 5px 10px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}
.logout-btn:hover { background: #c53030; }
.logout-btn:active { transform: scale(0.95); }

.tutorial-btn {
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: #1d7df0;
    background: var(--bg-chip);
    border: none;
    border-radius: 2rem;
    padding: 5px 10px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}
.tutorial-btn:hover { background: var(--bg-chip-hover); }
.tutorial-btn:active { transform: scale(0.95); }

.user-badge {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.78rem; font-weight: 600; color: var(--text-label);
    padding: 4px 8px; border-radius: 2rem;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    cursor: default;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.user-badge .avatar {
    flex-shrink: 0;
    width: 22px; height: 22px; border-radius: 50%;
    background: linear-gradient(135deg, #1d7df0, #22a06b);
    color: #ffffff; font-size: 0.7rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.user-badge span {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.date-badge {
    flex-shrink: 0;
    font-size: 0.72rem; font-weight: 600; color: var(--text-muted);
    background: var(--bg-chip); padding: 4px 9px; border-radius: 2rem;
}

.formula-box {
    background: var(--bg-card); border-radius: 1.2rem;
    padding: 6px 8px; text-align: center; font-weight: 500;
    color: var(--text-main);
    box-shadow: 0 2px 10px var(--shadow-soft), 0 0 0 1px rgba(70, 130, 200, 0.1);
    line-height: 1.6; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(0.7rem, 2.2vw, 0.85rem);
    flex-shrink: 0;
    transition: background 0.3s;
}
.formula-box span {
    font-family: 'Inter', monospace; font-weight: 600;
    color: var(--text-main); background: var(--bg-chip);
    padding: 2px 5px; border-radius: 5px; margin: 0 1px;
}
.formula-box .coeff { color: #0066cc; }
body.dark .formula-box .coeff { color: #6ba8ff; }

.distance-display {
    background: var(--bg-card); border-radius: 1rem;
    padding: 6px 10px; text-align: center;
    font-size: 0.85rem; font-weight: 500; color: var(--text-main);
    box-shadow: 0 2px 10px var(--shadow-soft), 0 0 0 1px rgba(70, 130, 200, 0.1);
    flex-shrink: 0; display: flex;
    justify-content: space-between; align-items: center;
    transition: background 0.3s;
}
.distance-display .label { color: var(--text-sub); font-size: 0.75rem; }
.distance-display .value { font-weight: 700; font-size: 0.95rem; color: #1d7df0; }
.distance-display .best-value { font-weight: 700; font-size: 0.95rem; color: #22a06b; }

.score-box {
    background: linear-gradient(135deg, var(--score-bg-1) 0%, var(--score-bg-2) 100%);
    border-radius: 1rem; padding: 6px 10px; flex-shrink: 0;
    box-shadow: 0 2px 10px var(--shadow-soft), 0 0 0 1px rgba(70, 130, 200, 0.15);
    display: flex; justify-content: space-between; align-items: center;
    transition: background 0.3s;
}
.score-box .score-label { color: var(--text-label); font-size: 0.8rem; font-weight: 600; }
.score-box .score-value {
    font-family: 'Inter', sans-serif; font-weight: 800;
    font-size: 1.05rem; color: #1d7df0;
    letter-spacing: 0.5px;
}
.score-box .score-value.bottom { color: #e07a5f; }

.sliders-container {
    display: flex; flex-direction: column; gap: 6px;
    flex: 1; min-height: 0; overflow: hidden;
}

.slider-card {
    background: var(--bg-card); border-radius: 1.2rem;
    padding: 40px 20px 20px;
    box-shadow: 0 4px 12px var(--shadow-soft), 0 0 0 1px var(--shadow-soft);
    transition: box-shadow 0.2s, background 0.3s;
    display: flex; flex-direction: column;
    flex: 1 1 0; min-height: 0; justify-content: center;
}
.slider-card:hover {
    box-shadow: 0 8px 20px -6px rgba(0, 80, 200, 0.12), 0 0 0 1px rgba(0, 120, 255, 0.1);
}

.slider-header {
    display: flex; justify-content: space-between;
    align-items: center; width: 100%;
    margin-bottom: 2px; flex-shrink: 0;
}
.slider-label { font-weight: 600; color: var(--text-main); font-size: 0.75rem; }
.slider-value {
    background: var(--bg-chip); border-radius: 2rem;
    padding: 2px 10px; font-weight: 600; font-size: 0.75rem;
    color: var(--text-main);
    box-shadow: 0 1px 4px var(--shadow-soft), 0 0 0 1px var(--border-light);
}

.custom-slider {
    position: relative; width: 100%; height: 20px;
    margin: 2px 0 2px; flex-shrink: 0;
    cursor: pointer; touch-action: none; user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.custom-slider-track {
    position: absolute; top: 50%; left: 0; right: 0;
    height: 5px; transform: translateY(-50%);
    background: var(--border-track); border-radius: 10px; overflow: hidden;
}
.custom-slider-fill {
    position: absolute; top: 0; left: 0; height: 100%;
    width: 0%; background: #3a7bd5; border-radius: 10px;
}
.custom-slider-thumb {
    position: absolute; top: 50%; left: 0%;
    width: 18px; height: 18px; margin-left: -9px;
    transform: translateY(-50%); background: var(--bg-card);
    border-radius: 50%;
    box-shadow: 0 3px 6px rgba(0, 80, 200, 0.25), 0 0 0 2px #3a7bd5;
    border: 2px solid var(--bg-card);
    transition: transform 0.08s ease;
    will-change: left;
}
.custom-slider:hover .custom-slider-thumb { transform: translateY(-50%) scale(1.12); }
.custom-slider.active .custom-slider-thumb { transform: translateY(-50%) scale(1.15); }

.card-a .custom-slider-fill { background: #b13e3e; }
.card-a .custom-slider-thumb { box-shadow: 0 3px 6px rgba(177, 62, 62, 0.25), 0 0 0 2px #b13e3e; }
.card-b .custom-slider-fill { background: #2b6f9c; }
.card-b .custom-slider-thumb { box-shadow: 0 3px 6px rgba(43, 111, 156, 0.25), 0 0 0 2px #2b6f9c; }
.card-c .custom-slider-fill { background: #2b8c5e; }
.card-c .custom-slider-thumb { box-shadow: 0 3px 6px rgba(43, 140, 94, 0.25), 0 0 0 2px #2b8c5e; }
.card-d .custom-slider-fill { background: #8a6e2b; }
.card-d .custom-slider-thumb { box-shadow: 0 3px 6px rgba(138, 110, 43, 0.25), 0 0 0 2px #8a6e2b; }

.button-row {
    display: flex; gap: 8px; flex-shrink: 0; margin-top: 2px;
}
.btn {
    flex: 1; padding: 8px 6px;
    font-family: 'Inter', sans-serif; font-size: 0.8rem; font-weight: 600;
    border: none; border-radius: 2rem; cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-save {
    color: #ffffff; background: #22a06b;
    box-shadow: 0 4px 12px rgba(34, 160, 107, 0.3);
}
.btn-save:hover { background: #1a8a5a; }

.btn-submit {
    color: #ffffff; background: #1d7df0;
    box-shadow: 0 4px 12px rgba(29, 125, 240, 0.3);
}
.btn-submit:hover { background: #1668d0; }

.btn-leaderboard {
    color: #ffffff; background: #d4a017;
    box-shadow: 0 4px 12px rgba(212, 160, 23, 0.3);
}
.btn-leaderboard:hover { background: #b88a10; }

.axis-hint {
    text-align: center; color: var(--text-muted);
    font-size: 0.65rem; margin-top: 2px;
    letter-spacing: 0.2px; flex-shrink: 0; line-height: 1.4;
}

.overlay {
    position: fixed; inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 0; pointer-events: none;
    transition: opacity 0.25s;
}
.overlay.show { opacity: 1; pointer-events: auto; }

.modal-card {
    background: var(--bg-card); border-radius: 2rem;
    padding: 24px 26px;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.4);
    width: 100%; max-width: 400px; max-height: 85vh;
    display: flex; flex-direction: column;
    transform: scale(0.9); transition: transform 0.25s, background 0.3s;
}
.overlay.show .modal-card { transform: scale(1); }

.modal-card .modal-title {
    font-size: 1.05rem; font-weight: 700; color: var(--text-main);
    margin-bottom: 4px; text-align: center;
}
.modal-card .modal-subtitle {
    font-size: 0.75rem; color: var(--text-muted);
    text-align: center; margin-bottom: 16px;
}

.modal-card .your-result {
    background: linear-gradient(135deg, var(--score-bg-1) 0%, var(--score-bg-2) 100%);
    border-radius: 1rem; padding: 10px 14px; margin-bottom: 16px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 2px 10px var(--shadow-soft), 0 0 0 1px rgba(70, 130, 200, 0.15);
}
.modal-card .your-result .yr-label { font-size: 0.8rem; color: var(--text-label); font-weight: 600; }
.modal-card .your-result .yr-score {
    font-family: 'Inter', sans-serif; font-weight: 800;
    font-size: 1.3rem; color: #1d7df0;
    letter-spacing: 0.5px;
}
.modal-card .your-result .yr-score.bottom { color: #e07a5f; }

.chart-container {
    flex: 1; min-height: 0; overflow-y: auto;
    padding: 4px 4px 4px 0;
}
.bar-chart { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.bar-rank {
    flex-shrink: 0; width: 22px; text-align: center;
    font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
}
.bar-row.top1 .bar-rank { color: #d4a017; }
.bar-row.top2 .bar-rank { color: #a0aec0; }
.bar-row.top3 .bar-rank { color: #cd7f32; }

.bar-dist {
    flex-shrink: 0; width: 140px; font-size: 0.72rem;
    font-weight: 700; color: var(--text-main);
    font-family: 'Inter', monospace;
    text-align: left;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-row.is-me .bar-dist { color: #1d7df0; }

.bar-track {
    flex: 1; height: 18px; background: var(--bar-bg);
    border-radius: 10px; overflow: hidden; position: relative;
}
.bar-fill {
    height: 100%; border-radius: 10px;
    background: linear-gradient(90deg, #4a90e2, #1d7df0);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 4px;
}
.bar-row.is-me .bar-fill { background: linear-gradient(90deg, #22a06b, #1a8a5a); }
.bar-row.top1 .bar-fill { background: linear-gradient(90deg, #f0b429, #d4a017); }
.bar-row.top2 .bar-fill { background: linear-gradient(90deg, #b8c2cf, #a0aec0); }
.bar-row.top3 .bar-fill { background: linear-gradient(90deg, #e0a06c, #cd7f32); }

.empty-chart {
    text-align: center; color: var(--text-muted);
    font-size: 0.8rem; padding: 24px 0;
}

.modal-card .btn-close {
    margin-top: 16px; width: 100%; padding: 10px;
    font-size: 0.9rem; font-weight: 600; color: #ffffff;
    background: #1d7df0; border: none; border-radius: 2rem;
    cursor: pointer; transition: background 0.15s; flex-shrink: 0;
}
.modal-card .btn-close:hover { background: #1668d0; }

.tutorial-card {
    max-width: 440px;
}

.tutorial-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 4px 4px 0;
    margin-bottom: 4px;
}

.tutorial-section {
    margin-bottom: 16px;
}
.tutorial-section:last-child {
    margin-bottom: 4px;
}

.tutorial-heading {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    padding-left: 2px;
}

.tutorial-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tutorial-list li {
    font-size: 0.78rem;
    line-height: 1.65;
    color: var(--text-sub);
    padding: 3px 0 3px 16px;
    position: relative;
}

.tutorial-list li::before {
    content: '•';
    position: absolute;
    left: 2px;
    color: var(--text-muted);
    font-weight: 700;
}

.tutorial-list strong {
    color: var(--text-main);
    font-weight: 700;
}

.tutorial-list .tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Inter', monospace;
}
.tutorial-list .tag.top {
    background: var(--bg-chip);
    color: #1d7df0;
}
.tutorial-list .tag.bottom {
    background: #fdeceb;
    color: #e07a5f;
}
body.dark .tutorial-list .tag.bottom {
    background: #3a2626;
    color: #ff9580;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    flex-shrink: 0;
    margin: 2px 0 2px;
}

.slider-row .custom-slider {
    flex: 1;
    margin: 0;
}

.step-btn {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    color: #1d7df0;
    background: var(--bg-chip);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s, transform 0.08s, color 0.12s;
    padding: 0;
    padding-bottom: 2px;
}
.step-btn:hover {
    background: var(--bg-chip-hover);
    color: #1668d0;
}
.step-btn:active {
    transform: scale(0.88);
    background: var(--bg-chip-hover);
}

.card-a .step-btn { color: #b13e3e; background: #fdeeee; }
.card-a .step-btn:hover { background: #fbdcdc; }
.card-b .step-btn { color: #2b6f9c; background: #eef4fa; }
.card-b .step-btn:hover { background: #dbe8f3; }
.card-c .step-btn { color: #2b8c5e; background: #edf8f2; }
.card-c .step-btn:hover { background: #d7efe1; }
.card-d .step-btn { color: #8a6e2b; background: #faf4e6; }
.card-d .step-btn:hover { background: #f3e7c9; }

body.dark .card-a .step-btn { background: #3a2626; color: #ff9580; }
body.dark .card-a .step-btn:hover { background: #4a2f2f; }
body.dark .card-b .step-btn { background: #1f2d3a; color: #7fb5e0; }
body.dark .card-b .step-btn:hover { background: #2a3d4f; }
body.dark .card-c .step-btn { background: #1e3328; color: #7ad4a3; }
body.dark .card-c .step-btn:hover { background: #294536; }
body.dark .card-d .step-btn { background: #33291c; color: #d4b87a; }
body.dark .card-d .step-btn:hover { background: #443627; }

@media (max-width: 900px) {
    body { overflow: auto; align-items: flex-start; }
    .app {
        flex-direction: column; height: auto; max-height: none;
        padding: 14px; gap: 14px;
    }
    .controls-section { flex: 1 1 auto; width: 100%; overflow: visible; height: auto; }
    .canvas-section { flex: 1 1 auto; min-height: 300px; }
    .sliders-container {
        display: grid; grid-template-columns: repeat(2, 1fr);
        gap: 10px; overflow: visible;
    }
    .slider-card { flex: initial; min-height: auto; }
}

.login-btn-top {
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: #ffffff;
    background: #1d7df0;
    border: none;
    border-radius: 2rem;
    padding: 5px 10px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}
.login-btn-top:hover { background: #1668d0; }
.login-btn-top:active { transform: scale(0.95); }
.login-btn-top.hidden { display: none; }

.bottom-bar {
    position: fixed;
    bottom: 12px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 500;
}

.bottom-bar .about-btn {
    pointer-events: auto;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 2rem;
    padding: 5px 14px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, color 0.15s;
    white-space: nowrap;
    color: var(--text-muted);
    background: var(--bg-card);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 8px var(--shadow-soft);
}
.bottom-bar .about-btn:hover {
    color: var(--text-label);
    background: var(--bg-card);
    border-color: var(--text-muted);
}
.bottom-bar .about-btn:active {
    transform: scale(0.96);
}

.footer-btn {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 2rem;
    padding: 5px 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, color 0.15s;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}

.about-btn {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 2rem;
    padding: 5px 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, color 0.15s;
    white-space: nowrap;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border-light);
}
.about-btn:hover {
    color: var(--text-label);
    background: var(--bg-chip);
}
.about-btn:active {
    transform: scale(0.96);
}

.footer-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    padding: 0 2px;
    flex-shrink: 0;
}

.fortune-btn {
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-chip);
    border: none;
    border-radius: 2rem;
    padding: 5px 10px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, color 0.15s;
    white-space: nowrap;
}
.fortune-btn:hover {
    background: var(--bg-chip-hover);
    color: var(--text-label);
}
.fortune-btn:active {
    transform: scale(0.95);
}

.fortune-btn.drawn {
    background: linear-gradient(135deg, #f0b429, #d4a017);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(212, 160, 23, 0.35);
    cursor: default;
    pointer-events: none;
}

.fortune-card {
    max-width: 360px;
    text-align: center;
    padding: 32px 26px 22px;
}

.fortune-result {
    font-family: 'STKaiti', 'KaiTi', 'Inter', serif;
    font-size: 6rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.1em;
    margin: 12px 0 20px;
    background: linear-gradient(135deg, #f0b429, #d4a017);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    user-select: none;
}

.fortune-result.luck-great {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.fortune-result.luck-mid {
    background: linear-gradient(135deg, #f0b429, #d4a017);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.fortune-result.luck-small {
    background: linear-gradient(135deg, #4a90e2, #1d7df0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.fortune-result.luck-last {
    background: linear-gradient(135deg, #7a8ba3, #4a5a70);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.fortune-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 12px;
}
.fortune-date,
.fortune-ip {
    font-family: 'Inter', monospace;
}

#aboutOverlay .modal-card {
    max-height: 90vh;
    padding: 20px 22px;
}

#aboutOverlay .tutorial-body {
    overflow-y: visible;
    padding: 0;
    margin-bottom: 0;
}

#aboutOverlay .tutorial-section {
    margin-bottom: 12px;
}

#aboutOverlay .tutorial-section:last-child {
    margin-bottom: 0;
}

#aboutOverlay .tutorial-heading {
    font-size: 0.8rem;
    margin-bottom: 4px;
}

#aboutOverlay .tutorial-list li {
    font-size: 0.74rem;
    line-height: 1.55;
    padding: 2px 0 2px 14px;
}

#aboutOverlay .btn-close {
    margin-top: 12px;
}

/* ========== 主题切换按钮 ========== */
.theme-btn {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 600;
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow-soft);
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.theme-btn:hover {
    background: var(--bg-chip);
    transform: scale(1.08);
}
.theme-btn:active {
    transform: scale(0.94);
}
@media (max-width: 500px) {
    .sliders-container { grid-template-columns: 1fr; }
    .formula-box { font-size: 0.72rem; }
}