@font-face {
    font-family: 'Norse';
    src: url('../font/Norse.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Norse-Bold';
    src: url('../font/Norsebold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
}

:root {
    --highlight-color: #ffffff;
    --ui-bg: rgba(0, 0, 0, 0.8);
    --text-color: #00ff00;
    /* Retro terminal green */
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    /* Prevent iOS scroll/bounce */
    background-color: #000000;
    font-family: 'Courier New', Courier, monospace;
    color: var(--text-color);
}


#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    /* No background image - canvas handles all map rendering */
    background-color: #2b2b80;
    /* Ocean blue background */
}


canvas {
    display: block;
    width: 100%;
    height: 100%;
    /* Canvas is transparent so background shows through */
    background: transparent;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to canvas */
    display: flex;
    justify-content: space-between;
    padding: 10px;
}

/* Fullscreen Toggle Button */
#btn-fullscreen {
    pointer-events: auto;
    position: absolute;
    bottom: 18px;
    left: 18px;
    width: 42px;
    height: 42px;
    padding: 9px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    backdrop-filter: blur(8px);
    cursor: pointer;
    z-index: 1100;
    color: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.2;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
    touch-action: auto;
}

#btn-fullscreen:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    opacity: 0.8;
}

#btn-fullscreen:active {
    transform: scale(0.9);
}

#btn-fullscreen svg {
    width: 100%;
    height: 100%;
    display: block;
}

.ui-panel {
    pointer-events: auto;
    z-index: 10;
}

/* Top Right Container - holds action panel, dice panel, and faction list */
#top-right-container {
    position: absolute;
    right: clamp(15px, 4vw, 50px);
    display: flex;
    flex-direction: row;
    gap: clamp(6px, 1vw, 15px);
    align-items: flex-start;
    pointer-events: none;
    z-index: 10;
}

/* ===== ACTION PANEL - Stone Display ===== */
#action-panel {
    pointer-events: auto;
    width: clamp(200px, 22vw, 340px);
    height: clamp(60px, 7vw, 100px);
    background: url('/static/img/display.webp') no-repeat center center;
    background-size: 100% 100%;
    /* Override panel-box */
    background-color: transparent !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}


/* Glassmorphism Panels */
.panel-box {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 8px;
    color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

#turn-indicator {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

#phase-indicator {
    font-size: 1rem;
    color: #aaa;
}

/* ===== FACTION LIST - Parchment Scroll ===== */
#stats-panel {
    width: clamp(160px, min(18vw, 38vh), 250px);
    height: clamp(160px, min(18vw, 38vh), 250px);
    background: url('/static/img/factionlist.webp') no-repeat center center;
    background-size: 100% 100%;
    /* Override panel-box glassmorphism */
    background-color: transparent !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

#faction-list {
    width: 100%;
    padding: clamp(12px, min(2.5vw, 5vh), 34px) clamp(14px, min(2.2vw, 4.5vh), 30px) clamp(10px, min(2vw, 4vh), 28px) clamp(14px, min(2.2vw, 4.5vh), 30px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
}

.faction-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(2px, min(0.5vw, 1vh), 8px) clamp(4px, min(0.8vw, 1.5vh), 12px);
    border-bottom: none;
    font-size: clamp(0.78rem, min(1.4vw, 2.8vh), 1.2rem);
    font-family: 'Norse-Bold', sans-serif;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border-radius: 3px;
    transition: all 0.15s ease;
}

.faction-row:last-child {
    border-bottom: none;
}


.faction-row.active-turn {
    background: rgba(255, 255, 255, 0.15);
    text-shadow: 0 0 6px currentColor, 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.faction-row.roulette-highlight {
    background: rgba(255, 255, 255, 0.12);
}

.faction-row.roulette-final {
    background: rgba(255, 255, 255, 0.25);
    text-shadow: 0 0 10px currentColor, 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.faction-arrow {
    opacity: 0;
}

.active-turn .faction-arrow {
    opacity: 1;
}

#action-text {
    font-family: 'Norse-Bold', sans-serif;
    font-size: clamp(1.0rem, 1.4vw, 1.4rem);
    color: #00e5ff;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.4), 1px 1px 2px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

#army-count {
    font-family: 'Norse-Bold', sans-serif;
    font-size: clamp(0.8rem, 1vw, 1.2rem);
    color: #b9c0c1;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    margin-top: 10px;
}

/* ===== TURN BUTTON - Stone Medallion (Bottom Right) ===== */
.turn-btn {
    position: absolute;
    right: clamp(15px, 4vw, 50px);
    width: clamp(60px, 7vw, 110px);
    height: clamp(60px, 7vw, 110px);
    background: url('/static/img/turnbutton.webp') no-repeat center center;
    background-size: 100% 100%;
    border: none;
    cursor: pointer;
    pointer-events: auto;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    padding-bottom: clamp(0px, 0.2vw, 2px);
    transition: filter 0.3s ease, transform 0.15s ease;
    /* Active state: normal colors */
    filter: brightness(1.1);
}

.turn-btn-text {
    font-family: 'Norse-Bold', sans-serif;
    font-size: clamp(0.9rem, 1.1vw, 1.3rem);
    color: #00e5ff;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.6), 0 0 16px rgba(0, 229, 255, 0.3), 1px 1px 2px rgba(0, 0, 0, 0.9);
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.1;
    pointer-events: none;
}

.turn-btn:hover {
    filter: brightness(1.3);
    transform: scale(1.05);
}

.turn-btn:active {
    transform: scale(0.95);
}

/* Disabled state: gray/desaturated */
.turn-btn:disabled {
    filter: grayscale(0.7) brightness(0.7);
    cursor: default;
}

.turn-btn:disabled .turn-btn-text {
    color: #8a9a9e;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.turn-btn:disabled:hover {
    filter: grayscale(0.7) brightness(0.7);
    transform: none;
}





/* Modal */
.hidden {
    display: none !important;
}

/* Game Over Modal - Stone Theme */

#modal-overlay {
    pointer-events: auto;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: modalFadeIn 0.3s ease-out;
}


#modal-content {
    position: relative;
    width: min(44vw, 544px, 72vh);
    aspect-ratio: 1040 / 680;
    background: url('/static/img/victory.webp') no-repeat center center;
    background-size: contain;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    background-color: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 10% 6% 10% 6%;
    box-sizing: border-box;
    font-family: 'Norse-Bold', sans-serif;
    color: #e0f7fa;
    text-align: center;
    filter: drop-shadow(0 0 16px rgba(43, 226, 233, 0.4));
    gap: clamp(4px, 1vh, 10px);
}

/* VICTORY / GAME OVER title — color set by JS */
#modal-title {
    font-family: 'Norse-Bold', sans-serif;
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 4px;
    /* Default fallback, JS overrides color */
    color: #2a3b40;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.12), 0 -1px 1px rgba(0, 0, 0, 0.6);
}

/* When JS sets color, add matching glow */
#modal-title[style*="color"] {
    text-shadow: 0 0 20px currentColor, 0 0 40px currentColor, 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Stats area */
#modal-message {
    width: 80%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(2px, 0.6vh, 8px);
}

/* Winner name row */
.winner-name-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: clamp(6px, 1vw, 12px);
    margin-bottom: clamp(2px, 0.5vh, 6px);
}

.winner-name {
    font-family: 'Norse-Bold', sans-serif;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.winner-label {
    font-family: 'Norse-Bold', sans-serif;
    font-size: clamp(0.95rem, 1.6vw, 1.3rem);
    color: #4ade80;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
}

/* Decorative divider */
.modal-divider {
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(43, 226, 233, 0.4), rgba(43, 226, 233, 0.6), rgba(43, 226, 233, 0.4), transparent);
    margin: clamp(2px, 0.4vh, 6px) 0;
}

/* Stats grid */
.stats-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1px, 0.3vh, 5px);
    width: 100%;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(6px, 1vw, 14px);
    font-family: sans-serif;
    font-size: clamp(0.8rem, 1.3vw, 1.1rem);
    letter-spacing: 0.5px;
}

.stat-icon {
    font-size: clamp(0.7rem, 1.1vw, 0.95rem);
    width: 18px;
    text-align: center;
}

.stat-label {
    color: #94acb3;
    min-width: clamp(40px, 5vw, 65px);
    text-align: right;
}

.stat-value {
    font-weight: bold;
    min-width: clamp(30px, 3vw, 50px);
    text-align: left;
}

.stat-kills .stat-value {
    color: #4ade80;
}

.stat-deaths .stat-value {
    color: #f87171;
}

.stat-kd .stat-value {
    color: #fbbf24;
}

#modal-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    width: 100%;
    margin-top: clamp(2px, 0.5vh, 8px);
}

#btn-confirm {
    background: rgba(74, 222, 128, 0.1);
    color: #bef0f0;
    border: 2px solid #4ade80;
    padding: clamp(5px, 0.8vh, 10px) clamp(25px, 4vw, 55px);
    font-family: 'Norse-Bold', sans-serif;
    font-size: clamp(1rem, 1.8vw, 1.5rem);
    letter-spacing: 2px;
    text-transform: uppercase;
    border-radius: clamp(4px, 0.8vw, 10px);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 0 12px rgba(190, 240, 240, 0.2),
        0 0 6px rgba(43, 226, 233, 0.15);
    text-shadow: 0 0 10px rgba(43, 226, 233, 0.6);
}

#btn-confirm:hover {
    filter: brightness(1.1);
}

#btn-confirm:active {
    transform: scale(0.97);
}



/* Move Modal - Stone Theme */
#move-modal {
    pointer-events: auto;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

#move-content {
    position: relative;
    /* Panel2: 1040x680, aspect ~1.529 — %40 küçültüldü */
    width: min(35vw, 435px, 58vh);
    aspect-ratio: 1040 / 680;
    background: url('/static/img/panel2.webp') no-repeat center center;
    background-size: contain;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* İçerik panele yayılsın — confirm aşağı kayar */
    justify-content: space-between;
    background-color: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 10% 4% 10% 4%;
    box-sizing: border-box;
    font-family: 'Norse-Bold', sans-serif;
    color: #e0f7fa;
    text-align: center;
    /* Tek simetrik turkuaz glow — offset yok */
    filter: drop-shadow(0 0 16px rgba(43, 226, 233, 0.4));
}

#move-content h2 {
    font-family: 'Norse-Bold', sans-serif;
    font-size: clamp(1.6rem, 3vw, 2.6rem);
    color: #2a3b40;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.12), 0 -1px 1px rgba(0, 0, 0, 0.6);
    letter-spacing: 2px;
    margin: 0 0 3% 0;
    text-transform: uppercase;
    white-space: nowrap;
}

#move-content>p {
    /* sans-serif kullanılıyor — Norse-Bold fontu doğası gereği sadece büyük harf gösterir */
    font-family: sans-serif;
    font-size: clamp(0.8rem, 1.3vw, 1.05rem);
    color: #c5d8da;
    margin: 0;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.slider-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 1.5vw, 16px);
    /* 100% width = tüm içerik alanı (padding ile trims) */
    width: 100%;
    margin: 0;
}

#move-slider {
    /* stone-slider style */
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 8px;
    background: #1a262b;
    border-radius: 4px;
    outline: none;
    border: 1px solid #4ade80;
    cursor: pointer;
}

#move-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: clamp(18px, 2vw, 26px);
    height: clamp(18px, 2vw, 26px);
    border-radius: 50%;
    background: #4ade80;
    cursor: pointer;
    box-shadow: 0 0 15px #4ade80;
}

#move-slider::-moz-range-thumb {
    width: clamp(18px, 2vw, 26px);
    height: clamp(18px, 2vw, 26px);
    border-radius: 50%;
    background: #4ade80;
    cursor: pointer;
    box-shadow: 0 0 15px #4ade80;
    border: none;
}

#move-count {
    font-family: 'Norse-Bold', sans-serif;
    font-size: clamp(1.4rem, 2.5vw, 2.2rem);
    font-weight: bold;
    color: #4ade80;
    text-shadow: 0 0 12px rgba(74, 222, 128, 0.7);
    /* Sabit genişlik — slider'ın alanını çalmaz */
    width: clamp(24px, 2.5vw, 36px);
    flex-shrink: 0;
    text-align: center;
}

#move-buttons {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 2%;
}

/* Move Confirm Button - stone theme (mode-text rengi #bef0f0) */
#btn-move-confirm {
    background: rgba(190, 240, 240, 0.08);
    color: #bef0f0;
    border: 2px solid #4ade80;
    padding: clamp(6px, 1vh, 12px) clamp(20px, 3.5vw, 50px);
    font-family: 'Norse-Bold', sans-serif;
    font-size: clamp(1rem, 1.8vw, 1.6rem);
    letter-spacing: 2px;
    text-transform: uppercase;
    border-radius: clamp(4px, 0.8vw, 10px);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 0 12px rgba(190, 240, 240, 0.2),
        0 0 6px rgba(43, 226, 233, 0.15);
    text-shadow: 0 0 10px rgba(43, 226, 233, 0.6);
}

#btn-move-confirm:hover {
    filter: brightness(1.1);
}


#btn-move-confirm:active {
    transform: scale(0.97);
    background: rgba(74, 222, 128, 0.4);
}

/* Overlay Container (for modals) */
.overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}



/* Difficulty Slider */
#difficulty-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: linear-gradient(to right, #004400, #00ff00);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

#difficulty-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: #00ff00;
    border: 3px solid #004400;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px #00ff00;
}

#difficulty-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #00ff00;
    border: 3px solid #004400;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px #00ff00;
}

/* ===== MAIN MENU STYLES ===== */
.main-menu-container {
    width: 520px;
    max-width: 95%;
    text-align: center;
    padding: 40px 30px;
    background: rgba(0, 20, 40, 0.85);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(56, 189, 248, 0.4);
    border-radius: 20px;
    box-shadow:
        0 0 60px rgba(56, 189, 248, 0.2),
        0 25px 50px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: menuFadeIn 0.6s ease-out;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.menu-header {
    margin-bottom: 35px;
}

.game-title {
    font-size: 2.4rem;
    font-weight: bold;
    letter-spacing: 3px;
    margin: 0;
    background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgba(56, 189, 248, 0.5));
}

.game-subtitle {
    margin: 10px 0 0 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 2px;
}

.menu-section {
    position: relative;
    animation: sectionFadeIn 0.4s ease-out;
}

@keyframes sectionFadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.section-label {
    font-size: 0.8rem;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 20px;
    text-transform: uppercase;
}

/* Mode Selection Buttons */
.mode-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.mode-btn {
    flex: 1;
    max-width: 200px;
    padding: 25px 20px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    color: white;
}

.mode-btn:hover:not(:disabled) {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.5);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(56, 189, 248, 0.2);
}

.mode-btn:active:not(:disabled) {
    transform: translateY(-1px);
}

.mode-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.mode-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.mode-title {
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.mode-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Back Button */
.back-btn {
    position: absolute;
    top: -20px;
    left: 5px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Difficulty Section */
#difficulty-section {
    position: relative;
}

.difficulty-display-wrapper {
    margin: 25px 0 20px 0;
}

.difficulty-level {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 5px;
}


.slider-wrapper {
    padding: 0 10px;
    margin-bottom: 25px;
}

#difficulty-slider {
    width: 100%;
    margin-bottom: 10px;
}

.slider-marks {
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
}

.difficulty-description {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    min-height: 40px;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Start Button */
.start-btn {
    position: relative;
    background: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%);
    border: none;
    padding: 18px 50px;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    overflow: hidden;
    transition: all 0.3s ease;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(16, 185, 129, 0.4);
}

.start-btn:active {
    transform: translateY(0);
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: btnShine 3s infinite;
}

@keyframes btnShine {
    0% {
        left: -100%;
    }

    50% {
        left: 100%;
    }

    100% {
        left: 100%;
    }
}

.btn-text {
    position: relative;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}







/* ===== RESPONSIVE SCALING FOR HIGH DPI / ZOOM ===== */
/* Scale down panels when viewport is smaller (high zoom or small screens) */
@media screen and (max-height: 600px) {
    #top-right-container {
        transform: scale(1.0);
        transform-origin: top right;
        top: 10px;
    }
}

@media screen and (max-height: 450px) {
    #top-right-container {
        transform: scale(0.85);
        transform-origin: top right;
        top: 5px;
    }
}











/* ===== DICE PANEL - Stone Tablet ===== */
#dice-panel {
    width: clamp(80px, 10vw, 150px);
    aspect-ratio: 1.15 / 1;
    background: url('/static/img/dice.webp') no-repeat center center;
    background-size: 100% 100%;
    /* Override panel-box glassmorphism */
    background-color: transparent !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: clamp(2px, 0.3vw, 6px) !important;
}

#dice-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(6px, 0.8vw, 14px);
}

.dice-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(2px, 0.3vw, 6px);
}

.dice-label {
    font-family: 'Norse-Bold', sans-serif;
    font-size: clamp(0.5rem, 0.81vw, 1.0rem);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.attacker-dice .dice-label {
    color: #4fc3f7;
    text-shadow: 0 0 8px #4fc3f7;
}

.defender-dice .dice-label {
    color: #ff7043;
    text-shadow: 0 0 8px #ff7043;
}

/* ===== REALISTIC DICE ===== */
.dice {
    width: clamp(18px, 2.2vw, 30px);
    height: clamp(18px, 2.2vw, 30px);
    border-radius: 4px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 3px;
    gap: 1px;
    position: relative;
    transition: all 0.3s ease;

    /* Realistic dice appearance - 10% transparent */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(232, 232, 232, 0.9) 50%, rgba(208, 208, 208, 0.9) 100%);
    border: 2px solid #888;
    box-shadow:
        2px 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 0 3px rgba(255, 255, 255, 0.8),
        inset -2px -2px 5px rgba(0, 0, 0, 0.1);
}


/* Dice dots */
.dice .dot {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: transparent;
    transition: background 0.2s ease;
}

.dice .dot.visible {
    background: radial-gradient(circle at 30% 30%, #444, #000);
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.3);
}

/* Dot positions in 3x3 grid:
   1 2 3
   4 5 6
   7 8 9
*/

/* Number 1: center only (dot-5) */
.dice[data-value="1"] .dot-5 {
    background: radial-gradient(circle at 30% 30%, #444, #000);
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.3);
}

/* Number 2: top-right and bottom-left (dot-3, dot-7) */
.dice[data-value="2"] .dot-3,
.dice[data-value="2"] .dot-7 {
    background: radial-gradient(circle at 30% 30%, #444, #000);
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.3);
}

/* Number 3: diagonal (dot-3, dot-5, dot-7) */
.dice[data-value="3"] .dot-3,
.dice[data-value="3"] .dot-5,
.dice[data-value="3"] .dot-7 {
    background: radial-gradient(circle at 30% 30%, #444, #000);
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.3);
}

/* Number 4: four corners (dot-1, dot-3, dot-7, dot-9) */
.dice[data-value="4"] .dot-1,
.dice[data-value="4"] .dot-3,
.dice[data-value="4"] .dot-7,
.dice[data-value="4"] .dot-9 {
    background: radial-gradient(circle at 30% 30%, #444, #000);
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.3);
}

/* Number 5: four corners + center (dot-1, dot-3, dot-5, dot-7, dot-9) */
.dice[data-value="5"] .dot-1,
.dice[data-value="5"] .dot-3,
.dice[data-value="5"] .dot-5,
.dice[data-value="5"] .dot-7,
.dice[data-value="5"] .dot-9 {
    background: radial-gradient(circle at 30% 30%, #444, #000);
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.3);
}

/* Number 6: two columns (dot-1, dot-4, dot-7, dot-3, dot-6, dot-9) */
.dice[data-value="6"] .dot-1,
.dice[data-value="6"] .dot-4,
.dice[data-value="6"] .dot-7,
.dice[data-value="6"] .dot-3,
.dice[data-value="6"] .dot-6,
.dice[data-value="6"] .dot-9 {
    background: radial-gradient(circle at 30% 30%, #444, #000);
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.3);
}

/* Initial state (no value) - show question mark style */
.dice[data-value="0"] {
    background: linear-gradient(135deg, #555 0%, #333 100%);
}

.dice-vs {
    font-family: 'Norse-Bold', sans-serif;
    font-size: clamp(0.6rem, 0.9vw, 1.1rem);
    color: #ffd54f;
    text-shadow: 0 0 10px #ffd54f;
    margin-top: clamp(10px, 1.5vw, 22px);
}

#dice-result {
    font-family: 'Norse-Bold', sans-serif;
    margin-top: clamp(4px, 0.5vw, 10px);
    font-size: clamp(0.6rem, 0.9vw, 1.1rem);
    letter-spacing: 1px;
    text-align: center;
    min-height: 10px;
}

#dice-result.win {
    color: #4caf50;
    text-shadow: 0 0 10px #4caf50;
}

#dice-result.loss {
    color: #f44336;
    text-shadow: 0 0 10px #f44336;
}

/* Dice animations */
.dice.rolling {
    animation: diceRoll 0.4s ease-out;
}

@keyframes diceRoll {
    0% {
        transform: scale(0.5) rotate(-180deg);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.15) rotate(10deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Winner glow effect */
.dice.winner {
    transform: scale(1.02);
    border-width: 1px !important;
    border-color: #ffd700 !important;
    box-shadow:
        0 0 2px 1px rgba(255, 215, 0, 0.7),
        0 0 5px 2px rgba(255, 215, 0, 0.3),
        inset 0 0 1px rgba(255, 255, 255, 0.5) !important;
}

/* ===== MULTIPLAYER LOBBY STYLES ===== */
#multiplayer-lobby,
#waiting-room {
    position: relative;
}

.lobby-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.lobby-input-group {
    text-align: left;
}

.lobby-input-group label {
    display: block;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.lobby-input-group input,
.room-code-input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.lobby-input-group input:focus,
.room-code-input:focus {
    outline: none;
    border-color: rgba(56, 189, 248, 0.5);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.lobby-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.lobby-btn {
    padding: 15px 25px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.lobby-btn.create {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    border-color: transparent;
}

.lobby-btn.create:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.lobby-btn.join {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    color: white;
    border-color: transparent;
    padding: 12px 20px;
}

.lobby-btn.join:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn-icon {
    font-size: 1.3rem;
}

.lobby-divider {
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    letter-spacing: 2px;
}

.join-room-row {
    display: flex;
    gap: 10px;
}

.room-code-input {
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-align: center;
    font-weight: bold;
}

.room-code-input::placeholder {
    letter-spacing: 1px;
}

.lobby-status {
    margin-top: 20px;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    min-height: 40px;
}

.lobby-status.error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.lobby-status.success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ===== WAITING ROOM STYLES ===== */
.room-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    margin-bottom: 25px;
}

.room-code-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.room-code-value {
    font-size: 2rem;
    font-weight: bold;
    letter-spacing: 5px;
    color: #38bdf8;
    text-shadow: 0 0 15px rgba(56, 189, 248, 0.5);
}

.copy-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.copy-btn:active {
    transform: scale(0.95);
}

.player-list {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.player-item:last-child {
    margin-bottom: 0;
}

.player-item.slot-0 {
    background: rgba(0, 200, 200, 0.2);
    border-left: 3px solid #00d4d4;
}

.player-item.slot-1 {
    background: rgba(255, 165, 0, 0.2);
    border-left: 3px solid #ffa500;
}

.player-item.slot-2 {
    background: rgba(255, 0, 128, 0.2);
    border-left: 3px solid #ff0080;
}

.player-item.slot-3 {
    background: rgba(148, 0, 211, 0.2);
    border-left: 3px solid #9400d3;
}

.player-item.empty {
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid rgba(255, 255, 255, 0.2);
}

.player-item.empty .player-name {
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
}

.player-name {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.host-badge {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #000;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.player-status {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.player-status.connected {
    color: #34d399;
}

.player-status.disconnected {
    color: #f87171;
}

.waiting-info {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.waiting-info span {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Reconnection Modal */
#reconnect-modal {
    pointer-events: auto;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

#reconnect-content {
    background: rgba(20, 0, 0, 0.9);
    border: 2px solid #ff4444;
    padding: 40px;
    width: 450px;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 68, 68, 0.3);
}

#reconnect-title {
    color: #ff4444;
    font-size: 2rem;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.reconnect-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.countdown-circle {
    width: 120px;
    height: 120px;
    border: 4px solid #ff4444;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.2);
}

#reconnect-countdown {
    font-size: 3.5rem;
    font-weight: bold;
    color: #fff;
    line-height: 1;
}

.secs-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #ff4444;
}

.reconnect-hint {
    font-size: 0.9rem;
    color: #aaa;
    line-height: 1.4;
}

/* Settings Button */
.settings-btn {
    position: absolute;
    top: -20px;
    right: 5px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    z-index: 10;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.main-settings {
    top: 5px;
    right: 5px;
}

/* Settings Modal */
#settings-modal {
    pointer-events: auto;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

#settings-modal.hidden {
    display: none !important;
}

.settings-panel {
    width: 450px;
    max-width: 90%;
    border: 2px solid rgba(56, 189, 248, 0.5);
    background: rgba(0, 10, 20, 0.95);
    box-shadow: 0 0 40px rgba(56, 189, 248, 0.3);
}

.settings-panel h2 {
    margin-top: 0;
    color: #38bdf8;
    letter-spacing: 4px;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
    border-bottom: 1px solid rgba(56, 189, 248, 0.3);
    padding-bottom: 15px;
}

.settings-group {
    margin: 25px 0;
    text-align: left;
}

.settings-row {
    display: flex;
    gap: 30px;
    margin: 25px 0;
}

.settings-row .settings-group {
    flex: 1;
    margin: 0;
}

.settings-group label {
    display: block;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Language Options */
.language-options {
    display: flex;
    gap: 15px;
}

.lang-btn {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-family: inherit;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lang-btn.active {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
    color: #38bdf8;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

input:checked+.slider {
    background-color: #059669;
}

input:focus+.slider {
    box-shadow: 0 0 1px #059669;
}

input:checked+.slider:before {
    transform: translateX(30px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* AI Speed Slider */
#ai-speed-slider {
    width: 100%;
    margin-bottom: 10px;
    accent-color: #38bdf8;
    cursor: pointer;
}

.ai-speed-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
}

#settings-buttons {
    margin-top: 30px;
}


#waiting-room .panel-carved-text {
    top: 6%;

}