:root {
    --bg-deep: #24202f;
    --bg-card: rgba(55, 50, 71, 0.7);
    --accent-primary: #93c890;
    --accent-secondary: #887a98;
    --accent-danger: #b02b38;
    --text-primary: #f5f5e7;
    --text-secondary: #c2bdd4;
    --border-color: rgba(78, 70, 95, 0.2);
    --high-match: #baa887;
    --glass-blur: 16px;
}

/* --- Base Styling --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    user-select: none;
}

/* Custom Scrollbar Dashboard v2.5 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
    background: rgba(147, 200, 144, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(147, 200, 144, 0.2) var(--bg-deep);
}

body {
    background: radial-gradient(circle at top right, #373247, #24202f);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
}

/* --- Layout Grid (v2.5 Fixed) --- */
.app-wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
    /* Fixed viewport height */
    overflow: hidden;
    /* Prevent body scroll */
}

.main-content {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    /* Core scroll area */
    height: 100%;
}

/* Sidebars Base (Fixed v2.5) */
.analyzer-drawer,
.server-drawer {
    width: 320px;
    flex-shrink: 0;
    /* Prevent sidebars from being squeezed */
    height: 100vh;
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1000;
}

.analyzer-drawer {
    border-right: 1px solid var(--border-color);
}

.server-drawer {
    border-left: 1px solid var(--border-color);
}

/* Lock Overlay v2.5 */
.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: inherit;
}

.lock-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.lock-content {
    animation: lock-pulse 2s infinite ease-in-out;
}

@keyframes lock-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

/* --- UI Components --- */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    width: 100%;
    max-width: 850px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}

#game-title {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary), #baa887);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1.5px;
}

.subtitle {
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Input Groups */
.input-grid-v2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-bottom: 30px;
}

.input-category {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.category-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-field-container {
    position: relative;
    width: 100%;
    background: rgba(36, 32, 47, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 15px;
    transition: all 0.3s ease;
}

.input-field-container:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(147, 200, 144, 0.15);
}

.input-field-container input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    font-size: 1rem;
    outline: none;
}

/* Success SVG Glow */
.border-glow-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.border-glow-svg rect {
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 3;
    stroke-dasharray: 0.3 0.7;
    animation: dash-animate 4s linear infinite;
}

@keyframes dash-animate {
    from {
        stroke-dashoffset: 1;
    }

    to {
        stroke-dashoffset: 0;
    }
}

.correct-field .border-glow-svg {
    opacity: 1;
}

.success-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-primary);
    display: none;
}

.correct-field .success-icon {
    display: block;
    animation: bounceIn 0.5s ease;
}

/* Buttons & Controls */
.action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 10px;
}

.btn {
    height: 48px;
    padding: 0 25px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #24202f;
    /* Deep background as text color for high contrast action */
    flex-grow: 1;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-danger {
    background: rgba(176, 43, 56, 0.1);
    color: var(--accent-danger);
    border: 1px solid var(--accent-danger);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

.attempt-pill {
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 16px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    font-weight: 700;
    color: var(--text-secondary);
}

/* History List */
.history-container {
    margin-top: 50px;
    width: 100%;
    max-width: 850px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    padding: 0 20px 15px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.guess-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 15px 25px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease;
}

.guess-card:hover {
    transform: scale(1.01);
    background: rgba(255, 255, 255, 0.03);
}

.chips-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.guess-chip {
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

/* --- Header & Typography --- */
header {
    margin-bottom: 40px;
    text-align: center;
    position: relative;
    width: 100%;
}

/* Header Navigation Actions */
.top-nav-actions {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
}

.nav-icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-icon-btn i {
    width: 18px;
    height: 18px;
}

/* Language Switcher Adjustment */
.lang-switch {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 3px;
    height: 36px;
    align-items: center;
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 4px 12px;
    font-size: 0.65rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 18px;
    letter-spacing: 1px;
}

.lang-btn:hover {
    color: white;
}

.lang-btn.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 0 15px rgba(26, 126, 114, 0.4);
}

.card-score {
    width: 80px;
    text-align: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--accent-primary);
}

.rank-badge {
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.rank-badge i,
.rank-badge svg {
    flex-shrink: 0;
}

.rank-badge.cold {
    background: rgba(136, 122, 152, 0.1);
    color: #887a98;
    border: 1px solid #887a98;
}

.rank-badge.warm {
    background: rgba(165, 151, 102, 0.1);
    color: #a59766;
    border: 1px solid #a59766;
}

.rank-badge.hot {
    background: rgba(226, 135, 99, 0.1);
    color: #e28763;
    border: 1px solid #e28763;
}

.rank-badge.very-close {
    background: rgba(219, 114, 102, 0.1);
    color: #db7266;
    border: 1px solid #db7266;
}

.rank-badge.correct {
    background: rgba(147, 200, 144, 0.1);
    color: #93c890;
    border: 1px solid #93c890;
}

/* Analyzer Drawer Content */
.analyzer-header {
    padding: 30px 25px 15px;
    border-bottom: 1px solid var(--border-color);
}

.analyzer-column {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.list-section {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 15px;
}

.list-title {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 800;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.search-box {
    width: 100%;
    padding: 10px 15px;
    border-radius: 10px;
    background: rgba(36, 32, 47, 0.6);
    border: 1px solid var(--border-color);
    color: white;
    margin-bottom: 15px;
}

.drop-zone {
    min-height: 80px;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
    transition: all 0.3s ease;
}

.monster-tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease, border-color 0.2s ease;
    position: relative;
    color: var(--text-secondary);
    white-space: nowrap;
}

.monster-tag:hover {
    background: var(--bg-deep);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

/* Match Indicators */
.match-badge {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--accent-primary);
    background: rgba(147, 200, 144, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.monster-tag.high-match {
    border-color: var(--high-match);
    background: rgba(186, 168, 135, 0.05);
    color: var(--high-match);
    box-shadow: 0 0 10px rgba(186, 168, 135, 0.2);
}

.monster-tag.high-match::after {
    content: '⭐';
    font-size: 0.7rem;
    margin-left: 4px;
}

.tag-actions {
    display: flex;
    gap: 4px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.monster-tag:hover .tag-actions {
    visibility: visible;
    opacity: 1;
}

.tag-btn {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    opacity: 0.6;
}

.tag-btn:hover {
    opacity: 1;
}

.tag-btn.maybe {
    background: var(--accent-primary);
    color: #24202f;
}

.tag-btn.not {
    background: var(--accent-danger);
}

.tag-btn.un {
    background: var(--text-secondary);
}

.attempt-indicator {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--accent-danger);
    pointer-events: none;
    transition: all 0.3s ease;
}

[data-type="name"] input {
    padding-right: 60px;
    /* Space for the indicator */
}

/* Server Intelligence Drawer (Right) */
.server-drawer {
    width: 320px;
    height: 100vh;
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1000;
}

.stat-card {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--accent-primary);
    transform: translateX(-5px);
}

.stat-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* --- Advertising Space (v2.6) --- */
.ad-unit-container {
    margin-top: auto;
    padding-top: 30px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    width: 100%;
}

.ad-spacer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.6rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.ad-content-box {
    width: 100%;
    min-height: 250px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.ad-content-box:hover {
    border-color: var(--accent-primary);
    background: rgba(26, 126, 114, 0.05);
}

.ad-mock-text {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.scanning-indicator {
    position: relative;
    padding: 10px;
    background: rgba(147, 200, 144, 0.03);
    border-radius: 8px;
    overflow: hidden;
}

.scan-bar {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    animation: scan-move 3s infinite linear;
}

@keyframes scan-move {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

/* Autocomplete */
.autocomplete-items {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #373247;
    border-radius: 0 0 12px 12px;
    z-index: 2000;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.autocomplete-items div {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.autocomplete-items div:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Animations */
@keyframes bounceIn {
    0% {
        transform: translateY(-50%) scale(0);
    }

    100% {
        transform: translateY(-50%) scale(1);
    }
}

/* Responsive Overrides */
@media (max-width: 1200px) {
    .server-drawer {
        display: none;
    }

    /* Hide stats on tablet/mobile for focus */
}

@media (max-width: 1000px) {
    .analyzer-drawer {
        position: fixed;
        transform: translateX(-400px);
    }

    .analyzer-drawer.open {
        transform: translateX(0);
    }

    .analyzer-drawer.collapsed {
        margin-right: 0;
    }
}

@media (max-width: 768px) {
    .input-grid-v2 {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 20px;
    }

    #game-title {
        font-size: 2rem;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    width: 90%;
    max-width: 500px;
    padding: 40px;
    text-align: center;
    transform: scale(0.9);
    animation: modalIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalIn {
    to {
        transform: scale(1);
    }
}