/* --- ALAP BEÁLLÍTÁSOK --- */
* { box-sizing: border-box; }
body { 
    background-color: #121212; 
    color: white; 
    font-family: 'Poppins', sans-serif; 
    margin: 0; 
    height: 100vh; 
    display: flex; 
    justify-content: center; 
    overflow: hidden; /* Hogy ne legyen dupla görgetősáv */
}

.main-wrapper { 
    width: 100%; 
    max-width: 1200px; 
    padding: 20px; 
    text-align: center; 
    display: flex; 
    flex-direction: column; 
    height: 100%; 
}

/* ADMIN GOMB (Bal felső sarok) */
.admin-link-btn { 
    position: fixed; 
    top: 15px; 
    left: 15px; 
    background-color: #ff4757; 
    color: white; 
    padding: 10px 15px; 
    border-radius: 5px; 
    text-decoration: none; 
    font-weight: bold; 
    z-index: 9999; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.5); 
}
.admin-link-btn:hover { 
    background-color: #ff6b81; 
    transform: scale(1.05); 
}

/* --- KÉPERNYŐK KEZELÉSE --- */
.hidden { display: none !important; }
.screen { 
    width: 100%; 
    height: 100%; 
    display: flex; 
    flex-direction: column; 
    animation: fadeIn 0.5s; 
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.full-height { height: 100%; }

/* --- INPUTOK ÉS GOMBOK --- */
input, select { 
    padding: 10px; 
    background: #333; 
    color: white; 
    border: 1px solid #555; 
    border-radius: 5px; 
    margin-bottom: 10px; 
    width: 80%; 
    max-width: 300px; 
    text-align: center; 
}
button { 
    cursor: pointer; 
    border: none; 
    font-weight: bold; 
    transition: 0.2s; 
    border-radius: 5px; 
}
button:disabled { 
    filter: grayscale(1); 
    opacity: 0.5; 
    cursor: not-allowed; 
}

.btn-main { background: #bb86fc; color: black; padding: 15px 30px; font-size: 1.2rem; width: 100%; max-width: 300px; }
.btn-start { background: #03dac6; color: black; padding: 15px; width: 100%; font-size: 1.5rem; margin-top: 20px; }
.btn-done { background: #03dac6; padding: 15px; width: 100%; font-size: 1.2rem; margin-top: 10px; }
.btn-small { padding: 5px 10px; font-size: 0.9rem; background: #ff9800; color: white; }

/* --- JÁTÉK TERÜLET (LAYER SYSTEM) --- */
.fit-container { 
    flex-grow: 1; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    max-height: 60vh; 
    margin: 10px 0; 
    overflow: hidden; 
    position: relative;
    width: 100%;
}

/* Ez a konténer tartja össze a GIF-et és a Szöveget */
.meme-stack {
    position: relative;
    display: inline-block;
    max-height: 100%;
    max-width: 100%;
}

/* Háttérkép (GIF/JPG) */
.meme-bg {
    display: block;
    max-width: 100%;
    max-height: 60vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 5px;
    border: 2px solid white;
}

/* Szövegréteg (Canvas/PNG) */
.meme-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Átkattintható */
}

/* Eredménykártyáknál a méretezés */
.meme-card-large .meme-stack {
    max-height: 400px;
}
.meme-card-large .meme-bg {
    max-height: 400px;
    border: 1px solid #444;
}
/* --- SZAVAZÁS --- */
.vote-buttons { display: flex; justify-content: center; gap: 10px; margin-top: 10px; }
.v-btn { padding: 10px; font-size: 1.5rem; flex: 1; max-width: 100px; }
.v-btn.up { background: #03dac6; } 
.v-btn.meh { background: #555; color: white; } 
.v-btn.down { background: #cf6679; }
.buddy-btn { background: linear-gradient(45deg, #ff00cc, #3333ff); color: white; width: 100%; padding: 12px; margin-top: 10px; font-weight: bold; }

/* --- ÚJ EREDMÉNY LAYOUT (SPLIT VIEW) --- */
.result-layout { 
    display: flex; 
    flex: 1; 
    gap: 20px; 
    overflow: hidden; 
    height: 100%; 
    padding-bottom: 20px;
}

/* Bal/Közép: A Mémek listája */
.result-main { 
    flex: 2; 
    display: flex; 
    flex-direction: column; 
    overflow-y: auto; 
    padding-right: 10px; 
    gap: 20px;
}

/* --- KÁRTYA DIZÁJN ÉS RÉTEGEK JAVÍTÁSA --- */
.meme-card-large { 
    background: #1e1e1e; 
    padding: 20px; 
    border-radius: 15px; 
    border: 1px solid #333; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s;
    width: 100%; /* Hogy kitöltse a rendelkezésre álló helyet */
}

.meme-card-large:hover { border-color: #bb86fc; }

/* A konténer, ami egyben tartja a GIF-et és a szöveget */
.meme-stack {
    position: relative;
    display: inline-block; /* Hogy rázugorodjon a képre */
    width: auto;
    max-width: 100%;
}

/* 1. RÉTEG: A HÁTTÉR (GIF/JPG) */
.meme-card-large .meme-bg { 
    display: block;
    max-width: 100%; 
    max-height: 400px; /* Magasság limit */
    width: auto; 
    height: auto;
    object-fit: contain; 
    border-radius: 5px; 
    background: #000; /* Csak a háttérkép mögött legyen fekete */
    border: 2px solid #fff;
}

/* 2. RÉTEG: A SZÖVEG (ÁTLÁTSZÓ!) */
.meme-card-large .meme-overlay { 
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: fill; /* Kitölti a szülő méreteit */
    background: transparent; /* FONTOS: ÁTLÁTSZÓ! */
    border: none; /* Keret nélkül */
    pointer-events: none;
}

/* Infó sáv */
.meme-details { 
    width: 100%;
    display: flex; 
    justify-content: space-between; 
    align-items: flex-end; 
    border-top: 1px solid #333;
    padding-top: 15px;
    margin-top: 10px;
}

.meme-player-name { font-size: 1.2rem; font-weight: bold; color: white; }
.meme-score { font-size: 1.8rem; color: #03dac6; font-weight: 900; }
.meme-buddy-list { color: #ff00cc; font-size: 0.9rem; margin-top: 5px; font-style: italic; }

.btn-download { 
    background: #333; color: #ccc; border: 1px solid #555; 
    padding: 8px 15px; text-decoration: none; border-radius: 20px; 
    font-size: 0.8rem; transition: 0.2s; display: inline-block; margin-top: 5px; cursor: pointer;
}
.btn-download:hover { background: #fff; color: black; }
/* Jobb: Ranglista */
.result-sidebar { 
    flex: 1; 
    background: #181818; 
    padding: 20px; 
    border-radius: 15px; 
    border: 1px solid #333; 
    overflow-y: auto; 
    min-width: 300px; 
    box-shadow: -5px 0 20px rgba(0,0,0,0.3);
}

.leaderboard-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.leaderboard-table th { text-align: left; color: #888; border-bottom: 2px solid #444; padding-bottom: 10px; }
.leaderboard-table td { padding: 15px 10px; border-bottom: 1px solid #333; font-size: 1.1rem; }
.rank-1 { color: #ffd700; font-weight: bold; text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
.rank-2 { color: #c0c0c0; font-weight: bold; }
.rank-3 { color: #cd7f32; font-weight: bold; }

/* --- VÉGSŐ KÉPERNYŐ --- */
.gallery-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); 
    gap: 15px; 
    margin-top: 20px; 
    overflow-y: auto; 
    flex: 1; 
    padding: 10px;
}
.gallery-item { background: #222; padding: 5px; border-radius: 5px; transition: transform 0.2s; }
.gallery-item:hover { transform: scale(1.05); z-index: 10; }
.gallery-item img { width: 100%; height: 150px; object-fit: cover; border-radius: 3px; cursor: pointer; }

/* --- VÉGSŐ EREDMÉNY LISTA (FEED) --- */
.final-header {
    flex-shrink: 0; /* Ne nyomódjon össze */
    padding: 10px;
    border-bottom: 1px solid #333;
    background: #121212;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.final-feed-container {
    flex: 1; /* Kitölti a maradék helyet */
    overflow-y: auto; /* GÖRGETHETŐ */
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center; /* Középre igazítás */
    gap: 30px; /* Távolság a mémek között */
}

/* Egy mém kártya a listában */
.final-card {
    background: #1e1e1e;
    width: 100%;
    max-width: 500px; /* Nem engedjük túl szélesre */
    border-radius: 15px;
    border: 1px solid #333;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

.final-card img {
    width: 100%;
    height: auto;
    display: block;
    border-bottom: 1px solid #333;
    background: black;
}

.final-card-info {
    padding: 15px;
    text-align: left;
}

.final-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.final-author { font-size: 1.3rem; font-weight: bold; color: white; }
.final-score { font-size: 1.5rem; font-weight: 900; color: #03dac6; }

.final-buddy-row {
    font-size: 0.9rem;
    color: #ff00cc; /* Pink a Buddy-nak */
    font-weight: bold;
    background: rgba(255, 0, 204, 0.1);
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-block;
    margin-bottom: 10px;
}

.final-actions {
    border-top: 1px solid #333;
    padding-top: 10px;
    text-align: center;
}

/* LOBBY KÓD STÍLUS */
.room-code-display {
    background: #222;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #bb86fc;
    display: inline-block;
    margin-bottom: 20px;
}
.room-code-display small { text-transform: uppercase; letter-spacing: 2px; color: #aaa; }
.room-code-display span { font-size: 3rem; font-weight: 900; color: #bb86fc; letter-spacing: 5px; display: block; margin-top: 5px; }

/* --- LOGIN KÁRTYÁK (SZIMMETRIA JAVÍTÁS) --- */
#menu-options { 
    display: flex; 
    flex-direction: row; /* Egymás mellett */
    justify-content: center; 
    align-items: stretch; /* Egyforma magasak legyenek */
    gap: 30px; 
    margin-top: 30px; 
    flex-wrap: wrap; /* Mobilon törjön sorba */
}

.login-card { 
    background: #1e1e1e; 
    padding: 30px; 
    border-radius: 15px; 
    border: 2px solid #333; 
    width: 300px; 
    display: flex;
    flex-direction: column;
    justify-content: center; /* Függőlegesen középre */
    align-items: center;     /* Vízszintesen középre (EZ HIÁNYZOTT) */
    text-align: center;      /* Szöveg is középre */
}

.login-card h3 { margin-top: 0; color: #03dac6; margin-bottom: 20px; }

/* A "VAGY" felirat középre igazítása */
.or-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #555;
}

/* --- LOBBY JÁTÉKOS RÁCS (PLAYER GRID) --- */
#player-grid { 
    display: grid; 
    /* Ez a sor felelős az elrendezésért: */
    /* Minimum 140px széles egy kártya, és annyi fér egymás mellé, amennyi a képernyőn elfér */
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
    gap: 15px; /* Távolság a dobozok között */
    width: 100%;
    margin-top: 20px;
    padding: 10px;
}

.player-card { 
    background: #252525; /* Kicsit világosabb a háttérnél */
    padding: 15px; 
    border-radius: 12px; 
    border: 2px solid #444; 
    text-align: center;
    font-weight: bold;
    color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); /* Szép árnyék */
    transition: transform 0.2s, border-color 0.2s;
    
    /* Hogy a szöveg és ikon középen legyen */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 80px; /* Legyen egy fix magassága */
}

/* Ha ráviszed az egeret, kicsit emelkedjen meg */
.player-card:hover {
    transform: translateY(-5px);
    border-color: #bb86fc;
}

/* A Host kártyájának külön stílusa (ezt a JS inline-ban is kezeli, de itt is megerősítjük) */
.player-card[style*="border-color"] {
    background: rgba(3, 218, 198, 0.1); /* Halvány zöldes háttér a Hostnak */
}

/* --- BEÁLLÍTÁSOK DOBOZ (MODERN LOOK) --- */
.settings-box { 
    background: linear-gradient(145deg, #1a1a1a, #222); /* Enyhe színátmenet a mélységért */
    padding: 30px; 
    border-radius: 15px; 
    margin: 30px auto; 
    text-align: left; 
    max-width: 500px; /* Kicsit szélesebb, kényelmesebb */
    border: 1px solid #333;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6); /* Erősebb árnyék */
}

/* A "Beállítások" cím */
.settings-box h3 {
    color: #bb86fc; /* Neon lila */
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    margin-top: 0;
    margin-bottom: 25px;
    border-bottom: 2px solid rgba(187, 134, 252, 0.3); /* Lila vonal alatta */
    padding-bottom: 15px;
}

/* Egy sor (Label + Select) */
.setting-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05); /* Halvány elválasztó csíkok */
}
.setting-row:last-child { border-bottom: none; }

/* A felirat (pl. "Körök:") */
.setting-row label {
    font-size: 1.1rem;
    font-weight: bold;
    color: #e0e0e0;
}

/* A legördülő menü */
.settings-box select { 
    width: 150px; 
    margin: 0; 
    padding: 10px 15px;
    background-color: #000; /* Fekete háttér a kontraszthoz */
    color: #03dac6; /* Neon zöld szöveg */
    border: 1px solid #444;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    appearance: none; /* Eltünteti a csúnya gyári nyilat */
    /* Egyedi nyíl helyette (CSS trükk) */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2303dac6%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 15px top 50%;
    background-size: 12px auto;
}

/* Ha ráviszed az egeret a menüre */
.settings-box select:hover {
    border-color: #03dac6;
    box-shadow: 0 0 15px rgba(3, 218, 198, 0.2); /* Zöld ragyogás */
}

.settings-box select:focus {
    outline: none;
    border-color: #bb86fc;
}

/* --- HALL OF FAME (BEST.HTML) --- */
.hall-body { 
    overflow-y: auto; 
    height: 100vh; 
    display: block; 
}

.hall-header { 
    padding: 30px; 
    text-align: center; 
    border-bottom: 2px solid #333; 
    background: #121212; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.8); 
}

.hall-title { 
    margin: 0; 
    color: #ffd700; 
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4); 
    font-size: 2.5rem; 
    letter-spacing: 3px; 
    text-transform: uppercase; 
}

.best-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); 
    gap: 30px; 
    padding: 40px; 
    max-width: 1400px; 
    margin: 0 auto; 
}

.best-card { 
    background: #1e1e1e; 
    border-radius: 15px; 
    overflow: hidden; 
    border: 1px solid #333; 
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s; 
    position: relative; 
    display: flex; 
    flex-direction: column; 
}

.best-card:hover { 
    transform: translateY(-10px); 
    box-shadow: 0 10px 30px rgba(0,0,0,0.7); 
    border-color: #ffd700; 
}

.best-card-image-container { 
    position: relative; 
    width: 100%; 
    min-height: 200px; 
    background: #000; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border-bottom: 1px solid #333; 
}

/* --- ITT A JAVÍTÁS: KERETEK ELTÜNTETÉSE --- */
.best-card .meme-stack {
    line-height: 0; /* Hogy ne legyen rés alatta */
}

.best-card .meme-bg { 
    max-height: 300px; 
    width: auto; 
    max-width: 100%; 
    /* A lényeg: semmi keret, semmi háttér */
    border: none !important; 
    outline: none !important;
    background: transparent !important; 
    border-radius: 0 !important;
}

.best-card .meme-overlay { 
    max-height: 300px; 
    border: none !important; 
    background: transparent !important;
}

/* Infó sáv */
.best-info { 
    padding: 20px; 
    background: linear-gradient(to bottom, #1e1e1e, #181818); 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
}

.best-player { 
    color: #fff; 
    font-weight: bold; 
    font-size: 1.2rem; 
    display: flex; 
    align-items: center; 
    gap: 5px; 
}

.best-score { 
    color: #03dac6; 
    font-weight: 900; 
    font-size: 1.1rem; 
}

.best-date { 
    font-size: 0.8rem; 
    color: #666; 
    font-style: italic; 
    text-align: right; 
}