:root {
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --bg-glass: rgba(30, 41, 59, 0.7);
    --border-light: rgba(255, 255, 255, 0.1);
    
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    
    --accent-oly: #dc2626; /* Olympiacos Red */
    --accent-pao: #16a34a; /* Panathinaikos Green */
    
    --correct-color: #22c55e;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --hover-color: #334155;
    --cell-bg: rgba(30, 41, 59, 0.5);
    --border: rgba(255, 255, 255, 0.12);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(220, 38, 38, 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(22, 163, 74, 0.05), transparent 25%);
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}
.logo-txt { font-weight: 900; }
.logo-txt.highlight { color: var(--text-muted); font-weight: 500; }

.score-panel {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.lives-container {
    display: flex;
    gap: 0.5rem;
    font-size: 1.25rem;
}
.life-icon { color: var(--error-color); transition: 0.3s; }
.life-icon.lost { color: var(--text-muted); opacity: 0.3; }

.score-display {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    background: var(--bg-panel);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

/* Views */
.view-panel {
    display: none;
    flex: 1;
    animation: fadeIn 0.4s ease-out forwards;
}
.view-panel.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero Boxes (Start/End) */
.hero-box {
    text-align: center;
    background: var(--bg-panel);
    padding: 3rem;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    max-width: 600px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.hero-box h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-box p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.config-options {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 12px;
}
.config-options h3 {
    margin-bottom: 1rem;
    font-family: var(--font-heading);
}
.size-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    outline: none;
}
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
.btn-primary {
    background: #3b82f6;
    color: white;
}
.btn-primary:hover { background: #2563eb; transform: translateY(-2px); }

.btn-danger {
    background: var(--error-color);
    color: white;
}
.btn-danger:hover { background: #dc2626; }

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}
.btn-outline:hover { background: var(--hover-color); }

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover { color: var(--error-color); }

.mt-4 { margin-top: 2rem; }

.size-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Toggle Switch Styles */
.mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.mode-label {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.mode-desc {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--correct-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--correct-color);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Team Picker */
.team-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.team-chip {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 2px solid var(--border-light);
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.team-chip:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.team-chip.selected {
    border-color: #a78bfa;
    background: rgba(167, 139, 250, 0.15);
    color: #c4b5fd;
}

.picker-hint {
    font-size: 0.8rem;
    color: var(--error-color);
    text-align: center;
    margin: 0;
}

/* Grid Layout */
.grid-wrapper {
    width: 100%;
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.grid-header {
    display: grid;
    gap: 1rem;
    /* Grid template auto-updated by JS based on size */
}

.empty-corner {
    /* Top left empty space */
}

.team-col-header {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1rem 0.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
.team-col-header span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.grid-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.grid-row {
    display: grid;
    gap: 1rem;
    /* Grid template auto-updated by JS */
}

.team-row-header {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Styling for Greek Teams */
.team-row-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}
.team-row-header[data-id="156392"]::before { background: var(--accent-oly); }
.team-row-header[data-id="175909"]::before { background: var(--accent-pao); }

/* Playable Grid Cells */
.grid-cell {
    background: var(--bg-panel);
    border: 2px dashed var(--border-light);
    border-radius: 8px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.grid-cell:hover {
    border-color: var(--text-muted);
    background: var(--hover-color);
}

.grid-cell.solved {
    border: 2px solid var(--correct-color);
    background: rgba(34, 197, 94, 0.15);
    cursor: default;
    padding: 0;
    justify-content: flex-end; /* Push text wrapper to the bottom */
}

.player-image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-headshot {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%; /* Vertically align slightly above center for faces */
    opacity: 0.8;
    transition: opacity 0.3s;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
}

.fallback-silhouette {
    width: 60%;
    height: 60%;
    object-fit: contain;
    opacity: 0.15;
    color: var(--text-primary);
    -webkit-mask-image: none;
    mask-image: none;
}

.grid-cell.solved:hover .player-headshot {
    opacity: 0.2; /* Dim the image on hover so the tooltip is clearer */
}

.player-name-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 1.5rem 0.5rem 0.5rem 0.5rem;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-cell.solved .player-name {
    font-weight: 800;
    color: var(--correct-color);
    font-size: 1.1rem;
    text-align: center;
    font-family: var(--font-heading);
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.no-image-placeholder {
    color: var(--text-muted);
    opacity: 0.3;
    font-size: 0.8rem;
    font-weight: 500;
}

.loader {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-light);
    border-bottom-color: var(--correct-color);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}
@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.grid-cell.failed {
    border: 2px solid var(--error-color);
    background: rgba(239, 68, 68, 0.1);
    cursor: default;
    overflow-y: auto;
    justify-content: flex-start;
    padding: 0.5rem;
}

.cell-icon {
    font-size: 2rem;
    color: var(--text-muted);
    opacity: 0.3;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    width: 100%;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 1rem 1rem;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.2s;
    overflow-y: auto;
}
.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-panel);
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    max-height: 80dvh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.modal-search {
    padding: 1.5rem;
    display: flex;
    gap: 0.75rem;
}
.modal-search input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1.1rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}
.modal-search input:focus {
    border-color: var(--text-muted);
}

.btn-surrender {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    padding: 0 1rem;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}
.btn-surrender:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border-color: var(--error-color);
}

.modal-results {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.5rem 1.5rem 1.5rem;
}

.result-item {
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
}
.result-item:hover {
    background: rgba(255, 255, 255, 0.1);
}
.result-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
}

/* Tooltips */
.cell-tooltip {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(15, 23, 42, 0.95);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    white-space: normal;
    min-width: 180px;
    max-width: min(280px, calc(100vw - 2rem));
    max-height: 200px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s;
    border: 1px solid var(--border-light);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    z-index: 50;
}

.cell-tooltip::-webkit-scrollbar {
    width: 6px;
}
.cell-tooltip::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.cell-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(15, 23, 42, 0.95) transparent transparent transparent;
}

.grid-cell.solved:hover .cell-tooltip,
.cell-tooltip:hover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-panel);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-light);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2000;
    max-width: 90vw;
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-success {
    border-left: 4px solid var(--correct-color);
}

.toast-error {
    border-left: 4px solid var(--error-color);
}

/* Daily Challenge */
.daily-section {
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.daily-section p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.btn-daily {
    width: 100%;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 1.05rem;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    border: none;
}

.btn-daily:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-daily.btn-daily-done {
    background: linear-gradient(135deg, #64748b, #475569);
    color: rgba(255, 255, 255, 0.65);
    box-shadow: none;
}

.btn-daily.btn-daily-done:hover {
    background: linear-gradient(135deg, #475569, #334155);
    transform: none;
    box-shadow: none;
}

.daily-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.daily-divider::before,
.daily-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

/* End screen share section */
#share-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
    width: 100%;
}

#share-section.hidden {
    display: none;
}

.emoji-grid {
    font-size: 1.75rem;
    line-height: 1.8;
    letter-spacing: 3px;
    font-family: monospace;
    margin: 0;
}

.daily-return-msg {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* Utility: hide sub-panels (cannot use global .hidden — modal uses it for opacity animation) */
#cc-game.hidden,
#cc-results-panel.hidden,
#cp-game.hidden,
#cp-results-panel.hidden,
#mp-game.hidden,
#mp-results-panel.hidden,
.cc-dropdown.hidden,
.mp-dropdown.hidden { display: none; }

/* Game Mode Button (start screen) */
.btn-game-mode {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    color: var(--text-primary);
}

.btn-game-mode:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.6);
    transform: translateY(-1px);
}

.btn-game-mode--teal {
    background: rgba(6, 182, 212, 0.08);
    border-color: rgba(6, 182, 212, 0.3);
}

.btn-game-mode--teal:hover {
    background: rgba(6, 182, 212, 0.18);
    border-color: rgba(6, 182, 212, 0.6);
}

.btn-game-mode--teal .teal-text,
.teal-text { color: #22d3ee; }

.game-mode-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
}

.game-mode-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.game-mode-info strong {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: #a78bfa;
}

.game-mode-info small {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Common Club Screen */
#common-club-screen {
    align-items: stretch;
}

.cc-container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.cc-meta {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

.cc-label {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
}

.cc-prompt {
    color: var(--text-muted);
    font-size: 1rem;
    text-align: center;
    line-height: 1.6;
    margin: 0;
}

/* Player cards */
.cc-players {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.cc-player-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 1.1rem 0.75rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    border-left: 3px solid rgba(139, 92, 246, 0.5);
}

.cc-player-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.3;
}

/* Search input + dropdown */
.cc-input-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cc-search-wrap {
    position: relative;
    width: 100%;
}

.cc-search-wrap input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1.05rem;
    padding: 0.9rem 1.25rem;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.cc-search-wrap input:focus {
    border-color: rgba(139, 92, 246, 0.6);
}

.cc-search-wrap input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cc-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 100;
    overflow: hidden;
}

.cc-dropdown.hidden {
    display: none;
}

.cc-give-up-btn {
    align-self: flex-end;
    font-size: 0.85rem;
    padding: 0.4rem 0.85rem;
}

/* Feedback */
.cc-feedback {
    width: 100%;
    min-height: 2rem;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
}

.cc-feedback-correct {
    color: var(--correct-color);
    padding: 0.75rem 1rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
}

.cc-feedback-wrong {
    color: var(--error-color);
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
}

.cc-action-btn {
    width: 100%;
}

/* Results panel */
.cc-result-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    margin: 0;
}

.cc-result-msg {
    color: var(--text-muted);
    font-size: 1.1rem;
    text-align: center;
    margin: 0;
}

.cc-result-actions {
    display: flex;
    gap: 1rem;
    width: 100%;
}

/* ── Career Path Screen ─────────────────────────────────────── */

#career-path-screen {
    align-items: stretch;
}

.cp-container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.cp-meta {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

.cp-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.cp-prompt {
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
    margin: 0;
}

.cp-player-name {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: #22d3ee;
    text-align: center;
    margin: 0;
}

/* Club cards */
.cp-clubs {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    touch-action: none; /* prevent scroll interfering with drag on mobile */
}

.cp-club-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    cursor: grab;
    user-select: none;
}

.cp-club-card:hover {
    background: rgba(34, 211, 238, 0.08);
    border-color: rgba(34, 211, 238, 0.3);
}

.cp-card-dragging {
    opacity: 0.25;
    cursor: grabbing;
}

.cp-drag-handle {
    font-size: 1.1rem;
    color: var(--text-muted);
    flex-shrink: 0;
    letter-spacing: -1px;
}

.cp-badge-wrap {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    padding: 3px;
}

.cp-badge-wrap:has(.cp-club-badge:not(.loaded)) {
    background: transparent;
}

.cp-club-badge {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}

.cp-club-badge.loaded { opacity: 1; }

.cp-club-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

/* Action row */
.cp-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: center;
}

.cp-action-btn {
    width: 100%;
}

/* Feedback */
.cp-feedback {
    width: 100%;
}

.cp-correct-order {
    width: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.cp-feedback-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}

.cp-correct-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.5rem;
    border-radius: 6px;
}

.cp-correct-item.pos-correct { background: rgba(34, 197, 94, 0.08); }
.cp-correct-item.pos-wrong   { background: rgba(239, 68, 68, 0.06); }

.cp-pos-icon {
    font-size: 0.85rem;
    font-weight: 700;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.cp-correct-item.pos-correct .cp-pos-icon { color: var(--success-color); }
.cp-correct-item.pos-wrong   .cp-pos-icon { color: var(--error-color); }

.cp-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.cp-item-club {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.cp-item-years {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.cp-round-score {
    margin: 0.75rem 0 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    padding-top: 0.6rem;
}

/* Results panel */
.cp-result-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    margin: 0;
}

.cp-result-msg {
    color: var(--text-muted);
    font-size: 1.1rem;
    text-align: center;
    margin: 0;
}

.cp-result-actions {
    display: flex;
    gap: 1rem;
    width: 100%;
}

/* =============================================================================
   MYSTERY PLAYER
   ============================================================================= */

.btn-game-mode--purple {
    background: rgba(168, 85, 247, 0.08);
    border-color: rgba(168, 85, 247, 0.3);
}
.btn-game-mode--purple:hover {
    background: rgba(168, 85, 247, 0.18);
    border-color: rgba(168, 85, 247, 0.6);
}
.btn-game-mode--purple .purple-text,
.purple-text { color: #a855f7; }

#mp-game.hidden, #mp-results-panel.hidden { display: none; }

.mp-container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem 1rem;
}

.mp-meta {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.mp-prompt {
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
    margin: 0;
}

.mp-clubs {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.mp-club-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--cell-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    animation: slideInCard 0.3s ease;
}

@keyframes slideInCard {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mp-badge-wrap {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    border-radius: 6px;
}

.mp-club-badge {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.mp-club-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.mp-club-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.mp-club-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.mp-club-years {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Search input */
.mp-input-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.mp-search-wrap {
    position: relative;
    width: 100%;
}

.mp-search-wrap input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--cell-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    box-sizing: border-box;
}
.mp-search-wrap input:focus { outline: none; border-color: #a855f7; }
.mp-search-wrap input:disabled { opacity: 0.5; cursor: not-allowed; }

.mp-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: rgba(10, 15, 35, 0.98);
    border: 1px solid var(--border);
    border-radius: 8px;
    z-index: 9999;
    max-height: 220px;
    overflow-y: auto;
}

/* Feedback */
.mp-feedback { width: 100%; text-align: center; min-height: 1.5rem; }
.mp-feedback-correct {
    color: var(--success-color, #4ade80);
    font-weight: 600;
    font-size: 1rem;
}
.mp-feedback-wrong {
    color: var(--error-color, #f87171);
    font-size: 0.95rem;
}

.mp-club-counter {
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
    margin-left: 4px;
}

.mp-action-btn { width: 100%; max-width: 340px; }

/* Results panel */
.mp-result-title {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
}
.mp-result-msg {
    color: var(--text-muted);
    text-align: center;
    font-size: 1rem;
    margin: 0;
}
.mp-result-actions {
    display: flex;
    gap: 1rem;
    width: 100%;
}

/* =============================================================================
   CONNECTIONS
   ============================================================================= */

.btn-game-mode--orange {
    background: rgba(249, 115, 22, 0.08);
    border-color: rgba(249, 115, 22, 0.3);
}
.btn-game-mode--orange:hover {
    background: rgba(249, 115, 22, 0.18);
    border-color: rgba(249, 115, 22, 0.6);
}
.btn-game-mode--orange .orange-text,
.orange-text { color: #fb923c; }

#cn-game.hidden, #cn-results-panel.hidden { display: none; }

.cn-container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1rem;
}

.cn-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.cn-label { font-weight: 600; font-size: 1rem; color: var(--text-primary); }

.cn-mistakes {
    color: var(--text-muted);
    font-size: 0.95rem;
}
#cn-mistakes-display {
    font-weight: 700;
    color: var(--text-primary);
}

.cn-prompt {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    margin: 0;
}

/* Solved group banners */
.cn-solved-groups { width: 100%; display: flex; flex-direction: column; gap: 0.5rem; }

.cn-solved-banner {
    width: 100%;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    animation: slideInCard 0.3s ease;
}
.cn-solved-banner strong { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.cn-solved-banner span   { font-size: 0.9rem; opacity: 0.85; }

/* Grid */
.cn-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.cn-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem 0.5rem;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.15s;
    line-height: 1.3;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.cn-card:hover {
    border-color: #fb923c;
    background: linear-gradient(135deg, rgba(249,115,22,0.1) 0%, rgba(249,115,22,0.05) 100%);
    box-shadow: 0 4px 12px rgba(249,115,22,0.15);
}
.cn-card.cn-selected {
    background: linear-gradient(135deg, rgba(249,115,22,0.28) 0%, rgba(249,115,22,0.15) 100%);
    border-color: #fb923c;
    transform: scale(1.04);
    box-shadow: 0 4px 16px rgba(249,115,22,0.25);
}

@keyframes cnShake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}
.cn-shake { animation: cnShake 0.45s ease; }

/* Hint banner */
.cn-hint-banner {
    width: 100%;
    background: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.4);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    color: #fb923c;
    text-align: center;
}

/* Actions */
.cn-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
}
.cn-action-btn { width: 100%; }

/* Color theming for groups */
.cn-color-yellow { background: rgba(234, 179, 8, 0.25);  border: 1px solid rgba(234, 179, 8, 0.5);  color: #fef08a; }
.cn-color-green  { background: rgba(34, 197, 94, 0.25);  border: 1px solid rgba(34, 197, 94, 0.5);  color: #bbf7d0; }
.cn-color-blue   { background: rgba(59, 130, 246, 0.25); border: 1px solid rgba(59, 130, 246, 0.5); color: #bfdbfe; }
.cn-color-purple { background: rgba(168, 85, 247, 0.25); border: 1px solid rgba(168, 85, 247, 0.5); color: #e9d5ff; }

/* Results */
.cn-result-title { font-size: 1.6rem; font-weight: 700; text-align: center; }
.cn-result-msg   { color: var(--text-muted); text-align: center; font-size: 1rem; margin: 0; }

.cn-result-groups {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.cn-result-group {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.cn-result-group strong { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.cn-result-group span   { font-size: 0.88rem; opacity: 0.85; }

.cn-result-actions { display: flex; gap: 1rem; width: 100%; }

/* ── Responsive: tablets ─────────────────────────────────────── */
@media (max-width: 768px) {
    .hero-box { padding: 2rem; }
    .hero-box h1 { font-size: 2rem; }
    .hero-box p { font-size: 1rem; margin-bottom: 1.25rem; }

    .grid-header, .grid-row { gap: 0.5rem; }
}

/* ── Responsive: phones ─────────────────────────────────────── */
@media (max-width: 480px) {
    /* ── Start screen ── */
    .hero-box { padding: 1.25rem; }
    .hero-box h1 { font-size: 1.6rem; margin-bottom: 0.5rem; }
    .hero-box p { font-size: 0.9rem; margin-bottom: 1rem; }
    .config-options { padding: 1rem; }
    .config-options h3 { font-size: 0.95rem; margin-bottom: 0.6rem; }

    .daily-section { margin-bottom: 0.75rem; }
    .daily-section p { font-size: 0.75rem; }

    .team-chip { font-size: 0.8rem; padding: 0.4rem 0.75rem; }
    .size-buttons { flex-direction: column; width: 100%; }
    .size-buttons .btn { width: 100%; }

    /* ── Grid game ── */
    .grid-header, .grid-row { gap: 0.4rem; }
    .team-col-header {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    .team-col-header span { font-size: 0.6rem; }
    .team-row-header {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    .grid-cell { min-height: 80px; }
    .cell-icon { font-size: 1.4rem; }
    .player-name { font-size: 0.7rem; }

    .game-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    .game-controls .btn { width: 100%; }

    /* ── Modal (search) ── */
    .modal-overlay { padding: 2vh 0.5rem 0.5rem; }
    .modal-content { max-height: 96vh; max-height: 96dvh; border-radius: 10px; }
    .modal-header { padding: 0.75rem 1rem; }
    .modal-header h3 { font-size: 0.95rem; }

    /* ── Tooltip ── */
    .cell-tooltip {
        font-size: 0.75rem;
        min-width: 140px;
    }

    /* ── Toast ── */
    .toast { bottom: 1rem; padding: 0.75rem 1rem; font-size: 0.9rem; }

    /* ── Emoji grids (results) ── */
    .emoji-grid { font-size: 1.4rem; letter-spacing: 1px; }

    /* ── Game mode containers ── */
    .cc-container,
    .cp-container,
    .mp-container,
    .cn-container {
        padding: 0 0.5rem;
    }

    /* ── Result action buttons: stack vertically ── */
    .cc-result-actions,
    .cp-result-actions,
    .cn-result-actions,
    .mp-result-actions {
        flex-direction: column;
    }

    /* ── Common Club ── */
    .cc-players { grid-template-columns: 1fr; gap: 0.5rem; }
    .cc-player-card { min-height: 48px; padding: 0.75rem; }

    /* ── Career Path ── */
    .cp-card { padding: 0.6rem 0.75rem; font-size: 0.9rem; }
    .cp-badge-wrap { width: 28px; height: 28px; padding: 2px; }

    /* ── Connections ── */
    .cn-grid { grid-template-columns: repeat(2, 1fr); }
    .cn-card { min-height: 56px; font-size: 0.8rem; }
    .cn-actions { grid-template-columns: 1fr 1fr; }
    .cn-action-btn:last-child { grid-column: span 2; }

    /* ── Mystery Player ── */
    .mp-club-card { gap: 0.6rem; padding: 0.5rem 0.75rem; }
    .mp-badge-wrap { width: 32px; height: 32px; }
    .mp-club-name { font-size: 0.9rem; }
    .mp-club-years { font-size: 0.75rem; }
}
