:root {
    --bg: #120f0c;
    --panel: rgba(31, 23, 18, 0.9);
    --line: rgba(230, 199, 152, 0.16);
    --text: #f6efe4;
    --muted: #c4b49b;
    --gold: #ddbd7b;
    --gold-strong: #b68942;
    --red: #a44a3f;
    --green: #58795c;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Instrument Sans", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top, rgba(221, 189, 123, 0.14), transparent 30%),
        linear-gradient(180deg, #231912 0%, #120f0c 55%, #0d0b09 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent);
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 56px;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(560px, 100%);
    padding: 36px;
    border-radius: 28px;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.auth-card--wide {
    width: min(680px, 100%);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: 16px 20px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(26, 19, 15, 0.88);
    box-shadow: var(--shadow);
}

.topbar__brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
    font-family: "Cinzel", serif;
    font-size: 1.1rem;
}

.brand-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
}

.topbar__links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.topbar__links a,
.auth-links a {
    color: var(--gold);
    text-decoration: none;
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
}

.flash--success {
    background: rgba(88, 121, 92, 0.22);
    border-color: rgba(88, 121, 92, 0.45);
}

.flash--error {
    background: rgba(164, 74, 63, 0.2);
    border-color: rgba(164, 74, 63, 0.48);
}

.auth-brand {
    display: block;
    width: min(440px, 100%);
    margin-bottom: 18px;
}

.auth-media {
    display: block;
    width: 100%;
    margin: 0 0 22px;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 16px;
    color: var(--muted);
    font-size: 0.92rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
}

.social-auth-grid {
    display: grid;
    gap: 12px;
}

.button--social {
    min-height: 48px;
}

.social-profile-card {
    display: grid;
    gap: 4px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
}

.social-profile-card strong {
    color: var(--text);
}

.social-account-list {
    display: grid;
    gap: 14px;
}

.social-account-card,
.social-link-state {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.social-account-card p,
.social-account-card span,
.social-link-state span {
    margin: 4px 0 0;
    color: var(--muted);
}

.social-link-state--linked {
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-start;
}

.qr-preview {
    width: 220px;
    max-width: 100%;
    margin-top: 12px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 10px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.9fr);
    gap: 24px;
    align-items: stretch;
    margin-bottom: 24px;
}

.hero__copy,
.hero__card,
.panel,
.world-bar {
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.hero__copy {
    padding: 36px;
    border-radius: 28px;
}

.hero__copy h1,
.hero__card h2,
.panel h2,
.panel h3 {
    margin: 0;
    font-family: "Cinzel", serif;
    letter-spacing: 0.02em;
}

.hero__copy h1 {
    font-size: clamp(2.3rem, 5vw, 4.7rem);
    line-height: 1.02;
    max-width: 11ch;
}

.hero__text {
    max-width: 60ch;
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.65;
}

.hero__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.hero__card {
    padding: 28px;
    border-radius: 28px;
    position: relative;
    overflow: hidden;
}

.hero__card::after {
    content: "";
    position: absolute;
    inset: auto -60px -60px auto;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(221, 189, 123, 0.25), transparent 65%);
}

.hero__crest {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: linear-gradient(180deg, #3f2d1f, #20160f);
    border: 1px solid rgba(221, 189, 123, 0.25);
    color: var(--gold);
    font-family: "Cinzel", serif;
    font-weight: 700;
    margin-bottom: 18px;
}

.hero__crest--image {
    width: 72px;
    height: 72px;
    display: block;
    margin-bottom: 18px;
}

.hero__art,
.panel-banner {
    display: block;
    width: 100%;
    border-radius: 22px;
    border: 1px solid rgba(221, 189, 123, 0.18);
    background: rgba(255, 255, 255, 0.03);
}

.hero__art {
    margin: 18px 0 16px;
}

.panel-banner {
    margin-top: 22px;
}

.stat-grid,
.overview-grid,
.guild-grid,
.loop-grid {
    display: grid;
    gap: 16px;
}

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

.stat-grid div,
.target-card dl div {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
}

dt,
.eyebrow,
.world-bar span,
.feed-item span,
.text-link {
    color: var(--muted);
}

dd,
dt {
    margin: 0;
}

.eyebrow {
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--text);
    text-decoration: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

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

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.button--primary {
    background: linear-gradient(180deg, var(--gold), var(--gold-strong));
    color: #1b140f;
}

.button--ghost {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.button--danger {
    background: linear-gradient(180deg, #b3584d, var(--red));
}

.page-title {
    margin: 0;
    font-family: "Cinzel", serif;
    font-size: clamp(1.8rem, 3vw, 3rem);
}

.world-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    border-radius: 22px;
    padding: 18px 22px;
    margin-bottom: 24px;
}

.world-bar strong {
    display: block;
    margin-top: 6px;
    font-size: 1.2rem;
}

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

.panel {
    padding: 24px;
    border-radius: 24px;
}

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

.panel__header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.form-card {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.025);
    border-radius: 20px;
}

.form-card--auth {
    margin-top: 24px;
}

.form-card label {
    display: grid;
    gap: 8px;
    color: var(--muted);
}

.checkbox-row {
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 12px;
}

.checkbox-row input {
    margin-top: 4px;
}

.form-card input {
    width: 100%;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(11, 9, 7, 0.55);
    color: var(--text);
    font: inherit;
}

.form-card select {
    width: 100%;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(11, 9, 7, 0.55);
    color: var(--text);
    font: inherit;
}

.form-card input:focus {
    outline: 2px solid rgba(221, 189, 123, 0.2);
    border-color: rgba(221, 189, 123, 0.4);
}

.form-card select:focus {
    outline: 2px solid rgba(221, 189, 123, 0.2);
    border-color: rgba(221, 189, 123, 0.4);
}

.pill {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(88, 121, 92, 0.2);
    color: #b8d2b7;
    border: 1px solid rgba(88, 121, 92, 0.4);
}

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

.overview-card,
.guild-card,
.target-card,
.feed-item,
.loop-grid article {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.025);
    border-radius: 20px;
    padding: 18px;
}

.plain-list {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
}

.plain-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.plain-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.target-list,
.feed-list {
    display: grid;
    gap: 14px;
}

.target-card {
    display: grid;
    gap: 16px;
}

.target-card dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.target-card__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.target-card__actions form,
.guild-card form,
.feed-item form {
    margin: 0;
}

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

.guild-card__top {
    display: flex;
    gap: 14px;
    align-items: center;
}

.guild-banner {
    flex: 0 0 auto;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #4b3626, #271b12);
    border: 1px solid rgba(221, 189, 123, 0.25);
    color: var(--gold);
    font-family: "Cinzel", serif;
    font-weight: 700;
}

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

.loop-grid p,
.feed-item p,
.guild-card p,
.target-card p {
    color: var(--muted);
    line-height: 1.55;
}

.guild-card--feature {
    margin-bottom: 18px;
}

.card-note,
.auth-links {
    color: var(--muted);
}

.construction-status {
    margin-bottom: 18px;
}

.text-link {
    text-decoration: none;
}

.dashboard--map {
    grid-template-columns: 1.2fr 0.8fr;
}

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

.map-tile {
    position: relative;
    min-height: 88px;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid rgba(221, 189, 123, 0.12);
    background:
        linear-gradient(180deg, rgba(80, 59, 36, 0.18), rgba(24, 18, 14, 0.65)),
        rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
}

.map-tile__overlays {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.map-tile strong {
    font-size: 0.9rem;
}

.map-tile span {
    color: var(--muted);
    font-size: 0.78rem;
}

.map-tile__coords {
    color: rgba(246, 239, 228, 0.55);
}

.map-tile--home {
    border-color: rgba(221, 189, 123, 0.5);
    box-shadow: inset 0 0 0 1px rgba(221, 189, 123, 0.22);
}

.map-tile--contested {
    border-color: rgba(198, 92, 72, 0.55);
    box-shadow: inset 0 0 0 1px rgba(198, 92, 72, 0.16);
}

.map-tile--encounter {
    border-color: rgba(104, 152, 98, 0.42);
}

.map-tile--boss {
    background:
        radial-gradient(circle at top, rgba(197, 95, 52, 0.24), transparent 56%),
        linear-gradient(180deg, rgba(80, 59, 36, 0.18), rgba(24, 18, 14, 0.65)),
        rgba(255, 255, 255, 0.03);
}

.map-overlay {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(11, 15, 20, 0.52);
    border: 1px solid rgba(221, 189, 123, 0.18);
    color: #f6efe4;
    font-size: 0.68rem;
    letter-spacing: 0.03em;
}

.map-overlay--banner {
    background: rgba(61, 83, 117, 0.35);
    border-color: rgba(112, 150, 202, 0.28);
}

.map-overlay--contest {
    background: rgba(118, 39, 32, 0.4);
    border-color: rgba(213, 112, 92, 0.28);
}

.map-overlay--encounter {
    background: rgba(44, 86, 53, 0.42);
    border-color: rgba(108, 166, 118, 0.28);
}

.map-overlay--boss {
    background: rgba(126, 64, 29, 0.48);
    border-color: rgba(225, 148, 77, 0.32);
}

@media (max-width: 980px) {
    .hero,
    .dashboard,
    .overview-grid,
    .guild-grid,
    .loop-grid,
    .world-bar {
        grid-template-columns: 1fr;
    }

    .target-card dl {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 20px, 1180px);
        padding-top: 18px;
    }

    .hero__copy,
    .hero__card,
    .panel {
        padding: 20px;
        border-radius: 22px;
    }

    .hero__copy h1 {
        font-size: 2.2rem;
    }

    .topbar {
        padding: 14px 16px;
    }

    .auth-card {
        padding: 24px;
    }

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