* {
    box-sizing: border-box;
}

:root {
    --brand: #0BAB9E;
    --brand-light: #E6F4F4;
    --brand-soft: #9DD8D5;
    --ink: #2C2F31;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    width: 100%;
    overflow-x: hidden;
    font-family: Arial, sans-serif;
    background: var(--brand-light);
    color: var(--ink);
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    padding: clamp(8px, 2vw, 20px);
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    flex-direction: column;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: white;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.app-footer {
    width: 100%;
    margin-top: auto;
    padding: 28px 12px 8px;
    color: #657174;
    text-align: center;
    font-size: 0.82rem;
    line-height: 1.5;
}

.app-footer p {
    margin: 0;
}

.top-bar button,
.bottom-buttons button,
.secondary-page button {
    background: var(--brand);
}

.top-bar .sign-in {
    background: var(--brand-soft);
    color: var(--ink);
}

.top-bar .logout {
    background: #dc2626;
    color: white;
}

.top-bar .logout:hover {
    background: #b91c1c;
    color: white;
}

.is-hidden {
    display: none !important;
}

.admin-page { width: min(1320px, 100%); padding: clamp(22px, 4vw, 44px); }
.admin-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.admin-heading h1 { margin: 4px 0 8px; line-height: 1; }
.admin-heading p { margin: 0; color: #657174; line-height: 1.5; }
.admin-eyebrow { color: var(--brand); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
#admin-logout { flex: 0 0 auto; padding-inline: 20px; background: #dc2626; color: white; }
#admin-logout:hover { background: #b91c1c; color: white; box-shadow: 0 6px 16px rgba(220, 38, 38, 0.24); }
.admin-login { display: grid; gap: 10px; max-width: 440px; margin: 28px 0; }
.admin-login label { font-weight: 700; }
.admin-table-wrap { margin: 18px 0 8px; overflow: hidden; border: 1px solid #d8e7e7; border-radius: 12px; }
.admin-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.admin-table th, .admin-table td { padding: 16px 14px; border-bottom: 1px solid #d8e7e7; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.admin-table th { background: var(--brand-light); font-size: 0.76rem; letter-spacing: 0.06em; text-transform: uppercase; }
.admin-table th:nth-child(1) { width: 12%; }
.admin-table th:nth-child(2) { width: 17%; }
.admin-table th:nth-child(3) { width: 27%; }
.admin-table th:nth-child(4) { width: 26%; }
.admin-table th:nth-child(5) { width: 18%; white-space: nowrap; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: #f8fbfb; }
.admin-answer { white-space: pre-wrap; line-height: 1.45; }
.admin-team { color: #176d67; }
.admin-date { color: #657174; font-size: 0.9rem; line-height: 1.4; }
.admin-media { display: block; width: 100%; max-width: 230px; aspect-ratio: 16 / 10; border-radius: 9px; object-fit: cover; background: #111; }
.admin-filename { display: block; max-width: 230px; margin-top: 7px; color: #657174; font-size: 0.78rem; overflow-wrap: anywhere; }
.secondary-page .admin-media-trigger { display: block; width: 100%; max-width: 230px; min-height: 0; padding: 0; overflow: hidden; border-radius: 9px; background: #111; text-align: left; }
.secondary-page .admin-media-trigger:hover { background: #111; color: white; transform: none; }
.admin-media-trigger span { display: block; padding: 8px 10px; background: rgba(0, 0, 0, 0.78); color: white; font-size: 0.76rem; text-align: center; }
.admin-file-download { font-size: 0.8rem; }
.secondary-page .admin-file-download { display: inline-flex; min-height: 32px; margin-top: 3px; }
.admin-tabs { display: flex; gap: 6px; margin-top: 32px; padding: 5px; width: fit-content; border-radius: 10px; background: var(--brand-light); }
.admin-tab { border-radius: 7px; background: transparent; color: var(--ink); }
.admin-tab.is-active { background: var(--brand); color: white; }
.admin-back-link { margin-top: 14px; }
.admin-section-tabs { display: flex; gap: 8px; margin-top: 30px; padding-bottom: 12px; border-bottom: 1px solid #d8e7e7; }
.admin-section-tab { background: #edf5f5; color: var(--ink); }
.admin-section-tab.is-active { background: var(--ink); color: white; }
.admin-content-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 24px; }
.admin-content-heading h2 { margin: 0 0 5px; }
.admin-content-heading p { margin: 0; color: #657174; }
.admin-content-tabs { display: flex; gap: 6px; margin: 22px 0 16px; padding: 5px; border-radius: 10px; background: var(--brand-light); }
.admin-content-tab { flex: 1; background: transparent; color: var(--ink); }
.admin-content-tab.is-active { background: var(--brand); color: white; }
.admin-content-list { display: grid; gap: 14px; }
.admin-content-card { margin: 0 !important; padding: 18px; border: 1px solid #d8e7e7; border-radius: 12px; background: #fbfdfd; }
.admin-card-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.admin-card-fields label { display: grid; align-content: start; gap: 6px; color: #536063; font-size: 0.78rem; font-weight: 800; }
.admin-card-fields input, .admin-card-fields select, .admin-card-fields textarea { width: 100%; min-height: 42px; padding: 9px 10px; border: 1px solid #bfd4d3; border-radius: 7px; background: white; color: var(--ink); font: inherit; font-size: 0.9rem; resize: vertical; }
.admin-card-fields .admin-field-wide { grid-column: 1 / -1; }
.admin-card-fields .admin-check { display: flex; align-items: center; align-self: end; min-height: 42px; }
.admin-card-fields .admin-check input { width: 18px; min-height: 18px; }
.admin-card-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; }
.admin-card-actions button { min-width: 100px; }
.admin-card-actions .admin-delete-content { background: #dc2626; }
.admin-card-actions .admin-delete-content:hover { background: #b91c1c; color: white; }
.admin-content-empty { padding: 28px; border: 1px dashed #bfd4d3; border-radius: 10px; color: #657174; text-align: center; }
.admin-danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 34px; padding: 18px; border: 1px solid #fecaca; border-radius: 12px; background: #fff7f7; }
.admin-danger-zone h2 { margin: 0 0 5px; color: #991b1b; font-size: 1.1rem; }
.admin-danger-zone p { margin: 0; color: #7f1d1d; line-height: 1.4; }
.secondary-page .admin-danger-zone button { flex: 0 0 auto; background: #dc2626; color: white; }
.secondary-page .admin-danger-zone button:hover { background: #991b1b; color: white; box-shadow: 0 6px 16px rgba(220, 38, 38, 0.24); }
.admin-preview-open { overflow: hidden; }
.admin-media-modal { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 18px; background: rgba(7, 13, 16, 0.92); backdrop-filter: blur(7px); }
.admin-media-dialog { display: grid; grid-template-rows: auto minmax(0, 1fr); width: min(1400px, 100%); height: min(900px, calc(100dvh - 36px)); overflow: hidden; border-radius: 14px; background: #111; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5); }
.admin-media-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-width: 0; padding: 12px 14px; background: white; }
.admin-media-toolbar > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-media-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.admin-media-actions .admin-media-download { display: inline-flex; align-items: center; min-height: 42px; padding: 9px 14px; border-radius: 8px; background: var(--brand); color: white; font-weight: 700; text-decoration: none; }
.admin-media-close { min-height: 42px; padding: 9px 14px; background: #dc2626; }
.admin-media-close:hover { background: #b91c1c; color: white; }
.admin-media-viewer { display: grid; min-height: 0; place-items: center; overflow: auto; }
.admin-media-full { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.admin-media-viewer video.admin-media-full { width: 100%; height: 100%; }

@media (max-width: 800px) {
    .admin-heading { align-items: center; }
    .admin-heading p { max-width: 34rem; }
    .admin-tabs { width: 100%; }
    .admin-tab { flex: 1; }
    .admin-table-wrap { border: 0; border-radius: 0; overflow: visible; }
    .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
    .admin-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .admin-table tbody { display: grid; gap: 14px; }
    .admin-table tr { overflow: hidden; border: 1px solid #d8e7e7; border-radius: 12px; background: #fff; box-shadow: 0 4px 14px rgba(44, 47, 49, 0.06); }
    .admin-table td { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 12px; padding: 12px 14px; border-bottom: 1px solid #e7eeee; }
    .admin-table td::before { content: attr(data-label); color: #718083; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
    .admin-table td:last-child { border-bottom: 0; }
    .admin-table .admin-evidence { align-items: start; }
    .admin-media, .admin-filename { max-width: 100%; }
    .admin-empty-filter td { display: block; text-align: center; }
    .admin-empty-filter td::before { content: none; }
    .admin-card-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
    .admin-heading { align-items: flex-start; }
    .admin-heading p { font-size: 0.9rem; }
    #admin-logout { min-height: 40px; padding: 8px 12px; }
    .admin-tabs { margin-top: 24px; }
    .admin-tab { padding-inline: 8px; font-size: 0.88rem; }
    .admin-table td { grid-template-columns: 82px minmax(0, 1fr); padding: 11px 12px; }
    .admin-section-tabs, .admin-content-tabs { display: grid; grid-template-columns: 1fr; }
    .admin-content-heading { align-items: flex-start; }
    .admin-content-heading p { font-size: 0.85rem; }
    .admin-card-fields { grid-template-columns: 1fr; }
    .admin-card-fields .admin-field-wide { grid-column: auto; }
    .admin-danger-zone { align-items: stretch; flex-direction: column; }
    .admin-media-modal { padding: 0; }
    .admin-media-dialog { width: 100%; height: 100dvh; border-radius: 0; }
    .admin-media-toolbar { gap: 8px; padding: 8px; }
    .admin-media-toolbar > strong { font-size: 0.82rem; }
    .admin-media-actions { gap: 5px; }
    .admin-media-actions .admin-media-download, .admin-media-close { min-height: 38px; padding: 7px 9px; font-size: 0.78rem; }
}

button:hover {
    background: var(--brand-soft);
    color: var(--ink);
    box-shadow: 0 6px 16px rgba(11, 171, 158, 0.22);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

/* ==================== TOP BAR ==================== */

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: min(100%, 1080px);
    margin: 0 auto 12px;
    padding: 10px;
    background: white;
    border: 1px solid var(--brand-soft);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(44, 47, 49, 0.08);
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    color: var(--ink);
    text-decoration: none;
}

.brand-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-size: clamp(0.86rem, 1.8vw, 1.05rem);
    font-weight: 400;
    letter-spacing: 0.015em;
    line-height: 1.2;
    white-space: nowrap;
}

.brand-name span {
    padding: 4px 7px;
    border: 1px solid var(--brand-soft);
    border-radius: 999px;
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 400;
    font-size: 0.82em;
    letter-spacing: 0.04em;
}

.brand-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: min(100%, 360px);
    min-width: 0;
}

.top-bar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 0.86rem;
    line-height: 1;
    white-space: nowrap;
    text-align: center;
}

.coins-label {
    font-weight: 700;
}

/* ==================== MAP ==================== */

#map {
    width: min(100%, 1080px);
    height: min(62vh, 560px);
    min-height: 360px;
    margin: 0 auto 14px;
    border: 2px solid var(--ink);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(44, 47, 49, 0.18);
}

.leaflet-control-zoom a {
    color: var(--ink);
}

.leaflet-control-zoom a:hover {
    background: var(--brand-light);
    color: var(--ink);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    color: var(--ink);
}

.map-pin {
    background: transparent;
    border: 0;
}

.map-pin span {
    display: block;
}

.waypoint-pin span {
    width: 26px;
    height: 26px;
    position: relative;
    border: 3px solid white;
    border-radius: 50% 50% 50% 0;
    background: var(--brand);
    box-shadow: 0 3px 10px rgba(44, 47, 49, 0.3);
    transform: rotate(-45deg);
}

.waypoint-pin span::after {
    content: "";
    position: absolute;
    top: 6px;
    left: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-light);
}

.user-pin span {
    width: 22px;
    height: 22px;
    border: 3px solid white;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 5px rgba(157, 216, 213, 0.5), 0 3px 10px rgba(44, 47, 49, 0.25);
}

/* ==================== BUTTONS + LEADERBOARD ==================== */

.bottom-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: min(100%, 1080px);
    margin: 0 auto;
}

.bottom-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.bottom-buttons button {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    font-size: 0.9rem;
    letter-spacing: 0;
    white-space: normal;
}

.leaderboard {
    width: 100%;
    background: white;
    border: 1px solid var(--brand-soft);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(44, 47, 49, 0.08);
    overflow-x: hidden;
}

.leaderboard h3 {
    margin: 0 0 10px;
    text-align: center;
    color: var(--ink);
    font-size: 1.05rem;
}

.leaderboard table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.88rem;
}

.leaderboard .rank-col {
    width: 34px;
}

.leaderboard .points-col {
    width: 86px;
}

.leaderboard th {
    text-align: left;
    padding: 7px 6px;
    border-bottom: 2px solid var(--brand-soft);
    color: var(--ink);
    font-size: 0.68rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.leaderboard td {
    padding: 8px 6px;
    overflow-wrap: anywhere;
}

.leaderboard th:first-child,
.leaderboard td:first-child {
    width: 34px;
}

.leaderboard th:last-child,
.leaderboard td:last-child {
    width: 86px;
    text-align: right;
}

.leaderboard th:nth-child(2),
.leaderboard td:nth-child(2) {
    padding-right: 14px;
}

.leaderboard tbody tr:nth-child(even) {
    background-color: var(--brand-light);
}

.leaderboard tbody tr.top1 {
    background-color: var(--brand-soft);
    font-weight: 700;
}

.leaderboard tbody tr:hover {
    background-color: var(--brand-light);
}

.home-panels { display: grid; gap: 10px; min-width: 0; }

.rules-open { overflow: hidden; }

.rules-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(5, 12, 18, 0.78);
    backdrop-filter: blur(8px);
}

.rules-modal.is-hidden { display: none; }
.rules-step.is-hidden { display: none; }

.rules-modal-card {
    width: min(100%, 560px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 28px;
    border-radius: 20px;
    background: #fff;
    color: #182026;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.rules-modal-card h2 { margin: 0 0 18px; }
.rules-content { line-height: 1.55; }
.rules-content h3 { margin: 22px 0 10px; }
.rules-content h3:first-child { margin-top: 0; }
.rules-content p { margin: 0 0 14px; }
.rules-content ul { padding-left: 22px; }
.rules-content li { margin-bottom: 8px; }

.rules-step-count {
    display: block;
    margin-bottom: 6px;
    color: #66727a;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.rules-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 22px 0 16px;
    font-weight: 700;
    cursor: pointer;
}

.rules-consent input { margin-top: 3px; }
.rules-modal-card button { width: 100%; }
.rules-modal-card button:disabled { cursor: not-allowed; opacity: 0.45; }

.rules-actions { display: grid; grid-template-columns: 0.45fr 1fr; gap: 10px; }
.rules-modal-card .rules-secondary-button { background: #e8edef; color: #182026; }
.home-achievements {
    padding: 12px;
    border: 1px solid var(--brand-soft);
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 8px rgba(44, 47, 49, 0.08);
}
.home-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.home-panel-heading h3 { margin: 0; font-size: 1.05rem; }
.home-panel-heading a { color: var(--brand); font-size: 0.8rem; font-weight: 800; text-decoration: none; }
#home-achievements-list { display: grid; gap: 8px; margin-top: 10px; }
.home-achievement {
    display: grid;
    grid-template-columns: 52px 1fr;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid var(--brand-soft);
    border-radius: 9px;
    background: var(--brand-light);
}
.home-achievement-medal { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.home-achievement span { display: block; margin-bottom: 3px; color: #667174; font-size: 0.66rem; font-weight: 800; text-transform: uppercase; }
.home-achievement strong { display: block; font-size: 0.88rem; line-height: 1.2; }
.home-achievement small { display: block; margin-top: 4px; color: #596164; font-size: 0.68rem; font-weight: 700; }
.achievement-progress {
    width: 100%;
    height: 7px;
    margin-top: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #d9e2e2;
}
.achievement-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--brand);
    transition: width 0.35s ease;
}
.home-achievement:nth-child(1) .achievement-progress i { background: #c9824b; }
.home-achievement:nth-child(2) .achievement-progress i { background: #aeb8c2; }
.home-achievement:nth-child(3) .achievement-progress i { background: #e7b416; }
.home-achievement.is-locked { opacity: 0.68; }
.home-achievement.is-locked > div { filter: grayscale(1); opacity: 0.72; }
.home-achievement.is-unlocked { border-left: 4px solid var(--brand); }

/* ==================== SECONDARY PAGES ==================== */

.secondary-page {
    width: min(100%, 680px);
    margin: 0 auto;
    padding: 20px;
    background: white;
    border: 1px solid var(--brand-soft);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(44, 47, 49, 0.1);
}

.secondary-page h1 {
    margin: 0 0 18px;
    font-size: clamp(1.6rem, 6vw, 2.4rem);
}

.secondary-page form {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.secondary-page input {
    width: 100%;
    min-height: 46px;
    padding: 11px 12px;
    border: 1px solid var(--brand-soft);
    border-radius: 8px;
    background: var(--brand-light);
    color: var(--ink);
    font-size: 1rem;
}

.secondary-page button {
    min-height: 46px;
    padding: 11px 14px;
}

.form-message {
    min-height: 22px;
    margin: 0 0 10px;
    color: #b91c1c;
}

.form-message.success {
    color: #15803d;
}

.auth-switch {
    margin: 0;
    color: var(--ink);
}

.secondary-page a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    margin-top: 10px;
    color: var(--brand);
    font-weight: 700;
    text-decoration: none;
}

.secondary-page a:hover {
    text-decoration: underline;
}

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

.quest-item {
    position: relative;
    border-bottom: 1px solid var(--brand-soft);
    padding: 14px 0;
}

.quest-item.quest-locked { opacity: 0.62; }
.quest-item.quest-complete { border-left: 4px solid var(--brand); padding-left: 12px; }
.quest-status {
    float: right;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--brand-light);
    color: var(--ink);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}
.complete-quest { display: block; margin-top: 12px; }
.complete-quest:disabled { cursor: not-allowed; filter: grayscale(1); opacity: 0.55; }

.quest-submission {
    clear: both;
    display: grid;
    gap: 12px;
    margin-top: 14px;
    padding: 14px;
    border-radius: 10px;
    background: var(--brand-light);
}
.quest-submission label { display: grid; gap: 6px; font-weight: 700; }
.quest-submission label span { font-weight: 500; line-height: 1.4; }
.quest-submission input { background: white; }
.quest-submission small { color: #596164; }
.extra-challenge-card {
    margin: 14px 0;
    padding: 16px;
    border: 1px solid var(--brand-soft);
    border-radius: 10px;
    background: var(--brand-light);
}
.extra-challenge-card h2 { margin: 8px 0; font-size: 1.1rem; }
.extra-challenge-card p { margin: 0; line-height: 1.45; }
.extra-challenge-card strong { display: block; margin-top: 10px; }
.extra-challenge-card.extra-complete { border-left: 4px solid var(--brand); }
.extra-challenge-card.extra-locked { filter: grayscale(1); opacity: 0.58; }
.extra-submission {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--brand-soft);
}
.extra-submission label { display: grid; gap: 6px; font-weight: 700; }
.extra-submission input { background: white; }
.extra-submission button:disabled { opacity: 0.55; cursor: wait; }
.optional-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--brand);
    color: white;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

#achievements-list { display: grid; gap: 12px; padding: 0; list-style: none; }
.achievement-item {
    display: grid;
    grid-template-columns: 86px 1fr;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--brand-soft);
    border-radius: 10px;
    background: var(--brand-light);
}
.achievement-item strong { display: block; margin: 3px 0 8px; font-size: 1.05rem; }
.achievement-item p { margin: 0; line-height: 1.4; }
.achievement-locked { filter: grayscale(1); opacity: 0.58; }
.achievement-unlocked { border-left: 5px solid var(--brand); }
.achievement-medal {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(44, 47, 49, 0.18);
}
.medal-bronze { filter: sepia(0.78) saturate(0.9) hue-rotate(335deg) brightness(1.02) contrast(0.9); }
.medal-silver { filter: grayscale(1) brightness(1.12) contrast(0.9); }
.medal-gold { filter: saturate(1.08) contrast(1.03); }
.achievement-tier {
    color: #6b7477;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.achievement-state {
    float: right;
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--brand);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

@media (max-width: 420px) {
    .achievement-item { grid-template-columns: 68px 1fr; gap: 10px; padding: 12px; }
    .achievement-medal { width: 68px; height: 68px; }
}

.quest-item h3 {
    margin: 0 0 6px;
}

.quest-item p {
    margin: 0 0 8px;
    line-height: 1.45;
    white-space: pre-line;
}

.quest-item:last-child {
    border-bottom: none;
}

/* ==================== RESPONSIVE ==================== */

@media (min-width: 700px) {
    .top-bar {
        padding: 12px 14px;
    }

    .auth-buttons {
        display: flex;
        justify-content: flex-end;
        width: auto;
    }

    .brand-logo {
        width: 56px;
        height: 56px;
    }

    .top-bar button {
        min-width: 110px;
    }

    .bottom-section {
        grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
        align-items: start;
    }

    .bottom-buttons button {
        min-height: 56px;
        font-size: 0.95rem;
    }

    .leaderboard {
        padding: 18px 20px;
    }

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

    .home-achievements { padding: 18px; }

    .leaderboard table {
        font-size: 1rem;
    }
}

@media (max-width: 699px) {
    body {
        padding: 8px;
    }

    .top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-bottom: 8px;
        padding: 8px;
        border-radius: 10px;
    }

    .brand-lockup {
        justify-content: center;
        min-height: 48px;
        padding: 2px 6px;
    }

    .brand-name {
        font-size: 0.94rem;
    }

    .brand-logo {
        width: 42px;
        height: 42px;
    }

    .auth-buttons {
        display: flex;
        width: 100%;
        justify-content: center;
        gap: 6px;
    }

    .auth-buttons button {
        flex: 1 1 0;
        min-width: 0;
    }

    .top-bar button {
        min-height: 40px;
        padding: 7px 6px;
        font-size: clamp(0.66rem, 2.9vw, 0.82rem);
        border-radius: 8px;
    }

    #map {
        height: 54dvh;
        min-height: 310px;
        margin-bottom: 10px;
        border-radius: 10px;
    }

    .leaflet-control-zoom a {
        width: 36px;
        height: 36px;
        line-height: 36px;
    }

    .bottom-section {
        gap: 10px;
    }

    .bottom-buttons {
        gap: 8px;
    }

    .bottom-buttons button {
        min-height: 44px;
        padding: 9px 10px;
        font-size: 0.82rem;
        border-radius: 8px;
    }

    .leaderboard {
        padding: 10px;
        border-radius: 10px;
    }

    .leaderboard h3 {
        margin-bottom: 8px;
        font-size: 1rem;
        line-height: 1.2;
    }

    .leaderboard table {
        font-size: 0.8rem;
    }

    .leaderboard .rank-col {
        width: 24px;
    }

    .leaderboard .points-col {
        width: 72px;
    }

    .leaderboard th {
        padding: 6px 4px;
        font-size: 0.58rem;
    }

    .leaderboard td {
        padding: 7px 4px;
    }

    .leaderboard th:first-child,
    .leaderboard td:first-child {
        width: 24px;
    }

    .leaderboard th:last-child,
    .leaderboard td:last-child {
        width: 72px;
    }

    .leaderboard th:nth-child(2),
    .leaderboard td:nth-child(2) {
        padding-right: 16px;
    }

    .secondary-page {
        width: 100%;
        min-height: calc(100dvh - 16px);
        margin: 0 auto;
        padding: 18px;
        border-radius: 10px;
    }

    .secondary-page h1 {
        margin-bottom: 16px;
        line-height: 1.1;
    }

    .secondary-page input,
    .secondary-page button {
        min-height: 48px;
    }

    .secondary-page a {
        min-height: 44px;
    }
}

@media (max-width: 420px) {
    .top-bar {
        gap: 6px;
    }

    .brand-logo {
        width: 38px;
        height: 38px;
    }

    .brand-lockup { gap: 7px; }
    .brand-name { gap: 6px; font-size: 0.82rem; }
    .brand-name span { padding: 3px 5px; }

    .auth-buttons { justify-content: center; gap: 5px; }

    .auth-buttons button {
        min-width: 0;
    }

    .top-bar button {
        min-height: 38px;
        padding: 7px 4px;
        font-size: clamp(0.6rem, 3vw, 0.76rem);
    }

    #map {
        height: 52dvh;
        min-height: 300px;
    }

    .top-bar,
    .leaderboard,
    .secondary-page {
        border-radius: 10px;
    }

    .bottom-buttons button {
        min-height: 42px;
        padding: 8px;
        font-size: 0.76rem;
    }

    .leaderboard table {
        font-size: 0.74rem;
    }

    .leaderboard th {
        padding: 6px 3px;
        font-size: 0.5rem;
    }

    .leaderboard td {
        padding: 7px 3px;
    }

    .leaderboard .rank-col {
        width: 20px;
    }

    .leaderboard .points-col {
        width: 68px;
    }

    .leaderboard th:first-child,
    .leaderboard td:first-child {
        width: 20px;
    }

    .leaderboard th:last-child,
    .leaderboard td:last-child {
        width: 68px;
    }

    .leaderboard th:nth-child(2),
    .leaderboard td:nth-child(2) {
        padding-right: 14px;
    }

    .secondary-page {
        padding: 16px;
    }
}

@media (max-width: 340px) {
    .brand-logo {
        width: 34px;
        height: 34px;
    }

    .top-bar button {
        min-height: 36px;
        font-size: 0.56rem;
    }

    .auth-buttons button {
        min-width: 0;
    }

    .leaderboard h3 {
        font-size: 0.92rem;
    }

    .leaderboard .points-col,
    .leaderboard th:last-child,
    .leaderboard td:last-child {
        width: 62px;
    }
}
