/* Smoke Ring: BBQ trip scorecard. Phone-first, tuned for a 440pt-wide iPhone.
   Palette: warm paper-grey by day, cool near-black by night, Catppuccin accents
   rationed to one job each. Mauve leads; the three criteria borrow mauve,
   lavender and sky as wayfinding; green, peach and red only carry meaning. */

:root {
	--bg: #EDEAE0;
	--surface: #F6F3EB;
	--surface-2: #E2DDD0;
	--line: #D7D0C3;
	--text: #2A2620;
	--text-dim: #6E6759;
	--structure: #209FB5;
	--string: #40A02B;
	--keyword: #8839EF;
	--signal: #7287FD;
	--warn: #FE640B;
	--red: #D20F39;
	--on-accent: #F6F3EB;
	--shadow: 0 12px 34px rgba(42, 38, 32, 0.18);
	--smoke: 0.34;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #0B0E14;
		--surface: #10141E;
		--surface-2: #161B27;
		--line: #232A38;
		--text: #CDD6F4;
		--text-dim: #7F849C;
		--structure: #89DCEB;
		--string: #A6E3A1;
		--keyword: #CBA6F7;
		--signal: #B4BEFE;
		--warn: #FAB387;
		--red: #F38BA8;
		--on-accent: #0B0E14;
		--shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
		--smoke: 0.42;
		color-scheme: dark;
	}
}

:root[data-theme="dark"] {
	--bg: #0B0E14;
	--surface: #10141E;
	--surface-2: #161B27;
	--line: #232A38;
	--text: #CDD6F4;
	--text-dim: #7F849C;
	--structure: #89DCEB;
	--string: #A6E3A1;
	--keyword: #CBA6F7;
	--signal: #B4BEFE;
	--warn: #FAB387;
	--red: #F38BA8;
	--on-accent: #0B0E14;
	--shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
	--smoke: 0.42;
	color-scheme: dark;
}

:root {
	--display: "Helvetica Neue", Helvetica, Arial, sans-serif;
	--body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
	--mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
	--gutter: 16px;
	--radius: 16px;
}

[data-c="presentation"] { --accent: var(--keyword); }
[data-c="texture"] { --accent: var(--signal); }
[data-c="flavor"] { --accent: var(--structure); }
/* Unscored, so it carries no criterion colour. */
[data-c="observations"] { --accent: var(--text-dim); }

* { box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	background: var(--bg);
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 17px/1.45 var(--body);
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
	overscroll-behavior-y: none;
}

#app {
	max-width: 520px;
	margin: 0 auto;
	padding:
		calc(12px + env(safe-area-inset-top)) calc(var(--gutter) + env(safe-area-inset-right))
		calc(28px + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left));
	min-height: 100dvh;
}

body.voice-open #app { padding-bottom: calc(250px + env(safe-area-inset-bottom)); }

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

h1 {
	font: 700 34px/1.05 var(--display);
	letter-spacing: -0.03em;
	text-wrap: balance;
	overflow-wrap: anywhere;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-appearance: none; appearance: none; touch-action: manipulation; }

:focus-visible { outline: 2px solid var(--keyword); outline-offset: 2px; }

svg.i {
	width: 22px;
	height: 22px;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.dim { color: var(--text-dim); }

/* Section label: a small accent mark plus an uppercase name. */
.eyebrow {
	display: flex;
	align-items: center;
	gap: 8px;
	font: 600 12px/1 var(--body);
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--text-dim);
}
.eyebrow::before {
	content: "";
	width: 14px;
	height: 3px;
	border-radius: 2px;
	background: var(--accent, var(--keyword));
}

/* ---------------------------------------------------------------- buttons */

.btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 54px;
	padding: 0 18px;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: var(--surface);
	font-weight: 600;
	text-decoration: none;
}
.btn:active { transform: scale(0.985); }
.btn.primary { border-color: transparent; background: var(--keyword); color: var(--on-accent); }
.btn.quiet { min-height: 44px; width: auto; border-color: transparent; background: none; color: var(--text-dim); font-weight: 500; }
.btn.danger { color: var(--red); }
.btn[disabled] { opacity: 0.5; }

.bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 44px;
	margin: 0 -8px 10px;
}
.icon-btn {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	min-width: 44px;
	min-height: 44px;
	padding: 0 8px;
	border: 0;
	background: none;
	color: var(--text-dim);
	font-size: 16px;
}

/* ---------------------------------------------------------------- home */

/* The one rendered moment: slow smoke made of blurred gradient layers. */
.hero {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	padding: 96px 20px 20px;
	border: 1px solid var(--line);
	border-radius: 22px;
	background: var(--surface);
}
.hero::before, .hero::after {
	content: "";
	position: absolute;
	inset: -45%;
	z-index: -2;
	opacity: var(--smoke);
	filter: blur(34px);
	will-change: transform;
	animation: drift 28s ease-in-out infinite alternate;
	background:
		radial-gradient(closest-side, var(--keyword), transparent) 18% 30% / 46% 52% no-repeat,
		radial-gradient(closest-side, var(--signal), transparent) 78% 22% / 42% 46% no-repeat,
		radial-gradient(closest-side, var(--structure), transparent) 62% 78% / 40% 40% no-repeat;
}
.hero::after {
	animation-duration: 37s;
	animation-direction: alternate-reverse;
	background:
		radial-gradient(closest-side, var(--signal), transparent) 30% 74% / 44% 44% no-repeat,
		radial-gradient(closest-side, var(--keyword), transparent) 84% 60% / 38% 44% no-repeat;
}
.hero .scrim {
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(to top, var(--surface) 8%, transparent 78%);
}
.hero h1 { margin-top: 10px; font-size: 44px; }
.hero .sub { margin-top: 8px; color: var(--text-dim); font-size: 15px; }

@keyframes drift {
	from { transform: translate3d(-6%, -3%, 0) rotate(0deg) scale(1); }
	to { transform: translate3d(7%, 5%, 0) rotate(14deg) scale(1.12); }
}

.home > .btn.primary { margin-top: 14px; }

.section { margin-top: 30px; }
.section > .eyebrow { margin-bottom: 10px; }

.list {
	margin: 0;
	padding: 0;
	list-style: none;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
	overflow: hidden;
}
.list > li + li { border-top: 1px solid var(--line); }

.row {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	min-height: 64px;
	padding: 12px 14px;
	border: 0;
	background: none;
	text-align: left;
}
.row:active { background: var(--surface-2); }
.row .main { flex: 1; min-width: 0; }
.row .name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { display: block; margin-top: 2px; font-size: 14px; color: var(--text-dim); }
.row .rank { width: 22px; text-align: center; font-size: 15px; color: var(--text-dim); }
.row .total { font-size: 24px; font-weight: 600; }
.row .total small { font-size: 13px; font-weight: 400; color: var(--text-dim); }
.row > svg.i { color: var(--text-dim); }

/* Three hairline meters, one per criterion, in the criterion's own accent. */
.meters { display: flex; gap: 4px; margin-top: 7px; }
.meters span { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.meters i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }

.empty {
	padding: 26px 18px;
	border: 1px dashed var(--line);
	border-radius: var(--radius);
	color: var(--text-dim);
	text-align: center;
}

.foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 6px;
	margin-top: 34px;
	padding-top: 14px;
	border-top: 1px solid var(--line);
	font-size: 14px;
	color: var(--text-dim);
}
.foot .who { flex: 1 1 auto; }
.foot a { color: var(--structure); }

/* ---------------------------------------------------------------- forms */

.field { display: block; margin-top: 18px; }
.field > span { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--text-dim); }

.input {
	display: block;
	width: 100%;
	min-height: 54px;
	padding: 14px;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: var(--surface);
	font-size: 17px;
	-webkit-appearance: none;
	appearance: none;
}
.input:focus { outline: none; border-color: var(--keyword); }
input[type="date"].input { min-width: 0; text-align: left; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
	min-height: 40px;
	padding: 0 14px;
	border: 1px solid var(--line);
	border-radius: 20px;
	background: var(--surface);
	font-size: 15px;
}

.lede { margin-top: 8px; color: var(--text-dim); }
.stack { display: grid; gap: 10px; margin-top: 22px; }

/* ---------------------------------------------------------------- card */

.status { display: inline-flex; align-items: center; gap: 6px; padding-right: 8px; font-size: 14px; color: var(--text-dim); }
.status svg.i { width: 16px; height: 16px; }
.status[data-state="saved"] svg.i { color: var(--string); }
.status[data-state="error"] { color: var(--warn); }

.title-row { display: flex; align-items: flex-start; gap: 4px; }
.title-row h1 { flex: 1; min-width: 0; }
.title-row .icon-btn { margin: -4px -8px 0 0; }
.when { margin-top: 6px; font-size: 15px; color: var(--text-dim); }

.say-all {
	margin-top: 18px;
	justify-content: flex-start;
	min-height: 64px;
	text-align: left;
}
.say-all .mic-dot {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--keyword);
	color: var(--on-accent);
}
.say-all b { display: block; font-weight: 600; }
.say-all small { display: block; font-size: 14px; font-weight: 400; color: var(--text-dim); }

.crit {
	margin-top: 14px;
	padding: 16px 14px 14px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
}
.crit.flash { animation: flash 1.1s ease-out; }
@keyframes flash {
	from { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 35%, transparent); }
	to { border-color: var(--line); box-shadow: 0 0 0 3px transparent; }
}

.crit-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.crit-head .hint { margin-top: 6px; font-size: 14px; color: var(--text-dim); }
.crit-head .score { font: 600 40px/0.9 var(--mono); letter-spacing: -0.04em; color: var(--accent); }
.crit-head .score.unset { color: var(--line); }

/* The 1-10 scale. Tap a cell or drag along it; it fills like a meter. */
.scale {
	display: grid;
	grid-template-columns: repeat(10, 1fr);
	gap: 4px;
	margin-top: 14px;
	border-radius: 12px;
	touch-action: pan-y;
	user-select: none;
	-webkit-user-select: none;
}
.scale span {
	display: grid;
	place-items: center;
	height: 50px;
	border-radius: 10px;
	background: var(--surface-2);
	color: var(--text-dim);
	font: 600 16px/1 var(--mono);
	pointer-events: none;
}
.scale span.under { background: color-mix(in oklab, var(--accent) 26%, var(--surface-2)); color: var(--text); }
.scale span.on { background: var(--accent); color: var(--on-accent); }

.notes { position: relative; margin-top: 12px; }
.notes textarea {
	display: block;
	width: 100%;
	min-height: 76px;
	padding: 12px 60px 12px 12px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: var(--bg);
	font-size: 17px;
	line-height: 1.4;
	resize: none;
	overflow: hidden;
}
.notes textarea:focus { outline: none; border-color: var(--accent); }
.notes textarea::placeholder { color: var(--text-dim); opacity: 0.8; }
.notes textarea.live { border-color: var(--red); }
.mic {
	position: absolute;
	right: 8px;
	bottom: 8px;
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	border: 1px solid var(--line);
	border-radius: 50%;
	background: var(--surface);
	color: var(--accent);
}
.mic.live { border-color: transparent; background: var(--red); color: var(--on-accent); }

.card-foot { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.card-foot .sum { flex: none; font: 600 30px/1 var(--mono); letter-spacing: -0.03em; }
.card-foot .sum small { font-size: 15px; font-weight: 400; color: var(--text-dim); }
.center { display: flex; justify-content: center; margin-top: 8px; }

/* ---------------------------------------------------------------- location */

.sealed {
	margin-top: 18px;
	padding: 22px 16px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
	text-align: center;
}
.sealed svg.i { width: 30px; height: 30px; color: var(--text-dim); }
.sealed p { margin: 8px 0 16px; color: var(--text-dim); }

.verdict { display: flex; align-items: baseline; gap: 8px; margin-top: 18px; }
.verdict .big { font: 700 68px/0.9 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }
.verdict .of { color: var(--text-dim); }

.cmp {
	margin-top: 14px;
	padding: 14px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
}
.cmp-head { display: flex; align-items: center; justify-content: space-between; }
.cmp-head .avg { font: 600 22px/1 var(--mono); color: var(--accent); }
.take { display: flex; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.take .n { flex: none; width: 34px; font: 600 24px/1.1 var(--mono); color: var(--accent); }
.take .who { font-size: 14px; font-weight: 600; }
.take .said { margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.take .said.none { color: var(--text-dim); font-style: italic; }

/* ---------------------------------------------------------------- voice */

/* The live-dictation popup: small, pinned above the home indicator. */
.voice {
	position: fixed;
	left: 12px;
	right: 12px;
	bottom: calc(12px + env(safe-area-inset-bottom));
	z-index: 50;
	max-width: 496px;
	margin: 0 auto;
	padding: 14px;
	border: 1px solid var(--line);
	border-radius: 20px;
	background: var(--surface);
	box-shadow: var(--shadow);
	animation: rise 0.18s ease-out;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }

.voice-head { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.voice-head .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-dim); }
.voice[data-state="listening"] .dot { background: var(--red); animation: pulse 1.2s ease-in-out infinite; }
.voice[data-state="filling"] .dot, .voice[data-state="finishing"] .dot { background: var(--keyword); animation: pulse 0.8s ease-in-out infinite; }
.voice[data-state="error"] .dot { background: var(--warn); }
@keyframes pulse { 50% { opacity: 0.3; } }
.voice-head .label { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-head .level { width: 46px; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.voice-head .level i { display: block; height: 100%; width: 100%; background: var(--red); transform-origin: left; transform: scaleX(0); transition: transform 0.09s linear; }

/* Shows the tail of the transcript: new words push older ones up and out. */
.voice-text {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	height: 4.35em;
	margin: 10px 0 12px;
	overflow: hidden;
	font-size: 17px;
	line-height: 1.45;
}
.voice-text p { overflow-wrap: anywhere; }
.voice-text .settled { color: var(--text-dim); }
.voice-text .hint { color: var(--text-dim); }

.voice-actions { display: flex; gap: 10px; }
.voice-actions .btn { min-height: 50px; }
.voice-actions .btn.quiet { flex: none; }
.voice-actions .stop { border-color: transparent; background: var(--red); color: var(--on-accent); }

.toast {
	position: fixed;
	left: 50%;
	bottom: calc(24px + env(safe-area-inset-bottom));
	z-index: 60;
	width: max-content;
	max-width: calc(100vw - 32px);
	padding: 12px 16px;
	border-radius: 14px;
	background: var(--text);
	color: var(--bg);
	font-size: 15px;
	transform: translateX(-50%);
	box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
}
