:root {
    --bg: #ffffff;
    --text: #000000;
    --accent: #2F52E0;
    --alert: #FF4D00;
    --muted: #666666;
    --line: #000000;
    --border: 3px solid #000;
    --shadow: 5px 5px 0 #000;
    --tabbar-h: 84px;
    --radius: 0;
}

button { appearance: none; -webkit-appearance: none; font: inherit; }
[hidden] { display: none !important; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: "Manrope", sans-serif;
    min-height: 100dvh;
}

body { padding-top: env(safe-area-inset-top); }

h2, h3, .brand, .btn, .chip, .live-pill, .stat-num, .tool-title {
    font-family: "Unbounded", sans-serif;
    text-transform: uppercase;
    line-height: 1.1;
}

h2 {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.4px;
}

h3 { font-size: 0.92rem; font-weight: 700; }

p, .lead { line-height: 1.45; }

.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100dvh;
    background: #fff;
    position: relative;
    border-left: var(--border);
    border-right: var(--border);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: var(--border);
}

.brand {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 900;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-pill {
    background: var(--alert);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 6px 8px;
    transform: rotate(2deg);
}

.live-pill.is-local { background: #000; }

.icon-btn,
.icon-add {
    width: 40px;
    height: 40px;
    border: var(--border);
    background: #000;
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.18s ease, background 0.18s ease;
}

.icon-add {
    background: var(--accent);
    font-size: 1.4rem;
    font-weight: 700;
    font-family: "Unbounded", sans-serif;
}

.icon-btn:active,
.icon-add:active { transform: translate(2px, 2px); }

.views { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.view { display: none; }
.view.is-active { display: block; animation: rise 0.28s ease; }

@keyframes rise {
    from { transform: translateY(8px); }
    to { transform: none; }
}

.pad { padding: 20px 16px 28px; }

.lead {
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 500;
    margin: 8px 0 18px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 28px 0 14px;
}

.text-link {
    background: none;
    border: none;
    color: var(--accent);
    font-family: "Unbounded", sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
}

.profile-card,
.community-card,
.info-card,
.tool-card,
.empty-card,
.alert-card,
.stat-box {
    border: var(--border);
    background: #fff;
    box-shadow: var(--shadow);
}

.profile-card {
    padding: 18px;
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}

.avatar,
.comm-avatar {
    width: 72px;
    height: 72px;
    border: var(--border);
    overflow: hidden;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #fff;
    font-family: "Unbounded", sans-serif;
    font-weight: 900;
    font-size: 1.3rem;
}

.avatar img,
.comm-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.comm-avatar {
    width: 52px;
    height: 52px;
    font-size: 1rem;
    flex-shrink: 0;
}

.profile-name {
    font-family: "Unbounded", sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.profile-meta {
    font-size: 0.88rem;
    color: #333;
    font-weight: 600;
}

.profile-id {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.profile-stats {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 4px;
}

.stat-box { padding: 10px 12px; box-shadow: none; }
.stat-box span {
    display: block;
    font-family: "Manrope", sans-serif;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}
.stat-box small {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #000;
    color: #fff;
    border: none;
    padding: 16px 18px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.btn--full { width: 100%; }

.btn:hover,
.btn:active {
    background: var(--accent);
    transform: translate(-3px, -3px);
    box-shadow: var(--shadow);
}

.stack { display: flex; flex-direction: column; gap: 12px; }

.community-card,
.alert-card {
    width: 100%;
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.community-card:active,
.alert-card:active,
.tool-card:active {
    transform: translate(-3px, -3px);
    border-color: var(--accent);
}

.community-body { min-width: 0; flex: 1; }

.tag {
    font-family: "Unbounded", sans-serif;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.tag.is-chat { color: var(--alert); }

.community-body h3 {
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 600;
}

.chevron {
    font-family: "Unbounded", sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
}

.empty-card {
    padding: 28px 18px;
    text-align: center;
}

.empty-card p {
    color: var(--muted);
    font-weight: 500;
}

.form { display: flex; flex-direction: column; gap: 14px; }

label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: "Unbounded", sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.field {
    border: var(--border);
    padding: 14px 12px;
    font: 600 1rem "Manrope", sans-serif;
    text-transform: none;
}

.field:focus {
    outline: none;
    box-shadow: 4px 4px 0 var(--accent);
}

.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.chip {
    border: var(--border);
    background: #fff;
    padding: 12px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.chip.is-on { background: #000; color: #fff; }

.community-hero {
    padding: 22px 16px 8px;
    background-image: radial-gradient(#ccc 1px, transparent 1px);
    background-size: 18px 18px;
    border-bottom: var(--border);
}

.community-hero-inner {
    display: flex;
    gap: 14px;
    align-items: center;
}

.community-hero h1 {
    font-family: "Unbounded", sans-serif;
    font-size: 1.35rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

.tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 18px 16px 28px;
}

.tool-card {
    min-height: 118px;
    padding: 16px;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.tool-card:hover,
.tool-card:active {
    background: var(--accent);
    color: #fff;
    transform: translate(-3px, -3px);
}

.tool-icon {
    width: 28px;
    height: 28px;
}

.tool-title { font-size: 0.86rem; font-weight: 700; }

.info-card { padding: 16px; box-shadow: none; }
.info-card p {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 500;
}

.settings-list { margin-top: 16px; }

.alert-card { cursor: default; }
.alert-card:active { transform: none; }

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(420px, calc(100% - 32px));
    background: #000;
    color: #fff;
    padding: 14px 16px;
    font-family: "Unbounded", sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
    z-index: 50;
    animation: rise 0.2s ease;
}

.tabbar {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: #fff;
    border-top: var(--border);
    border-left: var(--border);
    border-right: var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 30;
}

.tab {
    position: relative;
    background: #fff;
    border: none;
    border-right: 3px solid #000;
    padding: 10px 4px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: #000;
}

.tab:last-child { border-right: none; }
.tab svg { width: 20px; height: 20px; }
.tab span {
    font-family: "Manrope", sans-serif;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: none;
}

.tab.is-on {
    background: var(--accent);
    color: #fff;
}

.dot {
    position: absolute;
    top: 8px;
    right: 18px;
    width: 8px;
    height: 8px;
    background: var(--alert);
    border: 2px solid #000;
}

.note {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 8px;
}

@media (max-width: 520px) {
    .app, .tabbar {
        max-width: none;
        border-left: none;
        border-right: none;
    }
    .tabbar { left: 0; transform: none; }
}

@media (min-width: 900px) {
    body {
        background-image: radial-gradient(#ccc 1px, transparent 1px);
        background-size: 20px 20px;
    }
}
