body {
    margin: 0;
    background: #f7f7f7;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 58px;
    padding: 0 18px;
    background: #7f1018;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.app-brand {
    flex: none;
    color: white;
    font-size: 19px;
    font-weight: bold;
}

.app-navigation {
    display: flex;
    flex: 1;
    align-items: stretch;
    gap: 2px;
}

.app-navigation a {
    display: flex;
    align-items: center;
    padding: 0 11px;
    min-height: 58px;
    color: #f8f8f8;
    font-size: 14px;
    border-bottom: 4px solid transparent;
}

.app-navigation a:hover,
.app-navigation a.active {
    background: rgba(255, 255, 255, 0.12);
    border-bottom-color: white;
}

.nav-toggle {
    display: none;
    width: auto;
    margin-left: auto;
    padding: 8px 12px;
    color: white;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 4px;
}

@media (max-width: 1050px) {
    .app-header {
        flex-wrap: wrap;
        padding: 10px 14px;
    }

    .nav-toggle {
        display: block;
    }

    .app-navigation {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
    }

    .app-navigation.open {
        display: flex;
    }

    .app-navigation a {
        min-height: 40px;
        padding: 4px 10px;
        border-bottom: 0;
        border-left: 4px solid transparent;
    }

    .app-navigation a:hover,
    .app-navigation a.active {
        border-left-color: white;
    }
}

input {
    margin-top: 5px;
    font-size: 10px;
    padding: 2px 0;
}

select {
    margin-top: 5px;
    font-size: 12px;
}

button {
    margin-block: 5px;
    width: 100%;
    padding: 2px;
}

h1 {
    color: black;
    text-align: center;
    font-size: 30px;
    margin: auto;
}

h2 {
    color: black;
    text-align: center;
    font-size: 25px;
    margin: auto;
}

label {
    font-size: 13px;
}

a {
    text-decoration: none;
}

br {
    display: block;
    margin: 3px 0;
}

option {
    cursor: pointer;
}

.settings-page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 18px 48px;
    font-family: Arial, sans-serif;
}

.settings-intro {
    margin: 8px 0 24px;
    color: #555;
    text-align: center;
}

.settings-layout {
    display: grid;
    grid-template-columns: minmax(300px, 0.8fr) minmax(520px, 2fr);
    gap: 20px;
    align-items: start;
}

.settings-card {
    padding: 20px;
    border: 1px solid #d4d4d4;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.settings-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e4e4e4;
}

.settings-card h2 {
    margin: 0 0 5px;
    text-align: left;
    font-size: 21px;
}

.settings-card-header p {
    margin: 0;
    color: #666;
    font-size: 13px;
}

.settings-form-grid,
.team-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.settings-field.full-width {
    grid-column: 1 / -1;
}

.settings-field label {
    font-weight: bold;
    color: #333;
}

.settings-field input,
.settings-field select {
    box-sizing: border-box;
    width: 100%;
    min-height: 42px;
    margin: 0;
    padding: 8px;
    font-size: 16px;
    border: 1px solid #aaa;
    border-radius: 4px;
    background: white;
}

.settings-card-wide {
    grid-column: 1 / -1;
}

.team-settings-card {
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
}

.team-settings-card h3 {
    margin: 0 0 12px;
    color: #7f1018;
}

.team-settings-card .settings-field + .settings-field {
    margin-top: 10px;
}

.team-delete-button {
    width: 100%;
    min-height: 42px;
    margin-top: 14px;
    padding: 8px 12px;
    color: white;
    border: 0;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.settings-actions,
.settings-save-row,
.settings-import-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
}

.settings-save-row {
    grid-column: 1 / -1;
    justify-content: flex-end;
}

.settings-actions button,
.settings-save-row button,
.settings-import-actions button {
    width: auto;
    padding: 9px 16px;
    border: 0;
    border-radius: 4px;
    color: white;
    font-size: 14px;
    cursor: pointer;
}

.settings-primary {
    background: #2e7d32;
}

.settings-danger {
    background: #b71c1c;
}

.settings-actions button:hover,
.settings-save-row button:hover,
.settings-import-actions button:hover {
    filter: brightness(1.08);
}

.settings-import-actions {
    margin: 0 0 18px;
    padding: 12px;
    border-radius: 6px;
    background: #f2f2f2;
}

.settings-import-actions span {
    font-size: 14px;
    font-weight: bold;
}

.settings-status-pending {
    color: #555;
}

.settings-status-success {
    color: #2e7d32;
}

.settings-status-error {
    color: #b71c1c;
}

@media (max-width: 900px) {
    .settings-layout,
    .settings-form-grid,
    .team-settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-import-actions button {
        width: 100%;
    }
}

.page-shell {
    width: min(100% - 24px, 960px);
    margin: 0 auto;
    padding: 20px 0 48px;
}

.page-heading {
    margin-bottom: 18px;
    text-align: left;
}

.page-heading h1 {
    text-align: left;
    font-size: clamp(24px, 7vw, 34px);
}

.page-heading p {
    margin: 7px 0 0;
    color: #666;
    line-height: 1.45;
}

.content-card {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

.content-card h2 {
    margin: 0 0 14px;
    text-align: left;
    font-size: 21px;
}

.mobile-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.mobile-field label,
.inline-form-group label {
    font-weight: bold;
    color: #333;
}

.page-shell input:not([type="checkbox"]):not([type="button"]),
.page-shell select,
.page-shell textarea,
.inline-form-group input {
    box-sizing: border-box;
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 9px 10px;
    font-size: 16px;
    border: 1px solid #aaa;
    border-radius: 6px;
    background: white;
}

.page-shell textarea {
    min-height: 170px;
    resize: vertical;
}

.primary-action,
.secondary-action,
.danger-action,
.page-shell input[type="button"],
.page-shell button {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    font-size: 16px;
    font-weight: bold;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

.primary-action {
    color: white;
    background: #7f1018;
}

.secondary-action {
    color: #222;
    background: #e7e7e7;
}

.danger-action {
    color: white;
    background: #b71c1c;
}

.page-shell button:disabled,
.page-shell input:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.dashboard-card {
    display: block;
    padding: 18px;
    color: #222;
    border: 1px solid #ddd;
    border-left: 5px solid #7f1018;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.07);
}

.dashboard-card strong {
    display: block;
    margin-bottom: 4px;
    font-size: 18px;
}

.dashboard-card span {
    color: #666;
    font-size: 14px;
}

.games-grid {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.game-card {
    padding: 15px;
    border: 1px solid #d8d8d8;
    border-radius: 9px;
    background: white;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.06);
}

.game-card-title {
    margin: 0 0 10px;
    color: #7f1018;
    font-size: 17px;
}

.game-teams {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    line-height: 1.45;
}

.inline-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}

.inline-form-group input[type="button"] {
    min-height: 42px;
    font-size: 15px;
}

.game-actions {
    margin-top: 14px;
}

.selection-row {
    display: grid;
    gap: 10px;
}

.match-details {
    box-sizing: border-box;
    width: 100%;
    margin: 12px 0 0;
    padding: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.45;
    border-radius: 6px;
    background: #f1f1f1;
}

.character-count {
    margin: 7px 0;
    color: #555;
    text-align: right;
}

.button-stack {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.button-stack[hidden] {
    display: none;
}

#showPic,
#showReport {
    max-width: 100%;
    overflow: auto;
}

.saved-images-info {
    margin-top: 10px;
    color: #2e7d32;
    font-weight: bold;
}

.creation-preview {
    margin-top: 14px;
    text-align: center;
}

.creation-preview p {
    color: #666;
    font-size: 13px;
}

.creation-preview img {
    display: block;
    width: min(100%, 430px);
    max-height: 70vh;
    margin: 0 auto;
    object-fit: contain;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #111;
}

#crop-image {
    max-width: 100%;
    height: auto;
}

.jcrop-holder img,
.jcrop-preview img {
    max-width: none !important;
}

.logo-requirements {
    margin: 0;
    padding-left: 20px;
    color: #555;
    line-height: 1.6;
}

.buffered-list {
    margin: 10px 0;
    padding-left: 22px;
}

.result-list {
    display: grid;
    gap: 12px;
    margin: 10px 0;
    padding: 0;
    list-style: none;
}

.result-list > li {
    padding: 13px;
    border: 1px solid #ddd;
    border-radius: 7px;
    background: #fafafa;
    line-height: 1.45;
}

.result-list input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin: 0 8px 0 0;
    vertical-align: middle;
}

.result-list input[type="button"] {
    margin-top: 9px;
}

#reportboxes label {
    display: block;
    margin-top: 12px;
    font-weight: bold;
}

#reportboxes textarea {
    margin-bottom: 10px;
}

@media (min-width: 700px) {
    .page-shell {
        padding-top: 28px;
    }

    .content-card {
        padding: 22px;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .games-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .selection-row {
        grid-template-columns: 1fr auto;
        align-items: end;
    }

    .selection-row .danger-action,
    .selection-row input[type="button"] {
        width: auto;
        min-width: 150px;
    }

    .button-stack {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}