* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(ellipse 120% 80% at 50% -20%, rgba(251, 191, 36, 0.12), transparent 55%),
        linear-gradient(165deg, #1e0b24 0%, #3d1f4a 38%, #1a1033 72%, #0f172a 100%);
    min-height: 100vh;
    min-height: 100dvh;
    color: #fce7f3;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.wrap { max-width: 520px; margin: 0 auto; }
.head { text-align: center; margin-bottom: 12px; }
.head h1 {
    font-size: 1.65rem;
    margin-bottom: 10px;
    letter-spacing: 0.04em;
    text-shadow: 0 2px 6px rgba(0,0,0,0.45), 0 0 28px rgba(244, 114, 182, 0.25);
}
.stats {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}
.stat {
    background: linear-gradient(145deg, rgba(30, 15, 40, 0.75), rgba(15, 10, 28, 0.88));
    padding: 8px 14px;
    border-radius: 10px;
    min-width: 5rem;
    border: 1px solid rgba(251, 191, 36, 0.22);
    box-shadow: 0 4px 16px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.06);
}
.stat.wide { min-width: 6.5rem; }
.stat .lbl { opacity: 0.88; margin-right: 8px; font-size: 0.9rem; }
.stat span:last-child {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}
.canvas-wrap {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}
#game {
    display: block;
    width: 100%;
    max-width: min(100vw - 24px, 400px);
    height: auto;
    aspect-ratio: 400 / 560;
    background: #14081c;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(251, 191, 36, 0.08);
    border: 3px solid rgba(244, 114, 182, 0.2);
    touch-action: none;
    cursor: pointer;
    outline: none;
}
#game:focus-visible {
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.45), 0 10px 40px rgba(0,0,0,0.5);
}
.toolbar {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(244, 114, 182, 0.35), rgba(168, 85, 247, 0.28));
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.14);
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:hover {
    background: linear-gradient(180deg, rgba(244, 114, 182, 0.48), rgba(168, 85, 247, 0.38));
    box-shadow: 0 4px 14px rgba(244, 114, 182, 0.2);
}
.btn:active { transform: scale(0.97); }
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}
.btn:disabled:hover { background: rgba(255,255,255,0.16); }
.btn:focus-visible {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}
.hint {
    text-align: center;
    font-size: 0.84rem;
    opacity: 0.9;
    margin-top: 12px;
    line-height: 1.55;
}
