/* ========== Soccer Field Scoreboard ========== */
.soccer-field {
    flex-shrink: 0;
    position: relative;
    text-align: center;
    padding: 8px;
}

/* ========== Sudoku Grid ========== */
.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 2px;
    background: linear-gradient(145deg, #1e3a5f, #2c4e70);
    padding: 8px;
    margin: 0 auto 10px;
    max-width: 480px;
    aspect-ratio: 1;
    border-radius: 20px;
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.3),
        inset 0 2px 5px rgba(0, 0, 0, 0.5),
        inset 0 -2px 5px rgba(255, 255, 255, 0.1);
    position: relative;
    transform: perspective(1000px) rotateX(2deg);
}

.sudoku-cell {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: 800;
    cursor: pointer;
    color: #1e3a5f;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    position: relative;
    transform-style: preserve-3d;
    min-height: 40px;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Subtle pitch pattern for cells */
.sudoku-cell::after {
    content: '';
    position: absolute;
    inset: 15%;
    background: linear-gradient(45deg, transparent 45%, rgba(143, 188, 143, 0.1) 45%, rgba(143, 188, 143, 0.1) 55%, transparent 55%);
    transform: rotate(45deg);
    border-radius: 2px;
    opacity: 0.5;
    pointer-events: none;
}

.sudoku-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: linear-gradient(145deg, transparent, rgba(255,255,255,0.5));
    opacity: 0;
    transition: opacity 0.3s;
}

.sudoku-cell:hover:not(.fixed)::before {
    opacity: 1;
}

.sudoku-cell:active {
    transform: scale(0.95) translateZ(-5px);
}

.sudoku-cell:hover:not(.fixed) {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.2),
        0 0 0 2px rgba(33, 150, 243, 0.3);
    z-index: 10;
}

.sudoku-cell.selected {
    background: linear-gradient(145deg, #2196F3, #1976D2);
    color: white;
    box-shadow: 
        0 0 0 3px #2196F3,
        0 0 30px rgba(33, 150, 243, 0.6),
        inset 0 1px 3px rgba(255, 255, 255, 0.3);
    animation: selectedPulse 1.5s ease-in-out infinite;
    transform: scale(1.05);
}

@keyframes selectedPulse {
    0%, 100% { 
        transform: scale(1.05);
        box-shadow: 
            0 0 0 3px #2196F3,
            0 0 30px rgba(33, 150, 243, 0.6),
            inset 0 1px 3px rgba(255, 255, 255, 0.3);
    }
    50% { 
        transform: scale(1.08);
        box-shadow: 
            0 0 0 5px #2196F3,
            0 0 40px rgba(33, 150, 243, 0.8),
            inset 0 1px 3px rgba(255, 255, 255, 0.3);
    }
}

.sudoku-cell.fixed {
    background: linear-gradient(145deg, #eceff1, #cfd8dc);
    color: #455a64;
    cursor: default;
    font-weight: 900;
    box-shadow: 
        inset 2px 2px 5px rgba(0, 0, 0, 0.1),
        inset -2px -2px 5px rgba(255, 255, 255, 0.7);
}

.sudoku-cell.error {
    background: linear-gradient(145deg, #ff5252, #f44336);
    color: white;
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
    box-shadow: 
        0 0 20px rgba(244, 67, 54, 0.6),
        inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px) rotate(-2deg); }
    20%, 40%, 60%, 80% { transform: translateX(5px) rotate(2deg); }
}

.sudoku-cell.highlight {
    background: linear-gradient(145deg, #fff9c4, #fff59d);
    box-shadow: 
        0 0 15px rgba(255, 235, 59, 0.3),
        inset 0 1px 3px rgba(255, 255, 255, 0.6);
}

/* MAXIMUM SPECIFICITY POSITION HIGHLIGHTING - ALWAYS OVERRIDES EVERYTHING */
.sudoku-cell.position-highlight,
.sudoku-cell.position-highlight.fixed,
.sudoku-cell.position-highlight.highlight,
.sudoku-cell.fixed.position-highlight,
body .sudoku-cell.position-highlight,
html body .sudoku-cell.position-highlight {
    background: linear-gradient(145deg, var(--league-color, #4ade80), var(--league-color-dark, #16a34a)) !important;
    color: white !important;
    font-weight: 900 !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8) !important;
    box-shadow: 
        0 0 25px var(--league-color, #4ade80) !important,
        0 0 15px var(--league-color-light, rgba(74, 222, 128, 0.6)) !important,
        inset 0 2px 4px rgba(255, 255, 255, 0.4) !important;
    border: 3px solid white !important;
    animation: positionHighlightPulse 2s ease-in-out infinite !important;
    transform: scale(1.02) !important;
    z-index: 50 !important;
}

@keyframes positionHighlightPulse {
    0%, 100% { 
        box-shadow: 
            0 0 25px var(--league-color, #4ade80),
            0 0 15px var(--league-color-light, rgba(74, 222, 128, 0.6)),
            inset 0 2px 4px rgba(255, 255, 255, 0.4);
        transform: scale(1.02);
    }
    50% { 
        box-shadow: 
            0 0 35px var(--league-color, #4ade80),
            0 0 25px var(--league-color-light, rgba(74, 222, 128, 0.8)),
            inset 0 2px 4px rgba(255, 255, 255, 0.5);
        transform: scale(1.03);
    }
}

.sudoku-cell.hint-available {
    background: linear-gradient(145deg, #fff59d, #ffeb3b);
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.6),
        inset 0 1px 3px rgba(255, 255, 255, 0.8);
    border: 2px solid #ffd700;
    cursor: pointer;
    animation: hintPulse 1.5s ease-in-out infinite;
}

@keyframes hintPulse {
    0%, 100% { 
        box-shadow: 
            0 0 20px rgba(255, 215, 0, 0.6),
            inset 0 1px 3px rgba(255, 255, 255, 0.8);
    }
    50% { 
        box-shadow: 
            0 0 30px rgba(255, 215, 0, 0.8),
            inset 0 1px 3px rgba(255, 255, 255, 0.8);
    }
}

.sudoku-cell.notes-mode {
    background: linear-gradient(145deg, #e8f5e8, #f0f8f0);
    border: 2px solid #4CAF50;
    cursor: crosshair;
}

.sudoku-cell.notes-selected {
    background: linear-gradient(145deg, #c8e6c9, #a5d6a7) !important;
    border: 3px solid #4CAF50 !important;
    transform: scale(1.05) !important;
    z-index: 20;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.8) !important;
    position: relative;
}

.sudoku-cell.pop-in {
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes popIn {
    0% {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.3) rotate(90deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Thicker borders for 3x3 sections */
.sudoku-cell:nth-child(3n) {
    margin-right: 4px;
}

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    margin-bottom: 4px;
}

/* ========== Notes System ========== */
.cell-notes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 1px;
    width: 100%;
    height: 100%;
    padding: 2px;
    font-size: 0.4em;
    font-weight: 600;
    color: #666;
}

.note-item {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.note-item:hover {
    background: rgba(76, 175, 80, 0.3);
    color: #2e7d32;
    transform: scale(1.1);
}

.note-item.active {
    background: #4CAF50;
    color: white;
    font-weight: 800;
}

/* ========== Position Selector ========== */
.position-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    position: relative;
}

.position-row {
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* ========== Position Groups (Attack / Mid / Defense) ========== */
.pos-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.pos-group-buttons {
    display: flex;
    gap: 3px;
}

.pos-group-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    white-space: nowrap;
    line-height: 1;
    margin-top: 1px;
}

.label-attack { color: #ef4444; }
.label-mid { color: #eab308; }
.label-def { color: #4ade80; }

/* [?] help button */
.pos-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
    font-size: 0.55rem;
    font-weight: 800;
    cursor: pointer;
    margin-left: 3px;
    vertical-align: middle;
    border: 1px solid rgba(74, 222, 128, 0.3);
    line-height: 1;
}

.pos-help-btn:hover {
    background: rgba(74, 222, 128, 0.4);
}

/* Position Help Modal */
.pos-help-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 5000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.pos-help-overlay.show {
    display: flex;
}

.pos-help-modal {
    background: linear-gradient(145deg, #1a3a2a, #0f2a1a);
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: 18px;
    padding: 20px 22px;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 0.3s ease;
}

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

.pos-help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.pos-help-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
}

.pos-help-close {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
}

.pos-help-zone {
    margin-bottom: 12px;
}

.pos-help-zone:last-child {
    margin-bottom: 0;
}

.pos-help-zone-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.pos-help-item {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.85);
    padding: 4px 0;
    line-height: 1.4;
}

.pos-help-item strong {
    color: #fff;
    font-weight: 800;
    margin-right: 4px;
    display: inline-block;
    width: 28px;
}

/* Position Name Toast */
.pos-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 20px;
    pointer-events: none;
    opacity: 0;
    z-index: 4000;
    transition: opacity 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

/* ========== Soccer Ball Position Buttons ========== */
.position-btn {
    /* Perfect circle */
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: 900;
    letter-spacing: 0.02em;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    /* Classic soccer ball: white leather with 3D depth */
    background:
        radial-gradient(circle at 35% 30%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 50%),
        radial-gradient(circle at 50% 50%, #f8f8f8 0%, #e8e8e8 60%, #d0d0d0 100%);
    color: #222;
    text-shadow: 0 1px 0 rgba(255,255,255,0.6);
    /* 3D ball shadow */
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 2px 3px rgba(255, 255, 255, 1),
        inset 0 -3px 6px rgba(0, 0, 0, 0.12),
        inset 2px 0 3px rgba(255, 255, 255, 0.3),
        inset -2px 0 3px rgba(0, 0, 0, 0.05);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    /* Kill any default button styles */
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    /* Stacking: no z-index here so ::before z-index:-1 goes behind bg */
    isolation: isolate;
}

/* Pentagon pattern in league color - sits behind text */
.position-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    background:
        /* Top pentagon */
        radial-gradient(ellipse 8px 7px at 50% 6%, var(--league-color, #4ade80) 40%, transparent 50%),
        /* Left pentagon */
        radial-gradient(ellipse 7px 7px at 10% 40%, var(--league-color, #4ade80) 35%, transparent 48%),
        /* Right pentagon */
        radial-gradient(ellipse 7px 7px at 90% 40%, var(--league-color, #4ade80) 35%, transparent 48%),
        /* Bottom-left pentagon */
        radial-gradient(ellipse 7px 6px at 22% 85%, var(--league-color, #4ade80) 35%, transparent 48%),
        /* Bottom-right pentagon */
        radial-gradient(ellipse 7px 6px at 78% 85%, var(--league-color, #4ade80) 35%, transparent 48%);
    opacity: 0.4;
    pointer-events: none;
    z-index: -1;
}

/* Subtle seam border */
.position-btn::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 0, 0, 0.06);
    pointer-events: none;
    z-index: -1;
}

/* Hover: ball lifts and glows green */
.position-btn:hover:not(.disabled) {
    transform: translateY(-3px) scale(1.1);
    background:
        radial-gradient(circle at 35% 30%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 50%),
        radial-gradient(circle at 50% 50%, #f0fff0 0%, #d4edda 60%, #b8d4b8 100%);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.3),
        0 4px 10px rgba(0, 0, 0, 0.15),
        0 0 0 2.5px rgba(76, 175, 80, 0.7),
        0 0 16px rgba(76, 175, 80, 0.3),
        inset 0 2px 3px rgba(255, 255, 255, 1),
        inset 0 -3px 6px rgba(0, 0, 0, 0.08);
}

.position-btn:hover:not(.disabled)::before {
    opacity: 0.5;
}

/* Active press */
.position-btn:active:not(.disabled) {
    transform: translateY(0px) scale(0.97);
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Disabled: used position - deflated look */
.position-btn.disabled {
    opacity: 0.25;
    cursor: not-allowed;
    transform: scale(0.9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    filter: grayscale(1) brightness(0.9);
}

.position-btn.disabled:hover {
    transform: scale(0.9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Notes mode ON - balls get green ring glow */
.notes-mode-active .position-btn:not(.disabled) {
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 0 2px rgba(76, 175, 80, 0.5),
        0 0 12px rgba(76, 175, 80, 0.25),
        inset 0 2px 3px rgba(255, 255, 255, 1),
        inset 0 -3px 6px rgba(0, 0, 0, 0.08) !important;
}

/* Ball selected in notes mode - green ball */
.position-btn.notes-active {
    background:
        radial-gradient(circle at 35% 30%, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 50%),
        radial-gradient(circle at 50% 50%, #66bb6a 0%, #43a047 60%, #2e7d32 100%) !important;
    color: #ffffff !important;
    font-weight: 900 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.3),
        0 0 0 2px #4CAF50,
        0 0 20px rgba(76, 175, 80, 0.6),
        inset 0 2px 3px rgba(255, 255, 255, 0.4),
        inset 0 -3px 6px rgba(0, 0, 0, 0.15) !important;
    transform: scale(1.12);
    animation: notesActivePulse 1.5s ease-in-out infinite;
}

@keyframes notesActivePulse {
    0%, 100% { 
        box-shadow: 
            0 6px 20px rgba(0, 0, 0, 0.2),
            0 3px 8px rgba(0, 0, 0, 0.15),
            inset 0 2px 4px rgba(255, 255, 255, 0.9),
            0 0 0 2px #ffffff,
            0 0 20px rgba(76, 175, 80, 0.6);
    }
    50% { 
        box-shadow: 
            0 6px 20px rgba(0, 0, 0, 0.2),
            0 3px 8px rgba(0, 0, 0, 0.15),
            inset 0 2px 4px rgba(255, 255, 255, 0.9),
            0 0 0 2px #ffffff,
            0 0 30px rgba(76, 175, 80, 0.9);
    }
} 