/* Update your App Shell CSS */
header {
	padding-top: env(safe-area-inset-top);
	/* Keeps the title out of the camera notch */
	height: calc(60px + env(safe-area-inset-top));
}

#bottom-nav {
	padding-bottom: env(safe-area-inset-bottom);
	/* Lifts buttons above the home bar */
}

/* Stop the "Webby" bounce */
body {
	overscroll-behavior-y: none;
	position: fixed;
	width: 100%;
	height: 100%;
}



:root {
	--bg: #0f0f11;
	--bg2: #1a1a1e;
	--bg3: #242428;
	--bg4: #2e2e34;
	--border: rgba(255, 255, 255, 0.07);
	--border2: rgba(255, 255, 255, 0.13);
	--text: #e8e8ea;
	--text2: #8a8a8f;
	--text3: #5a5a60;
	--accent: #7c6df8;
	--green: #3cba82;
	--amber: #f59e0b;
	--red: #ef4444;
	--r: 10px;
	--rlg: 16px;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	font-family: 'SF Mono', 'Fira Code', monospace;
	background: var(--bg);
	color: var(--text);
	min-height: 100vh;
	display: grid;
	grid-template-rows: 60px 1fr;
}

/* ── NAV ── */
nav {
	background: var(--bg2);
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	padding: 0 2rem;
	gap: 0.5rem;
	position: sticky;
	top: 0;
	z-index: 100;
}

.nav-brand {
	font-size: 13px;
	font-weight: 700;
	color: var(--accent);
	letter-spacing: 0.1em;
	margin-right: 1.25rem;
	text-decoration: none;
}

nav a,
nav button {
	background: none;
	border: none;
	font-family: inherit;
	font-size: 13px;
	color: var(--text2);
	cursor: pointer;
	padding: 6px 14px;
	border-radius: var(--r);
	transition: background 0.1s, color 0.1s;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
}

nav a:hover,
nav button:hover {
	background: var(--bg3);
	color: var(--text);
}

nav a.active,
nav button.active {
	background: rgba(124, 109, 248, 0.12);
	color: var(--text);
}

.nav-spacer {
	flex: 1;
}

/* ── LOADER ── */
#app-loader {
	position: fixed;
	top: 60px;
	left: 0;
	right: 0;
	height: 2px;
	background: transparent;
	z-index: 200;
	pointer-events: none;
}

#app-loader::after {
	content: '';
	position: absolute;
	left: -60%;
	width: 60%;
	height: 100%;
	background: var(--accent);
	border-radius: 2px;
}

#app-loader.active::after {
	animation: load-bar 0.7s ease-in-out infinite;
}

@keyframes load-bar {
	0% {
		left: -60%;
	}

	100% {
		left: 110%;
	}
}

/* ── MAIN ── */
#app-main {
	padding: 2rem;
	max-width: 860px;
	width: 100%;
	margin: 0 auto;
	overflow-y: auto;
	height: 100%;
}

/* ── PAGE TITLE ── */
.page-title {
	font-size: 16px;
	font-weight: 700;
	color: var(--text);
	letter-spacing: 0.04em;
	margin-bottom: 1.5rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid var(--border);
}

/* ── POST CARD ── */
.post-card {
	background: var(--bg2);
	border: 1px solid var(--border);
	border-radius: var(--rlg);
	margin-bottom: 1.25rem;
	overflow: hidden;
}

.post-header {
	padding: 1.25rem 1.25rem 0.75rem;
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.post-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	flex-shrink: 0;
	background: rgba(124, 109, 248, 0.18);
	border: 1px solid rgba(124, 109, 248, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 700;
	color: var(--accent);
}

.post-meta {
	flex: 1;
}

.post-author {
	font-size: 14px;
	font-weight: 600;
	color: var(--text);
}

.post-time {
	font-size: 12px;
	color: var(--text3);
	margin-top: 2px;
}

.post-body {
	padding: 0 1.25rem 1rem;
	font-size: 14px;
	color: var(--text2);
	line-height: 1.75;
}

.post-actions {
	padding: 0.6rem 1.25rem;
	border-top: 1px solid var(--border);
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

/* ── BUTTONS ── */
.btn-ghost-sm {
	background: none;
	border: 1px solid var(--border2);
	border-radius: 6px;
	font-family: inherit;
	font-size: 12px;
	color: var(--text2);
	padding: 4px 10px;
	cursor: pointer;
	transition: background 0.1s, color 0.1s;
}

.btn-ghost-sm:hover {
	background: var(--bg3);
	color: var(--text);
}

.btn-ghost-sm.liked {
	color: var(--red);
	border-color: rgba(239, 68, 68, 0.3);
}

/* ── LINK BUTTON ── */
/* A button that looks and behaves like a plain text link */
.link-btn {
	appearance: none;
	-webkit-appearance: none;
	background: none;
	border: none;
	outline: none;
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	color: var(--text);
	cursor: pointer;
	padding: 0;
	margin: 0;
	display: inline;
	text-decoration: none;
	transition: color 0.1s;
}

.link-btn:hover {
	color: var(--accent);
}

/* ── COMMENT SECTION ── */
.comment-section {
	border-top: 1px solid var(--border);
	background: var(--bg3);
}

.js-toggle-comments {
	width: 100%;
	background: none;
	border: none;
	font-family: inherit;
	font-size: 12px;
	color: var(--text3);
	cursor: pointer;
	padding: 0.65rem 1.25rem;
	text-align: left;
	transition: color 0.1s, background 0.1s;
}

.js-toggle-comments:hover {
	background: var(--bg4);
	color: var(--text2);
}

.comment-list {
	padding: 0 0 0.25rem;
}

.comment-loading {
	padding: 0.75rem 1.25rem;
	font-size: 12px;
	color: var(--text3);
	animation: blink 0.8s ease-in-out infinite;
}

@keyframes blink {

	0%,
	100% {
		opacity: 0.4;
	}

	50% {
		opacity: 1;
	}
}

/* ── COMMENT ITEM ── */
.comment-item {
	padding: 0.75rem 1.25rem;
	border-bottom: 1px solid var(--border);
}

.comment-item:last-child {
	border-bottom: none;
}

.comment-meta {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 5px;
}

.comment-author {
	font-size: 13px;
	font-weight: 600;
	color: var(--text);
}

.comment-time {
	font-size: 11px;
	color: var(--text3);
}

.comment-body {
	font-size: 13px;
	color: var(--text2);
	line-height: 1.65;
	margin-bottom: 8px;
}

.comment-actions {
	display: flex;
	gap: 6px;
}

/* ── NEW COMMENT ROW ── */
.new-comment-row {
	display: flex;
	gap: 8px;
	padding: 0.75rem 1.25rem;
	border-top: 1px solid var(--border);
}

.js-comment-input {
	flex: 1;
	background: var(--bg2);
	border: 1px solid var(--border2);
	border-radius: var(--r);
	color: var(--text);
	padding: 0.45rem 0.75rem;
	font-size: 13px;
	font-family: inherit;
	outline: none;
	transition: border-color 0.15s;
}

.js-comment-input:focus {
	border-color: var(--accent);
}

.js-comment-input::placeholder {
	color: var(--text3);
}

.js-submit-comment {
	background: var(--accent);
	border: none;
	color: #fff;
	padding: 0.45rem 1rem;
	border-radius: var(--r);
	font-size: 13px;
	font-family: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.1s;
}

.js-submit-comment:hover {
	opacity: 0.85;
}

/* ── NEW POST FORM ── */
.new-post-form {
	background: var(--bg2);
	border: 1px solid var(--border);
	border-radius: var(--rlg);
	margin-bottom: 1.25rem;
	overflow: hidden;
}

.new-post-bar {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.85rem 1.25rem;
}

.new-post-toggle {
	background: rgba(124, 109, 248, 0.1);
	border: 1px solid rgba(124, 109, 248, 0.25);
	border-radius: var(--r);
	font-family: inherit;
	font-size: 13px;
	color: var(--accent);
	cursor: pointer;
	padding: 5px 14px;
	transition: background 0.1s;
}

.new-post-toggle:hover {
	background: rgba(124, 109, 248, 0.2);
}

.dirty-dot {
	font-size: 12px;
	color: var(--amber);
	font-weight: 600;
	animation: blink 1.2s ease-in-out infinite;
}

.new-post-body {
	flex-direction: column;
	gap: 0.75rem;
	padding: 0 1.25rem 1.25rem;
	border-top: 1px solid var(--border);
	padding-top: 1rem;
}

.post-title-input {
	background: var(--bg3);
	border: 1px solid var(--border2);
	border-radius: var(--r);
	color: var(--text);
	padding: 0.6rem 0.875rem;
	font-size: 15px;
	font-family: inherit;
	font-weight: 600;
	outline: none;
	transition: border-color 0.15s;
	width: 100%;
}

.post-title-input:focus {
	border-color: var(--accent);
}

.post-title-input::placeholder {
	color: var(--text3);
	font-weight: 400;
}

.post-body-input {
	background: var(--bg3);
	border: 1px solid var(--border2);
	border-radius: var(--r);
	color: var(--text);
	padding: 0.6rem 0.875rem;
	font-size: 14px;
	font-family: inherit;
	outline: none;
	resize: vertical;
	transition: border-color 0.15s;
	width: 100%;
	line-height: 1.65;
}

.post-body-input:focus {
	border-color: var(--accent);
}

.post-body-input::placeholder {
	color: var(--text3);
}

.form-row {
	display: flex;
	gap: 0.5rem;
}

.btn-submit {
	background: var(--accent);
	border: none;
	color: #fff;
	padding: 0.5rem 1.25rem;
	border-radius: var(--r);
	font-size: 13px;
	font-family: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.1s;
}

.btn-submit:hover {
	opacity: 0.85;
}

.btn-discard {
	background: none;
	border: 1px solid var(--border2);
	color: var(--text3);
	padding: 0.5rem 1.25rem;
	border-radius: var(--r);
	font-size: 13px;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.1s, color 0.1s;
}

.btn-discard:hover {
	background: var(--bg3);
	color: var(--text2);
}

/* ── ERROR STATE ── */
.error-state {
	padding: 2rem;
	color: var(--red);
	font-size: 15px;
}


.login-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: calc(100vh - 48px - 3rem - 50px);
}

.login-card {
	background: var(--bg2);
	border: 1px solid var(--border2);
	border-radius: var(--rlg);
	padding: 2rem;
	width: 100%;
	max-width: 320px;
}

.login-header {
	margin-bottom: 1.75rem;
	text-align: center;
}

.login-brand {
	font-size: 14px;
	font-weight: 700;
	color: var(--accent);
	letter-spacing: 0.1em;
}

.login-sub {
	font-size: 10px;
	color: var(--text3);
	margin-top: 6px;
	letter-spacing: 0.05em;
}

.login-error {
	background: rgba(239, 68, 68, 0.08);
	border: 1px solid rgba(239, 68, 68, 0.25);
	border-radius: var(--r);
	color: var(--red);
	font-size: 11px;
	padding: 0.5rem 0.75rem;
	margin-bottom: 1rem;
}

.login-fields {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.field-group {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.field-label {
	font-size: 9px;
	font-weight: 700;
	color: var(--text3);
	letter-spacing: 0.1em;
}

.field-input {
	background: var(--bg3);
	border: 1px solid var(--border2);
	border-radius: var(--r);
	color: var(--text);
	padding: 0.5rem 0.75rem;
	font-size: 12px;
	font-family: inherit;
	outline: none;
	transition: border-color 0.15s;
	width: 100%;
}

.field-input:focus {
	border-color: var(--accent);
}

.field-input::placeholder {
	color: var(--text3);
}

.btn-login {
	margin-top: 0.5rem;
	width: 100%;
	background: var(--accent);
	border: none;
	color: #fff;
	padding: 0.55rem 1rem;
	border-radius: var(--r);
	font-size: 11px;
	font-family: inherit;
	font-weight: 700;
	letter-spacing: 0.06em;
	cursor: pointer;
	transition: opacity 0.1s;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
}

.btn-login:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.btn-login:not(:disabled):hover {
	opacity: 0.85;
}

.btn-spinner {
	animation: blink 0.6s ease-in-out infinite;
	letter-spacing: 0.15em;
}

.profile-card {
	background: var(--bg2);
	border: 1px solid var(--border);
	border-radius: var(--rlg);
	padding: 1.5rem;
	margin-bottom: 1.5rem;
}

.profile-header {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1rem;
}

.profile-avatar {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	flex-shrink: 0;
	background: rgba(124, 109, 248, 0.18);
	border: 1px solid rgba(124, 109, 248, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	font-weight: 700;
	color: var(--accent);
}

.profile-info {
	flex: 1;
}

.profile-username {
	font-size: 16px;
	font-weight: 700;
	color: var(--text);
}

.profile-joined {
	font-size: 11px;
	color: var(--text3);
	margin-top: 3px;
}

.profile-edit-btn {
	margin-left: auto;
	flex-shrink: 0;
}

.profile-bio {
	font-size: 13px;
	color: var(--text2);
	line-height: 1.65;
	margin-bottom: 1.25rem;
	min-height: 1.2em;
}

.profile-edit-form {
	flex-direction: column;
	gap: 0.75rem;
	margin-bottom: 1.25rem;
}

.profile-bio-input {
	background: var(--bg3);
	border: 1px solid var(--border2);
	border-radius: var(--r);
	color: var(--text);
	padding: 0.6rem 0.875rem;
	font-size: 13px;
	font-family: inherit;
	outline: none;
	resize: vertical;
	width: 100%;
	line-height: 1.65;
	transition: border-color 0.15s;
}

.profile-bio-input:focus {
	border-color: var(--accent);
}

.profile-stats {
	display: flex;
	gap: 1.5rem;
	border-top: 1px solid var(--border);
	padding-top: 1rem;
}

.profile-stat {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
}

.profile-stat-value {
	font-size: 18px;
	font-weight: 700;
	color: var(--text);
}

.profile-stat-label {
	font-size: 10px;
	color: var(--text3);
	letter-spacing: 0.05em;
}

.profile-posts-title {
	font-size: 12px;
	font-weight: 700;
	color: var(--text3);
	letter-spacing: 0.08em;
	margin-bottom: 1rem;
	text-transform: uppercase;
}

.profile-empty {
	font-size: 13px;
	color: var(--text3);
	padding: 1rem 0;
}

.link-btn {
	background: none;
	border: none;
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	color: var(--text);
	cursor: pointer;
	padding: 0;
	transition: color 0.1s;
}

.link-btn:hover {
	color: var(--accent);
}