:root {
    --bg: #0f1715;
    --bg-soft: #182320;
    --panel: rgba(24, 35, 32, 0.92);
    --line: rgba(214, 187, 117, 0.2);
    --text: #f6f0df;
    --muted: #c8c1ae;
    --gold: #d6bb75;
    --gold-strong: #ebd08a;
    --shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
    --attackers: #ce7b5d;
    --attackers-soft: rgba(206, 123, 93, 0.16);
    --garrison: #a9b97b;
    --garrison-soft: rgba(169, 185, 123, 0.16);
    --flex: #7fb9b2;
    --flex-soft: rgba(127, 185, 178, 0.16);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Trebuchet MS", "Lucida Sans Unicode", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(214, 187, 117, 0.12), transparent 32%),
        radial-gradient(circle at bottom right, rgba(127, 185, 178, 0.12), transparent 28%),
        linear-gradient(180deg, #101715 0%, #131c19 42%, #0b1110 100%);
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

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

button {
    cursor: pointer;
}

.hero {
    position: relative;
    overflow: hidden;
    padding: 38px 0 88px;
    border-bottom: 1px solid rgba(214, 187, 117, 0.15);
    background:
        linear-gradient(135deg, rgba(214, 187, 117, 0.12), transparent 38%),
        linear-gradient(220deg, rgba(53, 84, 74, 0.58), rgba(15, 23, 21, 0.9));
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.hero::before {
    top: -120px;
    right: -120px;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, rgba(214, 187, 117, 0.2), transparent 65%);
}

.hero::after {
    bottom: -110px;
    left: -90px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(127, 185, 178, 0.14), transparent 70%);
}

.hero__inner,
.page-shell {
    width: min(1360px, calc(100vw - 32px));
    margin: 0 auto;
}

.hero__inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.72fr);
    gap: 24px;
    align-items: start;
}

.page-shell {
    margin-top: -48px;
    padding-bottom: 56px;
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand-mark__coin {
    width: 92px;
    aspect-ratio: 1;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(214, 187, 117, 0.28);
    background: rgba(16, 24, 22, 0.85);
    box-shadow: var(--shadow);
}

.hero__eyebrow,
.panel__eyebrow,
.legend-card__meta,
.table-note {
    margin: 0;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-size: 0.74rem;
    color: var(--gold);
}

.hero h1,
.panel__title,
.team-editor h3,
.legend-card h3 {
    margin: 0;
    font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-weight: 700;
}

.hero h1 {
    margin-top: 10px;
    font-size: clamp(2.5rem, 4.6vw, 4.2rem);
    line-height: 0.95;
}

.hero__lead {
    max-width: 62ch;
    margin: 16px 0 0;
    color: var(--muted);
    line-height: 1.7;
    font-size: 1.04rem;
}

.hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.chip,
.team-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(214, 187, 117, 0.2);
    background: rgba(15, 23, 21, 0.48);
    color: var(--muted);
    font-size: 0.92rem;
}

.lock-card,
.panel,
.stat-card,
.team-editor,
.legend-card {
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.lock-card,
.panel,
.team-editor,
.legend-card {
    border-radius: var(--radius-lg);
}

.lock-card,
.panel {
    padding: 24px;
}

.panel--compact {
    margin-bottom: 18px;
}

.lock-card__title,
.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.lock-card p,
.panel__copy,
.team-card__count,
.team-editor p,
.legend-card p,
.inline-alert p {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.login-form,
.lock-card__actions,
.field {
    display: grid;
    gap: 10px;
}

.input,
.textarea {
    width: 100%;
    border: 1px solid rgba(214, 187, 117, 0.22);
    border-radius: 14px;
    background: rgba(10, 15, 14, 0.72);
    color: var(--text);
    padding: 14px 15px;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.input:focus,
.textarea:focus {
    border-color: rgba(235, 208, 138, 0.8);
    background: rgba(16, 24, 22, 0.95);
    transform: translateY(-1px);
}

.textarea {
    min-height: 140px;
    resize: vertical;
}

.textarea--compact {
    min-height: 104px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.button:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.button--primary {
    color: #2f2413;
    background: linear-gradient(135deg, var(--gold-strong), var(--gold));
}

.button--ghost {
    color: var(--text);
    background: rgba(15, 23, 21, 0.38);
    border: 1px solid rgba(214, 187, 117, 0.22);
}

.alert,
.inline-alert {
    margin-bottom: 18px;
    padding: 14px 18px;
    border-radius: 16px;
}

.alert--success {
    color: #eff8f0;
    background: rgba(127, 176, 136, 0.16);
    border: 1px solid rgba(127, 176, 136, 0.35);
}

.alert--error,
.inline-alert {
    color: #fff0eb;
    background: rgba(206, 123, 93, 0.14);
    border: 1px solid rgba(206, 123, 93, 0.32);
}

.stats-grid,
.team-grid,
.form-grid,
.team-editor-grid,
.map-layout {
    display: grid;
    gap: 18px;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.stat-card {
    padding: 22px;
    border-radius: 22px;
}

.stat-card__label {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.stat-card__value {
    margin: 8px 0 0;
    font-size: clamp(1.7rem, 2vw, 2.25rem);
    font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.team-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 18px;
}

.team-card__count {
    color: var(--text);
    font-weight: 700;
}

.team-card--city-attackers,
.stat-card--city-attackers,
.team-editor--city-attackers,
.legend-card--city-attackers {
    border-color: rgba(206, 123, 93, 0.4);
    background: linear-gradient(180deg, rgba(24, 35, 32, 0.95), rgba(206, 123, 93, 0.08));
}

.team-card--garrison-leads,
.stat-card--garrison-leads,
.team-editor--garrison-leads,
.legend-card--garrison-leads {
    border-color: rgba(169, 185, 123, 0.4);
    background: linear-gradient(180deg, rgba(24, 35, 32, 0.95), rgba(169, 185, 123, 0.08));
}

.team-card--flex,
.stat-card--flex,
.team-editor--flex,
.legend-card--flex {
    border-color: rgba(127, 185, 178, 0.42);
    background: linear-gradient(180deg, rgba(24, 35, 32, 0.95), rgba(127, 185, 178, 0.08));
}

.table-wrap {
    overflow-x: auto;
    margin-top: 16px;
}

.table-wrap--editor {
    margin-top: 24px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(214, 187, 117, 0.16);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--gold-strong);
    font-size: 0.86rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.data-table td {
    color: var(--muted);
}

.data-table td strong {
    color: var(--text);
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.team-pill {
    padding: 8px 12px;
    font-size: 0.88rem;
}

.team-pill--city-attackers {
    background: var(--attackers-soft);
    border-color: rgba(206, 123, 93, 0.35);
    color: #ffd2c3;
}

.team-pill--garrison-leads {
    background: var(--garrison-soft);
    border-color: rgba(169, 185, 123, 0.34);
    color: #ebf0ce;
}

.team-pill--flex {
    background: var(--flex-soft);
    border-color: rgba(127, 185, 178, 0.34);
    color: #d9faf5;
}

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

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

.field span {
    color: var(--muted);
    font-size: 0.9rem;
}

.team-editor-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 24px;
}

.team-editor {
    padding: 18px;
}

.team-editor h3 {
    margin-top: 8px;
    font-size: 1.45rem;
}

.table-note {
    margin-top: 8px;
    line-height: 1.4;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.panel--map {
    margin-top: 18px;
}

.map-layout {
    grid-template-columns: minmax(0, 0.9fr) minmax(320px, 0.8fr);
    align-items: start;
    margin-top: 18px;
}



.map-stage__surface {
    position: relative;
    aspect-ratio: 905 / 799;
    overflow: hidden;
    border-radius: 26px;
    border: 1px solid rgba(214, 187, 117, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    background: rgba(14, 18, 17, 0.55);
}

.map-stage__image {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.map-pin {
    position: absolute;
    left: calc(var(--x) * 1%);
    top: calc(var(--y) * 1%);
    transform: translate(-50%, -50%);
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    color: var(--text);
    max-width: 118px;
    z-index: 2;
    pointer-events: none;
}

.map-pin__badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px 7px 8px;
    border-radius: 999px;
    background: rgba(10, 14, 14, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.28);
}

.map-pin__order {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    color: #1c1510;
}

.map-pin__short {
    font-size: 0.79rem;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.map-pin__names {
    padding: 5px 7px;
    border-radius: 10px;
    background: rgba(10, 14, 14, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.68rem;
    line-height: 1.25;
    color: #f3f0e6;
    white-space: normal;
    overflow-wrap: anywhere;
}

.map-pin--city-attackers .map-pin__order {
    background: linear-gradient(135deg, #f0b08d, var(--attackers));
}

.map-pin--garrison-leads .map-pin__order {
    background: linear-gradient(135deg, #d9e7ac, var(--garrison));
}

.map-pin--flex .map-pin__order {
    background: linear-gradient(135deg, #c7f0eb, var(--flex));
}

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

.legend-card {
    padding: 16px;
}

.legend-card__header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.legend-card__order {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    font-weight: 800;
}

.legend-card__meta {
    margin-top: 6px;
}

.legend-card h3 {
    font-size: 1.2rem;
}

@media (max-width: 1180px) {
    .hero__inner,
    .stats-grid,
    .team-grid,
    .form-grid,
    .team-editor-grid,
    .map-layout {
        grid-template-columns: 1fr;
    }

    .page-shell {
        margin-top: -38px;
    }
}

@media (max-width: 760px) {
    .hero {
        padding-top: 24px;
        padding-bottom: 74px;
    }

    .hero__inner,
    .page-shell {
        width: min(100vw - 20px, 1360px);
    }

    .lock-card,
    .panel,
    .stat-card,
    .team-editor,
    .legend-card {
        border-radius: 20px;
    }

    .brand-mark {
        align-items: flex-start;
    }

    .brand-mark__coin {
        width: 76px;
        border-radius: 20px;
    }

    .map-pin {
        padding-right: 8px;
    }

    .map-pin__short {
        display: none;
    }
}
/* Browser and mobile compatibility overrides */
html {
    -webkit-text-size-adjust: 100%;
}

.hero__inner > *,
.stats-grid > *,
.team-grid > *,
.team-editor-grid > *,
.map-layout > * {
    min-width: 0;
}

.table-wrap {
    -webkit-overflow-scrolling: touch;
}

.map-stage {
    min-width: 0;
}

.map-stage__surface {
    width: 100%;
    min-height: 340px;
}

.legend-list {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

@supports not (aspect-ratio: 1 / 1) {
    .map-stage__surface {
        height: 0;
        min-height: 0;
        padding-top: calc(799 / 905 * 100%);
    }
}

@media (max-width: 760px) {
    .lock-card,
    .panel,
    .team-editor {
        padding: 18px;
    }

    .chip,
    .team-pill,
    .button,
    .input,
    .textarea,
    select {
        font-size: 16px;
    }

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

    .map-stage {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
    }

    .map-stage__surface {
        min-width: 620px;
        min-height: 548px;
    }

    .map-pin {
        max-width: 92px !important;
        gap: 3px !important;
    }

    .map-pin__badge {
        padding: 5px 8px 5px 6px;
    }

    .map-pin__order {
        width: 24px;
        height: 24px;
        font-size: 0.72rem;
    }

    .map-pin__names {
        max-width: 84px;
        padding: 4px 6px;
        font-size: 0.62rem;
    }
}