body {
    font-family: Arial, sans-serif;
    background: #f4f4f4;
    margin: 0;
    padding: 0;
}
.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-width: 1000px;
    min-height: 80vh;
    width: 95vw;
    max-width: 120vw;
    margin: 40px auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 30px 0 40px 0;
}
h1 {
    text-align: center;
    margin-bottom: 20px;
}
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}
.controls label {
    font-size: 1rem;
}
button {
    padding: 6px 16px;
    font-size: 1rem;
    border: none;
    border-radius: 4px;
    background: #1976d2;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}
button:hover {
    background: #1565c0;
}
button:disabled, input:disabled {
    background: #bdbdbd !important;
    color: #e0e0e0 !important;
    border: 1px solid #bdbdbd !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
    box-shadow: none !important;
}
button:disabled:hover, input:disabled:hover {
    background: #bdbdbd !important;
}
#status {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 20px;
    min-height: 24px;
}
#boardContainer {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
}
.layer {
    display: inline-block;
    margin: 0 8px;
}
.layer-title {
    text-align: center;
    font-weight: bold;
    margin-bottom: 4px;
}
.board {
    display: grid;
    gap: 4px;
    background: #e0e0e0;
    border-radius: 6px;
    padding: 6px;
}
.cell {
    width: 40px;
    height: 40px;
    background: #fafafa;
    border: 1px solid #bdbdbd;
    border-radius: 4px;
    font-size: 1.5rem;
    text-align: center;
    line-height: 40px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.cell.X {
    color: #1976d2;
    font-weight: bold;
}
.cell.O {
    color: #d32f2f;
    font-weight: bold;
}
.cell:disabled {
    background: #e0e0e0;
    color: #aaa;
    cursor: not-allowed;
}

/* 3D UI styles */
.board3d-container {
    perspective: 1200px;
    width: 400px;
    height: 400px;
    margin: 40px auto 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cube {
    width: 300px;
    height: 300px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(25deg) rotateY(-35deg);
    transition: transform 0.5s;
}
.cube-layer {
    position: absolute;
    left: 0; top: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(var(--width), 1fr);
    grid-template-rows: repeat(var(--height), 1fr);
    gap: 6px;
    opacity: 0.95;
    pointer-events: none;
}
.cube-cell {
    width: 40px;
    height: 40px;
    background: #fafafa;
    border: 1.5px solid #bdbdbd;
    border-radius: 4px;
    font-size: 1.5rem;
    text-align: center;
    line-height: 40px;
    font-weight: bold;
    color: #222;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s, color 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.cube-cell.X { color: #1976d2; }
.cube-cell.O { color: #d32f2f; }
.cube-cell:disabled {
    background: #e0e0e0;
    color: #aaa;
    cursor: not-allowed;
}
/* Each layer will be offset in Z */
.cube-layer[data-z] {
    transform: translateZ(calc(var(--z) * 40px));
}

/* three.js 3D UI styles */
#board3dContainer {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 90vw;
    height: 70vh;
    min-width: 600px;
    min-height: 500px;
    max-width: 98vw;
    max-height: 80vh;
    margin: 0 auto;
    background: #f4f4f4;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}
.threejs-canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    outline: none;
    background: #e0e0e0;
    border-radius: 10px;
}

.rotation-icon {
    position: absolute;
    right: 32px;
    top: 32px;
    width: 64px;
    height: 64px;
    z-index: 10;
    pointer-events: auto;
    cursor: grab;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rotation-icon canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.status3d-centered {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 500;
    margin: 24px 0 12px 0;
    width: 100%;
}

.cube-cell-hovered {
    filter: brightness(0.7);
}

/* Instructions section */
.instructions {
    margin-top: 30px;
    padding: 20px 40px;
    background: #f9f9f9;
    border-radius: 8px;
    max-width: 700px;
    text-align: left;
}
.instructions h2 {
    margin-top: 0;
    font-size: 1.3rem;
    color: #333;
}
.instructions ul {
    padding-left: 20px;
    margin: 12px 0;
}
.instructions li {
    margin: 8px 0;
    line-height: 1.5;
}
.instructions p {
    margin: 10px 0;
    line-height: 1.5;
}
