/* Settla portal – dark, calm, a little Minecraft-green. */
:root {
    --bg: #101512;
    --bg-2: #161d19;
    --card: #1b241f;
    --card-2: #222d27;
    --line: #2e3b34;
    --text: #e8efe9;
    --muted: #93a39a;
    --green: #7bc96f;
    --green-2: #5fae55;
    --gold: #f2c94c;
    --red: #eb6f6f;
    --blue: #6fb3eb;
    --radius: 12px;
    --shadow: 0 6px 24px rgba(0, 0, 0, .25);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; color: var(--muted); font-weight: 600; }
p { line-height: 1.55; }
code, kbd { background: var(--card-2); border: 1px solid var(--line); border-radius: 6px; padding: .1rem .35rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .8rem 1.5rem; background: var(--bg-2);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 800; font-size: 1.15rem; }
.brand:hover { text-decoration: none; }
.brand-sub { color: var(--green); font-weight: 600; margin-left: .35rem; }
.nav { display: flex; gap: .3rem; flex: 1; flex-wrap: wrap; }
.nav a, .nav-soon { padding: .45rem .8rem; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: .95rem; }
.nav a:hover { background: var(--card); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--card-2); color: var(--text); }
.nav-soon { opacity: .45; cursor: default; }
.nav-soon::after { content: "bald"; font-size: .65rem; margin-left: .35rem; padding: .05rem .3rem; border-radius: 4px;
    background: var(--line); color: var(--muted); vertical-align: middle; }
.user { display: flex; align-items: center; gap: .7rem; color: var(--muted); }
.user span { color: var(--text); font-weight: 600; }

/* Layout */
.container { width: 100%; max-width: 1150px; margin: 0 auto; padding: 1.5rem; flex: 1; }
.footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem; border-top: 1px solid var(--line);
    color: var(--muted); font-size: .85rem; flex-wrap: wrap; }
.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.section { margin-top: 2rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat .value { font-size: 1.6rem; font-weight: 800; margin: .3rem 0 .15rem; }
.stat .sub { color: var(--muted); font-size: .85rem; }
.value.green { color: var(--green); }
.value.gold { color: var(--gold); }
.value.red { color: var(--red); }
td.green { color: var(--green); font-weight: 700; }
td.gold { color: var(--gold); font-weight: 700; }
td.red { color: var(--red); font-weight: 700; }

/* Bars */
.bar { height: 10px; border-radius: 99px; background: var(--card-2); overflow: hidden; display: flex; margin: .6rem 0 .4rem; }
.bar > span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; color: var(--muted); }
.dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; margin-right: .35rem; vertical-align: baseline; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: .6rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 700; }
tbody tr:hover { background: var(--card-2); }
.badge { display: inline-block; padding: .12rem .5rem; border-radius: 99px; font-size: .78rem; font-weight: 700;
    background: var(--card-2); border: 1px solid var(--line); color: var(--muted); }
.badge.buy { color: var(--gold); border-color: #5b4d22; }
.badge.sell { color: var(--green); border-color: #2f5130; }
.badge.on { color: var(--green); }
.item-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; background: var(--card-2);
    border: 1px solid var(--line); font-size: .7rem; font-weight: 800; color: var(--muted); margin-right: .6rem; vertical-align: middle; }

/* Forms */
form { display: grid; gap: .8rem; }
label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
input[type=text], input[type=password], input[type=email], input[type=search] {
    background: var(--bg-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: .65rem .75rem;
    font-size: 1rem; width: 100%; }
input:focus { outline: 2px solid var(--green-2); outline-offset: 1px; border-color: transparent; }
button { font: inherit; cursor: pointer; }
.btn { background: var(--green-2); color: #0c140e; border: 0; border-radius: 8px; padding: .65rem 1rem; font-weight: 800; }
.btn:hover { background: var(--green); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid #5a3030; }
.link { background: none; border: 0; color: var(--green); padding: 0; font-weight: 600; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.switch { display: flex; align-items: center; gap: .7rem; font-weight: 600; }
.switch input { width: 1.2rem; height: 1.2rem; accent-color: var(--green-2); }

/* Messages */
.notice { padding: .75rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card-2); margin: .6rem 0; }
.notice.error { border-color: #5a3030; color: #ffc9c9; background: #2a1919; }
.notice.ok { border-color: #2f5130; color: #c9f2c4; background: #172417; }
.empty { color: var(--muted); padding: 1rem 0; }

/* Login */
.login { max-width: 900px; margin: 2rem auto; }
.login-hero { text-align: center; margin-bottom: 2rem; }
.login-hero p { color: var(--muted); max-width: 560px; margin: .5rem auto 0; }
.steps { padding-left: 1.2rem; line-height: 1.8; }

@media (max-width: 640px) {
    .topbar { gap: .6rem; padding: .7rem 1rem; }
    .container { padding: 1rem; }
    .stat .value { font-size: 1.35rem; }
}

/* Charts */
.chart { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis { fill: var(--muted); font-size: 11px; }
.chart-svg .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .cursor { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart-svg .bar-rect:hover { opacity: .8; }
.chart-tip { position: absolute; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem;
    font-size: .82rem; pointer-events: none; box-shadow: var(--shadow); white-space: nowrap; z-index: 2; }
.dot-inline { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .35rem; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented a { padding: .35rem .7rem; color: var(--muted); font-size: .88rem; font-weight: 600; }
.segmented a:hover { background: var(--card); text-decoration: none; color: var(--text); }
.segmented a.active { background: var(--card-2); color: var(--text); }

/* Shop rows with history + icons */
tr.clickable { cursor: pointer; }
.history-row td { background: var(--bg-2); }
.history-chart { margin: .3rem 0; }
.item-icon { position: relative; overflow: hidden; }
.item-icon img { position: absolute; inset: 3px; width: 24px; height: 24px; image-rendering: pixelated;
    object-fit: cover; object-position: top; /* animated textures are strips: show the first frame */ }
.item-icon.has-img .item-letters { visibility: hidden; }

/* Community: mails, news, forum */
.count { display: inline-block; min-width: 1.2rem; padding: 0 .35rem; margin-left: .25rem; border-radius: 99px;
    background: var(--red); color: #fff; font-size: .72rem; font-weight: 800; text-align: center; }
.badge.team { color: var(--blue); border-color: #2b4a63; }
.mail-list { list-style: none; margin: 0; padding: 0; }
.mail-list li { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.mail-list li:last-child { border-bottom: 0; }
.mail-list li.unread .mail-text { font-weight: 700; }
.mail-text { margin: .25rem 0; white-space: pre-wrap; }
.news h2 a { color: var(--text); }
.news-teaser { display: block; color: var(--text); }
.news-teaser:hover { text-decoration: none; border-color: var(--green-2); }
.news-teaser h3 { color: var(--text); margin-top: .3rem; }
.prose { line-height: 1.6; overflow-wrap: anywhere; }
.prose h3, .prose h4, .prose h5 { margin: 1rem 0 .4rem; color: var(--text); }
.prose pre { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: .7rem; overflow-x: auto; }
.prose pre code { background: none; border: 0; padding: 0; }
.prose ul { padding-left: 1.3rem; }
.forum-title { font-weight: 700; color: var(--text); }
.posts { display: grid; gap: .8rem; }
.post-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .4rem; }
.post-actions { margin-top: .4rem; }
.danger-link { color: var(--red); }
.pager { display: flex; justify-content: space-between; align-items: center; margin: 1.2rem 0; }
.editor { display: grid; gap: .8rem; }
textarea { background: var(--bg-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: .65rem .75rem;
    font: inherit; width: 100%; resize: vertical; }
textarea:focus { outline: 2px solid var(--green-2); outline-offset: 1px; border-color: transparent; }
.preview { border: 1px dashed var(--line); border-radius: 8px; padding: .8rem; }

/* Map (#/karte): full height below the top bar, sidebar left, canvas right */
.gold { color: var(--gold); }
.red { color: var(--red); }
body.map-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.map-mode .footer { display: none; }
body.map-mode main.container { max-width: none; padding: 0; min-height: 0; display: flex; }
.map-page { flex: 1; display: grid; grid-template-columns: 320px 1fr; min-height: 0; }
.map-side { background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.map-side-head { padding: .8rem; display: grid; gap: .5rem; border-bottom: 1px solid var(--line); position: relative; }
.map-side-head select { background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 8px;
    padding: .5rem .6rem; font: inherit; font-weight: 600; }
.map-side-head input { padding: .55rem .7rem; font-size: .95rem; }
.map-results { position: absolute; left: .8rem; right: .8rem; top: 100%; z-index: 5; background: var(--card); border: 1px solid var(--line);
    border-radius: 10px; box-shadow: var(--shadow); padding: .3rem; max-height: 50vh; overflow-y: auto; }
.map-results button { display: grid; width: 100%; text-align: left; background: none; border: 0; color: var(--text);
    padding: .45rem .55rem; border-radius: 7px; }
.map-results button:hover { background: var(--card-2); }
.map-results p { margin: .4rem .5rem; }
.map-side-body { overflow-y: auto; padding: .4rem .8rem 1rem; }
.map-side-body section { margin: .9rem 0; }
.map-side-body h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .45rem; }
.map-list { display: grid; gap: .25rem; }
.map-item { display: flex; align-items: center; gap: .55rem; width: 100%; text-align: left; background: none;
    border: 1px solid transparent; border-radius: 9px; padding: .4rem .5rem; color: var(--text); }
button.map-item:hover, .map-item:hover { background: var(--card); border-color: var(--line); }
.map-item.active { border-color: var(--gold); background: #2a2614; }
.map-item .grow { flex: 1; display: grid; min-width: 0; }
.map-item .grow strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-item-main { flex: 1; display: flex; align-items: center; gap: .55rem; background: none; border: 0; color: inherit;
    text-align: left; padding: 0; min-width: 0; }
.map-follow-btn { background: var(--card-2); border: 1px solid var(--line); color: var(--muted); border-radius: 7px;
    width: 2rem; height: 2rem; font-size: 1rem; line-height: 1; }
.map-follow-btn:hover { color: var(--text); }
.map-follow-btn.on { color: var(--gold); border-color: var(--gold); }
.map-head { width: 22px; height: 22px; border-radius: 4px; image-rendering: pixelated; background: var(--card-2);
    flex: none; vertical-align: middle; }
.map-head.missing { visibility: hidden; }
.sw { display: inline-block; width: .85rem; height: .85rem; border-radius: 3px; border: 2px solid transparent; flex: none;
    vertical-align: middle; margin-right: .4rem; }
.map-item .sw { margin-right: 0; }
.map-legend { display: grid; gap: .35rem; font-size: .85rem; color: var(--muted); }
.map-layers { display: grid; gap: .35rem; }
.map-me { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; display: grid; gap: .5rem; }
.small-btn { padding: .4rem .7rem; font-size: .85rem; }
.btn.confirm { background: var(--gold); }
.live-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--green);
    box-shadow: 0 0 0 0 rgba(123, 201, 111, .6); animation: live 1.6s infinite; vertical-align: middle; }
@keyframes live { 70% { box-shadow: 0 0 0 7px rgba(123, 201, 111, 0); } 100% { box-shadow: 0 0 0 0 rgba(123, 201, 111, 0); } }

.map-stage { position: relative; overflow: hidden; min-height: 0; background: #0b100d; }
.map-stage canvas { display: block; touch-action: none; cursor: grab; outline: none; }
.map-stage canvas:active { cursor: grabbing; }
.map-controls { position: absolute; top: .8rem; right: .8rem; display: grid; gap: .35rem; z-index: 2; }
.map-btn { width: 2.4rem; height: 2.4rem; border-radius: 9px; background: rgba(22, 29, 25, .92); border: 1px solid var(--line);
    color: var(--text); font-size: 1.15rem; font-weight: 700; box-shadow: var(--shadow); }
.map-btn:hover { background: var(--card-2); }
.only-mobile { display: none; }
.map-follow { position: absolute; top: .8rem; left: 50%; transform: translateX(-50%); z-index: 2; background: rgba(42, 38, 20, .95);
    border: 1px solid var(--gold); color: var(--text); border-radius: 99px; padding: .4rem .9rem; font-size: .9rem;
    box-shadow: var(--shadow); white-space: nowrap; }
.map-follow .live-dot { background: var(--gold); }
.map-coords { position: absolute; left: .8rem; bottom: 2.4rem; z-index: 2; font-size: .78rem; color: var(--muted);
    background: rgba(11, 16, 13, .75); padding: .2rem .5rem; border-radius: 6px; font-variant-numeric: tabular-nums; }
.map-coords:empty { display: none; }
.map-tip { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; background: rgba(22, 29, 25, .95);
    border: 1px solid var(--line); border-radius: 8px; padding: .4rem .6rem; font-size: .84rem; line-height: 1.4;
    box-shadow: var(--shadow); max-width: 260px; }
.map-status { position: absolute; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 3; background: var(--card);
    border: 1px solid var(--line); border-radius: 10px; padding: .55rem .9rem; box-shadow: var(--shadow); font-size: .9rem; }
.map-panel { position: absolute; top: .8rem; right: 3.9rem; width: 330px; max-height: calc(100% - 1.6rem); overflow-y: auto;
    z-index: 4; background: rgba(27, 36, 31, .97); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem;
    box-shadow: var(--shadow); }
.map-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; margin-bottom: .5rem; }
.map-panel-head .badge { margin-right: .35rem; }
.map-panel h4 { margin: .8rem 0 .3rem; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.map-panel p { margin: .4rem 0; }
.map-tag { font-size: 1.1rem; font-weight: 800; }
.map-district { background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; margin: .4rem 0; }
.map-people { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.map-people li { display: flex; align-items: center; gap: .5rem; }
.map-people li .link { margin-left: auto; font-size: .8rem; }
.map-form { margin-top: .9rem; gap: .5rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.map-form input[type=text] { padding: .5rem .6rem; font-size: .95rem; }
.map-buy { border: 1px solid #5b4d22; background: #221f12; border-radius: 10px; padding: .6rem .75rem; margin-top: .6rem; }

@media (max-width: 800px) {
    .map-page { grid-template-columns: 1fr; position: relative; }
    .map-side { position: absolute; inset: 0 auto 0 0; width: min(320px, 88vw); z-index: 6; transform: translateX(-100%);
        transition: transform .2s ease; box-shadow: var(--shadow); }
    .map-side.open { transform: none; }
    .only-mobile { display: block; }
    .map-panel { left: .6rem; right: .6rem; top: auto; bottom: .6rem; width: auto; max-height: 55%; }
    .map-follow { top: auto; bottom: 4.2rem; }
}

/* Small screens: brand + user in one row, navigation as a scrollable strip below */
@media (max-width: 800px) {
    .topbar { gap: .4rem .8rem; padding: .55rem .8rem; }
    .brand { font-size: 1rem; }
    .brand img { width: 24px; height: 24px; }
    .user { margin-left: auto; font-size: .9rem; }
    .nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: .15rem; }
    .nav::-webkit-scrollbar { display: none; }
    .nav a { white-space: nowrap; padding: .35rem .6rem; font-size: .9rem; }
}

/* Team area (#/admin) */
.admin-tabs { margin-bottom: 1.2rem; }
.admin-body .section { margin-top: 1rem; }
.section-tight { margin-top: .8rem; }
.admin-search { margin-bottom: .5rem; flex-wrap: nowrap; }
.admin-search input { flex: 1; }
.admin-form { gap: .55rem; }
.admin-form .row input { flex: 1; min-width: 180px; }
.admin-form select { background: var(--bg-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px;
    padding: .55rem .6rem; font: inherit; }
.admin-narrow { max-width: 640px; }
.player-head { display: flex; gap: 1rem; align-items: center; }
.player-head .grow { flex: 1; min-width: 0; }
.player-head h2 { margin-bottom: .25rem; }
.player-avatar { width: 56px; height: 56px; border-radius: 10px; image-rendering: pixelated; background: var(--card-2); flex: none; }
.player-avatar.missing { visibility: hidden; }
.red-badge { color: var(--red); border-color: #5a3030; }
table.audit td { vertical-align: top; }
tr.warn-row td { background: #2a1919; }

/* Rank badge (LuckPerms group, colour from its prefix) */
.badge.rank { color: var(--gold); border-color: #5b4d22; }
h1 .badge.rank { font-size: .85rem; vertical-align: middle; margin-left: .3rem; }
.map-admin { background: #241a10; border: 1px solid #5b3d1e; border-radius: 10px; padding: .6rem .7rem; }
.map-admin h3 { color: #ffb36b; }
.map-admin p { margin: .4rem 0 0; }
.map-admin-box { margin-top: 1rem; border-top: 2px solid #5b3d1e; padding-top: .3rem; }
.map-admin-box h4 { color: #ffb36b !important; }
.map-panel select, .map-form select { background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
    border-radius: 8px; padding: .45rem .5rem; font: inherit; }
.map-backups { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .35rem; font-size: .88rem; }
.map-backups li { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.map-backups li > span { display: grid; }
