/* ============================================
   BLOKSTAD - Game Styles
   ============================================ */

.game-body {
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #87CEEB;
}

/* HUD */
.hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 1rem;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 100;
    flex-shrink: 0;
}

.hud-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hud-logo {
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--dark-blue);
    letter-spacing: 1px;
}

.hud-level {
    font-weight: 700;
    color: var(--sky-blue);
    font-size: 0.9rem;
}

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

.hud-coins {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--dark-blue);
    background: #FFF8E1;
    padding: 0.3rem 1rem;
    border-radius: 20px;
    border: 2px solid var(--golden-yellow);
}

.hud-wood {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 800;
    font-size: 1.1rem;
    color: #5D4037;
    background: #EFEBE9;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    border: 2px solid #8D6E63;
}

.wood-icon {
    font-size: 1.2rem;
}

.hud-stones {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 800;
    font-size: 1.1rem;
    color: #546E7A;
    background: #ECEFF1;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    border: 2px solid #78909C;
}

.stone-icon {
    font-size: 1.2rem;
}

.coin-icon::before {
    content: '\26C1';
    font-size: 1.3rem;
    color: var(--golden-yellow);
}

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

.hud-player {
    font-weight: 700;
    color: var(--dark-blue);
    font-size: 0.9rem;
}

.hud-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    background: white;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    position: relative;
    text-decoration: none;
    color: var(--dark-blue);
}

.hud-btn:hover {
    border-color: var(--sky-blue);
    background: #e3f2fd;
}

.hud-btn-small {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
    color: #999;
}

.bell-icon::before {
    content: '\1F514';
    font-size: 1rem;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger-red);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* Game Canvas Container */
.game-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: default;
}

/* Classmates bar */
.classmates-bar {
    padding: 0.4rem 1rem;
    background: rgba(255,255,255,0.9);
    flex-shrink: 0;
    z-index: 100;
}

.classmates-list {
    display: flex;
    gap: 0.8rem;
    overflow-x: auto;
    align-items: center;
    font-size: 0.85rem;
}

.classmate-tag {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    background: #f5f5f5;
    white-space: nowrap;
    font-weight: 600;
}

.classmate-tag.imprisoned {
    background: #ffe0e0;
    color: var(--danger-red);
}

.classmate-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Monster attack overlay */
.monster-attack {
    position: fixed;
    inset: 0;
    background: rgba(180, 0, 0, 0.55);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: monsterFlash 0.3s ease-out;
    pointer-events: none;
}
.monster-attack-content {
    text-align: center;
    animation: monsterShake 0.5s ease-in-out;
}
.monster-attack-icon {
    font-size: 5rem;
    display: block;
    margin-bottom: 0.5rem;
    animation: monsterPulse 0.6s ease-in-out infinite alternate;
}
.monster-attack-text {
    font-size: 1.6rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
@keyframes monsterFlash {
    0% { background: rgba(255, 0, 0, 0.8); }
    100% { background: rgba(180, 0, 0, 0.55); }
}
@keyframes monsterShake {
    0%, 100% { transform: translateX(0); }
    10%, 50%, 90% { transform: translateX(-8px); }
    30%, 70% { transform: translateX(8px); }
}
@keyframes monsterPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.15); }
}

/* Prison banner (top bar while imprisoned) */
.prison-banner {
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    z-index: 400;
}
.prison-banner-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    background: rgba(80, 0, 0, 0.88);
    padding: 0.7rem 1.5rem;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.prison-banner-icon { font-size: 1.3rem; }
.prison-banner-text { flex-shrink: 0; }
.prison-banner-help {
    background: var(--sky-blue) !important;
    color: white !important;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.prison-banner-help:hover { background: #1e88e5 !important; }

.prison-help-panel {
    background: rgba(30, 0, 0, 0.94);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}
.prison-help-panel:not(.hidden) {
    max-height: 60vh;
    overflow-y: auto;
}
.prison-help-inner {
    padding: 1.2rem 1.5rem;
    max-width: 420px;
    margin: 0 auto;
}
.prison-help-inner h3 {
    color: #ccc;
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.prison-classmates {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 160px;
    overflow-y: auto;
}

.prison-classmate-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
}

.prison-classmate-name {
    flex: 1;
    color: #eee;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: left;
}

.btn-ping {
    background: var(--sky-blue);
    color: white;
    border: none;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-ping:hover { background: #1e88e5; }
.btn-ping.pinged { background: var(--grass-green); cursor: default; }
.btn-ping:disabled { opacity: 0.7; cursor: default; }

.prison-divider {
    border-top: 1px solid rgba(255,255,255,0.15);
    margin: 1rem 0;
}

.prison-invite {
    display: flex;
    gap: 0.5rem;
}

.prison-invite input {
    flex: 1;
    padding: 0.5rem 0.8rem;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 0.9rem;
    font-family: inherit;
}

.prison-invite input::placeholder { color: rgba(255,255,255,0.4); }
.prison-invite input:focus { outline: none; border-color: var(--sky-blue); }

#prison-invite-status {
    margin-top: 0.4rem;
    font-size: 0.85rem;
}

.prison-tip {
    color: var(--golden-yellow);
    font-weight: 700;
    font-size: 0.9rem;
    margin-top: 0.8rem;
}

.prison-panel-close {
    margin-top: 0.8rem;
    background: rgba(255,255,255,0.15) !important;
    color: #ccc !important;
    border: none;
    width: 100%;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-card {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 460px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    margin-bottom: 1rem;
}

.puzzle-category {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.puzzle-category[data-cat="rekenen"] { background: #e3f2fd; color: #1565C0; }
.puzzle-category[data-cat="taal"] { background: #e8f5e9; color: #2e7d32; }
.puzzle-category[data-cat="raadsel"] { background: #fff3e0; color: #e65100; }
.puzzle-category[data-cat="woordspel"] { background: #f3e5f5; color: #7b1fa2; }

.puzzle-question {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark-blue);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.puzzle-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.puzzle-option {
    padding: 0.8rem 1rem;
    border: 3px solid #e0e0e0;
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    transition: all 0.15s;
    color: var(--dark-blue);
}

.puzzle-option:hover {
    border-color: var(--sky-blue);
    background: #e3f2fd;
}

.puzzle-option.selected {
    border-color: var(--sky-blue);
    background: var(--sky-blue);
    color: white;
}

.puzzle-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 3px solid #e0e0e0;
    border-radius: var(--radius-sm);
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    font-family: inherit;
}

.puzzle-input:focus {
    outline: none;
    border-color: var(--sky-blue);
}

.modal-footer {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.modal-footer .btn {
    flex: 1;
}

/* Result modal */
.result-card {
    text-align: center;
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.result-icon.coin::before { content: '\1F4B0'; }
.result-icon.monster::before { content: '\1F47E'; }
.result-icon.prison::before { content: '\1F511'; }
.result-icon.empty::before { content: '\1F3E0'; }
.result-icon.wrong::before { content: '\274C'; }

/* Leaderboard */
.leaderboard-list {
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem;
    border-bottom: 1px solid #eee;
}

.leaderboard-rank {
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--dark-blue);
    width: 30px;
    text-align: center;
}

.leaderboard-rank.gold { color: var(--golden-yellow); }
.leaderboard-rank.silver { color: #aaa; }
.leaderboard-rank.bronze { color: #cd7f32; }

.leaderboard-name {
    flex: 1;
    font-weight: 700;
}

.leaderboard-coins {
    font-weight: 800;
    color: var(--golden-yellow);
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 60px;
    right: 1rem;
    z-index: 600;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: white;
    border-radius: var(--radius-sm);
    padding: 0.8rem 1.2rem;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease-out;
    max-width: 320px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast.freed { border-left: 4px solid var(--grass-green); }
.toast.coin { border-left: 4px solid var(--golden-yellow); }
.toast.monster { border-left: 4px solid var(--danger-red); }
.toast.info { border-left: 4px solid var(--sky-blue); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Notifications panel */
.notif-panel {
    position: fixed;
    top: 50px;
    right: 0.5rem;
    width: 300px;
    max-height: 400px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 300;
    padding: 1rem;
    overflow-y: auto;
}

.notif-panel h3 {
    margin-bottom: 0.8rem;
}

.notif-item {
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.notif-item:last-child {
    border-bottom: none;
}

/* Level complete */
.level-complete-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.level-complete-content {
    text-align: center;
    color: white;
    animation: celebrate 0.5s ease-out;
}

.level-complete-content h1 {
    color: var(--golden-yellow);
    font-size: 3rem;
    margin-bottom: 1rem;
}

.level-complete-content p {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

@keyframes celebrate {
    from { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); }
    to { transform: scale(1); opacity: 1; }
}

/* Controls Wrapper (action toolbar + D-pad) */
.controls-wrapper {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    user-select: none;
    -webkit-user-select: none;
}

/* Action Toolbar */
.action-toolbar {
    display: flex;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(0,0,0,0.4);
    border-radius: 16px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.action-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.15);
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s;
    padding: 2px;
}
.action-btn:hover { background: rgba(255,255,255,0.3); }
.action-btn:active { transform: scale(0.9); background: rgba(255,255,255,0.4); }

.action-icon { font-size: 1.3rem; line-height: 1; }

.action-progress {
    width: 30px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    overflow: hidden;
}
.action-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width 0.15s ease;
}
.action-progress-fill.axe-fill { background: #8BC34A; }
.action-progress-fill.pickaxe-fill { background: #42A5F5; }

.action-label {
    font-size: 0.55rem;
    font-weight: 800;
    opacity: 0.8;
    line-height: 1;
}

.action-chat { background: rgba(49,183,233,0.5); border-color: rgba(49,183,233,0.6); }
.action-build { background: rgba(231,76,60,0.5); border-color: rgba(231,76,60,0.6); }
.action-path { background: rgba(120,144,156,0.5); border-color: rgba(120,144,156,0.6); }
.action-axe { background: rgba(93,64,55,0.5); border-color: rgba(141,110,99,0.6); }
.action-pickaxe { background: rgba(84,110,122,0.5); border-color: rgba(120,144,156,0.6); }

.axe-shake { animation: axe-swing 0.2s ease; }
.pickaxe-shake { animation: pickaxe-swing 0.2s ease; }

/* D-pad Controls */
.dpad {
    display: grid;
    grid-template-areas:
        ".    up   ."
        "left ctr  right"
        ".    down .";
    grid-template-columns: 52px 52px 52px;
    grid-template-rows: 52px 52px 52px;
    gap: 4px;
    opacity: 0.75;
    touch-action: none;
}

.dpad-btn {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.4);
    background: rgba(0,0,0,0.35);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s;
}

.dpad-btn:active { background: rgba(0,0,0,0.6); }
.dpad-up { grid-area: up; }
.dpad-left { grid-area: left; }
.dpad-center { grid-area: ctr; background: rgba(0,0,0,0.15); border: none; pointer-events: none; }
.dpad-right { grid-area: right; }
.dpad-down { grid-area: down; }

/* Avatar Builder */
.avatar-builder-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    background: #f0f4f8;
    border: 3px solid #e0e0e0;
}

.avatar-options {
    width: 100%;
}

.avatar-option-group {
    margin-bottom: 0.6rem;
}

.avatar-option-label {
    display: block;
    font-weight: 700;
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
}

.avatar-option-row {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding: 0.3rem 0;
    -webkit-overflow-scrolling: touch;
}

.avatar-option {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.avatar-option:hover { transform: scale(1.1); }
.avatar-option.selected { border-color: var(--sky-blue); transform: scale(1.15); box-shadow: 0 2px 8px rgba(33,150,243,0.3); }

.avatar-option-text {
    border-radius: 8px;
    width: auto;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: #f0f0f0;
    color: #333;
}

.avatar-option-text.selected {
    background: var(--sky-blue);
    color: white;
}

/* Responsive */
@media (max-width: 600px) {
    .hud {
        padding: 0.3rem 0.5rem;
        flex-wrap: wrap;
        gap: 0.3rem;
    }
    .hud-left { order: 1; }
    .hud-center { order: 3; width: 100%; justify-content: center; }
    .hud-right { order: 2; }
    .hud-logo { font-size: 1rem; }
    .hud-level { display: none; }
    .hud-player { display: none; }
    .hud-coins { font-size: 1rem; }
    .modal-card { padding: 1.2rem; }
    .puzzle-question { font-size: 1.1rem; }
    .puzzle-options { grid-template-columns: 1fr; }
    .controls-wrapper { bottom: 30px; }
    .dpad {
        grid-template-columns: 46px 46px 46px;
        grid-template-rows: 46px 46px 46px;
    }
    .dpad-btn { width: 46px; height: 46px; font-size: 1rem; }
    .action-btn { width: 38px; height: 38px; }
    .action-icon { font-size: 1.1rem; }
    .chat-panel { left: 0; right: 0; bottom: 0; width: 100%; height: 50vh; border-radius: 12px 12px 0 0; }
}

/* ===== Chat ===== */
.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #FF4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.chat-panel {
    position: fixed;
    bottom: 280px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 380px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 501;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-header {
    background: #31B7E9;
    color: #fff;
    padding: 0.6rem 1rem;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.chat-msg {
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    background: #f4f4f4;
}
.chat-msg-own {
    background: #E3F2FD;
}
.chat-msg-header {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.15rem;
}
.chat-msg-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.chat-msg-name {
    font-weight: bold;
    font-size: 0.8rem;
}
.chat-msg-time {
    font-size: 0.7rem;
    color: #999;
    margin-left: auto;
}
.chat-msg-text {
    font-size: 0.85rem;
    word-break: break-word;
}
.chat-input-row {
    display: flex;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}
.chat-input-row input {
    flex: 1;
    border: none;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    outline: none;
}
.chat-send {
    background: #31B7E9;
    color: #fff;
    border: none;
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 1rem;
}
.chat-send:hover { background: #2098C4; }

/* ===== Lives (Hearts) ===== */
.hud-lives {
    display: flex;
    gap: 2px;
    align-items: center;
}
.heart {
    font-size: 1.2rem;
    transition: all 0.3s;
    line-height: 1;
}
.heart.full {
    color: #e74c3c;
}
.heart.empty {
    color: #555;
    opacity: 0.3;
}
.heart.losing {
    animation: heartBreak 0.5s ease-out;
}
@keyframes heartBreak {
    0% { transform: scale(1); color: #e74c3c; }
    30% { transform: scale(1.4); color: #ff0000; }
    100% { transform: scale(0.8); color: #555; opacity: 0.3; }
}

/* ===== Game Time & Werewolf ===== */
.hud-clock {
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}
.hud-sword {
    font-size: 1.2rem;
    animation: sword-pulse 1.5s ease-in-out infinite;
}
@keyframes sword-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}
.werewolf-attack {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(30, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: werewolf-flash 0.3s ease-out;
}
@keyframes werewolf-flash {
    0% { background: rgba(255, 0, 0, 0.9); }
    100% { background: rgba(30, 0, 0, 0.85); }
}
.werewolf-attack-content {
    text-align: center;
    color: #fff;
}
.werewolf-attack-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: wolf-shake 0.5s ease-in-out infinite;
}
@keyframes wolf-shake {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}
.werewolf-attack-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #FF4444;
}
.pause-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pause-content {
    color: #fff;
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    animation: pause-pulse 2s ease-in-out infinite;
}
@keyframes pause-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Build buttons are now in action toolbar */

/* Old standalone buttons removed — now in action toolbar */
@keyframes axe-swing {
    0% { transform: rotate(0deg); }
    30% { transform: rotate(-15deg); }
    60% { transform: rotate(5deg); }
    100% { transform: rotate(0deg); }
}
@keyframes pickaxe-swing {
    0% { transform: rotate(0deg); }
    30% { transform: rotate(-15deg); }
    60% { transform: rotate(5deg); }
    100% { transform: rotate(0deg); }
}

/* Color Picker */
.color-picker-options {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 1rem 0;
}
.color-option {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}
.color-option:hover {
    transform: scale(1.15);
}
.color-option.selected {
    border-color: #fff;
    box-shadow: 0 0 0 3px #333, 0 4px 12px rgba(0,0,0,0.3);
    transform: scale(1.2);
}

/* House Interior Buttons */
.hud-exit-house {
    position: fixed;
    bottom: 240px;
    left: 20px;
    z-index: 95;
    background: linear-gradient(135deg, #5D4037, #4E342E);
    color: #fff;
    border: 3px solid #8D6E63;
    border-radius: 2rem;
    padding: 0.6rem 1.2rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.hud-exit-house:hover {
    transform: scale(1.05);
}

.hud-furniture {
    position: fixed;
    bottom: 240px;
    left: 190px;
    z-index: 95;
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: #fff;
    border: none;
    border-radius: 2rem;
    padding: 0.6rem 1.2rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: build-bounce 2s ease-in-out infinite;
}
.hud-furniture:hover {
    transform: scale(1.05);
}

/* Furniture Shop */
.furniture-catalog {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin: 1rem 0;
    max-height: 300px;
    overflow-y: auto;
}
.furniture-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.6rem 0.4rem;
    border: 2px solid #e0e0e0;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
}
.furniture-item:hover:not(.disabled) {
    border-color: #FF9800;
    background: #FFF3E0;
    transform: scale(1.03);
}
.furniture-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.furniture-emoji {
    font-size: 1.5rem;
}
.furniture-name {
    font-weight: 700;
    font-size: 0.85rem;
}
.furniture-price {
    font-size: 0.8rem;
    color: #F57C00;
    font-weight: 700;
}
.furniture-placement {
    text-align: center;
    margin: 0.5rem 0;
}
.furniture-placement canvas {
    border: 2px solid #ccc;
    border-radius: 0.5rem;
    cursor: pointer;
    max-width: 100%;
}
.placement-hint {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: #333;
}
.coin-badge {
    background: #FFD700;
    color: #333;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-weight: 800;
}

/* --- Visit Banner --- */
.visit-banner {
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    z-index: 900;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.visit-banner-text {
    flex: 1;
    text-align: center;
}
.btn-warning {
    background: #fff;
    color: #e67e22;
    border: none;
    border-radius: 0.5rem;
    padding: 0.3rem 0.8rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.btn-warning:hover {
    background: #ffecd2;
}

/* --- Level Selector --- */
.level-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 60vh;
    overflow-y: auto;
    padding: 0.25rem;
}
.level-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.2s;
    background: #fff;
}
.level-card:hover {
    transform: scale(1.02);
    border-color: #aaa;
}
.level-card.completed {
    border-color: #2ecc71;
    background: #f0fdf4;
}
.level-card.current {
    border-color: #f39c12;
    background: #fff8ed;
}
.level-card.visiting {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.3);
}
.level-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.level-card-name {
    font-size: 0.9rem;
    color: #666;
}
.level-card-coins {
    font-size: 0.85rem;
    color: #888;
}
.level-badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-weight: 700;
}
.level-badge-completed {
    background: #d5f5e3;
    color: #27ae60;
}
.level-badge-current {
    background: #fdebd0;
    color: #e67e22;
}

/* --- Tutorial --- */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 100px;
}
.tutorial-overlay.hidden { display: none; }
.tutorial-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    max-width: 400px;
    width: 90vw;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    animation: tutorialPop 0.3s ease-out;
}
@keyframes tutorialPop {
    from { transform: scale(0.8) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.tutorial-msg {
    font-size: 1.05rem;
    margin-bottom: 1rem;
    line-height: 1.5;
    color: #333;
}
.tutorial-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}
.tutorial-highlight {
    position: relative;
    z-index: 9500;
    animation: tutorialPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.7), 0 0 15px rgba(255, 215, 0, 0.4);
    border-radius: 8px;
}
@keyframes tutorialPulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.7), 0 0 15px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(255, 215, 0, 0.9), 0 0 25px rgba(255, 215, 0, 0.6); }
}

/* --- Achievements --- */
.achievement-toast {
    position: fixed;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #f9e547 0%, #e6a817 100%);
    color: #4a3800;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 20px rgba(230, 168, 23, 0.5);
    z-index: 10000;
    transition: top 0.4s ease-out;
    font-size: 0.95rem;
    max-width: 90vw;
}
.achievement-toast.show {
    top: 16px;
}
.achievement-toast-icon {
    font-size: 1.8rem;
}
.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 60vh;
    overflow-y: auto;
    padding: 0.5rem 0;
}
.achievement-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    background: #f8f9fa;
}
.achievement-item.unlocked {
    background: linear-gradient(135deg, #fef9e7 0%, #fdebd0 100%);
    border: 1px solid #f0c040;
}
.achievement-item.locked {
    opacity: 0.5;
}
.achievement-icon {
    font-size: 1.4rem;
}
