:root {
    --bg: #ffffff;
    --panel: #ffffff;
    --panel-alt: #f7f7f7;
    --line: #e5e5e5;
    --ink: #1f1f1f;
    --muted: #616161;
    --accent: #088a4b;
    --accent-soft: #e8f5ed;
    --soft-pink: #f8e0ec;
    --field: #f2f2f2;
    --danger: #a63c39;
    --ok: #2f8f46;
    --shadow: 0 16px 42px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Open Sans", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%);
    color: var(--ink);
}

button,
input,
select,
textarea {
    font: inherit;
}

.landing-screen {
    padding-bottom: 18px;
}

.hero {
    padding: 24px 18px 10px;
    display: grid;
    justify-items: center;
    gap: 12px;
    text-align: center;
}

.hero--compact {
    padding-bottom: 0;
}

.eyebrow {
    margin: 0 0 6px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #424242;
    font-size: 0.78rem;
    font-weight: 700;
}

.hero__brand-logo {
    display: block;
    width: min(100%, 360px);
    height: auto;
    margin: 0 auto 10px;
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.9rem, 4vw, 3rem);
}

.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;
}

.hero__subtitle,
.hero__hint,
.inline-note,
.send-status,
.panel__intro {
    color: var(--muted);
}

.hero__actions {
    margin-top: 4px;
}

.sponsor-strip {
    padding: 16px 14px 0;
    gap: 16px;
}

.sponsor-card {
    display: block;
    align-items: center;
    background: #fff;
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 18px 18px;
    text-align: center;
}

.sponsor-card__headline {
    margin: 0 0 10px;
    font-size: 0.95rem;
    font-weight: 700;
}

.landing-screen,
.landing-screen .hero,
.landing-screen .hero__copy,
.landing-screen .hero__subtitle,
.landing-screen .hero__hint,
.landing-screen .landing-actions {
    text-align: center;
}

.sponsor-card--blue {
    border-left: none;
}

.sponsor-card--red {
    border-left: none;
}

.sponsor-card__media {
    width: 100%;
    margin: 0 0 12px;
    padding: 0;
    border-radius: 18px;
    background: linear-gradient(180deg, #fcfcfc 0%, #f4f4f4 100%);
    overflow: hidden;
}

.sponsor-card__media-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.sponsor-card__media--duo {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 0;
}

.sponsor-card__media--single {
    display: block;
}

.sponsor-card__media--light {
    background: linear-gradient(180deg, #fff8f8 0%, #ffffff 100%);
}

.sponsor-card__slot {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 10px;
    background: #ffffff;
}

.sponsor-card__slot--light {
    background: #ffffff;
}

.sponsor-card__logo {
    display: block;
    width: 100%;
    height: auto;
}

.sponsor-card__logo--wide {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 164px;
    object-fit: contain;
}

.sponsor-card__logo--club {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 164px;
    object-fit: contain;
    background: #ffffff;
}

.sponsor-card__logo--foundation {
    transform: scale(0.9);
    transform-origin: center;
}

.sponsor-card__label {
    margin: 0 0 4px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.sponsor-bridge {
    margin: 0;
    text-align: center;
    font-weight: 700;
    color: var(--ink);
    font-size: 1.1rem;
}

.landing-actions {
    padding: 10px 14px 0;
    display: grid;
    gap: 12px;
}

.landing-actions--inside {
    padding: 18px 0 0;
}

.layout {
    padding: 10px 14px 32px;
    display: grid;
    gap: 14px;
}

.panel {
    background: var(--panel);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 16px;
}

.panel--full {
    grid-column: 1 / -1;
}

.panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.panel h2,
.panel h3 {
    margin: 0;
}

.status-subtext {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.submission-success {
    margin: 10px 14px 32px;
    text-align: center;
}

.submission-success h2 {
    margin-bottom: 12px;
}

.submission-success p {
    margin: 0;
    line-height: 1.6;
    color: var(--ink);
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.form-grid,
.checkpoint-form {
    display: grid;
    gap: 12px;
}

.form-grid--tour {
    gap: 14px;
}

.form-grid label,
.checkpoint-form label {
    display: grid;
    gap: 6px;
}

.form-grid .full,
.checkpoint-form .full {
    grid-column: 1 / -1;
}

.form-grid--tour label {
    gap: 8px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: var(--field);
    color: var(--ink);
}

textarea {
    resize: vertical;
}

.toggle {
    display: flex !important;
    align-items: center;
    gap: 10px;
}

.toggle input {
    width: auto;
}

.primary-button,
.secondary-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.primary-button {
    background: var(--soft-pink);
    color: var(--ink);
}

.primary-button.is-complete {
    background: var(--ok);
    color: #ffffff;
}

.secondary-button {
    background: var(--accent-soft);
    color: var(--accent);
}

.ghost-button {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(166, 60, 57, 0.2);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.sponsor-card__media-link:hover {
    transform: translateY(-1px);
}

.primary-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.primary-button.is-complete:disabled {
    opacity: 1;
    cursor: default;
}

.primary-button--wide {
    width: 100%;
}

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

.track-file-field {
    margin-top: 12px;
}

.status-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    margin-bottom: 12px;
}

.status-card {
    padding: 14px;
    border-radius: 18px;
    background: var(--panel-alt);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.status-label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 6px;
}

.signal-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.signal {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #c64a45;
    box-shadow: 0 0 0 6px rgba(155, 52, 47, 0.16);
}

.signal.is-ready {
    background: var(--ok);
    box-shadow: 0 0 0 6px rgba(47, 143, 70, 0.18);
}

#map {
    height: 340px;
    border-radius: 18px;
    overflow: hidden;
    background: #d9e4df;
}

.preview-grid,
.checkpoint-list {
    display: grid;
    gap: 12px;
}

.preview {
    margin: 0;
    padding: 10px;
    border-radius: 18px;
    background: var(--panel-alt);
    border: 1px dashed var(--line);
}

.preview--inline {
    margin-top: -2px;
}

.preview img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 12px;
    background: #ececec;
}

.form-grid .preview--inline {
    grid-column: span 1;
}

.form-grid .preview--inline img {
    max-height: 140px;
}

.preview figcaption {
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--muted);
}

.checkpoint-card {
    padding: 14px;
    border-radius: 18px;
    background: var(--panel-alt);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.checkpoint-card h3 {
    margin: 0 0 8px;
}

.checkpoint-card p {
    margin: 6px 0;
}

.checkpoint-card__image {
    width: 100%;
    margin: 10px 0 12px;
    border-radius: 14px;
    overflow: hidden;
    background: #ececec;
}

.checkpoint-card__image img {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: cover;
}

.checkpoint-card__actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.markdown-card {
    padding: 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, #fcfcfc 0%, #f7f7f7 100%);
    border: 1px solid var(--line);
    line-height: 1.65;
}

.markdown-card h2 {
    margin: 18px 0 8px;
    font-size: 1.15rem;
}

.markdown-card h2:first-child {
    margin-top: 0;
}

.markdown-card p {
    margin: 8px 0;
}

.markdown-card ul {
    margin: 8px 0 14px 20px;
    padding: 0;
}

.markdown-card li {
    margin: 6px 0;
}

.rules-screen {
    margin: 12px 14px 0;
}

.checkpoint-dialog {
    width: min(680px, calc(100vw - 18px));
    border: none;
    border-radius: 24px;
    padding: 0;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
}

.checkpoint-dialog::backdrop {
    background: rgba(0, 0, 0, 0.45);
}

.checkpoint-form {
    padding: 18px;
}

.checkpoint-dialog__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.report-dialog {
    width: min(980px, calc(100vw - 18px));
    border: none;
    border-radius: 24px;
    padding: 0;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
}

.report-dialog::backdrop {
    background: rgba(0, 0, 0, 0.45);
}

.report-dialog__content {
    padding: 18px;
    background: #fff;
}

.report-dialog__actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.report-frame {
    width: 100%;
    min-height: 70vh;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

.network-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 999px;
    background: #eef4f2;
}

.network-indicator::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #9b342f;
}

.network-indicator.is-online::before {
    background: var(--ok);
}

.file-field input {
    padding: 8px;
    background: var(--panel-alt);
}

.upload-field {
    display: grid;
    gap: 6px;
}

.upload-control {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.upload-control > input:not(.camera-input) {
    min-width: 0;
}

.camera-input {
    display: none;
}

.icon-button {
    width: 46px;
    min-width: 46px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.icon-button svg {
    width: 22px;
    height: 22px;
}

.icon-button svg path,
.icon-button svg circle {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.panel--tour-details {
    background: linear-gradient(180deg, #ffffff 0%, #fcfcfc 100%);
    box-shadow: none;
    border: 1px solid var(--line);
    margin-bottom: 14px;
}

.panel--tour-details h2 {
    margin-bottom: 10px;
}

.panel--tour-details .toggle {
    min-height: 36px;
}

@media (min-width: 780px) {
    .sponsor-strip {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .landing-actions {
        max-width: 780px;
        margin: 0 auto;
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .layout {
        grid-template-columns: repeat(1, minmax(0, 1fr));
        align-items: start;
    }

    .panel--controls,
    .panel--full,
    .panel--tour-details,
    .panel:nth-of-type(5),
    .panel:nth-of-type(8) {
        grid-column: 1 / -1;
    }

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

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

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

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