:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    touch-action: manipulation;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

.main-header {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.main-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.app-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card h3 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
    color: var(--text-muted);
}

.control-group {
    margin-bottom: 1rem;
}

select {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

select:focus {
    border-color: var(--primary);
}

.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#delete-competition {
    grid-column: span 2;
}

.setup-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    opacity: 0.9;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: #f1f5f9;
}

.main-content {
    min-width: 0;
}

#current-hill-info h1 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.placeholder {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    place-items: center;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    top: 0rem;
    right: .5rem;
    font-size: 2.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.scroll-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
    margin: 1rem 0;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.scroll-list li {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.scroll-list label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.scroll-list input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
}

/* Round View Styles */
.round-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.jumper-entry-card {
    padding: 2rem;
    margin-bottom: 2rem;
    background: #eff6ff;
    border: 2px solid #bfdbfe;
}

.jumper-profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    grid-column: span 2;
}

.jumper-photo {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    border: 2px solid #bfdbfe;
    flex-shrink: 0;
}

.jumper-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.jumper-info h2 {
    font-size: 2.5rem;
    margin: 0.1rem 0;
    color: var(--primary);
}

.nationality-badge {
    background: var(--primary);
    color: white;
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 0.05rem;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-field label {
    font-weight: 700;
    font-size: 1.125rem;
}

.touch-input {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid var(--border);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    user-select: none;
}

.judges-notes-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.note-input {
    background: white;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

/* Standings Table */
.standings-container {
    overflow-x: auto;
}

#standings {
    width: 100%;
    border-collapse: collapse;
}

#standings th {
    text-align: left;
    padding: 1rem;
    background: #f1f5f9;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
}

#standings td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.qualified-row {
    background: #f0fdf4;
}

.unqualified-row {
    opacity: 0.5;
}

/* Numpad Overlay */
.numpad-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.numpad-content {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.numpad-display {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
    font-size: 2rem;
    font-weight: 700;
    text-align: right;
    font-family: monospace;
}

.numpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.num-btn {
    padding: 1.5rem 1rem;
    border-radius: 8px;
    background: white;
    border: 1px solid var(--border);
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
}

.num-btn:active {
    background: #f1f5f9;
}

.action-del {
    color: var(--danger);
}

.numpad-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
    }
}

/* Sidebar Standings Widget */
#wc-standings-widget {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#wc-standings-widget h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #475569;
    letter-spacing: 0.05rem;
    margin-bottom: 0.75rem;
}

#sidebar-standings-list {
    font-size: 0.9rem;
}

.sidebar-standings-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-standings-row .rank {
    width: 25px;
    color: #64748b;
}

.sidebar-standings-row .name {
    flex: 1;
    margin-left: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-standings-row .points {
    font-weight: bold;
    color: var(--primary);
}

/* Modal Enhancements */
.large-modal {
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
}

.modal-scroll-area {
    overflow-y: auto;
    max-height: 65vh;
    margin-top: 1.5rem;
    padding-right: 0.5rem;
}

.modal-content.large-modal h2 {
    text-align: center;
    color: #fff;
    letter-spacing: 2px;
}

table#full-standings-table {
    width: 100%;
    text-align: center;
    background: #64748b;
    padding: 1rem;
    border-radius: 15px;
    color: #fff;
}

#full-standings-table thead tr th {
    border-bottom: 2px solid #fff;
    padding-bottom: 4px;
}

#full-standings-list tr td {
    padding: 6px 0;
}

/* Upcoming Jumpers */
.upcoming-jumpers-list {
    margin-top: 2rem;
    padding: 1.5rem;
}

.upcoming-jumpers-list h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03rem;
}

.upcoming-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
}

.upcoming-item {
    font-size: 0.85rem;
    padding: 0.6rem 0.4rem;
    background: white;
    border-radius: 6px;
    text-align: center;
    border: 1px solid var(--border);
}