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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    line-height: 1.6;
    min-height: 100vh;
}

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.back-link {
    display: inline-block;
    color: #4ecca3;
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.back-link:hover {
    text-decoration: underline;
}

h1 {
    text-align: center;
    color: #4ecca3;
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.score-board {
    display: flex;
    gap: 2rem;
    font-size: 1.1rem;
}

.score-board strong {
    color: #4ecca3;
}

.game-area {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.canvas-wrapper {
    position: relative;
}

#game-canvas {
    border: 2px solid #4ecca3;
    border-radius: 4px;
    display: block;
    background: #1a1a2e;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.next-piece {
    background: #1a1a2e;
    border: 2px solid #4ecca3;
    border-radius: 4px;
    padding: 0.5rem;
    text-align: center;
}

.next-piece p {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

#next-canvas {
    display: block;
    margin: 0 auto;
}

.level-info {
    background: #1a1a2e;
    border: 2px solid #4ecca3;
    border-radius: 4px;
    padding: 0.75rem;
    text-align: center;
}

.level-info p {
    margin: 0.25rem 0;
}

.level-info strong {
    color: #4ecca3;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 26, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    border-radius: 4px;
}

.overlay.hidden {
    display: none;
}

.overlay p {
    font-size: 1.5rem;
    color: #e94560;
}

.overlay button {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    background: #4ecca3;
    color: #0f0f1a;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.overlay button:hover {
    background: #3db892;
}

.overlay .share-btn {
    background: #2a9d8f;
    margin-top: 0.5rem;
}

.overlay .share-btn:hover {
    background: #248c7f;
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.control-row {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.25rem;
    background: #1a1a2e;
    color: #4ecca3;
    border: 2px solid #4ecca3;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.control-btn.wide {
    width: 7.5rem;
    font-size: 1rem;
}

.control-btn:active {
    background: #4ecca3;
    color: #0f0f1a;
}

.instructions {
    font-size: 0.9rem;
    color: #888;
    text-align: center;
}

.content {
    padding-top: 1rem;
    border-top: 1px solid #2a2a3e;
}

.content h2 {
    color: #4ecca3;
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
}

.content h2:first-child {
    margin-top: 1rem;
}

.content p {
    margin-bottom: 0.75rem;
}

.content ul {
    margin: 0.5rem 0 1rem 1.5rem;
}

.content li {
    margin-bottom: 0.5rem;
}

@media (min-width: 600px) {
    main {
        padding: 2rem;
    }

    h1 {
        font-size: 2rem;
    }

    .controls {
        display: none;
    }

    .instructions {
        font-size: 1rem;
    }
}

@media (hover: none) {
    .controls {
        display: flex;
    }
}

@media (max-width: 400px) {
    #game-canvas {
        width: 200px;
        height: 400px;
    }

    .side-panel {
        display: none;
    }
}
