html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Loading */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: radial-gradient(circle at 20% 10%, #24314a 0%, #0f1520 65%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-card {
    width: min(360px, 86vw);
    padding: 20px 18px;
    border-radius: 14px;
    border: 1px solid rgba(170, 201, 240, 0.35);
    background: linear-gradient(155deg, rgba(52, 74, 108, 0.32) 0%, rgba(18, 27, 42, 0.34) 100%);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
}

.loading-title {
    color: #e8edf7;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 12px;
    text-align: center;
}

.loading-bar-track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    border: 1px solid #405170;
    background: rgba(9, 14, 22, 0.75);
    overflow: hidden;
}

.loading-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4d86c9 0%, #78b8ff 100%);
    transition: width 0.2s ease;
}

.loading-status-text {
    color: #b9c6dd;
    font-size: 12px;
    text-align: center;
    margin-top: 10px;
}

/* Menu styles */
.menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 12, 20, 0.82);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: #e8edf7;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

.menu::before,
.menu::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    opacity: 0.24;
    pointer-events: none;
}

.menu::before {
    width: 340px;
    height: 340px;
    background: radial-gradient(circle, #4b7db8 0%, rgba(75, 125, 184, 0) 70%);
    top: -90px;
    left: -80px;
    animation: menuGlowA 11s ease-in-out infinite;
}

.menu::after {
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, #4e95c7 0%, rgba(78, 149, 199, 0) 72%);
    bottom: -130px;
    right: -90px;
    animation: menuGlowB 13s ease-in-out infinite;
}

.menu-card {
    position: relative;
    z-index: 1;
    width: min(300px, 84vw);
    padding: 22px 22px 18px;
    border-radius: 16px;
    border: 1px solid rgba(175, 207, 248, 0.34);
    background: linear-gradient(155deg, rgba(58, 83, 120, 0.26) 0%, rgba(20, 33, 52, 0.30) 100%);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px) saturate(125%);
    -webkit-backdrop-filter: blur(14px) saturate(125%);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.menu-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.04) 38%, rgba(255, 255, 255, 0) 60%);
    pointer-events: none;
}

.menu-card::after {
    content: "";
    position: absolute;
    width: 140px;
    height: 140px;
    top: -60px;
    right: -48px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(164, 211, 255, 0.26) 0%, rgba(164, 211, 255, 0) 72%);
    pointer-events: none;
}

.logo {
  width: 200px;
  display: block;
  margin: 0 auto 20px auto;
  animation: logoFloat 3.6s ease-in-out infinite;
  transform-origin: center;
  will-change: transform, filter;
}

@keyframes logoFloat {
    0% {
        transform: translateY(0) scale(1);
        filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
    }
    50% {
        transform: translateY(-8px) scale(1.015);
        filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.35));
    }
    100% {
        transform: translateY(0) scale(1);
        filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
    }
}

#aboutContent {
    padding: 6px 2px 10px;
    margin: 8px 0 16px;
    min-width: 260px;
    text-align: left;
    line-height: 1.7;
}

#aboutContent a {
    color: #8ec5ff;
}

#settingsContent {
    padding: 8px 2px 10px;
    margin: 8px 0 16px;
    min-width: 260px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.info-card {
    width: min(340px, 88vw);
}

.settings-row:last-child {
    margin-bottom: 0;
}

.settings-row button {
    min-width: 150px;
    margin: 0;
    padding: 10px 14px;
    font-size: 14px;
}

.settings-row span {
    font-size: 14px;
    color: #d7e3f8;
    min-width: 90px;
    text-align: left;
}

.menu button {
    background: linear-gradient(145deg, #20293a 0%, #161d2b 100%);
    color: #e8edf7;
    border: 1px solid #364159;
    padding: 15px 30px;
    margin: 10px;
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    min-width: 200px;
    transition: background 0.25s, transform 0.25s, border-color 0.25s;
}

.menu button:hover {
    background: linear-gradient(145deg, #27344a 0%, #1d2738 100%);
    border-color: #4e6488;
    transform: translateX(3px);
}

.hidden {
    display: none !important;
}

#mainMenu .menu-card > *:not(.logo) {
    animation: menuEntry 420ms ease both;
}

#mainMenu .logo {
    animation: menuEntry 420ms ease 50ms both, logoFloat 3.6s ease-in-out 520ms infinite;
}
#mainMenu #singlePlayerBtn { animation-delay: 120ms; }
#mainMenu #twoPlayerBtn { animation-delay: 180ms; }
#mainMenu #settingsBtn { animation-delay: 240ms; }
#mainMenu #aboutBtn { animation-delay: 300ms; }

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

@keyframes menuGlowA {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(26px, -12px) scale(1.08); }
}

@keyframes menuGlowB {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-24px, 14px) scale(1.06); }
}

/* Game UI styles */
.player-info {
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: linear-gradient(145deg, #222c3f 0%, #161f2e 100%);
    color: #e8edf7;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #3b4964;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    pointer-events: none;
    z-index: 100;
}

.current-player {
    font-weight: bold;
    margin-bottom: 8px;
}

.current-set {
    font-size: 12px;
    font-weight: bold;
    color: #b9c6dd;
    margin-bottom: 6px;
}

.current-hammer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #c6d3e8;
    margin-bottom: 6px;
}

.hammer-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    display: block;
}

.stone-track-row {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
}

.stone-track-row:last-of-type {
    margin-bottom: 0;
}

.stone-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.ai-status {
    color: #ffaa00;
    font-size: 12px;
    margin-top: 4px;
}

#powerContainer {
    position: fixed;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%);
    width: 240px;
    height: 24px;
    background: linear-gradient(145deg, rgba(24, 32, 46, 0.92) 0%, rgba(14, 20, 31, 0.92) 100%);
    border: 1px solid #3f4f6b;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

#powerBar {
    height: 100%;
    width: 0%;
    transition: width 0.1s ease-out;
    border-radius: 14px;
    box-shadow: inset 0 -2px 6px rgba(0, 0, 0, 0.22), 0 0 10px rgba(138, 198, 255, 0.3);
}

#gameUI {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    z-index: 99;
}

#menuBtn {
    position: fixed;
    top: 10px;
    left: 10px;
    background: linear-gradient(145deg, #222c3f 0%, #161f2e 100%);
    color: #e8edf7;
    border: 1px solid #3b4964;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 8px;
    cursor: pointer;
    pointer-events: auto;
    z-index: 100;
    transition: background 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#menuBtn:hover {
    background: linear-gradient(145deg, #293850 0%, #1f2b3d 100%);
    border-color: #4a5f81;
}

#menuBtn img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
}

#scoreBoard {
    position: fixed;
    bottom: 10px;
    right: 10px;
    min-width: 320px;
    background: linear-gradient(145deg, #222c3f 0%, #161f2e 100%);
    color: #e8edf7;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #3b4964;
    pointer-events: none;
    z-index: 100;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

.set-result-toast {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(17, 25, 39, 0.92);
    color: #e8edf7;
    border: 1px solid #3b4964;
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.2px;
    z-index: 101;
    pointer-events: none;
}


.score-board-title {
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 4px;
    letter-spacing: 0.4px;
}

.score-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.score-table th,
.score-table td {
    border: 1px solid #3f4f6b;
    padding: 3px 6px;
    text-align: center;
    background: #1b2435;
}

.score-table th {
    background: #26344b;
    font-weight: bold;
}

.team-red {
    color: #d20000;
    font-weight: bold;
}

.team-blue {
    color: #0066ff;
    font-weight: bold;
}

.score-total {
    font-weight: bold;
    color: #f4f7ff;
}

.active-set-cell {
    background: #324a73 !important;
    font-weight: bold;
}


@media (max-width: 720px) {
    #scoreBoard {
        min-width: 0;
        width: min(46vw, 220px);
        padding: 6px;
    }

    .score-table {
        table-layout: fixed;
        font-size: 10px;
    }

    .score-table th,
    .score-table td {
        padding: 2px 3px;
    }

    .score-board-title {
        font-size: 10px;
        margin-bottom: 3px;
    }
}

@media (max-width: 420px) {
    #scoreBoard {
        width: min(44vw, 190px);
        right: 6px;
        bottom: 6px;
    }

    .score-table {
        font-size: 9px;
    }
}

#gameOverMessage {
    margin: 20px 0;
    font-size: 24px;
    text-align: center;
}

