:root {
	--bg: #050d1a;
	--bg-2: #0b1830;
	--card: rgba(8, 16, 30, 0.88);
	--card-border: rgba(148, 163, 184, 0.2);
	--text: #eef2ff;
	--muted: #a6b4cf;
	--accent: #7dd3fc;
	--accent-strong: #38bdf8;
	--accent-pop: #d946ef;
	--success: #34d399;
	--danger: #fb7185;
	--warning: #fbbf24;
	--shadow: 0 24px 64px rgba(1, 7, 20, 0.5);
}

* {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
	min-height: 100%;
	background: #050d1a;
}

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	color: var(--text);
	background:
		radial-gradient(circle at top left, rgba(56, 189, 248, 0.28), transparent 35%),
		radial-gradient(circle at 80% 0%, rgba(217, 70, 239, 0.16), transparent 32%),
		linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
	font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	overscroll-behavior-y: none;
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	opacity: 0.16;
	background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
	background-size: 28px 28px;
}

.page-shell {
	position: relative;
	z-index: 1;
}

.topbar {
	position: relative;
	z-index: 20;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	padding: 14px 20px;
	backdrop-filter: blur(18px);
	background: linear-gradient(180deg, rgba(4, 10, 20, 0.92), rgba(4, 10, 20, 0.72));
	border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.brand-block {
	display: grid;
	gap: 4px;
}

.brand {
	color: var(--text);
	text-decoration: none;
	font-size: 1.12rem;
	font-weight: 800;
	letter-spacing: 0.01em;
}

.brand-tag {
	color: var(--muted);
	font-size: 0.86rem;
}

.nav-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	flex-wrap: wrap;
}

.nav-link,
.nav-button,
.login-inline button {
	border: 1px solid transparent;
	border-radius: 999px;
	padding: 10px 14px;
	font-size: 0.95rem;
	font-weight: 700;
	text-decoration: none;
	transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.nav-link {
	color: var(--text);
	background: rgba(255, 255, 255, 0.06);
	border-color: rgba(255, 255, 255, 0.12);
}

.nav-button,
.login-inline button {
	color: #05111f;
	background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 70%, var(--accent-pop) 130%);
}

.nav-button.ghost {
	color: var(--text);
	background: rgba(255, 255, 255, 0.06);
	border-color: rgba(255, 255, 255, 0.08);
}

.nav-button.logout-danger {
	color: #fff;
	background: linear-gradient(135deg, #ef4444 0%, #be123c 100%);
	border-color: rgba(255, 255, 255, 0.16);
}

.nav-link:hover,
.nav-button:hover,
.login-inline button:hover {
	transform: translateY(-1px);
	box-shadow: 0 8px 18px rgba(56, 189, 248, 0.24);
}

.login-inline {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.login-inline input {
	min-width: 132px;
	border-radius: 999px;
	border: 1px solid rgba(148, 163, 184, 0.22);
	background: rgba(15, 23, 42, 0.88);
	color: var(--text);
	padding: 10px 12px;
	font: inherit;
}

.login-inline input::placeholder {
	color: #7f8ea9;
}

.container {
	max-width: 1080px;
	margin: 0 auto;
	padding: 20px 16px;
	display: grid;
	gap: 18px;
}

.card {
	background: var(--card);
	border: 1px solid var(--card-border);
	border-radius: 20px;
	padding: 20px;
	box-shadow: var(--shadow);
	backdrop-filter: blur(10px);
}

.card:hover {
	border-color: rgba(148, 163, 184, 0.28);
}

.hero-card {
	display: grid;
	gap: 10px;
	background:
		linear-gradient(160deg, rgba(125, 211, 252, 0.11), rgba(217, 70, 239, 0.08) 50%, rgba(8, 16, 30, 0.94));
}

.hero-copy h1,
.section-head h2 {
	margin: 0;
	line-height: 1.1;
}

.hero-copy h1 {
	font-size: clamp(1.8rem, 5vw, 3rem);
	max-width: 14ch;
}

.eyebrow {
	margin: 0 0 8px;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	font-size: 0.72rem;
	font-weight: 800;
	color: var(--accent);
}

.subtext,
.section-note,
.hint,
.empty-state p,
.message,
.notice {
	color: var(--muted);
}

.hero-badges {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	border-radius: 999px;
	border: 1px solid rgba(148, 163, 184, 0.16);
	background: rgba(255, 255, 255, 0.04);
	color: #d7e3f5;
	font-size: 0.92rem;
}

.section-head {
	display: flex;
	justify-content: space-between;
	align-items: end;
	gap: 16px;
	margin-bottom: 16px;
}

.section-head h2 {
	font-size: clamp(1.25rem, 3vw, 1.7rem);
	font-weight: 800;
}

.section-note {
	margin: 0;
	max-width: 26ch;
	font-size: 0.92rem;
}

.notice {
	margin-top: -4px;
}

.notice.error,
.message.error {
	color: var(--danger);
}

.notice.warn,
.message.warn {
	color: var(--warning);
}

.journal-form {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
}

.journal-form label {
	display: grid;
	gap: 8px;
	font-size: 0.92rem;
	color: #d8e4f4;
}

.journal-form input,
.journal-form textarea {
	width: 100%;
	border-radius: 16px;
	border: 1px solid rgba(148, 163, 184, 0.24);
	background: rgba(8, 15, 28, 0.92);
	color: var(--text);
	padding: 12px 14px;
	font: inherit;
}

.journal-form input:focus,
.journal-form textarea:focus,
.login-inline input:focus {
	outline: none;
	border-color: rgba(125, 211, 252, 0.7);
	box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.16);
}

.journal-form input[readonly] {
	cursor: default;
	color: #c7d2fe;
}

.journal-form textarea {
	min-height: 128px;
	resize: vertical;
}

.note-field,
.form-actions,
.empty-state,
.message {
	grid-column: 1 / -1;
}

.form-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}

.form-actions button {
	border: 0;
	border-radius: 999px;
	padding: 12px 18px;
	font: inherit;
	font-weight: 800;
	color: #05111f;
	background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 65%, var(--accent-pop) 130%);
	box-shadow: 0 10px 24px rgba(56, 189, 248, 0.26);
}

.message {
	min-height: 1.2em;
	margin-bottom: 14px;
	font-size: 0.92rem;
}

.empty-state {
	padding: 8px 0 0;
}

.chart-card {
	overflow: hidden;
}

.chart-wrap {
	position: relative;
	min-height: 320px;
}

.chart-wrap canvas {
	width: 100% !important;
	height: 320px !important;
}

.journal-list {
	display: grid;
	gap: 12px;
}

.entry {
	padding: 16px;
	border-radius: 18px;
	border: 1px solid rgba(148, 163, 184, 0.14);
	background: rgba(255, 255, 255, 0.03);
}

.entry-post {
	padding: 0;
	overflow: hidden;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
}

.post-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	padding: 14px 14px 10px;
	border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.post-user {
	display: flex;
	align-items: center;
	gap: 10px;
}

.post-avatar {
	width: 34px;
	height: 34px;
	display: grid;
	place-items: center;
	border-radius: 999px;
	font-size: 0.9rem;
	font-weight: 800;
	color: #fdf4ff;
	background: linear-gradient(135deg, #d946ef, #7e22ce);
}

.post-name {
	font-size: 0.95rem;
	font-weight: 800;
	line-height: 1;
}

.post-note {
	padding: 14px;
	font-size: 0.98rem;
	line-height: 1.5;
	white-space: normal;
	word-break: break-word;
}

.entry-photo-trigger {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	margin: 0;
	background: transparent;
	cursor: zoom-in;
}

.entry-top {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	flex-wrap: wrap;
}

.entry-meta {
	color: var(--muted);
	font-size: 0.88rem;
}

.entry-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 12px;
	margin-top: 12px;
}

.entry-photo {
	width: 100%;
	display: block;
	max-height: 460px;
	object-fit: cover;
	border-top: 1px solid rgba(148, 163, 184, 0.12);
	border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.post-stats {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	padding: 12px 14px 14px;
}

.post-actions {
	display: flex;
	gap: 10px;
	padding: 0 14px 14px;
	flex-wrap: wrap;
}

.post-action {
	border: 1px solid rgba(148, 163, 184, 0.2);
	background: rgba(15, 23, 42, 0.8);
	color: var(--text);
	border-radius: 12px;
	padding: 10px 14px;
	font: inherit;
	font-size: 0.88rem;
	font-weight: 700;
	cursor: pointer;
}

.post-action.post-delete {
	border-color: rgba(239, 68, 68, 0.4);
	color: #fecaca;
	background: rgba(127, 29, 29, 0.26);
}

.post-action.post-edit {
	border-color: rgba(56, 189, 248, 0.35);
	color: #bae6fd;
}

.stat-pill {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	padding: 8px 10px;
	border-radius: 999px;
	font-size: 0.84rem;
	color: #dbe7ff;
	background: rgba(15, 23, 42, 0.88);
	border: 1px solid rgba(148, 163, 184, 0.16);
}

.photo-modal {
	position: fixed;
	inset: 0;
	z-index: 90;
	background: rgba(3, 7, 18, 0.92);
	display: grid;
	grid-template-rows: auto 1fr auto;
	gap: 10px;
	padding: 16px;
}

.photo-modal[hidden] {
	display: none;
}

.photo-close {
	justify-self: end;
	border: 1px solid rgba(255, 255, 255, 0.2);
	background: rgba(0, 0, 0, 0.35);
	color: #fff;
	border-radius: 999px;
	padding: 9px 14px;
	font: inherit;
	cursor: pointer;
}

.photo-full {
	max-width: min(1080px, 100%);
	max-height: 74vh;
	width: auto;
	height: auto;
	justify-self: center;
	align-self: center;
	border-radius: 14px;
	border: 1px solid rgba(148, 163, 184, 0.2);
	box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.photo-caption {
	text-align: center;
	color: #c8d3ea;
	font-size: 0.9rem;
}

body.modal-open {
	overflow: hidden;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 840px) {
	.topbar {
		align-items: stretch;
		flex-direction: column;
		gap: 10px;
	}

	.nav-actions {
		justify-content: flex-start;
		align-items: stretch;
	}

	.section-head {
		align-items: start;
		flex-direction: column;
	}

	.journal-form {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 560px) {
	body {
		font-size: 15px;
	}

	.topbar,
	.container {
		padding-left: 14px;
		padding-right: 14px;
	}

	.brand-tag,
	.section-note {
		font-size: 0.82rem;
	}

	.nav-actions {
		width: 100%;
	}

	.nav-link,
	.nav-button {
		min-height: 44px;
	}

	.card {
		padding: 16px;
		border-radius: 16px;
	}

	.login-inline {
		width: 100%;
	}

	.login-inline input {
		flex: 1 1 100%;
		min-width: 0;
		width: 100%;
		min-height: 44px;
	}

	.login-inline button,
	.nav-link,
	.nav-button {
		width: 100%;
		text-align: center;
		min-height: 44px;
	}

	.hero-copy h1 {
		max-width: none;
		font-size: clamp(1.7rem, 9vw, 2.2rem);
	}

	.hero-badges,
	.entry-grid {
		gap: 10px;
	}

	.post-head,
	.post-note,
	.post-stats,
	.post-actions {
		padding-left: 12px;
		padding-right: 12px;
	}

	.entry-photo {
		max-height: 340px;
	}

	.stat-pill {
		font-size: 0.8rem;
	}

	.post-actions {
		align-items: stretch;
	}

	.post-action {
		width: 100%;
		min-height: 44px;
	}

	.chart-wrap,
	.chart-wrap canvas {
		height: 260px !important;
		min-height: 260px;
	}

	.form-actions {
		align-items: stretch;
	}

	.form-actions button {
		width: 100%;
	}

	.photo-modal {
		padding: 10px;
	}

	.photo-full {
		max-height: 72vh;
	}
}
