* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent
}
:root { --safe-top: env(safe-area-inset-top); }
#shareBtn, #leaderboardBtn, #volBtn, #infoBtn {
  margin-top: max(12px, var(--safe-top));
}
html,
body {
    height: 100%;
    margin: 0
}

body {
    background: #000;
    overflow: hidden;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    touch-action: none;
    color: #EAEAEA;
}

#game {
    position: fixed;
    inset: 0;
    z-index: 0
}

#hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 12;
}

#scoreHud {
    position: absolute;
    top: .8rem;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(220px, 42vw, 360px);
    height: 72px;
    pointer-events: none;
    z-index: 12;
}

#scoreHud .hudFrame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%
}

#scoreHud .framePath {
    stroke-dasharray: 4;
    animation: hudDash 2s cubic-bezier(0.39, 0.575, 0.565, 1) infinite;
    stroke-linecap: round;
    opacity: 1;
}

#scoreHud .ticks {
    stroke-linecap: round;
    opacity: 1;
}

@keyframes hudDash {
    to {
        stroke-dashoffset: -200
    }
}

#score {
    position: relative;
    display: grid;
    place-items: center;
    height: 100%;
    padding: 0 32px;
    font-weight: bold;
    font-size: clamp(25px, 4vw, 50px);
    letter-spacing: .5px;
    color: transparent;
    background: linear-gradient(180deg, #a0f7ff 0%, #34e6e0 55%, #00a7cd 100%);
    -webkit-background-clip: text;
    background-clip: text;
}



#title {
    position: absolute;
    top: .7rem;
    left: 1rem;
    font-weight: 700;
    opacity: .9
}

#joystick {
    position: fixed;
    left: 16px;
    bottom: 16px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .28);
    border: #FAFAFA 5px solid;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, .35), 0 10px 30px rgba(0, 0, 0, .3);
    display: grid;
    place-items: center;
    pointer-events: auto;
    touch-action: none;
    z-index: 15
}

#stick {
    width: 46%;
    height: 46%;
    border-radius: 50%;
    background: #34e6e0;
    border: #000 5px solid;
    box-shadow: 0 0 14px rgba(0, 0, 0, .8);
    transform: translate3d(0, 0, 0)
}

#startOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: grid;
    place-items: center;
    z-index: 20;
}

#startOverlay[hidden] {
    display: none !important;
    pointer-events: none
}

#overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: grid;
    place-items: center;
    z-index: 20
}

#overlay[hidden] {
    display: none !important;
    pointer-events: none
}

.overlayCard {
    background: rgba(20, 20, 30, .7);
    border: 1px solid rgba(255, 255, 255, .15);
    padding: 1.2rem 1.4rem;
    border-radius: 14px;
    text-align: center;
    color: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .5)
}

.overlayCard .big {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: .2rem
}

.overlayCard .sub {
    opacity: .85;
    font-weight: 600
}

.startCard {
    max-width: min(92vw, 560px)
}

.startRow {
    display: flex;
    align-items: center;
    gap: 16px;
}

#startVideo {
    width: 108px;
    height: 108px;
    border-radius: 8px;
    object-fit: cover;
    flex: 0 0 108px;
}

#startGif {
    width: 108px;
    height: 108px;
    border-radius: 8px;
    object-fit: cover;
    flex: 0 0 108px;
}

.startTitle {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: .25rem;
    text-align: left !important;
}

.startDesc {
    opacity: .9;
    font-weight: 600;
    line-height: 1.25;
    text-align: left !important;
}

#infoBtn {
    position: fixed;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .12);
    color: #EAEAEA;
    border: 1px solid rgba(255, 255, 255, .22);
    box-shadow: 0 6px 22px rgba(0, 0, 0, .35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 18;
    cursor: pointer;
}

#infoBtn:hover {
    background: rgba(255, 255, 255, .18)
}

#infoBtn:active {
    transform: translateY(1px)
}

#infoModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    display: grid;
    place-items: center;
    z-index: 30;
}

#infoModal[hidden] {
    display: none !important;
    pointer-events: none
}

.infoCard {
    width: min(520px, 92vw);
    max-height: min(78vh, 720px);
    overflow: auto;
    text-align: left;
}

.infoCard .rule {
    opacity: .95;
    line-height: 1.4
}

.infoCard .bullets {
    margin: .6rem 0 .2rem 1.1rem;
    line-height: 1.2
}

.infoCard .bullets>li {
    margin: .25rem 0
}

.infoCard .bullets ul {
    margin: .25rem 0 .25rem 1rem;
    opacity: .95
}

.infoCard .dismiss {
    margin-top: .8rem;
    font-size: .9rem;
    opacity: .75;
    text-align: center;
}

#infoModal hr {
    border: none;
    height: 1px;
    margin: .6rem 0 .6rem 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
}

#startVid {
    width: 108px;
    height: 108px;
    border-radius: 8px;
    object-fit: cover;
    display: block
}

#commentToast {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 18;
    pointer-events: none;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .22s ease, transform .22s ease;
}

#commentToast.show {
    opacity: 1;
    transform: translateY(0)
}

#commentToast[hidden] {
    display: none !important
}

.commentCard {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.commentGif {
    width: 88px;
    height: 88px;
    border-radius: 8px;
    object-fit: cover;
    flex: 0 0 88px;
}

.commentText {
    max-width: min(50vw, 320px);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: .2px;
}

#shareBtn {
    position: fixed;
    top: 12px;
    left: 16px;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .12);
    color: #EAEAEA;
    border: 1px solid rgba(255, 255, 255, .22);
    box-shadow: 0 6px 22px rgba(0, 0, 0, .35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 18;
    cursor: pointer;
}

#shareBtn:hover {
    background: rgba(255, 255, 255, .18)
}

#shareBtn:active {
    transform: translateY(1px)
}

#shareMenu {
    position: fixed;
    top: 60px;
    left: 8px;
    background: rgba(20, 20, 30, .9);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, .5);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 28;
}

#shareMenu[hidden] {
    display: none !important
}

#shareMenu a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: .9rem;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
}

#shareMenu a:hover {
    background: rgba(255, 255, 255, .12)
}

#toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, .75);
    color: #fff;
    padding: .5rem .8rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: .9rem;
    z-index: 40;
    box-shadow: 0 6px 22px rgba(0, 0, 0, .4);
}

#toast[hidden] {
    display: none !important
}

#volBtn {
    position: fixed;
    top: 62px;
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .12);
    color: #EAEAEA;
    border: 1px solid rgba(255, 255, 255, .22);
    box-shadow: 0 6px 22px rgba(0, 0, 0, .35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 18;
    cursor: pointer;
}

#volBtn:hover {
    background: rgba(255, 255, 255, .18)
}

#volBtn:active {
    transform: translateY(1px)
}

#volBtn[data-level="mute"] .wave1,
#volBtn[data-level="mute"] .wave2 {
    opacity: 0
}

#volBtn[data-level="low"] .wave2 {
    opacity: .2
}

#volBtn[data-level="med"] .wave2 {
    opacity: .55
}

#volBtn[data-level="high"] .wave2 {
    opacity: 1
}

#volPanel {
    position: fixed;
    top: 112px;
    right: 12px;
    background: rgba(20, 20, 30, .9);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 12px;
    padding: 10px 12px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, .5);
    z-index: 28;
}

#volPanel[hidden] {
    display: none !important
}

#volRange {
    width: 140px
}

#volPct {
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
    min-width: 38px;
    text-align: right
}

#controlsInfo {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 15;
    pointer-events: none;
}

.testbutton {
    font-family: arial;
    font-weight: bold;
    color: #FFFFFF !important;
    font-size: 14px;
    padding: 10px 25px;
    border-radius: 8px;
    border: 0px solid #3866A3;
    background: #11111175;
}

.testbutton:hover {
    color: #FFFFFF !important;
    background: #4a4d597a;
}

.controlsCard {
    padding: .6rem .8rem;
    font-size: .9rem;
    font-weight: 600;
    opacity: .85;
}

.custom_input {
    display: flex;
    align-items: center;
    position: relative;
    max-width: 100%;
}

.input {
    font-size: 18px;
    font-weight: bold;
    padding: 5px 10px;
    width: 100%;
    outline: none;
    background: #11111175;
    color: #ffffff;
    border: 1px solid #8992A4;
    border-radius: 8px;
    transition: .3s ease;
}

.input:focus {
    background: #f2f2f27e;
    border: 0px;
    border-radius: 8px;
}

.input::placeholder {
    color: #c9e8e2;
}

/* Style pour le conteneur des boutons en haut à gauche */
#leaderboardBtn {
    position: fixed;
    top: 62px;
    left: 16px;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .12);
    color: #EAEAEA;
    border: 1px solid rgba(255, 255, 255, .22);
    box-shadow: 0 6px 22px rgba(0, 0, 0, .35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 16;
    cursor: pointer;
}

#leaderboardBtn:hover {
    background: rgba(255, 255, 255, .18)
}

#leaderboardBtn:active {
    transform: translateY(1px)
}

/* Share score button in game over overlay */
#shareScoreBtn {
    color: #34e6e0;
    transition: all 0.2s ease;
}

#shareScoreBtn:hover {
    background: rgba(52, 230, 224, 0.2) !important;
    border-color: rgba(52, 230, 224, 0.5) !important;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(52, 230, 224, 0.3);
}

#shareScoreBtn:active {
    transform: scale(0.95);
}