:root {
    --font-sans: "Space Grotesk", "IBM Plex Sans", "Noto Sans", sans-serif;
    --font-display: "Fraunces", "Space Grotesk", serif;
    --ink-strong: #111820;
    --ink: #202936;
    --accent: #08786f;
    --surface: #f7faf9;
}

html,
body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--ink);
    background: var(--surface);
}

h1 {
    margin-top: 0;
    font-family: var(--font-display);
    color: var(--ink-strong);
}

#blazor-error-ui {
    background: #fff3cd;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    color: white;
    padding: 1rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #d6e3df;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--accent);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 600;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
    color: var(--ink);
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "Loading");
}

.profile-shell {
    max-width: 760px;
    margin: 32px auto;
    padding: 28px;
    background: #ffffff;
    border: 1px solid #dbe7e4;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(17, 24, 32, 0.08);
}

.profile-header {
    margin-bottom: 24px;
}

.profile-header p {
    margin: 0;
    color: #52606d;
}

.form-grid {
    display: grid;
    gap: 18px;
}

.field-label,
.form-grid label,
.switch-list label {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

.form-control {
    min-height: 42px;
    box-sizing: border-box;
    border: 1px solid #b8c9c5;
    border-radius: 6px;
    padding: 9px 12px;
    font: inherit;
}

.form-control:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(8, 120, 111, 0.18);
}

.readonly-field {
    background: #f3f7f6;
    color: #52606d;
}

.switch-list {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.switch-list label {
    grid-template-columns: auto 1fr;
    align-items: center;
    font-weight: 500;
}

.actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 28px;
}

.primary-button {
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    padding: 0 18px;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.primary-button:disabled {
    cursor: progress;
    opacity: 0.7;
}

.alert-error {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #d48181;
    border-radius: 6px;
    background: #fff4f4;
    color: #8c2020;
}

.alert-success {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #75b89d;
    border-radius: 6px;
    background: #f0fbf5;
    color: #175c3a;
}

.profile-image-section {
    margin-bottom: 24px;
}

.profile-image-content {
    display: grid;
    grid-template-columns: 132px 1fr;
    gap: 18px;
    align-items: center;
    margin-top: 8px;
}

.profile-image-preview {
    width: 132px;
    height: 132px;
    border: 1px solid #cbd8d4;
    border-radius: 8px;
    object-fit: cover;
    background: #eef4f2;
}

.profile-image-placeholder {
    display: grid;
    place-items: center;
    color: #667784;
    font-weight: 600;
}

.profile-image-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.file-input {
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    pointer-events: none;
}

.file-trigger {
    display: grid;
    gap: 2px;
    min-width: 220px;
    border: 1px solid #b8c9c5;
    border-radius: 6px;
    padding: 9px 12px;
    background: #ffffff;
    cursor: pointer;
}

.file-trigger-title {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    font-weight: 700;
}

.file-trigger-subtitle {
    color: #667784;
    font-size: 0.9rem;
}

.file-trigger-disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.secondary-danger-button {
    min-height: 42px;
    border: 1px solid #c95d5d;
    border-radius: 6px;
    padding: 0 14px;
    background: #ffffff;
    color: #a92323;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.secondary-danger-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.country-picker {
    display: flex;
}

.country-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #b8c9c5;
    border-radius: 6px;
    padding: 8px 12px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    font-weight: 700;
}

.country-menu {
    max-height: 280px;
    overflow-y: auto;
}

.country-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 640px) {
    .profile-image-content {
        grid-template-columns: 1fr;
    }
}

.traffic-shell {
    max-width: 1040px;
}

.table-wrap {
    overflow-x: auto;
}

.traffic-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.game-shell {
    max-width: 1100px;
}

.challenge-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.challenge-wide-field {
    grid-column: 1 / -1;
}

.game-description-cell {
    max-width: 360px;
}

.game-actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 230px;
}

.challenge-map,
.map-placeholder {
    width: 100%;
    min-height: 320px;
    border: 1px solid #b8c9c5;
    border-radius: 8px;
    background: #eef4f2;
}

.map-placeholder {
    display: grid;
    place-items: center;
    color: #667784;
    font-weight: 600;
}

.challenge-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.challenge-image-item {
    display: grid;
    gap: 10px;
}

.challenge-image-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 1px solid #cbd8d4;
    border-radius: 8px;
    background: #eef4f2;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-pill-complete {
    background: #e7f8ef;
    color: #14633f;
}

.status-pill-draft {
    background: #fff4dc;
    color: #8a5b00;
}

.status-pill-active {
    background: #e8f4ff;
    color: #155a8a;
}

.image-count-complete {
    font-weight: 700;
    color: #14633f;
}

.image-count-missing {
    font-weight: 700;
    color: #a92323;
}

.challenge-required-panel {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
    border: 1px solid #d49b30;
    border-radius: 8px;
    padding: 14px;
    background: #fff8e8;
    color: #6f4700;
}

.challenge-required-panel strong,
.challenge-required-panel span {
    display: block;
}

.challenge-required-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.required-image-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 320px;
    border: 1px solid #d49b30;
    border-radius: 6px;
    padding: 8px 10px;
    background: #ffffff;
    color: #6f4700;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.required-image-button span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.challenge-row-incomplete > td {
    background: #fffaf0;
}

.challenge-detail-list {
    display: grid;
    grid-template-columns: minmax(130px, 180px) 1fr;
    gap: 10px 18px;
    margin: 0;
}

.challenge-detail-list dt {
    font-weight: 700;
    color: #52606d;
}

.challenge-detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.player-challenge-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 24px;
    align-items: start;
}

.player-challenge-main {
    display: grid;
    gap: 18px;
}

.player-challenge-card {
    display: grid;
    gap: 12px;
    border: 1px solid #dbe7e4;
    border-radius: 8px;
    padding: 16px;
    background: #ffffff;
}

.player-challenge-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    color: #52606d;
    font-size: 0.94rem;
}

.player-challenge-description {
    margin: 0;
    white-space: pre-wrap;
}

.player-image-grid {
    margin-top: 0;
}

.player-guess-panel {
    position: sticky;
    top: 16px;
    display: grid;
    gap: 14px;
    border: 1px solid #dbe7e4;
    border-radius: 8px;
    padding: 16px;
    background: #ffffff;
}

.player-guess-panel h2 {
    margin: 0;
    font-size: 1.25rem;
}

.player-guess-panel p {
    margin: 0;
    color: #52606d;
}

.player-guess-map {
    min-height: 360px;
}

.coordinate-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.player-save-button {
    width: 100%;
}

.player-result-list {
    border-top: 1px solid #dbe7e4;
    padding-top: 14px;
}

.challenge-owner-panel {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid #dbe7e4;
    padding-bottom: 14px;
}

.challenge-owner-image,
.challenge-owner-placeholder {
    width: 52px;
    height: 52px;
    border: 1px solid #cbd8d4;
    border-radius: 50%;
    background: #eef4f2;
}

.challenge-owner-image {
    object-fit: cover;
}

.challenge-owner-placeholder {
    display: grid;
    place-items: center;
    color: #667784;
}

.challenge-owner-content {
    display: grid;
    min-width: 0;
}

.challenge-owner-content strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.challenge-owner-label {
    color: #667784;
    font-size: 0.86rem;
}

.challenge-owner-switch {
    margin: 0;
    white-space: nowrap;
}

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

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

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

    .player-challenge-layout,
    .coordinate-grid {
        grid-template-columns: 1fr;
    }

    .player-guess-panel {
        position: static;
    }

    .challenge-owner-panel {
        grid-template-columns: 52px minmax(0, 1fr);
    }

    .challenge-owner-switch {
        grid-column: 1 / -1;
    }
}
