/**
 * Spider City 3D
 */
.sc-app [hidden] { display: none !important; }

.sc-app {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    color: #f1f5f9;
    background: #0b1020;
    overflow-x: hidden;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.sc-stage {
    position: relative;
    width: 100vw;
    height: calc(100vh - 72px);
    min-height: 520px;
    overflow: hidden;
    background: #0b1020;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
.sc-stage:fullscreen { height: 100vh; }

#scCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

/* Effetto velocità: vignetta ai bordi */
.sc-speedfx {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(10,14,30,0.55) 100%);
    transition: opacity 0.2s;
}

/* Mirino */
.sc-cross {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid rgba(255,255,255,0.75);
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 4px rgba(0,0,0,0.6);
    transition: transform 0.12s, border-color 0.12s;
}
.sc-cross.is-target { border-color: #ffd23f; transform: scale(1.5); }
.sc-cross.is-miss { border-color: #ff4d5e; transform: scale(0.8); }

/* HUD */
.sc-hud-top {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    pointer-events: none;
    z-index: 5;
}
.sc-chip {
    background: rgba(8, 12, 28, 0.72);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 999px;
    padding: 7px 14px;
    font-weight: 700;
    font-size: 14px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    white-space: nowrap;
}
.sc-brand span { color: #ff4d5e; }
.sc-state[data-mode="swing"] { background: rgba(190, 18, 40, 0.8); }
.sc-state[data-mode="wall"] { background: rgba(30, 64, 175, 0.8); }
.sc-state[data-mode="zip"] { background: rgba(180, 120, 0, 0.85); }
.sc-tokens { color: #ffd23f; }
.sc-hud-btns {
    margin-left: auto;
    display: flex;
    gap: 6px;
    pointer-events: auto;
}
.sc-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(8, 12, 28, 0.72);
    color: #fff;
    font-size: 19px;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.sc-btn:hover { background: rgba(40, 50, 90, 0.85); }

.sc-stats {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: flex;
    gap: 10px;
    pointer-events: none;
    z-index: 5;
}
.sc-stats > div {
    background: rgba(8, 12, 28, 0.72);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 12px;
    padding: 6px 12px;
    min-width: 86px;
}
.sc-stat-val { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sc-stat-unit { font-size: 12px; opacity: 0.75; margin-left: 4px; }

.sc-mini {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.35);
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
    pointer-events: none;
    z-index: 5;
}

.sc-toast {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translate(-50%, -10px);
    background: rgba(8, 12, 28, 0.85);
    border: 1px solid rgba(255, 210, 63, 0.5);
    color: #fff;
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    z-index: 6;
    max-width: calc(100% - 32px);
    text-align: center;
}
.sc-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.sc-lockhint {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    background: rgba(8, 12, 28, 0.72);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    pointer-events: none;
    z-index: 5;
}
.sc-stage.is-locked .sc-lockhint { display: none; }

/* Schermate */
.sc-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: radial-gradient(ellipse at center, rgba(8,12,28,0.55), rgba(8,12,28,0.88));
    z-index: 20;
    padding: 16px;
    overflow-y: auto;
}
.sc-card {
    width: min(620px, 100%);
    background: rgba(12, 18, 40, 0.92);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 18px;
    padding: 26px 26px 22px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    text-align: center;
}
.sc-card-small { width: min(360px, 100%); }
.sc-card h2 { margin: 0 0 14px; font-size: 24px; }
.sc-card-kicker { color: #ff4d5e; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; font-size: 13px; }
.sc-title {
    margin: 6px 0 8px;
    font-size: clamp(30px, 6vw, 46px);
    font-weight: 900;
    background: linear-gradient(90deg, #ff4d5e, #ffffff 50%, #4d7cff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.sc-lead { opacity: 0.88; line-height: 1.5; margin: 0 0 16px; }
.sc-keys {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    text-align: left;
    margin: 0 0 18px;
}
.sc-keys > div { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.sc-keys span { opacity: 0.8; }
kbd {
    display: inline-block;
    background: #1e2748;
    border: 1px solid rgba(255,255,255,0.22);
    border-bottom-width: 3px;
    border-radius: 6px;
    padding: 2px 7px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}
.sc-play {
    min-height: 48px;
    padding: 0 30px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #e11d2e, #b8141f);
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(225, 29, 46, 0.4);
}
.sc-play:hover { filter: brightness(1.1); }
.sc-note { font-size: 12px; opacity: 0.65; margin: 12px 0 0; }
.sc-help-actions { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; }
.sc-link { background: none; border: 0; color: #9fb4ff; text-decoration: underline; cursor: pointer; min-height: 44px; font-size: 14px; }

/* Touch */
.sc-touch { display: none; }
@media (pointer: coarse) {
    .sc-touch { display: block; }
    .sc-lockhint, .sc-cross { display: none; }
    .sc-stats { bottom: auto; top: 64px; }
    .sc-mini { width: 120px; height: 120px; top: 64px; right: 12px; bottom: auto; }
}
.sc-joy {
    position: absolute;
    left: 22px;
    bottom: 26px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.28);
    z-index: 8;
    touch-action: none;
}
.sc-joy-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 62px;
    height: 62px;
    margin: -31px 0 0 -31px;
    border-radius: 50%;
    background: rgba(255,255,255,0.45);
    border: 2px solid rgba(255,255,255,0.7);
    pointer-events: none;
}
.sc-tbtns {
    position: absolute;
    right: 18px;
    bottom: 22px;
    display: grid;
    grid-template-columns: 76px 76px;
    gap: 12px;
    z-index: 8;
}
.sc-tbtn {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.35);
    background: rgba(8, 12, 28, 0.6);
    color: #fff;
    font-size: 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
    touch-action: none;
}
.sc-tbtn small { font-size: 10px; font-weight: 700; margin-top: 4px; }
.sc-tbtn.is-down { transform: scale(0.92); background: rgba(225, 29, 46, 0.6); }
.sc-tbtn-swing { background: rgba(190, 18, 40, 0.55); }

/* Testo sotto il gioco */
.sc-info {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 16px 48px;
    line-height: 1.6;
}
.sc-info h2 { font-size: 26px; margin: 0 0 12px; }
.sc-info p { opacity: 0.88; }
.sc-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 20px;
}
.sc-info-grid > div {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 16px 18px;
}
.sc-info-grid h3 { margin: 0 0 6px; font-size: 17px; }

@media (max-width: 640px) {
    .sc-hud-top { top: 8px; left: 8px; right: 8px; gap: 6px; }
    .sc-brand { display: none; }
    .sc-chip { padding: 6px 10px; font-size: 13px; }
    .sc-keys { grid-template-columns: 1fr; }
    .sc-card { padding: 20px 16px; }
    .sc-hud-btns { gap: 4px; }
}

.sc-keys .sc-k { font-weight: 400; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

/* Scelta della città */
.sc-btn-city { width: auto; padding: 0 12px; font-size: 14px; font-weight: 800; white-space: nowrap; }
.sc-cities { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 16px; }
.sc-city-pick {
    min-height: 56px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px;
}
.sc-city-pick small { font-size: 11px; font-weight: 500; opacity: 0.75; }
.sc-city-pick.is-current { border-color: #ff4d5e; background: rgba(225, 29, 46, 0.18); }
.sc-city-pick:hover { background: rgba(255,255,255,0.1); }
@media (max-width: 640px) { .sc-btn-city { padding: 0 8px; font-size: 12px; } }
