* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: #0a0010;
    color: #fff;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1a0033 0%, #0a0010 100%);
}

.screen.active {
    display: flex;
}

.menu-card {
    text-align: center;
    padding: 40px 32px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 80, 160, 0.15);
    max-width: 460px;
    width: 90%;
    animation: menuFadeIn 0.7s ease both;
}

@keyframes menuFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.menu-card h1 {
    font-size: 3rem;
    letter-spacing: 2px;
    margin-bottom: 6px;
    background: linear-gradient(to bottom, #ff6bcf, #00d2ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(255, 107, 207, 0.35);
}

.menu-card p {
    color: #cfcfe6;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
    justify-content: center;
}

.toggle-label {
    color: #e0c3fc;
    font-size: 1rem;
    font-weight: 600;
}

.toggle {
    display: inline-flex;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.35);
}

.toggle-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    padding: 8px 22px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #ff6bcf, #00d2ff);
    box-shadow: 0 4px 12px rgba(255, 107, 207, 0.45);
}

.toggle-btn:hover:not(.active) {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    width: 100%;
    padding: 14px 18px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.1s, filter 0.2s, opacity 0.2s;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, #ff6bcf, #d63384);
    box-shadow: 0 4px 16px rgba(255, 107, 207, 0.4);
}

.btn-primary:hover {
    filter: brightness(1.15);
}

.btn-secondary {
    background: linear-gradient(135deg, #00d2ff, #0088cc);
    box-shadow: 0 4px 16px rgba(0, 210, 255, 0.4);
}

.btn-secondary:hover {
    filter: brightness(1.15);
}

.btn-quit {
    background: rgba(255, 255, 255, 0.08);
    color: #cfcfe6;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-quit:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.hint {
    margin-top: 18px;
    color: #a5a5c8;
    font-size: 0.9rem;
    min-height: 1.2em;
}
#gameCanvas {
    display: block;
    background: linear-gradient(to bottom, #12002b, #2a0052);
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

.hud {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 6px 16px;
    z-index: 10;
    pointer-events: none;
}

.hud-item {
    color: #e0e0f5;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.4px;
}

.hud-label {
    color: #a5a5c8;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    opacity: 0.8;
}

.hud-item.divider {
    color: #555;
    font-size: 0.9rem;
}

.controls-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    pointer-events: none;
    z-index: 5;
}

.controls-hint kbd {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: inherit;
    font-size: 0.75rem;
    color: #fff;
    margin: 0 2px;
}

/* ===== Phone touch controls ===== */
.phone-controls {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 24px;
    z-index: 20;
    pointer-events: none;
}

.phone-controls.hidden {
    display: none;
}

.phone-left {
    display: flex;
    gap: 14px;
    pointer-events: auto;
}

.phone-right {
    pointer-events: auto;
}

.phone-btn {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: background 0.1s, transform 0.05s;
}

.phone-btn:active {
    background: rgba(255, 107, 207, 0.35);
    transform: scale(0.93);
}

.phone-shoot {
    width: 88px;
    height: 88px;
    font-size: 1.05rem;
    background: rgba(255, 107, 207, 0.25);
    border-color: rgba(255, 107, 207, 0.6);
}

.overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

.overlay-card {
    text-align: center;
    padding: 50px 60px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    max-width: 900px;
    width: 90%;
    animation: popIn 0.3s ease both;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.overlay-card h2 {
    font-size: 2rem;
    margin-bottom: 8px;
    background: linear-gradient(to bottom, #ff6bcf, #00d2ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.overlay-card p {
    color: #cfcfe6;
    margin-bottom: 22px;
    font-size: 1.05rem;
}

/* Collected stars */
.level-stars {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 10px 0 6px;
    min-height: 6px;
}

.level-stars .star-icon {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.8));
    animation: starPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Final level summary */
.stars-summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 12px 0 18px;
    text-align: left;
}

.stars-summary .stars-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 4px 12px;
}

.stars-summary .stars-level {
    color: #e0c3fc;
    font-weight: 700;
    font-size: 0.8rem;
    min-width: 66px;
}

.stars-summary .stars-icons {
    display: flex;
    gap: 3px;
}

.stars-summary .star-icon,
.stars-summary .star-empty {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
}

.stars-summary .star-icon {
    filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.8));
}

/* grayed-out star (same shape as the filled one, just dim) */
.stars-summary .star-empty {
    filter: grayscale(1) opacity(0.45);
    border: none;
    background: none;
    border-radius: 0;
    opacity: 0.5;
}

.overlay-card .button-group {
    gap: 12px;
}

@media (max-width: 700px) {
    .controls-hint { display: none; }
    .menu-card h1 { font-size: 2.2rem; }
}

