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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #f0f0f0;
    color: #333;
    padding-bottom: 80px;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.clock-display {
    font-size: 2.5em;
    font-weight: bold;
    text-align: center;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
    background: rgba(255,255,255,0.2);
    padding: 10px;
    border-radius: 8px;
}

.controls {
    background: white;
    padding: 15px;
    margin: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.history-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.collapse-toggle {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    margin-left: auto;
}

.collapse-toggle:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.1);
}

.collapsible-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.collapsible-content.collapsed {
    max-height: 0;
    margin-bottom: 0;
    opacity: 0;
}

.quarter-selector {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin: 10px 0;
}

.quarter-button {
    flex: 1;
    padding: 12px 0;
    font-size: 1.2em;
    font-weight: 600;
    border: 2px solid #ddd;
    border-radius: 8px;
    background-color: #f5f5f5;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quarter-button.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: scale(1.05);
}

.control-row {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

.control-row label {
    flex: 1;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.control-row input, .control-row select {
    flex: 2;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    flex: 1;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
}

.clock-controls {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.clock-controls button {
    flex: 1;
}

.start-button {
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
}

.stop-button {
    background: linear-gradient(135deg, #f857a6 0%, #ff5858 100%);
}

.share-button {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.players-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    justify-content: center;
}

.player-card {
    width: calc(33.333% - 10px);
    min-width: 100px;
    background: white;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.player-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.player-card.on-field {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: #1a1a1a;
}

.player-card.warning {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    color: #1a1a1a;
}

.player-card.alert {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    animation: pulse 2s infinite;
}

.player-card.not-played {
    background: #e2e3e5;
    color: #666;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.player-name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
    word-break: break-word;
}

.player-time {
    font-size: 1.3em;
    font-family: 'Courier New', monospace;
}

.captain-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 1.2em;
}

.goaltender-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    font-size: 1.2em;
}

.alert-icon {
    position: absolute;
    top: 25px;
    left: 5px;
    font-size: 1.2em;
    animation: ring 1s infinite;
}

@keyframes ring {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.goal-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid #667eea;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.score-display {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 1.2em;
    font-weight: bold;
}

.team-score {
    padding: 5px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
}

.other-score {
    padding: 5px 15px;
    background: linear-gradient(135deg, #636e72 0%, #2d3436 100%);
    color: white;
    border-radius: 20px;
}

.event-button {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.2em;
    box-shadow: 0 5px 20px rgba(245, 87, 108, 0.4);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    background: white;
    margin: 20px;
    border-radius: 15px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

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

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px 15px 0 0;
    font-size: 1.3em;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    cursor: pointer;
    font-size: 1.5em;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.modal-body {
    padding: 20px;
}

.player-list {
    margin: 20px 0;
}

.player-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin: 5px 0;
    background: #f8f9fa;
    border-radius: 8px;
}

.player-item input {
    flex: 1;
    margin: 0 10px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
}

.player-item button {
    padding: 8px 15px;
    font-size: 0.9em;
    background: linear-gradient(135deg, #f857a6 0%, #ff5858 100%);
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #eee;
}

.add-player-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.add-player-row input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
}

.history-section {
    background: white;
    margin: 10px;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.history-section h2 {
    color: #667eea;
    margin: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

tr:nth-child(even) {
    background: #f8f9fa;
}

.event-modal select {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    border: 2px solid #667eea;
    border-radius: 8px;
    margin: 10px 0;
}

.event-type-container {
    margin: 20px 0;
}

.event-options {
    margin: 20px 0;
}

.events-list {
    max-height: 400px;
    overflow-y: auto;
}

.event-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    margin: 5px 0;
    background: #f8f9fa;
    border-radius: 8px;
}

.event-info {
    flex: 1;
}

.event-actions {
    display: flex;
    gap: 5px;
}

.event-actions button {
    padding: 5px 10px;
    font-size: 0.9em;
}

.edit-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.delete-button {
    background: linear-gradient(135deg, #f857a6 0%, #ff5858 100%);
}

.warning-modal {
    background: #fff3cd;
    border: 2px solid #ffc107;
    padding: 20px;
    border-radius: 10px;
    margin: 20px auto;
    max-width: 500px;
    text-align: center;
}

.warning-modal h3 {
    color: #856404;
    margin-bottom: 15px;
}

.warning-modal .modal-footer {
    justify-content: center;
}

.sound-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.2);
    padding: 5px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
}

.import-modal {
    background: #d4edda;
    border: 2px solid #28a745;
    padding: 20px;
    border-radius: 10px;
    margin: 20px auto;
    max-width: 500px;
    text-align: center;
}

.import-modal h3 {
    color: #155724;
    margin-bottom: 15px;
}

.share-modal {
    background: #d1ecf1;
    border: 2px solid #17a2b8;
    padding: 20px;
    border-radius: 10px;
    margin: 20px auto;
    max-width: 600px;
    text-align: left;
}

.share-modal h3 {
    color: #0c5460;
    margin-bottom: 15px;
    text-align: center;
}

.share-options {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.share-options h4 {
    margin-bottom: 10px;
    color: #0c5460;
}

.share-option {
    margin: 8px 0;
    display: flex;
    align-items: center;
}

.share-option input {
    margin-right: 8px;
}

.select-all-options {
    margin: 10px 0;
    padding: 10px;
    background: #e9ecef;
    border-radius: 6px;
}

.select-all-options button {
    margin-right: 10px;
    padding: 5px 10px;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    .player-card {
        width: calc(33.333% - 7px);
        padding: 10px;
    }
    
    .player-name {
        font-size: 0.9em;
    }
    
    .player-time {
        font-size: 1.1em;
    }
    
    h1 {
        font-size: 1.3em;
    }
    
    .clock-display {
        font-size: 2em;
    }
}

@media (max-width: 480px) {
    .player-card {
        width: calc(30% - 5px);
    }
}
