@font-face {
        font-family: 'playful';
        src: url('fonts/playful.ttf');
    }

    @font-face {
        font-family: 'funky';
        src: url('fonts/funky.ttf');
/* 
        font-family: 'boat';
        src: url('fonts/boat.ttf'); */
    }

    body {
        margin: 0;
        font-family: 'funky';
        letter-spacing: 3px;
        text-align: center;
        background: #67bed9;
        color: rgb(255, 255, 255);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        height: 100vh;
    }

    h1 { 
        font-family: 'funky'; 
        letter-spacing: 3px; 
        font-size: 5em; 
        margin-bottom: 0; 
        color:rgb(37, 37, 37);
        margin-top:0;
    }

    h3{
        color:rgb(37, 37, 37);
        margin-top: 30px;
    }

    #status { font-size: 2em; margin: 15px; }
    #reactionTime { font-size: 2.5em; margin: 10px; }

    #intro { 
        font-size: 1em; 
        /* margin: 10px;  */
        /* padding: 12px 20px; */
        border-radius: 8px;
        border: none;
        width: 400px;
        color:rgb(37, 37, 37);
    }

    /* button, input {
        padding: 12px 20px;
        font-size: 1em;
        border-radius: 8px;
        border: none;
        margin: 5px;
    } */

#scoreboards {
    position: absolute;
    left: 20px;
    top: 20px;
    width: 380px;
    display: flex;
    flex-direction: column;
    gap: 20px; /* space between solo & team */
    /* margin-left: 80px; */
    margin-top: 80px
}

#leaderboard, #teamLeaderboard {
    background: rgba(0,0,0,0.45);
    padding: 15px;
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

.score-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;              /* 🔥 adds space between name & score */
    padding: 6px 8px;
    margin: 4px 0;
    border-radius: 6px;
    font-size: 0.95em;
}

.score-row:nth-child(1) { background: linear-gradient(90deg, gold, #ffdc00); color: #000; font-weight: bold; }
.score-row:nth-child(2) { background: linear-gradient(90deg, silver, #ddd); color: #000; }
.score-row:nth-child(3) { background: linear-gradient(90deg, #cd7f32, #e0a96d); color: #000; }

.score-name { 
    flex: 1; 
    text-align: left; 
    padding-right: 5px;    /* extra breathing room */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.score-time { 
    flex-shrink: 0;
    min-width: 90px;        /* keeps times aligned */
    text-align: right;
    letter-spacing: 1px;
}

.new-record {
    animation: glow 1s ease-in-out 3;
}

@keyframes glow {
    0% { box-shadow: 0 0 5px #fff; }
    50% { box-shadow: 0 0 15px #ffdc00; }
    100% { box-shadow: 0 0 5px #fff; }
}


    .go-state {
    background: #bf3b24 !important;
}

/* Hidden sidebar */
#leaderboardPanel {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 400px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    padding: 10px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

/* When visible */
#leaderboardPanel.show {
    transform: translateX(0);
}

/* Toggle button */
#toggleLeaderboard {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1100;
    background: gold;
    color: #222;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 0.95em;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    font-family: 'funky';
    letter-spacing: 1px;
    font-weight: bold;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#toggleLeaderboard:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.5);
}

#toggleLeaderboard:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* about kdb */
#aboutBtn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    background: rgb(128, 20, 20);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 0.95em;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    font-family: 'funky';
    letter-spacing: 1px;
    font-weight: bold;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#aboutBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.5);
}

#aboutBtn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

#aboutPanel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 320px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    padding: 25px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    color: white;
    overflow-y: auto;
}

#aboutPanel.show {
    transform: translateX(0);
}

#aboutPanel h2 {
    margin-top: 60px;
    letter-spacing: 2px;
}

.about-links {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.about-link {
    background: rgba(255,255,255,0.15);
    padding: 10px 14px;
    border-radius: 8px;
    color: white;
    text-decoration: none;
    font-weight: bold;
    letter-spacing: 1px;
}

.about-link:hover {
    background: rgba(255,255,255,0.25);
}

.qr-section {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.15);
    text-align: center;
}

.qr-title {
    font-size: 0.85em;
    letter-spacing: 2px;
    margin-bottom: 14px;
    opacity: 0.9;
}

/* Wrapper controls spacing, not the image */
.qr-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

/* QR itself */
.qr-wrapper img {
    width: 160px;
    height: 160px;
    background: white;
    padding: 12px;
    border-radius: 14px;
}

/* Small helper text */
.qr-section small {
    font-size: 0.75em;
    letter-spacing: 1px;
    opacity: 0.7;
    margin-top: 6px;
}


/* other button */
button {
    border: none;
    border-radius: 10px;
    padding: 12px 22px;
    font-size: 1em;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.2s;
}

/* Hover effect */
button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Pressed effect */
button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* 🏠 Home Button */
.home-btn {
    background: #0074D9;
    color: #ffffff;
    font-family: 'funky';
    margin-top: 2%;
    bottom: 90px;              /* 👈 ABOVE the wave */
}

/* 🚀 Start Button */
.start-btn {
    background: #01ff70;
    color: #003300;
    font-weight: bold;
    font-family: 'funky';
    font-size: 1.5em;
    letter-spacing: 1px;
}

/* 🎮 Mode Buttons */
.mode-btn {
    background: #0074D9;
    color: white;
    font-weight: bold;
    font-family: 'funky';
    margin: 30px;
    font-size: 1.5em;
}

/* 🟡 Solo Paddle */
#tapBtn {
    background: #ffdc00;
    color: #222;
    font-size: 2em;
    font-family: 'funky';
    padding: 20px 50px;
}

/* 🔵 Team Paddle Buttons */
.teamTap {
    background: #ffdc00;
    font-family: 'funky';
    margin: 20px;
    color: #222;
    font-size: 2em;
    padding: 20px 50px;
}

/* Container (optional, if you wrap label + input) */
.name-field {
    margin: 15px 0;
    text-align: center;
}

/* Label */
.name-field label {
    display: block;
    font-size: 1em;
    letter-spacing: 2px;
    margin-bottom: 6px;
    margin-top: 20px;
    opacity: 0.8;
}

/* Input box */
.name-field input {
    padding: 12px 16px;
    border-radius: 8px;
    border: 2px solid transparent;
    font-size: 1em;
    font-family: 'funky';
    text-align: center;
    outline: none;
    background: rgba(255,255,255,0.9);
    color: #111;
    width: 220px;
    transition: all 0.2s ease;
}

/* Glow when clicked */
.name-field input:focus {
    border-color: #ffdc00;
    box-shadow: 0 0 10px rgba(255, 220, 0, 0.7);
    transform: scale(1.03);
}

/* Placeholder style */
.name-field input::placeholder {
    color: #666;
    letter-spacing: 1px;
}

.name-field input:disabled {
    background: #ddd;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* popup join */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);

    display: flex;
    align-items: center;
    justify-content: center;

    opacity: 0;
    pointer-events: none;   /* 🔥 MUST BE HERE */
    transition: opacity 0.3s ease;

    z-index: 2000;
}

.popup-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.popup-card {
    background: #003f5c;
    padding: 30px;
    border-radius: 16px;
    max-width: 550px;
    text-align: center;
    color: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    font-size: 1.5em;
}

.popup-card img {
    width: 180px;
    height: 180px;
    margin: 20px auto;
    background: white;
    padding: 10px;
    border-radius: 12px;
}

.popup-small {
    font-size: 0.8em;
    opacity: 0.8;
}

/* wave */
.water-layer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 140px;
    pointer-events: none;
    z-index: 1;
}

.wave-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 140px;
    overflow: hidden;
    z-index: 1;              /* behind UI */
    pointer-events: none;
}

.wave-container svg {
    width: 200%;
    height: 100%;
    animation: waveMove 12s linear infinite;
}

.wave-container path {
    fill: rgba(255,255,255,0.35);
}

@keyframes waveMove {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* boat */
/* 🐉 Dragon boat animation */
.boat-layer {
    position: absolute;
    bottom: -10px;          /* 👈 sits on wave crest */
    left: -500px;           /* start off-screen */
    width: 20%;
    pointer-events: none;
    z-index: 2;             /* above wave, below UI */
}

.dragon-boat {
    width: 200px;
    animation: boatSail 22s linear infinite;
    will-change: transform;
}

/* Smooth left → right loop */
@keyframes boatSail {
    0% {
        transform: translateX(-500px);
    }
    100% {
        transform: translateX(calc(100vw + 500px));
    }
}

#beatCircle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    margin: 40px auto;
    transition: transform 0.15s ease, background 0.15s ease;
}

#beatCircle.active {
    background: #ffdc00;
    transform: scale(1.3);
}

#paddleBtn {
    font-size: 1.5em;
    padding: 16px 40px;
    background: #ffdc00;
    border-radius: 12px;
    font-family: 'funky';
}

/* feedback */
#feedback {
    margin-top: 20px;
    font-size: 1.5em;
    font-family: 'funky';
    letter-spacing: 2px;
    transition: transform 0.15s ease, opacity 0.15s ease;
    margin-bottom: 20px;
}

/* Feedback types */
#feedback.perfect {
    color: #ffdc00;
    transform: scale(1.2);
}

#feedback.good {
    color: #7CFF7C;
    transform: scale(1.1);
}

#feedback.miss {
    color: #ff6b6b;
    transform: scale(1);
}


.subtitle {
    opacity: 0.8;
    letter-spacing: 2px;
}


#readyStatus {
    font-size: 2em;
    letter-spacing: 4px;
    margin-top: 20px;
    opacity: 0.9;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

#readyStatus.go {
    color: #ffdc00;
    transform: scale(1.2);
}

#startRhythmBtn {
    margin-top: 20px;
    padding: 14px 40px;
    font-size: 1.4em;
    border-radius: 12px;
    border: none;
    background: #01ff70;
    color: #003300;
    font-family: 'funky';
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(0,0,0,0.4);
}

#startRhythmBtn:hover {
    transform: translateY(-2px);
}

#startRhythmBtn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

#readyStatus,
#beatCircle,
#paddleBtn {
    display: none;
}

#score {
    margin-bottom: 40px; /* adjust value as you like */
}

/* responsive */
/* =====================
   📱 MOBILE FIX
===================== */
@media (max-width: 768px) {

  body {
    padding-top: 80px;   /* kasih ruang buat header buttons */
  }

  h1 {
    font-size: 2.4rem;   /* dari yang besar banget */
    line-height: 1.1;
    margin-bottom: 16px;
    /* margin-top: 20px; */
  }

  .subtitle,
  .small-text {
    font-size: 0.8rem;
  }

  /* Player name */
  .name-field {
    margin: 16px auto;
  }

  .name-field input {
    width: 85%;
    font-size: 1rem;
  }

  /* Mode section */
  .mode-title {
    font-size: 1rem;
    margin-top: 24px;
  }

  /* Mode buttons */
  .mode-btn {
    width: 85%;
    font-size: 1rem;
    padding: 14px 0;
    margin: 10px auto;
    display: block;
  }

  /* Start / Reset buttons */
  #startBtn{
    width: 20%;
    font-size: 1.2rem;
    padding: 14px 0;
    margin: 10px;
  }
  #resetBtn {
    width: 70%;
    font-size: 1rem;
    padding: 14px 0;
  }

}

@media (max-width: 768px) {

  #toggleLeaderboard,
  #aboutBtn {
    font-size: 0.75rem;
    padding: 8px 12px;
    top: 10px;
  }

  #toggleLeaderboard {
    left: 10px;
  }

  #aboutBtn {
    right: 10px;
  }
}

@media (max-width: 768px) {

  .water-layer {
    height: 100px;      /* wave smaller */
    margin-top: 30px;
  }

  .boat-layer {
    bottom: 0px;
  }

  .dragon-boat {
    width: 150px;
  }

}


@media (max-width: 768px) {
  body {
    height: auto;
    overflow-y: auto;
  }
}

