:root {
	--bg: #1a1a2e;
	--bg-card: #16213e;
	--bg-card-hover: #1a2744;
	--text: #e8e8e8;
	--text-dim: #8a8a9a;
	--accent: #e94560;
	--accent-dim: #c81e45;
	--radius: 16px;
	--radius-sm: 8px;
	--max-width: 480px;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html,
body {
	height: 100%;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family:
		-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
		sans-serif;
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
}

#app {
	min-height: 100%;
}

a {
	color: var(--accent);
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}

/* --- Loading screen --- */

.loading-screen {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100vh;
	gap: 16px;
}

.loading-screen__spinner {
	width: 40px;
	height: 40px;
	border: 3px solid var(--bg-card);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

.loading-screen__text {
	font-size: 1.5rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	color: var(--text-dim);
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* --- App shell / layout --- */

.app-shell {
	min-height: 100%;
}
.app-main {
	max-width: var(--max-width);
	margin: 0 auto;
	padding: 24px 20px;
	padding-top: max(24px, env(safe-area-inset-top));
	padding-bottom: max(24px, env(safe-area-inset-bottom));
}

/* --- Home page --- */

.home {
	display: flex;
	flex-direction: column;
	gap: 24px;
	min-height: 100vh;
}

.home-header {
	padding-top: 16px;
}

/* Polaroid-style logo block */
.home-polaroid {
	background: #f5f0e6;
	padding: 24px 24px 32px;
	border-radius: 4px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	text-align: center;
}

.home-title {
	font-size: 2.5rem;
	font-weight: 800;
	letter-spacing: -0.02em;
	color: #1a1a2e;
}

.home-tagline {
	font-size: 0.85rem;
	color: #6a6a7a;
	margin-top: 4px;
}

/* 2×2 goal grid: Daily (top-left), Weekly (top-right), Random (full-width bottom) */

.goal-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	flex: 1;
	align-content: center;
}

.goal-tile {
	display: flex;
	flex-direction: column;
	background: var(--bg-card);
	border-radius: var(--radius);
	padding: 20px;
	text-decoration: none;
	color: var(--text);
	min-height: 160px;
	transition:
		background 0.2s,
		transform 0.1s;
}

.goal-tile:active {
	transform: scale(0.98);
}
.goal-tile:hover {
	background: var(--bg-card-hover);
	text-decoration: none;
}

/* Random tile spans both columns */
.goal-tile--wide {
	grid-column: 1 / -1;
}

.goal-tile__header {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
}

.goal-tile__icon {
	font-size: 1.3rem;
}

.goal-tile__title {
	font-size: 1rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--text-dim);
}

.goal-tile__body {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	flex: 1;
	gap: 10px;
}

.goal-tile__text {
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.4;
}

.goal-tile--random .goal-tile__text {
	font-size: 1.15rem;
}

.goal-tile__text--empty {
	font-weight: 400;
	color: var(--text-dim);
	font-style: italic;
}

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

.goal-tile__category {
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--accent);
	font-weight: 600;
}

.goal-tile__difficulty {
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--text-dim);
}

.home-footer {
	text-align: center;
	padding-bottom: 12px;
}

.home-footer a {
	font-size: 0.875rem;
	color: var(--text-dim);
}

/* --- Mode pages --- */

.mode-page {
	display: flex;
	flex-direction: column;
	gap: 20px;
	min-height: 100vh;
}

.back-link {
	font-size: 0.9rem;
	color: var(--text-dim);
	align-self: flex-start;
}

.mode-page__title {
	font-size: 1.5rem;
	font-weight: 700;
}

/* --- Goal view (shared) --- */

.goal-view {
	display: flex;
	flex-direction: column;
	gap: 24px;
	flex: 1;
	justify-content: center;
}

.goal-card {
	background: var(--bg-card);
	border-radius: var(--radius);
	padding: 32px 24px;
	text-align: center;
}

.goal-card__meta {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-bottom: 20px;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.goal-card__category {
	color: var(--accent);
	font-weight: 600;
}

.goal-card__difficulty {
	color: var(--text-dim);
}

.goal-card__text {
	font-size: 1.4rem;
	font-weight: 600;
	line-height: 1.4;
}

.goal-card__tags {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	margin-top: 16px;
}

.tag {
	font-size: 0.7rem;
	color: var(--text-dim);
	background: rgba(255, 255, 255, 0.06);
	padding: 2px 8px;
	border-radius: 20px;
}

.goal-empty {
	text-align: center;
}
.goal-empty__text {
	color: var(--text-dim);
	margin-bottom: 16px;
}

/* --- Buttons --- */

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

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 14px 24px;
	border-radius: var(--radius-sm);
	border: none;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	transition:
		opacity 0.2s,
		transform 0.1s;
}

.btn:active {
	transform: scale(0.98);
}
.btn:disabled {
	opacity: 0.5;
	cursor: default;
}

.btn--reroll {
	background: transparent;
	color: var(--text);
	border: 1px solid var(--bg-card);
}

.btn--capture {
	background: var(--accent);
	color: #fff;
}

.btn--capture input {
	display: none;
}

.btn--primary {
	background: var(--accent);
	color: #fff;
}

/* --- Goal hint / About link --- */

.goal-hint {
	text-align: center;
}
.goal-hint a {
	font-size: 0.85rem;
	color: var(--text-dim);
}

/* --- About page --- */

.about-page {
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-height: 100vh;
}

.about-page h1 {
	font-size: 1.75rem;
	font-weight: 700;
}
.about-page h2 {
	font-size: 1.1rem;
	font-weight: 600;
	margin-top: 8px;
	color: var(--accent);
}
.about-page p {
	color: var(--text);
}
.about-page ul {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.about-page li {
	padding-left: 20px;
	position: relative;
	color: var(--text-dim);
}
.about-page li::before {
	content: "✕";
	position: absolute;
	left: 0;
	color: var(--accent);
	font-weight: 700;
}
.about-footer {
	margin-top: auto;
	padding-top: 24px;
	text-align: center;
	color: var(--text-dim);
	font-size: 0.85rem;
}

/* --- Not found --- */

.not-found {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	min-height: 100vh;
	text-align: center;
}

.not-found h1 {
	font-size: 1.5rem;
}
.not-found p {
	color: var(--text-dim);
}

/* --- Blazor error UI --- */

#blazor-error-ui {
	display: none;
	background: var(--accent);
	color: #fff;
	padding: 12px 20px;
	border-radius: var(--radius-sm);
	margin: 16px;
	font-size: 0.85rem;
}

#blazor-error-ui .reload {
	color: #fff;
	text-decoration: underline;
}
#blazor-error-ui .dismiss {
	cursor: pointer;
	margin-left: 12px;
}
