/* Minecraft Guess Who - Stylesheet */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

:root {
    /* Palette colors */
    --mc-gray-dark: #212121;
    --mc-gray-med: #313131;
    --mc-gray-light: #4c4c4c;
    --mc-border-light: #8b8b8b;
    --mc-border-dark: #373737;
    --mc-green: #3c8527;
    --mc-green-hover: #56af38;
    --mc-red: #b02e26;
    --mc-red-hover: #e5473d;
    --mc-gold: #ffaa00;
    --mc-yellow: #ffff55;
    --mc-text-shadow: #141414;
    --mc-font-pressstart: 'Press Start 2P', monospace;
    --mc-font-vt323: 'VT323', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    image-rendering: pixelated; /* Ensures Minecraft images render crisp */
}

body {
    background-color: #1a1a1a;
    background-image: 
        radial-gradient(circle, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.85) 100%),
        repeating-linear-gradient(0deg, rgba(20,20,20,0.2) 0px, rgba(20,20,20,0.2) 2px, transparent 2px, transparent 4px),
        repeating-linear-gradient(90deg, rgba(20,20,20,0.2) 0px, rgba(20,20,20,0.2) 2px, transparent 2px, transparent 4px);
    color: #f0f0f0;
    font-family: var(--mc-font-vt323), sans-serif;
    font-size: 20px;
    letter-spacing: 0.5px;
    min-height: 100vh;
    padding-bottom: 40px;
}

/* Header & Title */
header {
    text-align: center;
    padding: 30px 10px 15px;
    background-color: rgba(0, 0, 0, 0.4);
    border-bottom: 4px solid var(--mc-gray-med);
    margin-bottom: 25px;
}

h1 {
    font-family: var(--mc-font-pressstart);
    font-size: 1.8rem;
    color: #ffffff;
    text-shadow: 3px 3px 0px var(--mc-text-shadow);
    margin-bottom: 10px;
}

/* Main Layout Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Control Panel & Secret Mob Status */
.dashboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

/* Minecraft-style Box Container */
.mc-box {
    background-color: #c6c6c6;
    border: 4px solid #555555;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-bottom-color: #000000;
    border-right-color: #000000;
    color: #373737;
    padding: 15px;
    box-shadow: inset -2px -2px 0px #555, inset 2px 2px 0px #fff;
}

.dark-box {
    background-color: rgba(0, 0, 0, 0.6);
    border: 4px solid var(--mc-gray-light);
    border-top-color: var(--mc-gray-med);
    border-left-color: var(--mc-gray-med);
    color: #f0f0f0;
    box-shadow: none;
}

/* Buttons (Minecraft style) */
.mc-btn {
    font-family: var(--mc-font-pressstart);
    font-size: 0.75rem;
    color: #e0e0e0;
    background-color: var(--mc-gray-light);
    border: 3px solid #000;
    border-top-color: #a0a0a0;
    border-left-color: #a0a0a0;
    border-right-color: #505050;
    border-bottom-color: #505050;
    padding: 10px 15px;
    cursor: pointer;
    text-shadow: 2px 2px 0px #1a1a1a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    user-select: none;
    text-decoration: none;
}

.mc-btn:hover {
    color: #ffffff;
    background-color: #5a5a5a;
    border-top-color: #b0b0b0;
    border-left-color: #b0b0b0;
    border-right-color: #606060;
    border-bottom-color: #606060;
}

.mc-btn:active {
    border-top-color: #303030;
    border-left-color: #303030;
    border-right-color: #808080;
    border-bottom-color: #808080;
    background-color: #404040;
    transform: translateY(1px);
}

.mc-btn.green {
    background-color: var(--mc-green);
    border-top-color: #5ea847;
    border-left-color: #5ea847;
    border-right-color: #1f5012;
    border-bottom-color: #1f5012;
}

.mc-btn.green:hover {
    background-color: var(--mc-green-hover);
    border-top-color: #72cf4c;
    border-left-color: #72cf4c;
}

.mc-btn.red {
    background-color: var(--mc-red);
    border-top-color: #d6473d;
    border-left-color: #d6473d;
    border-right-color: #6e1813;
    border-bottom-color: #6e1813;
}

.mc-btn.red:hover {
    background-color: var(--mc-red-hover);
    border-top-color: #eb5c52;
    border-left-color: #eb5c52;
}

/* Controls Grid */
.controls-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.share-wrapper {
    position: relative;
    display: inline-block;
}

.share-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background-color: #000;
    color: var(--mc-yellow);
    font-family: var(--mc-font-pressstart);
    font-size: 0.6rem;
    padding: 6px 10px;
    border: 2px solid var(--mc-gray-light);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    z-index: 10;
}

.share-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Secret Mob Panel */
.secret-mob-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.secret-mob-label-overlay {
    font-family: var(--mc-font-pressstart);
    font-size: 0.75rem;
    color: var(--mc-gold);
    margin-bottom: 10px;
    text-shadow: 2px 2px 0px var(--mc-text-shadow);
    text-transform: uppercase;
}

#secret-mob-card-wrapper {
    /* Base width matching 2 columns on small screens */
    width: calc((100vw - 30px - 12px) / 2);
    max-width: 155px;
}

@media (min-width: 480px) {
    #secret-mob-card-wrapper {
        /* 4 columns */
        width: calc((100vw - 30px - 3 * 12px) / 4);
    }
}

@media (min-width: 768px) {
    #secret-mob-card-wrapper {
        /* 6 columns */
        width: calc((100vw - 30px - 5 * 15px) / 6);
    }
}

@media (min-width: 1024px) {
    #secret-mob-card-wrapper {
        /* 8 columns */
        width: calc((100vw - 30px - 7 * 18px) / 8);
    }
}

/* Game Board Grid */
.board-container {
    display: flex;
    justify-content: center;
}

#board {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

@media (min-width: 480px) {
    #board {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) {
    #board {
        grid-template-columns: repeat(6, 1fr);
        gap: 15px;
    }
}

@media (min-width: 1024px) {
    #board {
        grid-template-columns: repeat(8, 1fr);
        gap: 18px;
    }
}

/* Mob Cards */
.mob-card {
    position: relative;
    cursor: pointer;
    background-color: var(--mc-gray-med);
    border: 4px solid var(--mc-gray-light);
    border-top-color: #666666;
    border-left-color: #666666;
    border-right-color: #222222;
    border-bottom-color: #222222;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.15s, border-color 0.15s;
    user-select: none;
    overflow: hidden;
}

.mob-card:hover:not(.eliminated) {
    transform: translateY(-4px) scale(1.03);
    border-color: #aaaaaa;
    box-shadow: 0 8px 12px rgba(0,0,0,0.4);
}

.mob-card.is-secret {
    border: 4px solid var(--mc-gold);
    animation: borderGoldGlow 1.5s infinite alternate;
}

@keyframes borderGoldGlow {
    from { border-color: #bfa02c; }
    to { border-color: #ffdd44; }
}

.card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.image-container {
    width: 100%;
    aspect-ratio: 1;
    background-color: var(--mc-gray-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    position: relative;
    border-bottom: 4px solid var(--mc-gray-dark);
}

.image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: filter 0.2s, opacity 0.2s;
}

.mob-name-container {
    background-color: var(--mc-gray-dark);
    padding: 6px 4px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    min-height: 42px;
}

.mob-name {
    font-size: 1.15rem;
    font-weight: bold;
    color: #e0e0e0;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Card States: Eliminated */
.mob-card.eliminated {
    border-color: #222222;
    box-shadow: none;
    transform: none;
}

.mob-card.eliminated .image-container img {
    filter: grayscale(100%) brightness(40%);
    opacity: 0.65;
}

.eliminated-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    background-image: url('../barrier.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.mob-card.eliminated .eliminated-overlay {
    opacity: 1;
}

.mob-card.eliminated .mob-name {
    color: #666666;
    text-decoration: line-through;
}

/* Modal Picker CSS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
    padding: 15px;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-wrapper {
    width: 100%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 3px solid var(--mc-gray-light);
    padding-bottom: 10px;
}

.modal-title {
    font-family: var(--mc-font-pressstart);
    font-size: 0.95rem;
    color: var(--mc-yellow);
    text-shadow: 2px 2px 0px var(--mc-text-shadow);
}

.modal-close-btn {
    background: none;
    border: none;
    color: #aaaaaa;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close-btn:hover {
    color: #ffffff;
}

.modal-body-scroll {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 5px;
    /* Webkit scrollbar stylings for retro look */
}

.modal-body-scroll::-webkit-scrollbar {
    width: 10px;
}
.modal-body-scroll::-webkit-scrollbar-track {
    background: var(--mc-gray-dark);
}
.modal-body-scroll::-webkit-scrollbar-thumb {
    background: var(--mc-gray-light);
    border: 2px solid var(--mc-gray-dark);
}

.modal-body-scroll::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

@media (min-width: 480px) {
    .picker-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 640px) {
    .picker-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

.picker-card {
    background-color: var(--mc-gray-dark);
    border: 3px solid var(--mc-gray-light);
    border-radius: 4px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-align: center;
    transition: transform 0.15s, border-color 0.15s;
    user-select: none;
}

.picker-card img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-bottom: 6px;
}

.picker-name {
    font-size: 0.95rem;
    color: #e0e0e0;
    line-height: 1.1;
    word-break: break-word;
}

.picker-card:hover {
    border-color: #ffffff;
    transform: scale(1.05);
}

.picker-card.selected {
    border-color: var(--mc-gold);
    background-color: rgba(255, 170, 0, 0.15);
}

.modal-footer {
    margin-top: 15px;
    border-top: 3px solid var(--mc-gray-light);
    padding-top: 15px;
    display: flex;
    justify-content: flex-end;
}
