* {
    padding: 0;
    margin: 0;
    color: #ddd;
    font-family: 'Outfit', 'Courier New', Courier, monospace;
    box-sizing: border-box;
}

body {
    background: #0a0a0a;
    overflow: hidden;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.handle {
    width: 6px;
    height: 6px;
    background-color: white;
    border-radius: 50%;
    position: absolute;
    cursor: crosshair;
    pointer-events: auto;
    user-select: none;
    z-index: 2;
    border: 1px solid;
}

.player-handle {
    border-color: #3F8AE2;
}

.ball-handle {
    border-color: red;
}

#home {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#home > div {
    margin-top: 10px;
}

option, select {
    color: black;
}

#content {
    display: none;
    flex-direction: row;
    height: calc(100vh - 16px);
    box-sizing: border-box;
}

#container {
    display: flex;
    flex-direction: column;
    width: calc(80vw - 8px);
    height: calc(100vh - 16px);
    box-sizing: border-box;
}

#deleteMove {
    display: none;
}

#options {
    display: flex;
    flex-direction: column;
    border: 1px solid #bbb;
    border-radius: 3px;
    margin: 0 0 0 8px;
    padding: 8px;
    width: calc(20vw - 8px);
    height: calc(100vh - 16px);
    overflow-y: auto;
    box-sizing: border-box;
}

/* Section headers for organizing controls */
.section-header {
    font-size: 14px;
    font-weight: 600;
    color: #888;
    margin: 20px 0 12px 0;
    letter-spacing: 0.5px;
    padding-bottom: 8px;
    padding-top: 8px;
}

.section-header:first-of-type {
    margin-top: 0;
}

/* Close button styles for modals */
.close-button {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 25px;
    height: 25px;
    min-width: 25px;
    min-height: 25px;
    max-width: 25px;
    max-height: 25px;
    background: var(--color-elevated);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    z-index: 10;
    box-sizing: border-box;
    transition: background-color 0.15s ease;
    flex-shrink: 0;
    padding: 0;
}

.close-button:hover {
    background: var(--color-elevated-hover);
}

.close-button::before {
    content: "✕";
    font-size: 14px;
    line-height: 1;
}

/* Player options close button - same style as sidebar toggle */
#exit-player-options {
    position: absolute !important;
    top: 9px !important;
    right: 9px !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    background: var(--color-elevated) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    font-weight: bold !important;
    z-index: 10 !important;
    box-sizing: border-box !important;
    transition: background-color 0.15s ease !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
}

#exit-player-options:hover {
    background: var(--color-elevated-hover) !important;
}

#exit-player-options::before {
    content: "✕" !important;
    font-size: 10px !important;
    line-height: 1 !important;
}

/* Hide sidebar toggle buttons */
#sidebar-toggle,
#show-sidebar-toggle {
    display: none !important;
}


.item {
    padding: 10px;
    margin-bottom: 0;
    border: 1px solid #bbb;
    border-radius: 3px;
    overflow: hidden;
    box-sizing: border-box;
}

.pitch {
    background: #5A7C4A;
    height: calc(100vh - 16px);
    box-sizing: border-box;
}

#player-options {
    display: none;
}

#setpiece-options > * {
    display: block;
    margin: 0;
    margin-bottom: 5px;
    text-align: left;
}

#animation-modal > * {
    display: block;
    margin: 0;
    margin-bottom: 5px;
    text-align: left;
}

/* Special styling for the add buttons container */
#setpiece-options .add-buttons-container {
    display: flex !important;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 5px;
}

.add-buttons-container button {
    flex: 1 1 0;
    margin-bottom: 0;
    min-width: 0;
    padding: 5px 0;
}

#player-options > * {
    display: block;
    margin: 0;
    margin-bottom: 5px;
    text-align: left;
}

.description-box {
    border: 1px dashed black;
    background: transparent;
    color: black;
    position: absolute;
    width: 300px;
    height: 100px;
    padding: 5px;
}

.description-box:focus {
    outline: none;
    border: 1px solid black;
}

.header {
    font-weight: bold;
    text-align: center;
    position: relative;
    padding-right: 35px; /* Make room for the close button */
}

.large {
    font-size: 3em;
}

#pitch-wrapper {
    position: relative;
    background: #5A7C4A;
    display: flex;
    justify-content: center;
    border-radius: 3px;
}

input {
    color: black;
}

#pitch {
    user-select: none;
    -webkit-user-drag: none;
}

/* CSS Custom Properties for Dark Theme */
:root {
  /* Primary Colors */
  --color-primary: #38BDF8;
  --color-primary-hover: #0EA5E9;
  --color-primary-active: #0284C7;
  
  /* Status Colors */
  --color-error: #F87171;
  --color-error-hover: #EF4444;
  --color-error-active: #DC2626;
  
  --color-success: #4ADE80;
  --color-success-hover: #22C55E;
  --color-success-active: #16A34A;
  
  /* Neutral Colors */
  --color-object-bg: #F8FAFC;
  --color-object-text: #0F172A;
  --color-border: #E2E8F0;
  --color-border-hover: #CBD5E1;
  
  /* Elevated Colors */
  --color-elevated: #0f0f0f;
  --color-elevated-hover: #1a1a1a;
  --color-elevated-active: #2a2a2a;
  --color-elevated-border: #1a1a1a;
  
  /* Focus */
  --color-focus: rgba(255, 255, 255, 0.3);
  
  /* Typography */
  --font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-weight: 600;
  
  /* Spacing */
  --button-height: 40px;
  --button-padding: 0 20px;
  --button-gap: 8px;
  --button-radius: 8px;
  --button-min-width: 120px;
  
  /* Transitions */
  --transition: background-color 0.15s ease;
  
  /* Form Field Variables */
  --form-border-radius: 8px;
  --form-border-width: 0.5px;
  --form-padding-vertical: 6px;
  --form-padding-horizontal: 8px;
  --form-font-size: 14px;
  --form-line-height: 1;
  --form-transition: border-color 0.2s ease, box-shadow 0.2s ease;
  
  /* Form Colors */
  --form-bg: var(--color-elevated);
  --form-bg-hover: var(--color-elevated-hover);
  --form-border: var(--color-elevated-border);
  --form-border-focus: #ffffff;
  --form-text: #ffffff;
  --form-text-placeholder: #888888;
  --form-text-secondary: #cccccc;
  
  /* Form Spacing */
  --form-margin-vertical: 5px;
  --form-gap: 8px;
}

/* Base Button Styles */
button {
  /* Layout */
  height: var(--button-height);
  padding: var(--button-padding);
  width: 100%;
  min-width: var(--button-min-width);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--button-gap);
  box-sizing: border-box;
  
  /* Appearance */
  border: none;
  border-radius: var(--button-radius);
  cursor: pointer;
  
  /* Typography */
  font-family: var(--font-family);
  font-weight: var(--font-weight);
  font-size: 14px;
  
  /* Behavior */
  transition: var(--transition);
  
  /* Default state */
  background: var(--color-primary);
  color: white;
}

/* Button States */
button:hover { background: var(--color-primary-hover); }
button:active { background: var(--color-primary-active); }
button:focus { 
  outline: none; 
  box-shadow: 0 0 0 2px var(--color-focus); 
}

/* Primary Variants */
button.primary.red {
  background: var(--color-error);
}
button.primary.red:hover { background: var(--color-error-hover); }
button.primary.red:active { background: var(--color-error-active); }

button.primary.green {
  background: #3b82f6;
}
button.primary.green:hover { background: #2563eb; }
button.primary.green:active { background: #1d4ed8; }

button.primary.white {
  background: var(--color-elevated);
  color: white;
  border: 1px solid var(--color-elevated-border);
}
button.primary.white:hover { 
  background: var(--color-elevated-hover);
  border-color: var(--color-elevated-active);
}
button.primary.white:active { background: var(--color-elevated-active); }

/* Secondary Button */
button.secondary {
  background: var(--color-object-bg);
  color: var(--color-object-text);
  border: 1px solid var(--color-border);
}
button.secondary:hover { 
  background: #F1F5F9;
  border-color: var(--color-border-hover);
}
button.secondary:active { background: var(--color-border); }

/* Button Sizes */
button.large {
  height: 48px;
  padding: 0 24px;
  font-size: 16px;
  min-width: 160px;
}

/* Button with Icon */
button .icon {
    width: 16px;
    height: 16px;
    display: inline-block;
}

/* Loading State */
button.loading {
    pointer-events: none;
    opacity: 0.7;
}

button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Disabled State */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:disabled:hover {
    background: #667eea;
}

/* ===== FORM FIELD STYLES ===== */

/* Form Field Wrapper */
.form-field {
    position: relative;
    width: 100%;
    border-radius: var(--form-border-radius);
    border: var(--form-border-width) solid var(--form-border);
    background-color: var(--form-bg);
    transition: var(--form-transition);
    margin: var(--form-margin-vertical) 0;
}

.form-field:hover {
    background-color: var(--form-bg-hover);
}

.form-field:focus-within {
    border-color: var(--form-border-focus);
    box-shadow: 0 0 0 2px var(--color-focus);
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: var(--form-gap);
}

/* Input Container */
.form-input-container {
    display: flex;
    align-items: center;
    position: relative;
}

/* Base Input Styles */
.form-input {
    flex: 1;
    width: 100%;
    padding: var(--form-padding-vertical) var(--form-padding-horizontal);
    border: none;
    border-radius: var(--form-border-radius);
    background: transparent;
    color: var(--form-text);
    font-family: var(--font-family);
    font-size: var(--form-font-size);
    line-height: var(--form-line-height);
    outline: none;
    transition: var(--form-transition);
}

.form-input::placeholder {
    color: var(--form-text-placeholder);
    opacity: 1;
}

.form-input:focus {
    outline: none;
}

/* Form Field States */
.form-field.error {
    border-color: var(--color-error);
}

.form-field.error:focus-within {
    border-color: var(--color-error);
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.3);
}

.form-field.success {
    border-color: var(--color-success);
}

.form-field.success:focus-within {
    border-color: var(--color-success);
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.3);
}

/* Form Labels */
.form-label {
    display: block;
    margin-bottom: var(--form-gap);
    color: var(--form-text);
    font-family: var(--font-family);
    font-size: var(--form-font-size);
    font-weight: 500;
}

/* Form Help Text */
.form-help {
    margin-top: var(--form-gap);
    color: var(--form-text-secondary);
    font-size: 12px;
    font-family: var(--font-family);
}

.form-help.error {
    color: var(--color-error);
}

.form-help.success {
    color: var(--color-success);
}


/* Select Field Styling */
.form-field select.form-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

.player {
    display: flex;
    position: absolute;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    user-select: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    background: #c9473e;
    transition: transform 0.05s ease;
    scale: 1;
    z-index: 3;
}

/* Player color variants */
.player-blue {
    background-color: #3F8AE2;
}

.player-red {
    background-color: #E53E3E;
}

.player-green {
    background-color: #38A169;
}

.player-yellow {
    background-color: #D69E2E;
}

.player-purple {
    background-color: #805AD5;
}

.ball {
    position: absolute;
    cursor: pointer;
    user-select: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    background: white;
    transition: transform 0.05s ease;
    scale: 1;
    z-index: 3;
}

.active-ball {
    border: 1px solid white;
    width: 19px;
    height: 19px;
}

.active {
    border: 1px solid white;
    width: 24px;
    height: 24px;
}

#save-modal {
    position: absolute;
    display: none;
    top: 30%;
    left: 25%;
    background: #0f0f0f;
    color: white;
    padding: 20px;
    border: 2px solid black;
    width: 30%;
    min-height: 25%;
    z-index: 5;
}

#animation-modal {
    position: fixed;
    display: none;
    background: #0f0f0f;
    color: white;
    padding: 15px;
    border: 2px solid #38bdf8;
    border-radius: 8px;
    z-index: 1000;
    width: 350px;
    min-height: 200px;
    bottom: 20px;
    right: 20px;
    user-select: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ===== CUSTOM ANIMATION SLIDER STYLES ===== */

.animation-controls {
    background: var(--color-elevated);
    border: 1px solid var(--color-elevated-border);
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Time Display */
.time-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--form-text);
}

.time-separator {
    color: var(--form-text-placeholder);
}

/* Timeline Container */
.timeline-container {
    position: relative;
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
}

.timeline-track {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--color-elevated-border);
    border-radius: 3px;
    cursor: pointer;
    overflow: visible;
}

.timeline-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-hover));
    border-radius: 3px;
    transition: width 0.1s ease;
    width: 0%;
}

.timeline-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 16px;
    height: 16px;
    background: white;
    border: 2px solid var(--color-primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    transition: all 0.1s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.timeline-handle:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.timeline-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.05);
}

/* Keyframe Markers */
.keyframe-marker {
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    background: #ff6b6b;
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.keyframe-marker:hover {
    transform: translate(-50%, -50%) scale(1.3);
    background: #ff5252;
}

.keyframe-marker.active {
    background: #4ade80;
    border-color: #22c55e;
}

/* Animation Buttons */
.animation-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 8px 0;
}

.control-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--color-elevated-hover);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
    min-width: 36px;
    padding: 0;
}

.control-btn:hover {
    background: var(--color-elevated-active);
    transform: scale(1.05);
}

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

.play-btn {
    background: var(--color-success);
}

.play-btn:hover {
    background: var(--color-success-hover);
}

.play-btn.paused {
    background: var(--color-primary);
}

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

.stop-btn {
    background: var(--color-error);
}

.stop-btn:hover {
    background: var(--color-error-hover);
}

.loop-btn {
    background: var(--color-elevated-hover);
}

.loop-btn.active {
    background: var(--color-primary);
}

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

/* Speed Control */
.speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--form-text-secondary);
}

.speed-control label {
    font-weight: 500;
    min-width: 40px;
}

.speed-control input[type="range"] {
    flex: 1;
    height: 4px;
    background: var(--color-elevated-border);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.speed-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.speed-control input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--color-primary-hover);
    transform: scale(1.1);
}

.speed-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.speed-control input[type="range"]::-moz-range-thumb:hover {
    background: var(--color-primary-hover);
    transform: scale(1.1);
}

#speed-value {
    min-width: 30px;
    text-align: right;
    font-weight: 600;
    color: var(--form-text);
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 4px;
    background: var(--color-elevated-border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    width: 100%;
    height: 100%;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-hover));
    border-radius: 2px;
    transition: width 0.1s ease;
    width: 0%;
}

/* Animation States */
.animation-controls.playing .play-btn .play-icon::before {
    content: "⏸";
}

.animation-controls.playing .play-btn .play-icon {
    display: none;
}

.animation-controls.playing .play-btn::before {
    content: "⏸";
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    #container {
        width: calc(75vw - 8px);
    }
    
    #options {
        width: calc(25vw - 8px);
    }
}

@media (max-width: 768px) {
    #container {
        width: calc(70vw - 8px);
    }
    
    #options {
        width: calc(30vw - 8px);
        margin: 0 0 0 4px;
        padding: 4px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 4px;
    }
    
    #content {
        height: calc(100vh - 8px);
    }
    
    #container {
        width: calc(65vw - 4px);
        height: calc(100vh - 8px);
    }
    
    #options {
        width: calc(35vw - 4px);
        height: calc(100vh - 8px);
        margin: 0 0 0 4px;
        padding: 4px;
    }
    
    .pitch {
        height: calc(100vh - 8px);
    }
    
    .animation-controls {
        padding: 12px;
        gap: 10px;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
        min-width: 32px;
    }
    
    .timeline-handle {
        width: 14px;
        height: 14px;
    }
    
    .keyframe-marker {
        width: 6px;
        height: 6px;
    }
}

#save-warning {
    color: red;
    display: none;
}

#save-confirmation {
    display: none;
}

#save-modal > * {
    margin: 0;
    margin-bottom: 5px;
    text-align: left;
}

line.curve-control {
    stroke: black;
    stroke-dasharray: 4;
    stroke-width: 1;
}

line.curve-segment {
    stroke: rgba(255, 255, 255, 0.6);
    stroke-width: 1;
    stroke-linecap: round;
}