:root {
    --bg-dark: #050a1f;
    --primary: #5c27fe;
    --primary-hover: #7b4dff;
    --secondary: #1f3a93;
    --danger: #e74c3c;
    --text-main: #f0f3f8;
    --text-muted: #8e9bb0;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden; /* Prevent pull-to-refresh on mobile */
    height: 100vh;
    width: 100vw;
}

/* Background Stars Effect */
.stars, .twinkling {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    display: block;
    z-index: -2;
}
.stars {
    background: #000 url('https://raw.githubusercontent.com/ajmwagar/space-backgrounds/master/stars.png') repeat top center;
}
.twinkling {
    background: transparent url('https://raw.githubusercontent.com/ajmwagar/space-backgrounds/master/twinkling.png') repeat top center;
    z-index: -1;
    animation: move-twink-back 200s linear infinite;
}
@keyframes move-twink-back {
    from {background-position: 0 0;}
    to {background-position: -10000px 5000px;}
}

/* Screens */
.screen {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    position: absolute;
    top: 0;
    left: 0;
}
.screen.active {
    display: flex;
}

/* Typography */
.glow-text {
    font-family: 'Orbitron', 'Noto Sans KR', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    text-align: center;
    line-height: 1.3;
    margin-bottom: 40px;
    text-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary);
}

/* Buttons */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 300px;
}
.btn {
    padding: 15px 20px;
    border-radius: 12px;
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: 'Noto Sans KR', sans-serif;
}
.btn small { font-size: 0.8rem; font-weight: 400; opacity: 0.9; }
.btn:active { transform: scale(0.95); }
.btn.primary { background: linear-gradient(135deg, var(--primary), #9d4edd); box-shadow: 0 4px 15px rgba(92, 39, 254, 0.4); }
.btn.danger { background: linear-gradient(135deg, #c0392b, var(--danger)); box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4); }
.btn.secondary { background: var(--glass-bg); border: 1px solid var(--glass-border); backdrop-filter: blur(10px); }
.btn.full-width { width: 100%; margin-top: 20px; padding: 12px; }
.btn:disabled { opacity: 0.5; filter: grayscale(1); cursor: not-allowed; }

/* In-game Layout */
#gameScreen {
    justify-content: space-between;
    padding: 10px;
}

.icon-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    font-size: 1.2rem;
    backdrop-filter: blur(5px);
    z-index: 10;
    cursor: pointer;
}

.area {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}
.computer-area { flex: 1; justify-content: flex-start; margin-top: 40px;}
.center-area { height: 140px; justify-content: center; }
.player-area { flex: 1; justify-content: flex-end; margin-bottom: 20px;}

.label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 5px 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
}

/* Hands and Tiles */
.hand {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    max-width: 600px;
    padding: 5px;
}

.tile {
    width: 80px;
    height: 115px;
    border-radius: 12px;
    background: linear-gradient(145deg, #111830, #1a2540);
    border: 2px solid #2a3b60;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: transform 0.3s, border-color 0.3s;
    cursor: pointer;
    overflow: hidden;
}
.tile.hidden {
    background: linear-gradient(145deg, #0d1225, #141c30);
    border-color: #1a2540;
}
.tile.hidden::after {
    content: '?';
    font-size: 3.5rem;
    font-weight: 800;
    color: rgba(255,255,255,0.1);
    font-family: 'Orbitron', sans-serif;
}
.tile.exposed {
    border-color: #e74c3c;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.6);
    filter: grayscale(80%) brightness(0.6);
}
.tile.exposed::after {
    content: '발각됨';
    position: absolute;
    top: -1px;
    right: -1px;
    background: #e74c3c;
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 3px 6px;
    border-bottom-left-radius: 8px;
    border-top-right-radius: 10px;
    z-index: 10;
    font-family: 'Noto Sans KR', sans-serif;
    letter-spacing: 0;
}
.tile:active { transform: scale(0.9); }
.tile.selected { border-color: var(--primary); box-shadow: 0 0 15px var(--primary); }

/* Tile content layouts */
.tile-b {
    text-align: center;
}
.tile-b .en { font-family: 'Orbitron', sans-serif; font-size: 0.85rem; font-weight: 800; color: #ddd; letter-spacing: 1px;}
.tile-b .ko { font-size: 1.25rem; font-weight: 900; color: #fff; margin-top: 8px;}

.tile-c img, .tile-a img {
    width: 62px;
    height: 62px;
    object-fit: contain;
    margin-bottom: 6px;
    border-radius: 8px;
}
.tile-c .god-ko {
    font-size: 0.95rem;
    font-weight: 700;
    color: #e0e0e0;
}
.tile-c, .tile-a { padding: 8px; }

/* Center Deck */
.center-deck { margin-top: 10px; }
.draw-pile {
    width: 90px;
    height: 45px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), #9d4edd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(92, 39, 254, 0.4);
    cursor: pointer;
}
.draw-pile:active { transform: scale(0.95); }
.status-message {
    font-size: 1rem;
    text-align: center;
    color: #ffd700;
    margin-bottom: 10px;
    line-height: 1.4;
    min-height: 2.8em;
    font-weight: 700;
}
.deck-info {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.deck-info span { font-weight: 700; color: #fff; }

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.active { display: flex; }

.modal-content {
    background: linear-gradient(145deg, #0d1225, #141c30);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 25px;
    width: 100%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    max-height: 90vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 2rem;
    line-height: 1;
    color: #fff;
    cursor: pointer;
}

h2 { margin-bottom: 15px; font-size: 1.4rem; text-align: center; color: var(--text-main); }

.help-section { margin-bottom: 20px; }
.help-section h3 { font-size: 1rem; color: #9d4edd; margin-bottom: 5px; }
.help-section p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px;}
.order-list {
    background: rgba(0,0,0,0.3);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #ffd700;
    text-align: center;
}

/* Guess Modal specific */
.guess-selectors { display: flex; flex-direction: column; gap: 20px; margin-top: 15px; }
.selector-group label { display: block; margin-bottom: 8px; font-weight: 700; color: #aaa; font-size: 0.9rem; }
.flex-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.sel-btn {
    flex: 1 1 calc(25% - 8px);
    padding: 10px 5px;
    background: #1a2540;
    border: 1px solid #2a3b60;
    color: #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}
.sel-btn.active {
    background: var(--primary);
    border-color: var(--primary-hover);
    color: #fff;
    box-shadow: 0 0 10px rgba(92, 39, 254, 0.5);
    transform: scale(1.05);
}
.type-btn { flex: 1 1 calc(33.3% - 8px); }
.hide { display: none !important; }

/* God Dictionary */
.god-dictionary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(65px, 1fr));
    gap: 10px;
    margin-top: 10px;
}
.god-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0,0,0,0.3);
    padding: 8px;
    border-radius: 8px;
    text-align: center;
}
.god-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-bottom: 5px;
    border-radius: 5px;
}
.god-item span {
    font-size: 0.7rem;
    color: #ffd700;
    line-height: 1.3;
    font-weight: 700;
}

/* Tutorial Overlay */
.tutorial-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 200;
}
body.tutorial-active {
    pointer-events: none;
}
.spotlight-target, .spotlight-target *, .tutorial-box, .tutorial-box * {
    pointer-events: auto !important;
}
.tutorial-overlay.active {
    pointer-events: none;
}
.spotlight {
    position: fixed;
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.7), 0 0 20px 5px #ffd700;
    pointer-events: none; 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 201;
}
.tutorial-overlay:not(.active) .spotlight { display: none; }
.tutorial-box {
    position: fixed;
    background: #ffd700;
    color: #111;
    padding: 15px;
    border-radius: 12px;
    font-weight: 800;
    width: 280px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 202;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: all;
    font-size: 1rem;
    line-height: 1.5;
}
.tutorial-overlay:not(.active) .tutorial-box { display: none; }
.tutorial-box::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 15px 15px 0;
    border-style: solid;
    border-color: #ffd700 transparent transparent transparent;
}
.tutorial-box.top-arrow::after {
    top: -15px; bottom: auto;
    border-width: 0 15px 15px;
    border-color: transparent transparent #ffd700 transparent;
}
.spotlight-target {
    position: relative;
    z-index: 205 !important;
    pointer-events: auto !important;
}
