*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

:root {
    --wingo-dark: #165F84;
    --wingo-mid: #336F91;
    --wingo-light: #4A8BAD;
    --wingo-red: #E43312;
    --wingo-red-hover: #C62B0F;
    --board-bg: #0E4562;
    --cell-bg: #1B6E96;
    --board-radius: 12px;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: var(--wingo-dark);
    color: #FFF;
    overflow: hidden;
}

#game-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 420px;
    margin: 0 auto;
    padding: 12px 16px;
}

#game-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--wingo-mid);
    color: #FFF;
    text-decoration: none;
    transition: background 0.2s;
    flex-shrink: 0;
}

.back-link:hover {
    background: var(--wingo-light);
}

.header-logo {
    height: 36px;
    width: auto;
}

#game-container {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.top-bar {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.score-box {
    flex: 1;
    background: var(--board-bg);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.score-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
    line-height: 1;
}

.score-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

#board {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    background: var(--board-bg);
    border-radius: var(--board-radius);
    overflow: hidden;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--board-radius);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--board-radius);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
    pointer-events: none;
    background: rgba(14, 69, 98, 0.88);
}

.overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.overlay-title {
    font-size: 2rem;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.overlay-hint {
    font-size: 13px;
    opacity: 0.6;
    text-align: center;
    padding: 0 20px;
    margin-bottom: 8px;
}

.action-btn {
    background: var(--wingo-red);
    color: #FFF;
    border: none;
    border-radius: 10px;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    font-family: inherit;
}

.action-btn:hover {
    background: var(--wingo-red-hover);
}

.action-btn:active {
    transform: scale(0.96);
}

@media (max-width: 420px) {
    #game-wrap {
        padding: 8px 10px;
    }
    #game-header {
        margin-bottom: 10px;
    }
    .header-logo {
        height: 30px;
    }
    .score-value {
        font-size: 18px;
    }
    .overlay-title {
        font-size: 1.6rem;
    }
}

@media (min-width: 421px) {
    #game-wrap {
        justify-content: center;
    }
}
