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

html, body {
    margin: 0;
    padding: 0;
    background-color: #000;
    height: 100%;
    width: 100%;
    position: fixed;
    overflow: hidden;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.site-logo {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 900;
    transition: opacity 0.3s ease;
}

.site-logo h2 {
    color: white;
    font-size: 24px;
    margin: 0;
    font-weight: bold;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.button-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 10px;
    transition: opacity 0.3s ease;
    opacity: 0.5;
}

.control-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    opacity: 0.7;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    opacity: 1;
}

.control-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    cursor: not-allowed;
    opacity: 0.3;
}

.control-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.05);
    opacity: 0.3;
}

.control-btn.active {
    background: rgba(100, 200, 255, 0.4);
    box-shadow: 0 0 10px rgba(100, 200, 255, 0.7);
    transform: scale(1.05);
}

.control-btn .material-icons {
    color: white;
    font-size: 24px;
}

.qr-container {
    display: grid;
    gap: 0;
    background-color: #000;
    padding: 0;
    aspect-ratio: 1;
    width: min(95vw, 95vh);
    height: min(95vw, 95vh);
    max-width: none;
    max-height: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: none;
}

.qr-cell {
    width: 100%;
    height: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
    border: none;
    outline: none;
    position: relative;
}

.qr-cell:hover {
    opacity: 0.8;
}

.qr-cell.breakable {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2L2 12l10 10 10-10L12 2z"/><path d="M12 6v12"/><path d="M6 12h12"/></svg>') 16 16, auto;
}

.qr-cell.breakable::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.qr-cell.breakable:hover::after {
    opacity: 1;
}

.qr-cell.broken {
    background-color: transparent !important;
    animation: breakTile 0.3s ease-out forwards;
}

@keyframes breakTile {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.5;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.qr-cell.black {
    background-color: #000;
}

.qr-cell.white {
    background-color: #fff;
}

.qr-cell.finder-pattern {
    background-color: #ff3333 !important;
    position: relative;
}

.qr-cell.finder-pattern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 51, 51, 0.2);
    pointer-events: none;
}

.qr-cell.finder-pattern.broken {
    background-color: transparent !important;
}

.qr-cell.alignment-pattern {
    background-color: #ff6666 !important;
    position: relative;
}

.qr-cell.alignment-pattern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 102, 102, 0.2);
    pointer-events: none;
}

.qr-cell.alignment-pattern.broken {
    background-color: transparent !important;
}

.qr-cell.timing-pattern {
    background-color: #ff9999 !important;
    position: relative;
}

.qr-cell.timing-pattern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 153, 153, 0.2);
    pointer-events: none;
}

.qr-cell.timing-pattern.broken {
    background-color: transparent !important;
}

.qr-cell.highlight {
    box-shadow: inset 0 0 0 1px rgba(100, 200, 255, 0.8);
}

.qr-cell.player-added {
    box-shadow: inset 0 0 0 1px rgba(255, 100, 100, 0.8);
}

.player-container {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    z-index: 10;
    opacity: 0.5;
    transition: opacity 0.3s ease;
    padding: 12px 16px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    width: 220px;
    margin-left: 20px;
}

.player-container:hover {
    opacity: 1;
}

#currentPlayer {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: none;
    width: 100%;
    text-align: left;
}

.qr-text-display {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: left;
    min-height: 1.2em;
    margin: 4px 0;
    padding: 6px 8px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    width: 100%;
    word-break: break-all;
}

.validation-result {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: left;
    min-height: 1.2em;
    margin-top: 4px;
    transition: opacity 0.3s ease;
    width: 100%;
}

.validation-result.valid {
    color: #4cd137;
}

.validation-result.invalid {
    color: #ff6b6b;
}

.color-picker {
    display: flex;
    gap: 10px;
}

.color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
}

.color:hover {
    transform: scale(1.1);
}

.color.selected {
    border-color: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.color.black {
    background-color: #000;
}

.color.white {
    background-color: #fff;
}

.hidden {
    display: none !important;
}

/* Overlay Styles */
.intro-overlay,
.game-over-overlay,
.info-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    text-align: center;
}

.intro-overlay h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    color: white;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
}

.intro-overlay p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    max-width: 600px;
}

.input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.player-selection {
    display: flex;
    gap: 20px;
    margin: 10px 0;
}

.player-selection label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    transition: all 0.2s ease;
}

.player-selection label:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.player-selection input[type="radio"] {
    margin: 0;
}

.player-selection input[type="radio"]:checked + label,
.player-selection label:has(input[type="radio"]:checked) {
    background-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

input[type="text"] {
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: white;
    font-size: 1rem;
    width: 100%;
}

input[type="text"]:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background-color: rgba(255, 255, 255, 0.15);
}

button {
    padding: 12px 20px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

button:active {
    transform: scale(0.98);
}

/* Remove scanner overlay styles */
.scanner-overlay {
    display: none;
}

/* Add validation result styles */
#scanResult {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 30px;
    background-color: rgba(0, 0, 0, 0.8);
    border-radius: 10px;
    font-weight: bold;
    z-index: 1000;
    text-align: center;
    animation: fadeInOut 2s ease-in-out forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* Game Over Overlay */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    overflow: hidden;
}

#gameOverContent {
    text-align: center;
    color: white;
    margin-bottom: 2rem;
    z-index: 1001;
}

#gameOverContent h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

#gameResult {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

#reviewQrBtn, #newGameBtn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#reviewQrBtn:hover, #newGameBtn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.falling-tiles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: 1;
}

.falling-tile {
    position: absolute;
    width: 20px;
    height: 20px;
    transform-origin: center;
    animation: fallAndSpin 2s ease-in forwards;
}

@keyframes fallAndSpin {
    0% {
        transform: translateY(-50px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Info Overlay */
.info-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    color: white;
    text-align: center;
}

.info-overlay h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.info-overlay p {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.game-modes {
    display: flex;
    gap: 2rem;
    margin: 1rem auto;
    width: 100%;
    max-width: 900px;
    justify-content: center;
}

.game-mode {
    flex: 1;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 10px;
    text-align: left;
}

.game-mode h3 {
    margin-top: 0;
    font-size: 1.5rem;
    color: #ff6b6b;
    text-align: center;
}

.game-mode p {
    text-align: center;
}

.game-mode ol {
    padding-left: 1.5rem;
    margin-top: 1rem;
}

.game-mode li {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.decoder-info {
    margin: 1.5rem auto;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 10px;
    width: 100%;
    max-width: 900px;
    text-align: center;
}

.decoder-info h3 {
    margin-top: 0;
    font-size: 1.5rem;
    color: #ff6b6b;
    margin-bottom: 0.8rem;
}

.decoder-info p {
    margin-bottom: 0;
    line-height: 1.5;
}

.credits {
    margin-top: 30px;
    font-size: 0.9rem;
    opacity: 0.7;
    text-align: center;
}

.credits-small {
    margin-top: 20px;
    font-size: 0.8rem;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.credits-small:hover {
    opacity: 0.8;
}

.library-credits, .library-credits-small {
    margin-top: 8px;
    font-size: 0.8rem;
    opacity: 0.8;
}

.library-credits-small {
    font-size: 0.7rem;
    margin-top: 5px;
}

.trademark-notice, .trademark-notice-small {
    margin-top: 8px;
    font-size: 0.75rem;
    opacity: 0.6;
    font-style: italic;
}

.trademark-notice-small {
    font-size: 0.65rem;
    margin-top: 5px;
}

.credits a, .credits-small a, .library-credits a, .library-credits-small a {
    color: white;
    text-decoration: none;
}

.credits a:hover, .credits-small a:hover, .library-credits a:hover, .library-credits-small a:hover {
    text-decoration: underline;
}

/* Fullscreen handling */
:fullscreen .button-container {
    opacity: 0;
    pointer-events: none;
}

:fullscreen .button-container.active {
    opacity: 1;
    pointer-events: auto;
}

:fullscreen .site-logo {
    opacity: 0;
    pointer-events: none;
}

:fullscreen .site-logo.active {
    opacity: 1;
    pointer-events: auto;
}

/* Media queries for responsiveness */
@media (max-width: 1024px) {
    .player-container {
        position: fixed;
        bottom: 20px;
        left: 50%;
        right: auto;
        top: auto;
        transform: translateX(-50%);
        flex-direction: row;
        align-items: center;
        justify-content: center;
        width: auto;
        max-width: 90%;
        gap: 15px;
        margin-left: 0;
    }

    #currentPlayer, .qr-text-display, .validation-result {
        width: auto;
        text-align: center;
    }

    .qr-text-display {
        min-width: 150px;
    }
}

@media (max-width: 768px) {
    .player-container {
        flex-direction: column;
        padding: 10px 14px;
        gap: 8px;
    }

    #currentPlayer, .qr-text-display, .validation-result {
        text-align: center;
        width: 100%;
    }

    .game-modes {
        flex-direction: column;
    }
    
    .info-overlay {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .control-btn {
        width: 35px;
        height: 35px;
    }
    
    .control-btn .material-icons {
        font-size: 20px;
    }
    
    #qrScanner {
        width: 200px;
        height: 200px;
    }
}

/* Auto-hide controls after a delay when moving mouse away */
body:not(:hover) .button-container {
    opacity: 0.3;
}

body:hover .button-container {
    opacity: 1;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.close-btn .material-icons {
    color: white;
    font-size: 24px;
}

.beta-tag {
    font-size: 0.4em;
    background-color: rgba(255, 51, 153, 0.7);
    color: white;
    padding: 3px 6px;
    border-radius: 4px;
    vertical-align: super;
    font-weight: bold;
    margin-left: 5px;
    letter-spacing: 1px;
} 