:root {
    --seinfeld-blue: #0047ab;
    --seinfeld-red: #e94560;
    --seinfeld-yellow: #f1c40f;
    --bg-dark: #0a0a0c;
    --card-bg: #16161a;
    --tile-bg: #1c1c21;
    --input-bg: #1c1c21;
    --text-main: #ffffff;
    --text-dim: #a0a0a8;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    -webkit-tap-highlight-color: transparent; 
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 10px;
}

/* Global Nav */
.main-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.nav-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.2s;
}

.nav-link:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-link.active { color: var(--seinfeld-yellow); border-bottom: 2px solid var(--seinfeld-yellow); }

header { 
    text-align: center; 
    padding: 5px 0;
    flex-shrink: 0;
}
.logo { font-family: 'Oswald', sans-serif; font-size: 1.8rem; text-transform: uppercase; line-height: 1; margin-bottom: 2px; }
.logo span:nth-child(1) { color: var(--seinfeld-blue); text-shadow: 1px 1px 0 #fff; }
.logo span:nth-child(2) { color: var(--seinfeld-red); text-shadow: 1px 1px 0 #fff; }
.tagline { font-size: 0.5rem; color: var(--text-dim); letter-spacing: 3px; text-transform: uppercase; }

/* Reusable UI Components */
.btn-action {
    background: var(--seinfeld-red);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover { filter: brightness(1.1); transform: translateY(-1px); }

.toast {
    position: fixed;
    top: 80px; /* Lowered to clear the nav and logo */
    left: 50%;
    transform: translateX(-50%) translateY(-200%);
    padding: 14px 30px;
    border-radius: 100px;
    font-weight: 800;
    font-size: 0.9rem;
    z-index: 4000; /* Increased to be above everything */
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    pointer-events: none;
    width: auto;
    max-width: 90%;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}
.toast.active { transform: translateX(-50%) translateY(0); }
.toast.correct { background: #2ecc71; color: #fff; }
.toast.wrong { background: #e74c3c; color: #fff; }
.toast.info { background: var(--seinfeld-blue); color: #fff; }

/* Nexus Specifics */
.target-box {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 8px;
    text-align: center;
    margin: 5px 0 10px 0;
    flex-shrink: 0;
}
.target-label { font-size: 0.6rem; font-weight: 800; color: var(--seinfeld-yellow); text-transform: uppercase; letter-spacing: 1px; }
.target-title { font-size: 1rem; font-weight: 900; font-family: 'Oswald', sans-serif; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nexus-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 6px;
    flex: 1;
    min-height: 0;
    margin-bottom: 10px;
}

.atom-tile {
    background: var(--tile-bg);
    border: 2px solid rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    word-break: break-word;
}

.atom-tile.selected {
    border-color: var(--seinfeld-blue);
    background: rgba(0, 71, 171, 0.3);
    box-shadow: 0 0 15px rgba(0, 71, 171, 0.4);
    transform: scale(0.98);
}

.atom-tile.matched { opacity: 0.05; pointer-events: none; }

@keyframes jiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(2deg); }
    75% { transform: rotate(-2deg); }
}
.atom-tile.hint-glow {
    border-color: var(--seinfeld-yellow);
    animation: jiggle 0.2s infinite;
    box-shadow: 0 0 15px var(--seinfeld-yellow);
    z-index: 10;
}

.matches-container {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 5px;
    flex-shrink: 0;
    height: 60px;
}
.matches-container::-webkit-scrollbar { display: none; }

.match-card {
    flex: 0 0 180px;
    background: var(--card-bg);
    border-left: 3px solid var(--seinfeld-blue);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.match-title { font-weight: 800; font-size: 0.8rem; color: var(--seinfeld-yellow); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-info { font-size: 0.6rem; color: var(--text-dim); }

.btn-nexus {
    flex: 1;
    background: var(--seinfeld-red);
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.7rem;
    text-transform: uppercase;
    cursor: pointer;
}
.btn-hint { background: #222; color: #888; }

.controls { display: flex; gap: 8px; margin-bottom: 10px; flex-shrink: 0; }

@media (max-width: 600px) {
    .logo { font-size: 1.4rem; }
    .main-nav { gap: 8px; margin-bottom: 5px; }
    .nav-link { font-size: 0.65rem; padding: 4px 8px; }
    .tagline { font-size: 0.45rem; letter-spacing: 2px; }
    
    .nexus-grid { 
        grid-template-columns: repeat(2, 1fr); 
        grid-template-rows: repeat(8, 1fr);
    }
    .atom-tile { font-size: 0.85rem; }
}

