:root {
    --background-color: #FFF9EE;
    --surface: rgba(255, 252, 247, 0.92);
    --text-color: #243028;
    --muted: #4E5A53;
    --button-color: #355A40;
    --button-hover-color: #2C4C37;
    --sage: #4F7C5B;
    --sage-soft: #E6F1E8;
    --line: rgba(36, 48, 40, 0.1);
    --shadow: 0 16px 40px rgba(70, 60, 40, 0.07);
    --radius: 24px;
    --font-family: "Outfit", "Segoe UI", sans-serif;
    --display: "Fraunces", Georgia, serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    color: var(--text-color);
    font-family: var(--font-family);
    line-height: 1.5;
    background-color: var(--background-color);
    background-image:
        radial-gradient(900px 420px at -10% -20%, rgba(79, 124, 91, 0.16), transparent 60%),
        radial-gradient(700px 380px at 110% -10%, rgba(232, 214, 184, 0.65), transparent 55%);
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: #d5e8d8;
}

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

h1,
h2,
h3,
p {
    margin: 0;
}

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

button,
input,
textarea {
    font-family: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 249, 238, 0.88);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(36, 48, 40, 0.06);
}

.topbar-inner {
    width: min(1180px, calc(100% - 28px));
    margin: 0 auto;
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
    text-decoration: none;
}

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

.topnav {
    display: none;
    align-items: center;
    gap: 4px;
}

.nav-link,
.settings-link {
    text-decoration: none;
    color: #3d4a43;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 999px;
}

.nav-link.is-active,
.settings-link.is-active,
.nav-link:hover,
.settings-link:hover {
    background: var(--sage-soft);
    color: var(--button-color);
}

.topbar-end {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.who {
    display: none;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: var(--button-color);
}

.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    justify-content: space-around;
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 252, 248, 0.96);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(36, 48, 40, 0.08);
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 48px;
    text-decoration: none;
    color: #5c675f;
    font-size: 0.72rem;
    font-weight: 600;
}

.tab svg {
    width: 22px;
    height: 22px;
}

.tab.is-active {
    color: var(--button-color);
}

.page-app {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

.wrap {
    width: min(1180px, calc(100% - 28px));
    margin: 22px auto 28px;
}

.narrow {
    width: min(760px, calc(100% - 28px));
}

.card {
    background: var(--surface);
    border: 1px solid rgba(36, 48, 40, 0.06);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.landing-main {
    width: min(1120px, calc(100% - 32px));
    margin: 28px auto 56px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.eyebrow {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    color: var(--button-color);
    background: var(--sage-soft);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 6px 12px;
    border-radius: 999px;
}

.landing-copy h1 {
    margin-top: 14px;
    font-family: var(--display);
    font-weight: 560;
    font-size: clamp(4.2rem, 12vw, 7.6rem);
    line-height: 0.88;
    letter-spacing: -0.05em;
}

.lede {
    margin-top: 16px;
    max-width: 36ch;
    color: #3d4a43;
    font-size: 1.15rem;
    line-height: 1.5;
}

.landing-card {
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.landing-card h2,
.page-title,
.section-title,
.greeting,
.profile-name,
.quote,
.auth-card h1,
.danger-note h2,
.panel-intro h2 {
    font-family: var(--display);
    font-weight: 560;
    letter-spacing: -0.03em;
}

.landing-card h2 {
    font-size: clamp(1.8rem, 3vw, 2.3rem);
    line-height: 1.2;
}

.landing-card .lede {
    margin-top: 0;
}

.landing-actions,
.form-actions,
.action-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-shell {
    width: min(460px, calc(100% - 32px));
    margin: 36px auto 56px;
}

.auth-card {
    padding: 28px 22px 24px;
}

.auth-card h1 {
    font-size: 2.4rem;
    line-height: 1.05;
}

.auth-card .lede {
    margin: 8px 0 18px;
    font-size: 1rem;
}

.auth-switch {
    margin-top: 16px;
    text-align: center;
}

.auth-switch a {
    font-weight: 700;
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 0;
    padding: 0;
    margin: 0;
    min-inline-size: 0;
}

.field label,
.field legend,
.checkline {
    font-size: 0.92rem;
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="email"],
textarea {
    width: 100%;
    border: 1px solid rgba(36, 48, 40, 0.14);
    background: #fff;
    border-radius: 14px;
    padding: 14px 16px;
    color: inherit;
    font: inherit;
    font-size: 1rem;
}

textarea {
    min-height: 150px;
    resize: vertical;
    line-height: 1.5;
}

input[type="file"] {
    width: 100%;
    font-size: 0.95rem;
    padding: 12px;
    background: #fff;
    border-radius: 14px;
    border: 1px dashed rgba(53, 90, 64, 0.35);
}

input:focus-visible,
textarea:focus-visible {
    border-color: var(--sage);
    box-shadow: 0 0 0 4px rgba(79, 124, 91, 0.16);
    outline: none;
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid rgba(79, 124, 91, 0.45);
    outline-offset: 2px;
}

.choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(36, 48, 40, 0.12);
    border-radius: 999px;
    padding: 8px 14px;
    background: #fff;
    font-weight: 600;
}

.choice:has(input:checked) {
    border-color: var(--sage);
    background: var(--sage-soft);
}

.hint,
.muted,
.quote-foot,
.post-time {
    color: var(--muted);
}

.hint {
    font-size: 0.85rem;
    font-weight: 500;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1.5px solid transparent;
    background: var(--button-color);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.btn:hover {
    background: var(--button-hover-color);
}

.btn-ghost {
    background: transparent;
    color: var(--button-color);
    border-color: rgba(53, 90, 64, 0.28);
}

.btn-ghost:hover {
    background: rgba(79, 124, 91, 0.1);
}

.btn-danger {
    background: #8d4b3c;
}

.btn-danger:hover {
    background: #733c30;
}

.btn-small {
    min-height: 40px;
    padding: 0 14px;
    font-size: 0.92rem;
}

.auth-card .btn,
.landing-actions .btn,
.form .btn {
    width: 100%;
}

.banner {
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.banner-ok {
    background: var(--sage-soft);
    color: #244833;
}

.banner-warn {
    background: #F8EFE2;
    color: #6A4A28;
}

.app-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidecard,
.quote-card,
.composer,
.settings-nav,
.settings-panel {
    padding: 18px;
}

.quote-card {
    display: none;
}

.identity {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.identity-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.identity-copy .muted {
    font-size: 0.82rem;
    line-height: 1.3;
}

.identity strong,
.post-user {
    overflow-wrap: anywhere;
}

.greeting {
    font-size: clamp(1.55rem, 2.5vw, 2.05rem);
    line-height: 1.25;
    margin-bottom: 16px;
    overflow-wrap: anywhere;
}

.section-title {
    font-size: 1.7rem;
    margin-bottom: 14px;
}

.stack,
.post-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.post-card {
    background: var(--surface);
    border: 1px solid rgba(36, 48, 40, 0.06);
    border-radius: 22px;
    padding: 18px 18px 16px;
    box-shadow: 0 10px 30px rgba(70, 60, 40, 0.05);
}

.post-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.post-user {
    display: block;
    font-size: 1rem;
}

.post-time {
    font-size: 0.82rem;
}

.post-body,
.bio {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.6;
}

.post-image {
    display: block;
    width: 100%;
    max-height: 520px;
    object-fit: cover;
    border-radius: 16px;
    margin: 4px 0 4px;
}

.post-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.inline-form {
    margin: 0;
}

.btn.is-liked {
    background: var(--sage-soft);
    color: var(--button-color);
    border-color: transparent;
}

.btn.is-liked:hover {
    background: #d7eadc;
}

.comment-count {
    margin: 0;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.92rem;
}

.discussion {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.comment-form {
    gap: 10px;
}

.comment-form textarea {
    min-height: 88px;
}

.form.comment-form .btn,
.inline-form .btn,
.post-manage .btn {
    width: auto;
}

.comments {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.comment {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.avatar-sm,
.avatar-fallback.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
}

.comment-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
}

.comment-head time {
    color: var(--muted);
    font-size: 0.8rem;
}

.comment p {
    margin: 2px 0 6px;
}

.post-manage {
    margin-top: 8px;
}

.stats {
    display: flex;
    gap: 22px;
    margin: 16px 0 0;
}

.stats div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stats dt {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.stats dd {
    margin: 0;
    font-family: var(--display);
    font-size: 1.4rem;
    color: var(--button-color);
}

.you-pill {
    display: inline-block;
    margin-left: 6px;
    background: var(--sage-soft);
    color: var(--button-color);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    vertical-align: 1px;
}

.empty {
    padding: 36px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.empty-mark {
    width: 72px;
    height: 72px;
}

.avatar,
.avatar-fallback {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}

.avatar-fallback {
    display: inline-grid;
    place-items: center;
    background: var(--button-color);
    color: #fff;
    font-family: var(--display);
    font-weight: 560;
    font-size: 1.15rem;
}

.sidecard .avatar,
.sidecard .avatar-fallback {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
}

.profile-card {
    overflow: hidden;
    padding: 0;
}

.profile-cover {
    height: 148px;
    background:
        radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.5), transparent 42%),
        linear-gradient(135deg, #cfe0d1 0%, #e7f2e8 42%, #f4ead8 100%);
}

.profile-body {
    padding: 0 22px 26px;
}

.profile-body .avatar,
.profile-body .avatar-fallback {
    width: 104px;
    height: 104px;
    margin-top: -52px;
    border: 4px solid #fff;
    box-shadow: 0 10px 24px rgba(48, 62, 50, 0.12);
    font-size: 2.4rem;
}

.profile-name {
    margin-top: 12px;
    font-size: clamp(2rem, 4vw, 2.7rem);
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.handle {
    margin-top: 4px;
    color: var(--button-color);
    font-weight: 700;
}

.bio {
    margin-top: 14px;
    max-width: 52ch;
}

.action-row {
    margin-top: 18px;
}

.page-title {
    font-size: clamp(2rem, 4vw, 2.6rem);
    margin-bottom: 16px;
}

.settings-layout {
    display: grid;
    gap: 16px;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-link {
    display: block;
}

.panel-intro h2,
.danger-note h2 {
    font-size: 1.45rem;
    margin-bottom: 8px;
}

.panel-intro p,
.danger-note p {
    color: var(--muted);
    line-height: 1.5;
}

.danger-note {
    background: #FBF6F1;
    border: 1px solid rgba(141, 75, 60, 0.18);
    border-radius: 16px;
    padding: 14px;
}

.danger-note + .form,
.profile-note {
    margin-top: 16px;
}

.checkline {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    line-height: 1.4;
}

.checkline input {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: #8d4b3c;
}

.back-row {
    margin-top: 16px;
}

.text-link {
    font-weight: 700;
}

.quote {
    font-size: 1.7rem;
    line-height: 1.2;
}

.quote-foot {
    margin-top: 12px;
}

@media (min-width: 700px) {
    .who {
        display: inline;
    }

    .auth-card {
        padding: 32px 28px 26px;
    }

    .form-actions,
    .action-row {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .form-actions .btn,
    .action-row .btn {
        width: auto;
    }
}

@media (min-width: 900px) {
    body {
        background-attachment: fixed;
    }

    .topnav {
        display: flex;
    }

    .tabbar {
        display: none;
    }

    .page-app {
        padding-bottom: 32px;
    }

    .landing-main {
        min-height: calc(100vh - 140px);
        margin-top: 0;
        margin-bottom: 40px;
        display: grid;
        grid-template-columns: 1.15fr 0.85fr;
        align-items: center;
        gap: 56px;
    }
}

@media (min-width: 980px) {
    .app-grid {
        display: grid;
        grid-template-columns: 280px minmax(0, 640px) 220px;
        justify-content: center;
        align-items: start;
        gap: 22px;
    }

    .quote-card,
    .sidecard {
        display: block;
        position: sticky;
        top: 90px;
    }
}

@media (min-width: 800px) {
    .settings-layout {
        grid-template-columns: 250px minmax(0, 1fr);
        align-items: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn {
        transition: none;
    }
}
