:root {
    color-scheme: dark;
    --bg: #06100d;
    --panel: #0b1814;
    --panel-soft: #10231c;
    --panel-lifted: #142a22;
    --line: #29473b;
    --line-soft: rgba(117, 240, 169, .14);
    --text: #f2fff8;
    --muted: #9ab9ab;
    --accent: #75f0a9;
    --accent-strong: #3fca7a;
    --gold: #ffd166;
    --danger: #ff8d8d;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 12% -10%, rgba(63, 202, 122, .19), transparent 34rem),
        radial-gradient(circle at 72% 28%, rgba(255, 209, 102, .055), transparent 29rem),
        var(--bg);
}

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

.shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    min-height: 100vh;
}

.content {
    width: 100%;
    max-width: 1380px;
    margin: 0 auto;
    padding: clamp(2rem, 4.5vw, 4.75rem);
}

.content > header {
    max-width: 790px;
    margin-bottom: 2rem;
}

.eyebrow,
.section-kicker {
    margin: 0 0 .55rem;
    color: var(--accent);
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .17em;
}

h1 {
    margin: .3rem 0 1rem;
    font-size: clamp(2.65rem, 7vw, 5.4rem);
    line-height: .93;
    letter-spacing: -.058em;
}

h2,
h3,
h4 { margin-top: 0; }

h2 { letter-spacing: -.025em; }

.lead,
.admin-panel p {
    color: var(--muted);
    line-height: 1.68;
}

.lookup,
.alert,
.raw-data,
.admin-data {
    margin: 1rem 0;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(11, 24, 20, .88);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .12);
}

label,
.label {
    display: block;
    margin-bottom: .55rem;
    color: var(--muted);
    font-size: .82rem;
}

.input-row { display: flex; gap: .65rem; }

input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #07130f;
    color: var(--text);
    padding: .92rem 1rem;
    font: inherit;
}

input:focus {
    outline: 2px solid var(--accent-strong);
    outline-offset: 2px;
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    border: 0;
    border-radius: 11px;
    background: var(--accent);
    color: #052015;
    padding: .92rem 1.2rem;
    font: inherit;
    font-weight: 850;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background .18s ease, transform .18s ease;
}

button:hover,
.button-link:hover { background: #a4ffc9; transform: translateY(-1px); }

.secondary {
    width: 100%;
    border: 1px solid var(--accent-strong);
    background: transparent;
    color: var(--accent);
}

small { display: block; color: var(--muted); margin-top: .7rem; }

code {
    color: #adffd2;
    overflow-wrap: anywhere;
}

a { color: var(--accent); }

.profile-card {
    position: relative;
    overflow: hidden;
    margin: 2rem 0 3rem;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: linear-gradient(145deg, rgba(20, 42, 34, .98), rgba(9, 22, 18, .98));
    box-shadow: 0 35px 90px rgba(0, 0, 0, .24);
}

.profile-cover {
    height: clamp(130px, 21vw, 235px);
    background:
        linear-gradient(120deg, rgba(117, 240, 169, .25), rgba(255, 209, 102, .12)),
        repeating-linear-gradient(135deg, transparent 0 26px, rgba(255, 255, 255, .025) 26px 52px),
        #153629;
}

.profile-cover::after,
.community-cover::after {
    position: absolute;
    inset: 0;
    content: "";
    background: linear-gradient(to bottom, transparent 25%, rgba(6, 16, 13, .82));
}

.profile-cover { position: relative; }

.profile-cover img,
.community-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-card-body {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr) minmax(225px, .42fr);
    gap: 1.5rem;
    align-items: start;
    padding: 0 clamp(1.25rem, 3vw, 2.2rem) 2rem;
}

.profile-avatar,
.community-icon {
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 5px solid var(--panel);
    background: linear-gradient(145deg, var(--accent), #248956);
    color: #052015;
    font-weight: 900;
    box-shadow: 0 18px 38px rgba(0, 0, 0, .3);
}

.profile-avatar {
    position: relative;
    z-index: 2;
    width: 132px;
    height: 132px;
    margin-top: -54px;
    border-radius: 36px;
    font-size: 2.35rem;
}

.profile-avatar img,
.community-icon img { width: 100%; height: 100%; object-fit: cover; }

.profile-heading { padding-top: 1.35rem; }

.profile-heading h2 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.35rem);
    line-height: 1;
}

.profile-handle { margin: .55rem 0 0; color: var(--accent); font-weight: 750; }

.profile-bio {
    max-width: 720px;
    margin: 1rem 0 0;
    color: #cce6da;
    line-height: 1.6;
}

.profile-actions { display: grid; gap: .9rem; padding-top: 1.35rem; }

.profile-actions small { margin: 0; }

.profile-id {
    min-width: 0;
    padding: .8rem .9rem;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: rgba(5, 17, 13, .55);
}

.profile-id span {
    display: block;
    margin-bottom: .3rem;
    color: var(--muted);
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .12em;
}

.profile-id code { font-size: .72rem; }

.summary-section,
.communities-section,
.secondary-activity,
.wall-section { margin: 3.4rem 0; }

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 2rem;
    margin-bottom: 1.25rem;
}

.section-heading h2 {
    margin: 0;
    font-size: clamp(1.75rem, 3.5vw, 2.6rem);
}

.section-heading > p {
    max-width: 470px;
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
    text-align: right;
}

.section-heading.compact h2 { font-size: clamp(1.5rem, 3vw, 2.15rem); }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
    gap: .7rem;
}

.stat {
    min-height: 105px;
    padding: 1rem;
    border: 1px solid var(--line-soft);
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(20, 42, 34, .9), rgba(11, 26, 20, .9));
}

.stat strong {
    display: block;
    margin-bottom: .2rem;
    color: var(--accent);
    font-size: 1.85rem;
    letter-spacing: -.04em;
}

.stat span { color: var(--muted); font-size: .78rem; }

.availability-note,
.empty-state {
    margin: 0 0 1rem;
    padding: .9rem 1rem;
    border: 1px dashed #5b6b45;
    border-radius: 13px;
    background: rgba(255, 209, 102, .055);
    color: var(--muted);
    line-height: 1.5;
}

.availability-note strong { color: var(--gold); }

.empty-state { display: grid; gap: .25rem; }
.empty-state strong { color: var(--text); }

.community-list { display: grid; gap: 1.35rem; }

.community-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(11, 24, 20, .96);
    box-shadow: 0 24px 65px rgba(0, 0, 0, .15);
    transition: border-color .2s ease, transform .2s ease;
}

.community-card:hover { border-color: #3b6654; transform: translateY(-2px); }

.community-cover {
    position: relative;
    height: 165px;
    background:
        linear-gradient(120deg, rgba(117, 240, 169, .18), rgba(255, 209, 102, .09)),
        #17372b;
}

.community-header {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 1.25rem;
    padding: 0 1.4rem 1.25rem;
}

.community-icon {
    width: 104px;
    height: 104px;
    margin-top: -40px;
    border-radius: 29px;
    font-size: 1.7rem;
    z-index: 1;
}

.community-heading { min-width: 0; padding-top: 1rem; }

.community-name-row {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
}

.community-name-row h3 {
    margin: 0 0 .32rem;
    font-size: clamp(1.35rem, 3vw, 2rem);
    letter-spacing: -.025em;
}

.community-id { display: block; color: #7fa99a; font-size: .66rem; }

.role-badge,
.activity-type {
    flex: 0 0 auto;
    border: 1px solid rgba(117, 240, 169, .25);
    border-radius: 999px;
    background: rgba(117, 240, 169, .09);
    color: var(--accent);
    padding: .35rem .58rem;
    font-size: .7rem;
    font-weight: 800;
}

.community-heading > p {
    max-width: 720px;
    margin: .7rem 0;
    color: var(--muted);
    line-height: 1.5;
}

.community-link { font-size: .82rem; font-weight: 750; text-decoration: none; }
.community-link:hover { text-decoration: underline; }

.community-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: 0 1.4rem;
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: 15px;
    background: rgba(5, 16, 12, .48);
}

.community-metrics > div { padding: .9rem 1rem; }
.community-metrics > div + div { border-left: 1px solid var(--line-soft); }

.community-metrics span {
    display: block;
    margin-bottom: .2rem;
    color: var(--muted);
    font-size: .7rem;
}

.community-metrics strong { color: var(--gold); font-size: 1.45rem; }

.activity-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1.4rem;
}

.activity-column {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    background: rgba(16, 35, 28, .56);
}

.activity-title,
.activity-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.activity-title { margin-bottom: .75rem; }
.activity-title h4 { margin: 0; font-size: 1rem; }
.activity-title > span { color: var(--muted); font-size: .7rem; }

.activity-list,
.wide-activity-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.activity-list { display: grid; gap: .65rem; }

.activity-list li {
    padding: .8rem;
    border: 1px solid rgba(154, 185, 171, .1);
    border-radius: 12px;
    background: rgba(5, 16, 12, .5);
}

.activity-meta { margin-bottom: .52rem; color: #739c8c; font-size: .66rem; }
.activity-meta > span { color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }

.activity-list li > strong { display: block; margin-bottom: .3rem; font-size: .9rem; }

.activity-list p,
.wide-activity-list p {
    margin: 0;
    color: #d4e8df;
    font-size: .86rem;
    line-height: 1.5;
}

.activity-list small { margin: .55rem 0 0; font-size: .66rem; }

.activity-empty {
    min-height: 76px;
    margin: 0;
    padding: 1rem;
    border: 1px dashed rgba(154, 185, 171, .18);
    border-radius: 12px;
    color: var(--muted);
    font-size: .83rem;
    line-height: 1.45;
}

.last-active {
    margin: 0;
    padding: 0 1.4rem 1.25rem;
    color: #6f9485;
    font-size: .68rem;
}

.secondary-activity,
.wall-section {
    padding: clamp(1rem, 2.5vw, 1.5rem);
    border: 1px solid var(--line);
    border-radius: 21px;
    background: rgba(11, 24, 20, .72);
}

.wide-activity-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }

.wide-activity-list li {
    min-width: 0;
    padding: .95rem;
    border: 1px solid var(--line-soft);
    border-radius: 13px;
    background: rgba(5, 16, 12, .52);
}

.wide-activity-list li > div {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: .7rem;
}

.wide-activity-list code,
.muted-label { color: #789d8e; font-size: .65rem; }

.wide-activity-list time {
    display: block;
    margin-top: .65rem;
    color: #739687;
    font-size: .67rem;
}

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

summary { cursor: pointer; font-weight: 800; }

.raw-data > p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: .78rem;
}

pre {
    max-height: 60vh;
    overflow: auto;
    margin-bottom: 0;
    border-radius: 11px;
    background: #030906;
    padding: 1rem;
    font-size: .76rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.admin-data { border-color: #806a33; }

.admin-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
    border-left: 1px solid var(--line);
    background: rgba(7, 19, 15, .96);
}

.admin-panel > div { position: sticky; top: 2rem; }
.admin-form { display: grid; gap: .75rem; }
.admin-form label { margin-bottom: -.35rem; }
.privacy { font-size: .75rem; }

.alert.error { border-color: #9c4848; color: #ffd5d5; }
.alert.notice { border-color: var(--accent-strong); color: #c9ffe2; }

@media (max-width: 1080px) {
    .shell { grid-template-columns: 1fr; }
    .admin-panel { border-top: 1px solid var(--line); border-left: 0; }
    .admin-panel > div { position: static; }
}

@media (max-width: 760px) {
    .content { padding: 1.25rem; }
    .input-row { display: grid; }
    .profile-card-body { grid-template-columns: 92px minmax(0, 1fr); gap: 1rem; }
    .profile-avatar { width: 92px; height: 92px; margin-top: -34px; border-radius: 25px; font-size: 1.6rem; }
    .profile-actions { grid-column: 1 / -1; padding-top: 0; }
    .section-heading { display: grid; gap: .55rem; align-items: start; }
    .section-heading > p { text-align: left; }
    .community-header { grid-template-columns: 78px minmax(0, 1fr); padding-inline: 1rem; gap: .85rem; }
    .community-icon { width: 78px; height: 78px; margin-top: -27px; border-radius: 22px; font-size: 1.25rem; }
    .community-name-row { display: grid; gap: .7rem; }
    .role-badge { justify-self: start; }
    .community-metrics { grid-template-columns: repeat(2, 1fr); margin-inline: 1rem; }
    .community-metrics > div + div { border-left: 0; }
    .community-metrics > div:nth-child(even) { border-left: 1px solid var(--line-soft); }
    .community-metrics > div:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
    .activity-grid { grid-template-columns: 1fr; padding: 1rem; }
    .wide-activity-list { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
    .profile-card-body { grid-template-columns: 1fr; }
    .profile-avatar { margin-top: -38px; }
    .profile-heading { padding-top: 0; }
    .profile-heading h2 { font-size: 2rem; }
    .community-header { grid-template-columns: 1fr; }
    .community-icon { margin-top: -30px; }
    .community-name-row h3 { font-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; }
}
