* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #f4f4f9, #eaf2ff);
    color: #1f2937;
}

header {
    background: #1f2937;
    color: white;
    padding: 24px 20px;
    text-align: center;
}

nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

nav a:hover {
    opacity: 0.8;
}

h1, h2, h3 {
    margin-top: 0;
}

.page-content {
    max-width: 900px;
    margin: 50px auto;
    padding: 0 20px 40px;
}

.hero,
.card {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 12px 30px rgba(31, 41, 55, 0.08);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 12px;
    color: #3b82f6;
    font-weight: 700;
}

.hero h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 16px;
}

.hero p {
    font-size: 1.1rem;
    line-height: 1.7;
}

.button-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.home-intro {
    border-left: 6px solid #3498db;
}

.secondary-link {
    background: #1f2937;
}

.secondary-link:hover {
    background: #374151;
}

.home-workflow {
    margin-top: 28px;
}

.home-workflow-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
}

.home-workflow-heading h2 {
    margin-bottom: 0;
}

.workflow-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 0;
    margin-top: 16px;
    list-style: none;
}

.workflow-list li {
    display: flex;
    gap: 14px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid #dbe4ef;
    border-radius: 8px;
}

.workflow-list h3 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.workflow-list p {
    margin: 0;
    color: #4b5563;
    line-height: 1.55;
}

.workflow-number {
    color: #3498db;
    font-size: 0.8rem;
    font-weight: 700;
}

button,
.link-button,
.score-action {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 8px;
    text-decoration: none;
    display: inline-block;
}

button:hover,
.link-button:hover,
.score-action:hover {
    background-color: #2980b9;
}

.score-action.small {
    padding: 8px 10px;
    font-size: 14px;
    min-width: 42px;
}

.score-row .score-action.remove {
    padding: 6px 8px;
    font-size: 12px;
    min-width: 0;
}

.score-action.remove {
    background-color: #e74c3c;
}

.score-action.remove:hover {
    background-color: #c0392b;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.card h3 {
    color: #1f2937;
}

.card p,
.card li {
    line-height: 1.7;
}

ul {
    margin: 0;
    padding-left: 20px;
}

.contact-list {
    list-style: none;
    padding: 0;
}

.contact-list li {
    margin-bottom: 12px;
}

.scoreboard-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.tracker-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

.player-controls {
    margin-bottom: 0;
}

.game-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 280px;
}

.game-action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.game-label-row {
    width: 100%;
    margin-bottom: 24px;
}

.game-label-row input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
}

.round-tracker {
    margin: 16px 0 24px;
    padding: 12px 16px;
    background: #eff6ff;
    border-left: 4px solid #3498db;
    color: #1e3a8a;
    font-weight: 700;
}

.session-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 20px;
}

.session-controls input {
    width: 140px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    text-transform: uppercase;
}

.session-controls span {
    color: #18794e;
    font-size: 14px;
    font-weight: 600;
}

.game-objective {
    margin: 0 0 16px;
    color: #374151;
    font-weight: 600;
}

.scoreboard-controls input {
    flex: 1;
    min-width: 180px;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
}

.score-list {
    display: grid;
    gap: 16px;
}

.score-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    cursor: grab;
    padding-right: 42px;
}

.player-remove-button {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    padding: 0;
    background: #e74c3c;
    color: white;
    border: 0;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    z-index: 1;
}

.player-remove-button:hover {
    background: #c0392b;
}

.score-row.dragging {
    opacity: 0.5;
}

.score-row.drag-over {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

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

.player-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #dbeafe;
    background: #e5e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #1f2937;
}

.score-badge {
    min-width: 54px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1f2937;
}

.score-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.score-input {
    width: 96px;
    min-width: 96px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}

.manillen-team-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.manillen-team-heading {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.manillen-team-members {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.manillen-member {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-right: 24px;
}

.manillen-member .player-remove-button {
    top: -7px;
    right: -7px;
}

.manillen-team-select {
    padding: 4px 6px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
}

.manillen-team-total {
    color: #1f2937;
    font-weight: 700;
}

.manillen-double {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    font-size: 14px;
}

.score-submit-area {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 20px;
}

.score-validation {
    margin: 0;
    color: #b42318;
    text-align: right;
}

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropbtn {
    background: transparent;
    color: white;
    border: none;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: white;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
    border-radius: 10px;
    padding: 8px 0;
    z-index: 10;
}

.nav-dropdown:hover .nav-dropdown-content,
.nav-dropdown.open .nav-dropdown-content {
    display: block;
}

.nav-dropdown-content a {
    display: block;
    padding: 10px 14px;
    color: #1f2937;
    text-decoration: none;
}

.nav-dropdown-content a:hover {
    background: #f3f4f6;
}

.tab-nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 20px 0 24px;
}

.game-picker {
    align-items: center;
    max-width: 420px;
}

.game-picker select {
    flex: 1;
    min-width: 220px;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
}

.game-library-form {
    display: grid;
    grid-template-columns: minmax(0, 520px);
    gap: 10px;
    justify-items: start;
    margin-bottom: 16px;
}

.game-library-form input:not([type="checkbox"]) {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}

.history-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-width: 720px;
    margin-bottom: 16px;
}

.history-filters label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

.history-filters select {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
}

.game-win-condition {
    display: grid;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

.game-win-condition legend {
    padding: 0 4px;
    font-weight: 700;
}

@media (max-width: 760px) {
    .game-library-form {
        grid-template-columns: 1fr;
    }

    .history-filters {
        grid-template-columns: 1fr;
    }
}

.game-tab-button {
    display: none;
}

.game-tab-panel[data-tab="tracker"],
.game-tab-panel[data-tab="history"] {
    display: block;
}

.tab-button,
.game-tab-button {
    background: #dbeafe;
    color: #1f2937;
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.tab-button.active,
.game-tab-button.active {
    background: #3498db;
    color: white;
}

.tab-panel,
.game-tab-panel {
    display: none;
}

.tab-panel.active,
.game-tab-panel.active {
    display: block;
}

.history-panel {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.history-panel h3 {
    margin-bottom: 12px;
}

.history-list {
    display: grid;
    gap: 12px;
}

.history-item {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
}

.history-item strong {
    display: block;
    margin-bottom: 8px;
}

.history-item ul {
    margin: 0;
    padding-left: 18px;
}

.saved-player-panel {
    margin: 24px 0;
    padding: 18px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.saved-player-list {
    display: grid;
    gap: 12px;
}

.saved-player-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: white;
}

.saved-player-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.saved-player-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.muted-text {
    color: #6b7280;
    margin: 0;
}

.admin-card {
    max-width: 620px;
    margin: 0 auto;
}

.admin-status {
    min-height: 24px;
    margin: 12px 0 0;
    color: #b42318;
}

.admin-status.success {
    color: #18794e;
}

.admin-panel {
    margin-top: 20px;
}

.admin-success {
    color: #18794e;
    font-weight: 700;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 600px) {
    nav {
        gap: 10px;
    }

    .hero,
    .card {
        padding: 24px 18px;
    }

    .home-workflow-heading {
        display: block;
    }

    .workflow-list {
        grid-template-columns: 1fr;
    }

    .score-row,
    .saved-player-row,
    .manillen-team-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .tracker-controls {
        flex-direction: column;
    }

    .game-actions {
        min-width: 0;
    }

    .game-action-buttons {
        justify-content: flex-start;
    }

    .manillen-team-names {
        flex-direction: column;
    }

    .score-submit-area {
        align-items: stretch;
        flex-direction: column;
    }

    .score-validation {
        text-align: left;
    }
}
