:root {
    --qookie-cell-size: clamp(1rem, min(calc((100vw - 2.5rem) / 20), calc((100vh - 14rem) / 20)), 2.5rem);
}
html, body {
    height: 100%;
}
body {
    font-family: 'Noto Sans KR', sans-serif;
    touch-action: manipulation;
    overflow-x: hidden;
    overflow-y: auto;
}
#fireworks-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Make canvas click-through */
    z-index: 100;
}
.board {
    display: grid;
    grid-template-columns: repeat(20, var(--qookie-cell-size));
    grid-template-rows: repeat(20, var(--qookie-cell-size));
    gap: 0;
    padding: 0;
}
.board-cell {
    width: var(--qookie-cell-size);
    height: var(--qookie-cell-size);
    border: 1px solid #94a3b8; /* slate-400 */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background-color: rgba(255, 255, 255, 0.05);
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.3), inset -2px -2px 5px rgba(255,255,255,0.5);
}
.score-hint {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(0.6rem, calc(var(--qookie-cell-size) * 0.45), 1rem);
    font-weight: bold;
    color: white;
    text-shadow: 0 0 4px black, 0 0 4px black;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s;
}
.highlight-valid .score-hint {
    opacity: 1;
}
.tile {
    width: calc(var(--qookie-cell-size) * 0.9);
    height: calc(var(--qookie-cell-size) * 0.9);
    border-radius: 0.375rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, #3c3c3c, #1a1a1a);
    box-shadow: inset 0 2px 3px rgba(255,255,255,0.15), 
                        inset 0 -3px 3px rgba(0,0,0,0.4), 
                        0 5px 8px rgba(0,0,0,0.4);
    transition: transform 0.1s, box-shadow 0.1s;
}
.tile::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 80%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: skewX(-30deg);
}
.tile:active {
    transform: translateY(2px);
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.15), 
                        inset 0 -2px 2px rgba(0,0,0,0.4), 
                        0 2px 4px rgba(0,0,0,0.3);
}
.tile svg {
    width: 80%;
    height: 80%;
    filter: drop-shadow(0 1px 1.5px rgba(0,0,0,0.6));
    z-index: 1;
}
.player-hand .tile.selected {
    transform: scale(1.15) translateY(-2px);
    box-shadow: 0 0 15px rgba(255, 255, 0, 0.9), 
                        inset 0 2px 3px rgba(255,255,255,0.15), 
                        inset 0 -3px 3px rgba(0,0,0,0.4);
    border: 2px solid #FBBF24;
}
.highlight-valid {
    background-color: rgba(74, 222, 128, 0.3) !important;
    border: 1px dashed #22c55e;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(192, 132, 252, 0.7); }
    50% { transform: scale(1.05); box-shadow: 0 0 10px 5px rgba(192, 132, 252, 0); }
}
.hint-cell {
    background-color: rgba(168, 85, 247, 0.3) !important; /* purple-500 with opacity */
    border: 2px solid #a855f7;
    animation: pulse 1.5s infinite;
}
.player-hand .tile.hint-tile {
    border: 3px solid #c084fc; /* purple-400 */
    transform: scale(1.1);
    animation: pulse 1.5s infinite;
}
.control-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: bold;
    transition: all 0.2s;
    color: white;
    min-width: 80px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.control-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.guide-content {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 1rem; /* for scrollbar */
}
.board-cell.center-cell {
    background-color: rgba(255, 255, 0, 0.1);
}
.board-cell.center-cell::before {
    content: '★';
    position: absolute;
    font-size: 1.5rem;
    color: rgba(0, 0, 0, 0.1);
    z-index: 0;
    pointer-events: none;
}

#game-board-container {
    width: min(100%, calc(var(--qookie-cell-size) * 20 + 8px));
    margin: 0 auto;
    max-height: calc(100vh - 18rem);
    background: linear-gradient(145deg, #e2e8f0, #94a3b8);
    border-radius: 0.75rem;
    border: 1.5px solid #969fac;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.25);
}

.full-size-mode #game-board-container {
    width: min(100%, calc(var(--qookie-cell-size) * 20 + 8px));
    margin: 0 auto;
    max-height: calc(100vh - 12rem);
}

.speech-bubble {
    position: relative;
    background: #ffffff;
    border-radius: .4em;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.speech-bubble:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 0;
    border: 20px solid transparent;
    border-top-color: #ffffff;
    border-bottom: 0;
    margin-left: -20px;
    margin-bottom: -20px;
}
