/* ============================================= */
/*  BẮN CÁ OFFLINE - CSS Design System           */
/* ============================================= */

:root {
    --ocean-deep: #0a1628;
    --ocean-mid: #0d2847;
    --ocean-light: #1a4a7a;
    --ocean-glow: #00b4d8;
    --ocean-surface: #48cae4;
    --gold: #ffd700;
    --gold-dark: #c9a300;
    --coral: #ff6b6b;
    --coral-dark: #ee3a3a;
    --emerald: #2dce89;
    --purple: #7c3aed;
    --white: #ffffff;
    --text-primary: #e0f0ff;
    --text-secondary: #8ab4d8;
    --glass-bg: rgba(13, 40, 71, 0.7);
    --glass-border: rgba(72, 202, 228, 0.2);
    --shadow-glow: 0 0 30px rgba(0, 180, 216, 0.3);
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--ocean-deep);
    font-family: var(--font-main);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    width: 100%;
    height: 100%;
    position: relative;
}

/* ============================================= */
/*  LOADING SCREEN                                */
/* ============================================= */
#loading-screen {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #0a1628 0%, #0d2847 40%, #1a4a7a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-content {
    text-align: center;
}

.loading-title {
    font-size: 2.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--gold) 0%, #fff8b4 50%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5));
    animation: titlePulse 2s ease-in-out infinite;
    letter-spacing: 4px;
    line-height: 1.1;
}

.loading-subtitle {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--ocean-surface);
    letter-spacing: 8px;
    margin-top: 8px;
}

@keyframes titlePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.03);
    }
}

.loading-bar-container {
    width: 320px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    margin: 20px auto 12px;
    overflow: hidden;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--ocean-glow), var(--gold));
    border-radius: 20px;
    transition: width 0.3s ease;
    box-shadow: 0 0 15px var(--ocean-glow);
}

.loading-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
}

/* ============================================= */
/*  LOBBY SCREEN                                  */
/* ============================================= */
#lobby-screen {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lobby-bg {
    position: absolute;
    inset: 0;
    background: url('assets/lobby_bg.png') center/cover no-repeat;
    background-color: #0a1628;
}

#btn-sound {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btn-sound:hover {
    background: rgba(255, 255, 255, 0.2);
}

#btn-sound.active {
    border-color: var(--ocean-glow);
    box-shadow: 0 0 8px rgba(0, 180, 216, 0.3);
}

.lobby-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(0, 180, 216, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(124, 58, 237, 0.1) 0%, transparent 60%);
}

.lobby-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.lobby-header {
    margin-bottom: 10px;
    flex-shrink: 0;
}

.lobby-title {
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--gold) 0%, #fff8b4 50%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.4));
    letter-spacing: 4px;
    line-height: 1.1;
}

.lobby-balance {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 6px 18px;
    margin-top: 8px;
    backdrop-filter: blur(10px);
}

.coin-icon {
    font-size: 1.5rem;
}

.lobby-balance span:last-child {
    color: var(--gold);
    font-weight: 700;
    font-size: 1.3rem;
}

.room-select h2 {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 4px;
    margin-bottom: 12px;
}

.rooms {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.room-card {
    width: 190px;
    background: linear-gradient(135deg, rgba(13, 40, 71, 0.8) 0%, rgba(26, 74, 122, 0.6) 100%);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.room-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--ocean-glow);
    box-shadow: var(--shadow-glow), 0 20px 40px rgba(0, 0, 0, 0.3);
}

.room-card:active {
    transform: translateY(-2px) scale(0.98);
}

.room-icon {
    font-size: 2.2rem;
    margin-bottom: 6px;
    animation: fishFloat 3s ease-in-out infinite;
}

.room-card:nth-child(2) .room-icon {
    animation-delay: 0.3s;
}

.room-card:nth-child(3) .room-icon {
    animation-delay: 0.6s;
}

@keyframes fishFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.room-name {
    color: var(--white);
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.room-bet {
    color: var(--gold);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.room-desc {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* ============================================= */
/*  GAME SCREEN                                   */
/* ============================================= */
#game-screen {
    position: absolute;
    inset: 0;
    z-index: 10;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

/* ============================================= */
/*  HUD                                           */
/* ============================================= */
#hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 20;
}

#hud>* {
    pointer-events: auto;
}

#hud-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
}

#btn-back {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
}

#btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--ocean-glow);
}

#jackpot-display {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.05));
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 6px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(8px);
}

.jackpot-label {
    color: var(--gold);
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 2px;
}

#jackpot-value {
    color: var(--gold);
    font-weight: 700;
    font-size: 1.1rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#room-label {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
}

#hud-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
}

#player-info {
    text-align: left;
}

.player-name {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.9rem;
}

.player-coin {
    color: var(--gold);
    font-weight: 600;
    font-size: 1rem;
}

#controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

#btn-bet-down,
#btn-bet-up {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-main);
    display: flex;
    align-items: center;
    justify-content: center;
}

#btn-bet-down:hover,
#btn-bet-up:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--ocean-glow);
}

#bet-display {
    text-align: center;
    min-width: 80px;
}

.bet-label {
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 2px;
}

#bet-value {
    color: var(--gold);
    font-weight: 800;
    font-size: 1.1rem;
}

#btn-auto,
#btn-fast {
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-main);
}

#btn-auto:hover,
#btn-fast:hover {
    background: rgba(255, 255, 255, 0.2);
}

#btn-auto.active {
    background: linear-gradient(135deg, var(--emerald), #1ea362);
    border-color: var(--emerald);
    box-shadow: 0 0 15px rgba(45, 206, 137, 0.4);
}

#btn-fast.active {
    background: linear-gradient(135deg, var(--coral), var(--coral-dark));
    border-color: var(--coral);
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.4);
}

/* ============================================= */
/*  EFFECTS OVERLAY                               */
/* ============================================= */
#effects-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 30;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
}

#effect-text {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--gold) 0%, #fff8b4 50%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.6));
    animation: effectIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    letter-spacing: 4px;
}

#effect-subtext {
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    animation: effectIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards;
    opacity: 0;
}

@keyframes effectIn {
    from {
        transform: scale(0.3);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================= */
/*  BUBBLES - background decoration              */
/* ============================================= */
.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.15), rgba(72, 202, 228, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: bubbleRise linear infinite;
}

@keyframes bubbleRise {
    from {
        transform: translateY(100vh) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    to {
        transform: translateY(-100px) scale(1);
        opacity: 0;
    }
}

/* ============================================= */
/*  RESPONSIVE (small landscape screens)          */
/* ============================================= */
@media (max-height: 500px) {
    .loading-title {
        font-size: 2rem;
    }

    .lobby-title {
        font-size: 1.8rem;
    }

    .lobby-header {
        margin-bottom: 6px;
    }

    .room-select h2 {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .rooms {
        gap: 12px;
    }

    .room-card {
        width: 170px;
        padding: 12px 14px;
    }

    .room-icon {
        font-size: 1.8rem;
        margin-bottom: 4px;
    }

    .room-name {
        font-size: 0.9rem;
    }

    .room-bet,
    .room-desc {
        font-size: 0.75rem;
    }

    .lobby-balance {
        padding: 4px 14px;
        margin-top: 6px;
    }

    .lobby-balance span:last-child {
        font-size: 1rem;
    }

    .loading-bar-container {
        margin: 14px auto 10px;
    }

    #controls {
        gap: 4px;
    }

    #btn-auto,
    #btn-fast {
        padding: 6px 8px;
        font-size: 0.7rem;
    }

    #jackpot-display {
        padding: 4px 10px;
    }

    .jackpot-label {
        font-size: 0.65rem;
    }

    #jackpot-value {
        font-size: 0.85rem;
    }

    #effect-text {
        font-size: 2rem;
    }

    #effect-subtext {
        font-size: 1rem;
    }
}

@media (max-height: 400px) {
    #hud-top {
        padding: 4px 10px;
    }

    #hud-bottom {
        padding: 4px 10px;
    }

    #btn-back {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    #room-label {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    .player-name {
        font-size: 0.75rem;
    }

    .player-coin {
        font-size: 0.8rem;
    }

    #btn-bet-down,
    #btn-bet-up {
        width: 28px;
        height: 28px;
    }

    #bet-value {
        font-size: 0.9rem;
    }

    #btn-auto,
    #btn-fast {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
}

/* ============================================= */
/*  ROTATE OVERLAY (Portrait warning)            */
/* ============================================= */
#rotate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(180deg, #0a1628 0%, #0d2847 50%, #1a4a7a 100%);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.rotate-content {
    text-align: center;
    animation: rotateBounce 2s ease-in-out infinite;
}

.rotate-icon {
    font-size: 4rem;
    margin-bottom: 10px;
    display: inline-block;
    animation: rotatePhone 2s ease-in-out infinite;
}

@keyframes rotatePhone {

    0%,
    100% {
        transform: rotate(0deg);
    }

    30%,
    70% {
        transform: rotate(90deg);
    }
}

.rotate-arrow {
    font-size: 3rem;
    color: var(--ocean-glow);
    margin-bottom: 16px;
    animation: arrowPulse 1.5s ease-in-out infinite;
}

@keyframes arrowPulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(0.9);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.rotate-text {
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1px;
    max-width: 260px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Show rotate overlay ONLY in portrait on mobile/tablet */
@media (orientation: portrait) and (max-width: 1024px) {
    #rotate-overlay {
        display: flex !important;
    }

    #game-container {
        display: none !important;
    }
}

/* Landscape: ensure everything is visible */
@media (orientation: landscape) {
    #rotate-overlay {
        display: none !important;
    }

    #game-container {
        display: block !important;
    }
}