* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-family: 'MS Sans Serif', 'Segoe UI', Tahoma, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    overflow-x: auto;
}

@media (max-width: 544px) {
    body {
        align-items: flex-start;
    }
}

#game-container {
    position: relative;
    width: 528px;
    height: 384px;
    display: flex;
    flex-shrink: 0;
    background: #000;
}

#sidebar-canvas {
    width: 144px;
    height: 384px;
    cursor: default;
}

#board-canvas {
    width: 384px;
    height: 384px;
    cursor: default;
}

footer {
    width: 528px;
    font-size: 14px;
    margin-top: 16px;
    text-align: center;
    color: #666;
}

footer a {
    color: #aaa;
    text-decoration: none;
}

footer a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Context Menu */
.context-menu {
    position: absolute;
    background: #f0f0f0;
    border: 1px solid #999;
    box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
    font-size: 13px;
    z-index: 100;
    min-width: 200px;
    padding: 2px 0;
}

.context-menu.hidden {
    display: none;
}

.menu-item {
    padding: 4px 24px 4px 28px;
    cursor: default;
    white-space: nowrap;
    position: relative;
    color: #000;
}

.menu-item:hover {
    background: #0078d4;
    color: #fff;
}

.menu-item.disabled {
    color: #888;
    pointer-events: none;
}

.menu-item.disabled:hover {
    background: transparent;
    color: #888;
}

.menu-item.checked::before {
    content: '\2022';
    position: absolute;
    left: 10px;
    font-size: 16px;
    line-height: 1;
}

.menu-separator {
    height: 1px;
    background: #ccc;
    margin: 2px 0;
}

.menu-submenu {
    position: relative;
}

.menu-submenu > .menu-item::after {
    content: '\25B6';
    position: absolute;
    right: 8px;
    font-size: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.menu-submenu > .menu-item:hover::after {
    color: #fff;
}

.submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: -2px;
    background: #f0f0f0;
    border: 1px solid #999;
    box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
    min-width: 160px;
    padding: 2px 0;
}

.menu-submenu:hover > .submenu,
.menu-submenu.touch-open > .submenu {
    display: block;
}

/* About overlay */
#about-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

#about-overlay.hidden {
    display: none;
}

#about-dialog {
    cursor: pointer;
}

#about-canvas {
    display: block;
    width: 320px;
    height: 185px;
}

/* HiDPI support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #game-container {
        width: 528px;
        height: 384px;
    }
}
