html, body {
    height: 100%;
    min-height: 100vh;
    box-sizing: border-box;
}
body {
    background: #f7f7f7;
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}
.container {
    max-width: 900px;
    margin: 8px auto 0 auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    padding: 16px 12px 18px 12px;
    width: 98vw;
    min-width: 320px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}
h1, h2, .control-tip, .countdown, .prompt-box, .fail-info, .game-description {
    text-align: center;
    width: 100%;
}
h1 {
    color: #333;
    margin-bottom: 18px;
    margin-top: 0;
    font-size: 2.1rem;
}
.prompt-box {
    height: 48px;
    background: #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #007bff;
    margin-bottom: 24px;
    letter-spacing: 8px;
}
.keyboard {
    background: #eaeaea;
    border-radius: 18px;
    padding: 16px 6px 16px 6px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
}
.keyboard-row {
    display: flex;
    gap: 8px;
    width: 100%;
    justify-content: center;
}
.key {
    min-width: 38px;
    max-width: 120px;
    height: 38px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.08rem;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border 0.2s, box-shadow 0.2s;
    user-select: none;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    margin-bottom: 2px;
    flex: 1;
    text-align: center;
}
.key.active {
    background: #007bff;
    color: #fff;
    border: 2px solid #007bff;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,123,255,0.15);
    z-index: 1;
}
.key.inactive {
    color: #fff;
}
.key.show-label {
    color: #222;
}
.key.func-key {
    background: #f3f3f3;
    color: #888;
    border: 2px solid #e0e0e0;
    font-size: 0.98rem;
    cursor: default;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.key.func-key:active {
    background: #e0e0e0;
}
.key[style*="flex"] {
    min-width: 38px;
    max-width: 160px;
}
.fail-info {
    color: #dc3545;
    font-size: 1.1rem;
    min-height: 24px;
    margin-top: 8px;
}
.control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
    margin: 24px 0 0 0;
    width: 100%;
    max-width: 700px;
    box-sizing: border-box;
}
.control-bar button {
    flex: 1 1 0;
    background: #fff;
    border: 2px solid #007bff;
    color: #007bff;
    border-radius: 16px;
    padding: 10px 0;
    font-size: 1.18rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,123,255,0.06);
    outline: none;
    min-width: 0;
    text-align: center;
}
.control-bar button:first-child,
.control-bar button:nth-child(2),
.control-bar button:last-child {
    margin-left: 0;
    margin-right: 0;
    text-align: center;
}
.control-bar button:hover {
    background: #007bff;
    color: #fff;
    border: 2px solid #0056b3;
}
.control-bar button:active {
    background: #0056b3;
    color: #fff;
    border: 2px solid #0056b3;
}
.control-tip {
    color: #666;
    font-size: 1rem;
    margin-bottom: 10px;
    letter-spacing: 1px;
}
.kbd {
    display: inline-block;
    background: #f3f3f3;
    border: 1.5px solid #bbb;
    border-radius: 5px;
    padding: 2px 8px;
    font-family: 'Consolas', 'Menlo', 'Monaco', monospace;
    font-size: 1.05em;
    color: #333;
    margin: 0 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.countdown {
    font-size: 2.2rem;
    color: #ff5722;
    font-weight: bold;
    min-height: 36px;
    margin-bottom: 8px;
    letter-spacing: 2px;
    transition: color 0.2s;
}
.game-description {
    margin-top: 18px;
    max-width: 600px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.game-description ul {
    display: inline-block;
    text-align: left;
    margin: 0 auto;
}
.topbar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 18px;
    z-index: 10;
    background: transparent;
    box-sizing: border-box;
}
.menu-btn {
    position: fixed;
    top: 18px;
    left: 18px;
    width: 38px;
    height: 38px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    margin-right: 16px;
    z-index: 300;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background 0.18s, box-shadow 0.18s;
}
.menu-btn:hover {
    background: #f3f6fa;
    box-shadow: 0 4px 16px rgba(0,123,255,0.10);
}
.menu-btn span {
    display: block;
    width: 26px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    margin: 3px 0;
    transition: all 0.2s;
}
.speed-btn {
    position: absolute;
    right: 60px;
    top: 10px;
    min-width: 64px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    cursor: pointer;
    font-size: 1.08rem;
    border: 1.5px solid #e0e0e0;
    z-index: 20;
    transition: box-shadow 0.2s, border 0.2s;
    padding: 0 18px;
    color: #007bff;
    font-weight: 600;
    letter-spacing: 1px;
}
.speed-btn:active, .speed-btn:focus {
    box-shadow: 0 4px 16px rgba(0,123,255,0.12);
    border: 1.5px solid #007bff;
}
.speed-text {
    display: block;
    font-size: 1.08rem;
    color: #007bff;
    font-weight: 600;
    letter-spacing: 1px;
}
.speed-popup {
    display: none;
    position: absolute;
    right: 18px;
    top: 54px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.13);
    padding: 18px 22px 14px 22px;
    z-index: 30;
    min-width: 210px;
    text-align: center;
    border: 1.5px solid #e0e0e0;
}
.speed-popup label {
    font-size: 1.08rem;
    color: #333;
    margin-bottom: 8px;
    display: block;
}
#speed-range {
    width: 100%;
    margin-top: 8px;
}
@media (max-width: 600px) {
    .topbar {
        height: 44px;
        padding: 0 6px;
    }
    .menu-btn {
        top: 8px;
        left: 8px;
        width: 28px;
        height: 28px;
        border-radius: 6px;
    }
    .menu-btn span {
        width: 18px;
        height: 3px;
    }
    .speed-btn {
        right: 38px;
        top: 6px;
        min-width: 44px;
        height: 28px;
        font-size: 0.95rem;
        padding: 0 8px;
    }
    .speed-text {
        font-size: 0.95rem;
    }
    .speed-popup {
        right: 6px;
        top: 38px;
        min-width: 140px;
        padding: 10px 10px 8px 10px;
    }
    .control-bar {
        max-width: 100%;
        margin-top: 14px;
        gap: 12px;
    }
    .control-bar button {
        font-size: 1rem;
        padding: 8px 0;
        border-radius: 12px;
    }
}
.game-section {
    margin: 36px auto 0 auto;
    max-width: 700px;
    width: 100%;
    background: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 28px 28px 18px 28px;
    text-align: left;
}
.game-section h2 {
    font-size: 1.35rem;
    color: #007bff;
    margin-bottom: 16px;
    margin-top: 0;
    text-align: left;
}
.game-section p, .game-section ul, .game-section ol, .game-section dl {
    font-size: 1.08rem;
    color: #333;
    margin-bottom: 12px;
    text-align: left;
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
}
.game-section ul, .game-section ol {
    padding-left: 24px;
}
.game-section li {
    margin-bottom: 6px;
}
.game-section dt {
    font-weight: bold;
    margin-top: 10px;
}
.game-section dd {
    margin-left: 0;
    margin-bottom: 8px;
}
.faq-list {
    list-style-type: disc;
    padding-left: 24px;
    margin-top: 0;
    margin-bottom: 0;
}
.faq-list li {
    margin-bottom: 18px;
    font-size: 1.08rem;
    color: #333;
    line-height: 1.7;
}
.faq-list li b {
    color: #222;
    font-size: 1.08rem;
}
.score-bar {
    width: 100vw;
    max-width: 900px;
    margin: 0 auto 12px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: #007bff;
    background: #f3f6fa;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,123,255,0.04);
    padding: 10px 0 10px 0;
    letter-spacing: 1px;
    gap: 18px;
}
.score-bar .score-divider {
    color: #bbb;
    margin: 0 12px;
    font-weight: 400;
}
@media (max-width: 600px) {
    .score-bar {
        font-size: 1.05rem;
        padding: 7px 0 7px 0;
        border-radius: 8px;
        gap: 8px;
    }
    .score-bar .score-divider {
        margin: 0 6px;
    }
}
.sidebar-mask {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.18);
    z-index: 100;
    display: none;
    transition: opacity 0.2s;
}
.sidebar-mask.active {
    display: block;
    opacity: 1;
}
.sidebar {
    position: fixed;
    top: 0; left: -260px;
    width: 240px;
    height: 100vh;
    background: #fff;
    box-shadow: 2px 0 16px rgba(0,0,0,0.10);
    z-index: 120;
    transition: left 0.25s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    padding-top: 0;
}
.sidebar.active {
    left: 0;
}
.sidebar-header {
    font-size: 1.18rem;
    font-weight: bold;
    color: #007bff;
    padding: 22px 20px 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    background: #f7f7f7;
}
.sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0 0 0 0;
}
.sidebar-list li {
    border-bottom: 1px solid #f0f0f0;
}
.sidebar-list li a {
    display: block;
    padding: 16px 22px;
    color: #333;
    text-decoration: none;
    font-size: 1.08rem;
    transition: background 0.18s, color 0.18s;
}
.sidebar-list li a:hover {
    background: #f3f6fa;
    color: #007bff;
}
@media (max-width: 600px) {
    .sidebar {
        width: 80vw;
        min-width: 160px;
        max-width: 320px;
    }
}
#back-to-top {
    position: fixed;
    right: 28px;
    bottom: 38px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #007bff;
    color: #fff;
    border: none;
    box-shadow: 0 2px 12px rgba(0,123,255,0.18);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    z-index: 200;
    transition: opacity 0.25s, background 0.18s;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
#back-to-top.show {
    opacity: 1;
    pointer-events: auto;
}
#back-to-top:hover {
    background: #0056b3;
}
@media (max-width: 600px) {
    #back-to-top {
        right: 12px;
        bottom: 16px;
        width: 38px;
        height: 38px;
        font-size: 1.4rem;
    }
} 