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

:root {
	--green: #2d6a4f;
	--green-light: #d8f3dc;
	--text: #1c1c1e;
	--muted: #6e6e73;
	--bg: #f7f7f5;
	--surface: #ffffff;
	--border: #e5e5e5;
	--radius: 12px;
}

html, body {
	height: 100%;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
	font-size: 16px;
	color: var(--text);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
}

#app {
	height: 100%;
}

.view {
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

/* Header */

.header {
	background: var(--green);
	color: white;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

.header h1 {
	font-size: 18px;
	font-weight: 600;
	flex: 1;
}

/* Buttons */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 13px 20px;
	border: none;
	border-radius: 10px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	min-height: 48px;
	font-family: inherit;
	transition: opacity 0.12s;
}

.btn:active { opacity: 0.75; }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn-primary { background: var(--green); color: white; flex: 1; }

.btn-secondary {
	background: transparent;
	color: var(--green);
	border: 2px solid var(--green);
	flex: 1;
}

.btn-ghost {
	background: rgba(255, 255, 255, 0.15);
	color: white;
	padding: 8px 12px;
	min-height: 0;
	font-size: 15px;
	border-radius: 8px;
}

.btn-ghost:active { background: rgba(255, 255, 255, 0.25); opacity: 1; }

/* Plan view */

.plan-content {
	flex: 1;
	overflow-y: auto;
	padding: 20px 16px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	max-width: 480px;
	width: 100%;
	margin: 0 auto;
	align-self: center;
}

.input-label {
	font-size: 15px;
	font-weight: 600;
	color: var(--text);
}

.btn-hints {
	display: flex;
	gap: 12px;
	margin-top: -8px;
}

.btn-hints span {
	flex: 1;
	text-align: center;
	font-size: 12px;
	color: var(--muted);
}

.empty-hint {
	text-align: center;
	color: var(--muted);
	font-size: 15px;
	line-height: 1.6;
	padding: 8px 4px;
}

.token-prompt {
	background: var(--surface);
	border-radius: var(--radius);
	padding: 16px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.token-hint {
	font-size: 15px;
	color: var(--text);
}

.token-row {
	display: flex;
	gap: 8px;
}

.token-input {
	flex: 1;
	padding: 11px 14px;
	border: 2px solid var(--border);
	border-radius: 10px;
	font-size: 16px;
	font-family: inherit;
	background: var(--bg);
	color: var(--text);
}

.token-input:focus {
	outline: none;
	border-color: var(--green);
}

.token-submit {
	flex: none;
	padding: 11px 20px;
}

.copy-link-btn {
	background: none;
	border: none;
	color: var(--muted);
	font-size: 13px;
	font-family: inherit;
	text-align: center;
	cursor: pointer;
	text-decoration: underline;
	padding: 4px;
}

.meal-input {
	width: 100%;
	padding: 14px;
	border: 2px solid var(--border);
	border-radius: var(--radius);
	font-size: 16px;
	font-family: inherit;
	resize: none;
	height: 120px;
	background: var(--surface);
	color: var(--text);
	line-height: 1.5;
}

.meal-input:focus {
	outline: none;
	border-color: var(--green);
}

.btn-row {
	display: flex;
	gap: 12px;
}

.plan-card {
	background: var(--surface);
	border-radius: var(--radius);
	padding: 16px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

.plan-card .card-label {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
	margin-bottom: 12px;
}

.plan-card ul { list-style: none; }

.plan-card li {
	border-bottom: 1px solid var(--border);
}

.plan-card li:last-child { border-bottom: none; }

.meal-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 10px 0;
	font-size: 16px;
	font-family: inherit;
	font-weight: 400;
	color: var(--text);
	background: transparent;
	border: none;
	cursor: pointer;
	text-align: left;
	-webkit-tap-highlight-color: transparent;
}

.meal-link::after {
	content: '›';
	font-size: 20px;
	color: var(--muted);
	margin-left: 8px;
	flex-shrink: 0;
}

.meal-link:active { opacity: 0.6; }

.meal-streaming {
	display: flex;
	align-items: center;
	width: 100%;
	padding: 10px 0;
	font-size: 16px;
	color: var(--muted);
}

.list-link {
	display: block;
	background: var(--green-light);
	color: var(--green);
	text-align: center;
	padding: 14px;
	border-radius: var(--radius);
	font-weight: 600;
	font-size: 16px;
	cursor: pointer;
	border: none;
	font-family: inherit;
	width: 100%;
}

.list-link:active { opacity: 0.8; }

/* Banners */

.error-banner {
	background: #fee2e2;
	color: #991b1b;
	padding: 12px 14px;
	border-radius: var(--radius);
	font-size: 15px;
}

.stale-banner {
	background: #fef3c7;
	color: #92400e;
	padding: 12px 14px;
	border-radius: var(--radius);
	font-size: 15px;
}

.loading {
	text-align: center;
	color: var(--muted);
	padding: 24px;
	font-size: 15px;
}

.loading-dots {
	display: inline-flex;
	gap: 6px;
	align-items: center;
}

.loading-dots span {
	width: 7px;
	height: 7px;
	background: var(--green);
	border-radius: 50%;
	animation: dot-bounce 1.2s infinite;
	opacity: 0.3;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-bounce {
	0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-4px); }
}

/* Grocery list view */

.list-scroll {
	flex: 1;
	overflow-y: auto;
	max-width: 480px;
	width: 100%;
	align-self: center;
}

.view > .list-scroll,
.view > .add-form {
	max-width: 480px;
	width: 100%;
	align-self: center;
}

.section-header {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--muted);
	padding: 16px 16px 8px;
}

.grocery-item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 0 16px;
	height: 56px;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	cursor: pointer;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.grocery-item:active { background: #f0f0ee; }

.grocery-item.checked .item-name {
	text-decoration: line-through;
	color: var(--muted);
}

.checkbox {
	width: 24px;
	height: 24px;
	border-radius: 6px;
	border: 2px solid var(--border);
	background: white;
	flex-shrink: 0;
	position: relative;
}

.grocery-item.checked .checkbox {
	background: var(--green);
	border-color: var(--green);
}

.checkbox::after {
	content: '';
	position: absolute;
	left: 6px;
	top: 2px;
	width: 6px;
	height: 11px;
	border: 2px solid white;
	border-top: none;
	border-left: none;
	transform: rotate(45deg);
	opacity: 0;
}

.grocery-item.checked .checkbox::after { opacity: 1; }

.item-name { font-size: 16px; }

.empty-state {
	text-align: center;
	color: var(--muted);
	padding: 48px 20px;
	font-size: 16px;
	line-height: 1.6;
}

/* Add item form */

.add-form {
	flex-shrink: 0;
	display: flex;
	gap: 8px;
	padding: 12px 16px;
	background: var(--surface);
	border-top: 1px solid var(--border);
}

.add-input {
	flex: 1;
	padding: 11px 14px;
	border: 2px solid var(--border);
	border-radius: 10px;
	font-size: 16px;
	font-family: inherit;
	background: var(--bg);
	color: var(--text);
}

.add-input:focus {
	outline: none;
	border-color: var(--green);
}

.add-btn {
	background: var(--green);
	color: white;
	border: none;
	border-radius: 10px;
	padding: 11px 16px;
	font-size: 16px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	min-height: 48px;
}

.add-btn:active { opacity: 0.8; }

/* Recipe view */

.recipe-content {
	flex: 1;
	overflow-y: auto;
	padding: 20px 16px;
	display: flex;
	flex-direction: column;
	gap: 24px;
	max-width: 480px;
	width: 100%;
	align-self: center;
}

.recipe-section {
	background: var(--surface);
	border-radius: var(--radius);
	padding: 16px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

.section-label {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
	margin-bottom: 12px;
}

.recipe-ingredients {
	list-style: none;
}

.recipe-ingredients li {
	padding: 10px 0;
	font-size: 16px;
	border-bottom: 1px solid var(--border);
}

.recipe-ingredients li:last-child { border-bottom: none; }

.recipe-steps {
	list-style: none;
	counter-reset: step;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.recipe-steps li {
	counter-increment: step;
	display: flex;
	gap: 12px;
	font-size: 16px;
	line-height: 1.5;
}

.recipe-steps li::before {
	content: counter(step);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	min-width: 28px;
	background: var(--green);
	color: white;
	border-radius: 50%;
	font-size: 13px;
	font-weight: 700;
	margin-top: 1px;
}
