@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;900&display=swap');

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

body {
    font-family: 'Poppins', sans-serif;
    background: #000000;
    color: white;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.text-cyan {
    color: #22d3ee;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: rgba(34, 211, 238, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(34, 211, 238, 0.2);
}

.header-dot {
    width: 0.5rem;
    height: 0.5rem;
    background: #22d3ee;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.header-title {
    font-size: 1.25rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.03em;
    line-height: 1;
}

.header-subtitle {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 0.15rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sync-indicator {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    transition: color 0.3s, background 0.3s, border-color 0.3s;
}

.sync-active {
    color: rgba(74, 222, 128, 0.9);
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.25);
}

.sync-inactive {
    color: rgba(251, 191, 36, 0.9);
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.sync-paused { color: rgba(251,191,36,.95); background:rgba(251,191,36,.12); border:1px solid rgba(251,191,36,.3); }
.room-join, .room-status { width:min(100%,700px); margin:0 auto .7rem; border:1px solid rgba(34,211,238,.26); border-radius:.75rem; background:rgba(34,211,238,.07); padding:1rem; }
.room-join.hidden, .room-status.hidden { display:none; }
.room-join h2 { font-size:1.2rem; font-weight:900; color:#67e8f9; }
.room-join p, .room-status { color:rgba(255,255,255,.82); font-size:.92rem; line-height:1.5; }
#room-join-form { display:flex; flex-wrap:wrap; align-items:end; gap:.55rem; margin-top:.75rem; }
#room-join-form label { position:static; flex:1 0 100%; color:#fff; font-size:.85rem; font-weight:700; }
#room-join-form input { flex:1 1 12rem; min-height:48px; border:1px solid rgba(255,255,255,.35); border-radius:.5rem; background:#111; color:#fff; padding:.6rem .75rem; font:inherit; font-size:1rem; }
#room-join-form button { min-height:48px; border:0; border-radius:.5rem; padding:.6rem 1rem; background:#67e8f9; color:#062b35; font:700 .88rem 'Poppins',sans-serif; cursor:pointer; }
.room-message { min-height:1.2em; color:#fda4af !important; margin-top:.5rem; }
.grid-cell.drawn:not(.marked) { border-color:rgba(103,232,249,.85); box-shadow:0 0 13px rgba(34,211,238,.45); }
.grid-cell:focus-visible, #room-join-form input:focus-visible, #room-join-form button:focus-visible { outline:3px solid #67e8f9; outline-offset:2px; }

.marked-counter {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(34, 211, 238, 0.7);
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.2);
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 .65rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    font-size: .78rem;
    font-weight: 800;
    transition: all 0.2s;
}

.back-link:hover {
    color: #22d3ee;
    border-color: rgba(34, 211, 238, 0.3);
}

main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0.5rem 1rem;
    width: 100%;
}

main > * {
    width: 100%;
    max-width: 650px;
}

body.joining-room .card-wrapper,
body.joining-room #drawn-history {
    display: none;
}

.card-wrapper {
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.bingo-alert {
    text-align: center;
    padding: 0.5rem;
    animation: bingoFlash 0.6s ease-in-out infinite alternate;
}

.bingo-alert.hidden {
    display: none;
}

.bingo-alert-text {
    font-size: 1.5rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: #22d3ee;
    text-shadow: 0 0 20px rgba(34, 211, 238, 0.8), 0 0 40px rgba(34, 211, 238, 0.4);
}

@keyframes bingoFlash {
    0% { opacity: 0.7; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.05); }
}

.bingo-celebration {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    overflow: hidden;
}

.bingo-celebration.hidden {
    display: none;
}

.bingo-celebration-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.97) 100%);
}

.bingo-celebration-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.bingo-celebration-title {
    font-size: clamp(3rem, 12vw, 7rem);
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #22d3ee, #a855f7, #ec4899, #eab308, #22d3ee);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: bingoTitleShimmer 3s ease-in-out infinite, bingoPulse 1.5s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 30px rgba(34, 211, 238, 0.5)) drop-shadow(0 0 60px rgba(168, 85, 247, 0.3));
}

@keyframes bingoTitleShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes bingoPulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 30px rgba(34, 211, 238, 0.5)) drop-shadow(0 0 60px rgba(168, 85, 247, 0.3)); }
    100% { transform: scale(1.06); filter: drop-shadow(0 0 50px rgba(34, 211, 238, 0.7)) drop-shadow(0 0 80px rgba(168, 85, 247, 0.5)); }
}

.bingo-celebration-subtitle {
    font-size: clamp(0.9rem, 3vw, 1.4rem);
    color: rgba(255,255,255,0.8);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    animation: subtitleFade 2s ease-in-out infinite alternate;
}

@keyframes subtitleFade {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

.bingo-winning-cells {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 90vw;
    padding: 1rem 0;
}

.bingo-winning-cell {
    width: clamp(50px, 14vw, 90px);
    height: clamp(50px, 14vw, 90px);
    border-radius: 0.5rem;
    overflow: hidden;
    border: 2px solid transparent;
    animation: winCellGlow 2s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

.bingo-winning-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@keyframes winCellGlow {
    0% { border-color: #22d3ee; box-shadow: 0 0 15px rgba(34, 211, 238, 0.7); transform: scale(1); }
    25% { border-color: #a855f7; box-shadow: 0 0 15px rgba(168, 85, 247, 0.7); }
    50% { border-color: #ec4899; box-shadow: 0 0 15px rgba(236, 72, 153, 0.7); transform: scale(1.08); }
    75% { border-color: #eab308; box-shadow: 0 0 15px rgba(234, 179, 8, 0.7); }
    100% { border-color: #22d3ee; box-shadow: 0 0 15px rgba(34, 211, 238, 0.7); transform: scale(1); }
}

.bingo-dismiss-btn {
    margin-top: 1rem;
    padding: 0.8rem 2.5rem;
    border-radius: 999px;
    border: 2px solid #22d3ee;
    background: transparent;
    color: #22d3ee;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bingo-dismiss-btn:hover {
    background: rgba(34, 211, 238, 0.15);
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.4);
}

.confetti-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    pointer-events: none;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translateY(100vh) rotate(720deg) scale(0.3); }
}

.spotlight {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: spotlightPulse 3s ease-in-out infinite alternate;
}

@keyframes spotlightPulse {
    0% { opacity: 0.15; transform: scale(1); }
    100% { opacity: 0.3; transform: scale(1.2); }
}

.fullcard-celebration {
    position: fixed;
    inset: 0;
    z-index: 410;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    overflow: hidden;
}

.fullcard-celebration-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(15,10,0,0.88) 0%, rgba(0,0,0,0.98) 100%);
}

.fullcard-celebration-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}

.fullcard-celebration-title {
    font-size: clamp(2.5rem, 11vw, 6rem);
    font-weight: 900;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #ef4444, #f97316, #fbbf24);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fullcardTitleShimmer 2.5s ease-in-out infinite, fullcardPulse 1.2s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 30px rgba(251, 191, 36, 0.6)) drop-shadow(0 0 60px rgba(245, 158, 11, 0.4));
}

@keyframes fullcardTitleShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes fullcardPulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 30px rgba(251, 191, 36, 0.6)) drop-shadow(0 0 60px rgba(245, 158, 11, 0.4)); }
    100% { transform: scale(1.05); filter: drop-shadow(0 0 50px rgba(251, 191, 36, 0.8)) drop-shadow(0 0 80px rgba(245, 158, 11, 0.6)); }
}

.fullcard-celebration-subtitle {
    font-size: clamp(0.8rem, 2.5vw, 1.2rem);
    color: rgba(251, 191, 36, 0.85);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    animation: subtitleFade 2s ease-in-out infinite alternate;
}

.fullcard-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    max-width: min(85vw, 400px);
    padding: 0.8rem 0;
}

.fullcard-grid-cell {
    width: clamp(40px, 14vw, 70px);
    height: clamp(40px, 14vw, 70px);
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    animation: fullcardCellGlow 3s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

.fullcard-grid-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@keyframes fullcardCellGlow {
    0% { border-color: #fbbf24; box-shadow: 0 0 12px rgba(251, 191, 36, 0.7); transform: scale(1); }
    20% { border-color: #ef4444; box-shadow: 0 0 12px rgba(239, 68, 68, 0.7); }
    40% { border-color: #a855f7; box-shadow: 0 0 12px rgba(168, 85, 247, 0.7); transform: scale(1.06); }
    60% { border-color: #22d3ee; box-shadow: 0 0 12px rgba(34, 211, 238, 0.7); }
    80% { border-color: #ec4899; box-shadow: 0 0 12px rgba(236, 72, 153, 0.7); transform: scale(1); }
    100% { border-color: #fbbf24; box-shadow: 0 0 12px rgba(251, 191, 36, 0.7); }
}

.fullcard-dismiss-btn {
    margin-top: 0.8rem;
    padding: 0.8rem 2.5rem;
    border-radius: 999px;
    border: 2px solid #fbbf24;
    background: transparent;
    color: #fbbf24;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.fullcard-dismiss-btn:hover {
    background: rgba(251, 191, 36, 0.15);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.fullcard-star {
    position: absolute;
    pointer-events: none;
    animation: starTwinkle linear forwards;
}

@keyframes starTwinkle {
    0% { opacity: 0; transform: translateY(0) rotate(0deg) scale(0); }
    15% { opacity: 1; transform: scale(1); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translateY(80vh) rotate(360deg) scale(0.2); }
}

.column-headers {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
    padding: 0 0 3px;
}

.col-header {
    text-align: center;
    font-size: clamp(0.9rem, 3vw, 1.4rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #22d3ee;
    padding: 0.3rem 0;
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.15);
    border-radius: 0.4rem;
}

.bingo-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
}

.grid-cell {
    position: relative;
    aspect-ratio: 1/1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.4rem;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.grid-cell:active {
    transform: scale(0.95);
}

.grid-cell.marked:not(.free-cell) {
    border-color: transparent;
    background: rgba(34, 211, 238, 0.05);
    animation: rainbowGlow 3s ease-in-out infinite;
}
.grid-cell.marked:not(.free-cell)::after {
    content: "Marked";
    position:absolute;
    top:3px;
    right:3px;
    z-index:3;
    padding:2px 4px;
    border-radius:4px;
    color:#001316;
    background:#a5f3fc;
    font-size:clamp(.42rem,1.25vw,.62rem);
    font-weight:900;
    line-height:1.15;
    text-transform:uppercase;
}

@keyframes rainbowGlow {
    0% { box-shadow: 0 0 10px rgba(34, 211, 238, 0.6), 0 0 25px rgba(34, 211, 238, 0.25), inset 0 0 8px rgba(34, 211, 238, 0.15); border-color: rgba(34, 211, 238, 0.8); }
    25% { box-shadow: 0 0 10px rgba(168, 85, 247, 0.6), 0 0 25px rgba(168, 85, 247, 0.25), inset 0 0 8px rgba(168, 85, 247, 0.15); border-color: rgba(168, 85, 247, 0.8); }
    50% { box-shadow: 0 0 10px rgba(236, 72, 153, 0.6), 0 0 25px rgba(236, 72, 153, 0.25), inset 0 0 8px rgba(236, 72, 153, 0.15); border-color: rgba(236, 72, 153, 0.8); }
    75% { box-shadow: 0 0 10px rgba(234, 179, 8, 0.6), 0 0 25px rgba(234, 179, 8, 0.25), inset 0 0 8px rgba(234, 179, 8, 0.15); border-color: rgba(234, 179, 8, 0.8); }
    100% { box-shadow: 0 0 10px rgba(34, 211, 238, 0.6), 0 0 25px rgba(34, 211, 238, 0.25), inset 0 0 8px rgba(34, 211, 238, 0.15); border-color: rgba(34, 211, 238, 0.8); }
}

.mark-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 299;
    pointer-events: none;
}

.mark-overlay {
    position: fixed;
    z-index: 300;
    border-radius: 0.6rem;
    overflow: hidden;
    pointer-events: none;
    will-change: transform, top, left, width, height;
}

.mark-overlay img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}

.mark-overlay-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    color: white;
    font-size: clamp(1rem, 4vw, 2rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-align: center;
    padding: 1.5rem 1rem 1rem;
    text-shadow: 0 0 20px rgba(34, 211, 238, 0.8);
    transition: opacity 0.4s ease;
}


.cell-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.grid-cell.marked .cell-image {
    opacity: 1;
}

.cell-number {
    display: none;
}

.cell-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    font-size: clamp(0.48rem, 1.35vw, 0.68rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: center;
    line-height: 1.15;
    padding: 2px 3px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.grid-cell.free-cell {
    background: rgba(34, 211, 238, 0.15);
    border-color: rgba(34, 211, 238, 0.4);
    cursor: default;
}

.free-cell .cell-number {
    display: block;
    font-size: clamp(1rem, 4vw, 1.8rem);
    font-weight: 900;
    color: #22d3ee;
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.6);
    position: relative;
}

.free-cell .cell-name {
    position: relative;
    background: none;
    font-size: clamp(0.5rem, 1.5vw, 0.7rem);
    color: rgba(34, 211, 238, 0.6);
}

.video-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.video-modal.hidden {
    display: none;
}

.video-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
}

.video-modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    overflow: hidden;
    z-index: 1;
}

.modal-close-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s;
    line-height: 1;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(34, 211, 238, 0.4);
}

.modal-video-wrap {
    width: 100%;
    aspect-ratio: 16/9;
    background: black;
}

.modal-video-wrap video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modal-info {
    padding: 1.25rem 1.5rem;
}

.modal-name {
    font-size: 1rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: white;
    margin-bottom: 0.5rem;
}

.modal-quote {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.4rem;
}

.modal-attr {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(34, 211, 238, 0.6);
}

.error-state {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.error-state.hidden {
    display: none;
}

.error-box {
    text-align: center;
    max-width: 400px;
}

.error-box h2 {
    font-size: 1.5rem;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 1rem;
    color: #22d3ee;
}

.error-box p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.error-link {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: white;
    color: black;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-decoration: none;
    transition: background 0.2s;
}

.error-link:hover {
    background: #e0f7fa;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.modal-ar-btn {
    padding: 0.5rem 1.2rem;
    border-radius: 999px;
    border: 1.5px solid rgba(34, 211, 238, 0.4);
    background: rgba(34, 211, 238, 0.1);
    color: #22d3ee;
    font-family: 'Poppins', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-ar-btn:hover {
    background: rgba(34, 211, 238, 0.25);
    border-color: rgba(34, 211, 238, 0.7);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.3);
}

.ar-modal {
    position: fixed;
    inset: 0;
    z-index: 350;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ar-modal.hidden {
    display: none;
}

.ar-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
}

.ar-modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    background: #111;
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 1.5rem;
    overflow: hidden;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

.ar-modal-header {
    padding: 1.25rem 1.5rem 0.75rem;
}

.ar-modal-name {
    font-size: 1rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: white;
}

.ar-widget-container {
    width: 100%;
    aspect-ratio: 4/5;
    position: relative;
    overflow: hidden;
}

.ar-widget-container iframe {
    width: 100% !important;
    height: 100% !important;
    border: none;
    display: block;
}

.ar-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: #111;
    z-index: 5;
}

.ar-loading.hidden {
    display: none;
}

.ar-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(34, 211, 238, 0.15);
    border-top-color: #22d3ee;
    border-radius: 50%;
    animation: arSpin 0.8s linear infinite;
}

@keyframes arSpin {
    to { transform: rotate(360deg); }
}

.ar-loading-text {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(34, 211, 238, 0.6);
}

@media (min-width: 768px) {
    header {
        padding: 1rem 2rem;
    }

    .header-icon {
        width: 3rem;
        height: 3rem;
    }

    .header-dot {
        width: 0.75rem;
        height: 0.75rem;
    }

    .header-title {
        font-size: 1.75rem;
    }

    .header-subtitle {
        font-size: 0.65rem;
    }

    .marked-counter {
        font-size: 0.8rem;
        padding: 0.5rem 1.2rem;
    }

    main {
        padding: 0 1rem 1.5rem;
    }

    .card-wrapper {
        max-width: min(650px, 80vh);
    }

    .bingo-grid {
        gap: 4px;
    }

    .column-headers {
        gap: 4px;
        padding-bottom: 4px;
    }
}

.drawn-history {
    padding: 1rem 1rem 2rem;
    max-width: 650px;
    width: 100%;
    margin: 0 auto;
    overflow-x: hidden;
}

.drawn-history-title {
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: rgba(34, 211, 238, 0.6);
    margin-bottom: 0.75rem;
    text-align: center;
}

.drawn-history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 40vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.drawn-history-list::-webkit-scrollbar {
    width: 4px;
}

.drawn-history-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.drawn-history-list::-webkit-scrollbar-thumb {
    background: rgba(34, 211, 238, 0.3);
    border-radius: 2px;
}

.drawn-history-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
}

.drawn-history-item .history-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.drawn-history-item .history-num {
    font-weight: 900;
    letter-spacing: 0.05em;
}

.drawn-history-item .history-name {
    color: rgba(255, 255, 255, 0.55);
    font-weight: 600;
}

.drawn-history-empty {
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 1rem 0;
}

/* Player-card accessibility: larger type, clearer actions, and dependable keyboard focus. */
.easy-view-toggle, .room-join-actions button, .room-join-actions a, .room-status-actions button, .room-status-actions a {
    min-height: 44px;
    border-radius: .55rem;
    padding: .65rem 1rem;
    font: 700 .82rem 'Poppins', sans-serif;
    letter-spacing: .04em;
    cursor: pointer;
}
.easy-view-toggle {
    border: 1px solid rgba(103,232,249,.55);
    background: rgba(34,211,238,.12);
    color: #cffafe;
}
.room-code-field { flex: 1 1 12rem; }
.room-code-field label { display: block; margin-bottom: .3rem; color: #fff; font-size: .85rem; }
.room-code-field input { width: 100%; min-height: 2.8rem; border: 1px solid rgba(255,255,255,.35); border-radius: .5rem; background:#111; color:#fff; padding:.55rem .7rem; font:inherit; }
.room-code-field.hidden, .room-join-actions.hidden, .room-status-actions.hidden { display: none; }
.room-join-actions, .room-status-actions { display:flex; flex-wrap:wrap; justify-content:center; gap:.6rem; margin:.75rem auto 1rem; }
.room-join-actions button, .room-join-actions a, .room-status-actions button, .room-status-actions a { border: 1px solid rgba(103,232,249,.65); background: transparent; color: #cffafe; text-decoration:none; display:inline-flex; align-items:center; }
.room-status-actions button { background:#67e8f9; color:#062b35; }
button:focus-visible, a:focus-visible, input:focus-visible, .grid-cell:focus-visible {
    outline: 3px solid #fef08a !important;
    outline-offset: 3px;
}
.back-link { min-width: 44px; min-height: 44px; }
.modal-close-btn, .modal-ar-btn { min-width: 44px; min-height: 44px; }
.grid-cell[role="gridcell"] { min-height: 44px; }

body.easy-view { font-size: 18px; }
body.easy-view .header-subtitle, body.easy-view .sync-indicator, body.easy-view .marked-counter { font-size: .78rem; }
body.easy-view .room-join, body.easy-view .room-status { max-width: 760px; padding: 1.2rem; }
body.easy-view .room-join h2 { font-size: 1.35rem; }
body.easy-view .room-join p, body.easy-view .room-status, body.easy-view #room-join-form input, body.easy-view .room-code-field input { font-size: 1rem; }
body.easy-view #room-join-form button { min-height: 3rem; font-size: .9rem; }
body.easy-view .card-wrapper { max-width: min(780px, 100%); }
body.easy-view .cell-name { font-size: clamp(.62rem, 1.75vw, .82rem); line-height: 1.25; padding: 3px; }
body.easy-view .drawn-history-title { font-size: .9rem; }
body.easy-view .drawn-history-item { font-size: .85rem; padding: 7px 12px; }

@media (max-width: 540px) {
    .header-right { gap: .3rem; }
    .marked-counter { display: none; }
    .easy-view-toggle { font-size: .68rem; padding: .45rem .55rem; }
    .room-join, .room-status { margin-bottom: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
