/* --- GLOBAL VARIABLES --- */
:root {
    --bg-color: #09090b;
    --card-bg: #18181b;
    --panel-bg: #27272a;
    --accent: #f43f5e;
    --gold: #fbbf24;
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --success: #10b981;
    --fail: #f43f5e;
    --header-height: 70px;
}

body {
    font-family: 'Fredoka', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
* { box-sizing: border-box; }

/* --- HEADER --- */
header {
    width: 100%; height: var(--header-height); padding: 0 2rem;
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(9, 9, 11, 0.95); border-bottom: 1px solid #27272a;
    position: sticky; top: 0; z-index: 100;
}
h1 { margin: 0; font-size: 1.5rem; color: var(--accent); letter-spacing: 1px; cursor: pointer; font-weight: 700; }
.nav-group { display: flex; gap: 10px; align-items: center; }

/* Avatar */
.user-capsule { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; cursor: pointer; border: 2px solid #333; transition: 0.2s; }
.user-capsule:hover { border-color: var(--accent); }
.user-capsule img { width: 100%; height: 100%; object-fit: cover; }

/* Buttons */
.btn { background: var(--panel-bg); color: #e4e4e7; border: 1px solid #3f3f46; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 6px; transition: 0.2s; }
.btn:hover { background: #3f3f46; color: white; }
.btn-accent { background: var(--accent); color: white; border: none; }
.btn-gold { background: var(--gold); color: black; border: none; }
.btn-danger { background: #ef4444; color: white; border: none; }

/* --- GAME LAYOUT (Split) --- */
#game-layout { width: 95%; max-width: 1100px; margin: 2rem auto; display: flex; flex-direction: column; gap: 20px; }
.game-top-bar { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.patreon-banner { background: linear-gradient(90deg, #f43f5e, #fb7185); color: white; padding: 8px 20px; border-radius: 20px; font-size: 0.9rem; font-weight: bold; }
.timer-row { display: flex; gap: 15px; }
.timer-pill { font-family: 'Roboto Mono'; background: #111; border: 1px solid #333; padding: 5px 15px; border-radius: 8px; color: var(--accent); font-weight: bold; }

.game-split { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: start; }
@media (max-width: 768px) { .game-split { grid-template-columns: 1fr; } .game-left { order: 2; } .game-right { order: 1; } }

.game-left { display: flex; flex-direction: column; gap: 15px; }
.game-right { display: flex; justify-content: center; }

.image-box { width: 100%; max-width: 400px; aspect-ratio: 3/4; background: #000; border-radius: 12px; position: relative; overflow: hidden; border: 2px solid #27272a; display: flex; justify-content: center; align-items: center; }
.image-box img { width: 100%; height: 100%; object-fit: cover; filter: blur(20px); display: none; }
.image-placeholder { font-size: 4rem; color: #333; }
#start-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.9); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 10; }

.inline-input-wrapper { display: flex; width: 100%; position: relative; } 
.input-wrapper { display: flex; gap: 0; width: 100%; position: relative; }
input { flex: 1; padding: 15px; background: #111; border: 1px solid #333; border-right: none; color: white; border-radius: 8px 0 0 8px; font-size: 1rem; outline: none; }
input:focus { border-color: var(--accent); }
.btn-guess { background: var(--accent); color: white; border: none; padding: 0 25px; border-radius: 0 8px 8px 0; font-weight: bold; cursor: pointer; }

.hints-container { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint-card { background: var(--card-bg); padding: 12px; border-radius: 8px; border: 1px solid #27272a; display: flex; justify-content: space-between; align-items: center; }
.hint-card.unlocked { border-color: var(--accent); background: #202024; }
.hint-label { font-size: 0.7rem; color: var(--text-muted); font-weight: bold; text-transform: uppercase; }
.hint-value { font-weight: 600; color: white; }

/* AUTOCOMPLETE */
.autocomplete-items { position: absolute; top: 100%; left: 0; width: 100%; background: #27272a; border: 1px solid #333; border-radius: 0 0 8px 8px; max-height: 200px; overflow-y: auto; z-index: 999; }
.autocomplete-item { padding: 12px; cursor: pointer; border-bottom: 1px solid #333; color: white; }
.autocomplete-item:hover { background: var(--accent); }

/* --- OTHER PAGES --- */
main { width: 95%; max-width: 1000px; margin-top: 2rem; padding-bottom: 4rem; }

/* Profile & Stats */
.profile-header-card { background: var(--card-bg); padding: 30px; border-radius: 16px; display: flex; align-items: center; gap: 20px; border: 1px solid #27272a; margin-bottom: 20px; }
.profile-avatar-container img { width: 90px; height: 90px; border-radius: 50%; border: 3px solid var(--accent); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 20px; }
.stat-box { background: var(--card-bg); padding: 20px; border-radius: 12px; border: 1px solid #27272a; text-align: center; }
.stat-box h3 { margin: 0 0 5px 0; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; }
.stat-box .val { font-size: 1.8rem; font-weight: bold; color: white; }

/* Heatmap & History */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.dash-card { background: var(--card-bg); padding: 20px; border-radius: 12px; border: 1px solid #27272a; }
.heatmap-grid { display: grid; grid-template-columns: repeat(20, 1fr); gap: 4px; margin-top: 15px; }
.heat-sq { aspect-ratio: 1; background: #27272a; border-radius: 2px; }
.heat-sq.win { background: var(--success); }
.heat-sq.loss { background: var(--fail); }

/* Leaderboard */
.lb-container { background: var(--card-bg); border-radius: 12px; border: 1px solid #333; overflow: hidden; }
.lb-row { display: flex; align-items: center; justify-content: space-between; padding: 15px; border-bottom: 1px solid #222; }
.lb-row:last-child { border-bottom: none; }
.lb-user { display: flex; align-items: center; gap: 10px; font-weight: bold; }
.lb-score { font-weight: bold; color: var(--gold); }

/* Admin */
.admin-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.9rem; }
.admin-table th { text-align: left; padding: 10px; background: #222; color: #aaa; }
.admin-table td { padding: 10px; border-bottom: 1px solid #333; }

/* Modals & Footer */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.9); display: none; justify-content: center; align-items: center; z-index: 200; }
.modal { background: var(--card-bg); padding: 30px; border-radius: 16px; width: 90%; max-width: 400px; text-align: center; border: 1px solid #333; }
footer { width: 100%; padding: 20px; background: #09090b; border-top: 1px solid #27272a; text-align: center; font-size: 0.8rem; color: #666; margin-top: auto; }
footer a { color: #888; text-decoration: none; margin: 0 5px; }

/* Shop / Waifu DB */
.market-grid, .waifu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; }
.market-item, .waifu-card { background: var(--card-bg); padding: 15px; border-radius: 8px; border: 1px solid #27272a; text-align: center; cursor: pointer; }
.waifu-card img { width: 100%; height: 160px; object-fit: cover; margin-bottom: 10px; border-radius: 4px; }

/* --- ADVERTISEMENT LAYOUT WRAPPER --- */
.content-wrapper {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    max-width: 1800px; /* Wider to fit Game + Ads */
    gap: 20px;
    flex-grow: 1;
    padding-top: 20px;
}

/* The Side Columns (Skyscrapers) */
.ad-sidebar {
    width: 160px;      /* Fixed width for ads */
    min-width: 160px;  /* Force width (Fixes "Text Tower" bug) */
    flex-shrink: 0;    /* IMPORTANT: Prevents ads from being squished */
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 2rem;
}

/* Hide ads on Tablets/Mobile so game fits */
@media (max-width: 1200px) {
    .ad-sidebar {
        display: none;
    }
}
