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

:root {
    --bg: #0d1117;
    --fg: #f0f6fc;
    --accent: #58a6ff;
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
    --card: #21262d;
    --input: #30363d;
    --button: #238636;
    --button-hover: #2ea043;
    --border: #30363d;
    --shadow: rgba(0, 0, 0, 0.3);
    --glow: rgba(88, 166, 255, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, #161b22 100%);
    color: var(--fg);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 16px;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 20px var(--glow);
    }

    50% {
        box-shadow: 0 0 30px var(--glow), 0 0 40px var(--glow);
    }
}

.header {
    text-align: center;
    padding: 40px 0;
    background: linear-gradient(45deg, var(--accent), #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header h1 {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 900;
    margin-bottom: 8px;
    animation: slideInLeft 1s ease-out;
}

.header p {
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    opacity: 0.8;
    color: var(--fg);
    animation: slideInRight 1s ease-out;
}

.server-status {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--fg);
    opacity: 0.9;
    animation: fadeIn 1.2s ease-out;
}

.status-indicator {
    font-size: 1rem;
    transition: all 0.3s ease;
}

.server-status.connected .status-indicator {
    color: var(--success);
}

.server-status.connecting .status-indicator {
    color: var(--warning);
    animation: pulse 2s infinite;
}

.server-status.disconnected .status-indicator {
    color: var(--danger);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.card {
    background: var(--card);
    border-radius: 16px;
    margin: 20px 0;
    padding: 24px;
    box-shadow: 0 8px 32px var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.6s ease-out;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 48px var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 700;
}

.card-header .icon {
    font-size: 1.5rem;
    margin-right: 12px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--fg);
}

.input-field {
    width: 100%;
    padding: 16px;
    background: var(--input);
    border: 2px solid transparent;
    border-radius: 12px;
    color: var(--fg);
    font-size: 16px;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-user-select: text;
    user-select: text;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.1);
    transform: scale(1.02);
}

.radio-group {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 16px;
}

.radio-option {
    flex: 1;
    position: relative;
}

.radio-option input {
    position: absolute;
    opacity: 0;
}

.radio-option label {
    display: block;
    padding: 16px;
    background: var(--input);
    border: 2px solid transparent;
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.radio-option input:checked+label {
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.1);
    transform: scale(1.05);
    animation: pulse 0.6s ease-out;
}

.red-alliance {
    color: #ff4444;
}

.blue-alliance {
    color: #4488ff;
}

.timer-display {
    text-align: center;
    padding: 40px 20px;
}

.timer-period {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 16px;
    animation: pulse 2s infinite;
}

.timer-time {
    font-size: clamp(3rem, 12vw, 5rem);
    font-weight: 900;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    margin: 20px 0;
    background: linear-gradient(45deg, var(--accent), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.timer-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 56px;
    touch-action: manipulation;
}

.btn-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn svg {
    width: 24px;
    height: 24px;
}

.btn:active {
    transform: scale(0.95);
}

/* Mobile-specific button fixes */
@media (hover: none) and (pointer: coarse) {
    .btn {
        cursor: default;
        -webkit-tap-highlight-color: rgba(88, 166, 255, 0.3);
    }
}

.btn-primary {
    background: var(--success);
    color: white;
    background-color: var(--button);
    color: var(--fg);
}

.btn-primary:hover {
    background-color: var(--button-hover);
}

.btn-primary:hover:not(:disabled) {
    background: var(--button-hover);
    box-shadow: 0 8px 24px rgba(35, 134, 54, 0.4);
}

.btn-warning {
    background: var(--warning);
    color: var(--fg);
}

.btn-danger {
    background: var(--danger);
    color: var(--fg);
}

.btn-accent {
    background: var(--accent);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.score-display {
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--success), #2ea043);
    border-radius: 16px;
    margin: 24px 0;
    animation: glow 3s infinite;
}

.score-display h2 {
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 900;
    color: white;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.scoring-section {
    display: none;
    animation: fadeInUp 0.5s ease-out;
}

.scoring-section.active {
    display: block;
}

.score-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    margin: 12px 0;
    background: var(--input);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.score-item:hover {
    background: rgba(88, 166, 255, 0.1);
}

.score-item-info {
    flex: 1;
}

.score-item-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.score-item-points {
    font-size: 0.9rem;
    opacity: 0.7;
}

.score-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.counter-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.counter-btn:active {
    transform: scale(0.9);
}

.counter-btn.minus {
    background: var(--danger);
    color: white;
}

.counter-btn.plus {
    background: var(--success);
    color: white;
}

.counter-display {
    width: 60px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.toggle-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.toggle-btn.off {
    background: var(--button);
    color: white;
}

.toggle-btn.on {
    background: var(--success);
    color: white;
}

.notes-section {
    margin: 24px 0;
}

.notes-textarea {
    width: 100%;
    min-height: 150px;
    padding: 20px;
    background: var(--input);
    border: 2px solid transparent;
    border-radius: 12px;
    color: var(--fg);
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
}

.notes-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.1);
}

.save-controls {
    background: var(--bg);
    padding: 20px 16px 40px 16px;
    margin-top: 20px;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    left: 20px;
    max-width: 400px;
    margin: 0 auto;
    padding: 16px 20px;
    border-radius: 12px;
    font-weight: 600;
    z-index: 1000;
    transform: translateY(-100px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification.show {
    transform: translateY(0);
}

.notification.success {
    background: var(--success);
    color: white;
}

.notification.error {
    background: var(--danger);
    color: white;
}

.notification.info {
    background: var(--accent);
    color: white;
}

.notification.warning {
    background: var(--warning);
    color: white;
}

.hidden {
    display: none !important;
}

/* Add these new styles */
.team-input-container {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px var(--shadow);
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
}

.autocomplete-item:hover {
    background: var(--input);
}

.team-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    background: var(--input);
}

.team-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.team-details {
    display: flex;
    flex-direction: column;
}

.team-details span {
    font-size: 0.9rem;
    opacity: 0.8;
}

.card.with-team-colors {
    border: 2px solid transparent;
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

/* Mobile specific styles */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }

    .card {
        margin: 16px 0;
        padding: 20px;
        border-radius: 12px;
    }

    .timer-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        justify-content: center;
        padding: 18px;
    }

    .radio-group {
        flex-direction: column;
        gap: 12px;
    }

    .counter-btn {
        width: 44px;
        height: 44px;
    }
}

/* Dark scrollbar for webkit */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Login Screen Styles */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg) 0%, #161b22 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px var(--shadow);
}

.login-box h1 {
    color: var(--accent);
    font-size: 1.8rem;
    margin-bottom: 10px;
    text-align: center;
}

.login-box h2 {
    color: var(--fg);
    font-size: 1.2rem;
    margin-bottom: 30px;
    text-align: center;
    font-weight: normal;
}

.login-box .input-group {
    margin-bottom: 20px;
}

.login-box button {
    width: 100%;
}