:root {
	--bg: #060606;
	--fg: #f2f0ea;
	--muted: #6b6862;
	--faint: #2a2825;
	--mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
	height: 100%;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--mono);
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
}

/* ---------- compose overlay ---------- */
#compose {
	position: fixed;
	inset: 0;
	z-index: 50;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 28px;
	padding: 24px;
	background: var(--bg);
	transition: opacity 0.6s ease;
}

#compose.hidden {
	opacity: 0;
	pointer-events: none;
}

.eyebrow {
	font-size: 11px;
	letter-spacing: 0.32em;
	text-transform: uppercase;
	color: var(--muted);
}

#compose h1 {
	font-family: var(--mono);
	font-weight: 300;
	font-size: clamp(22px, 3.6vw, 38px);
	letter-spacing: -0.02em;
	margin: 0;
	text-align: center;
	line-height: 1.25;
	max-width: 20ch;
}

.field {
	width: min(440px, 80vw);
	border: none;
	border-bottom: 1px solid var(--faint);
	background: transparent;
	color: var(--fg);
	font-family: var(--mono);
	font-size: 15px;
	padding: 10px 2px;
	text-align: center;
	letter-spacing: 0.02em;
	transition: border-color 0.3s ease;
}

.field::placeholder {
	color: var(--muted);
}

.field:focus {
	outline: none;
	border-color: var(--fg);
}

.ghost-btn {
	background: transparent;
	border: 1px solid var(--muted);
	color: var(--fg);
	font-family: var(--mono);
	font-size: 12px;
	letter-spacing: 0.28em;
	text-indent: 0.28em; /* offset trailing letter-spacing so label sits centered */
	text-transform: uppercase;
	cursor: pointer;
	padding: 12px 26px;
	transition:
		background-color 0.25s ease,
		border-color 0.25s ease,
		color 0.25s ease;
}

.ghost-btn:hover {
	background: var(--fg);
	border-color: var(--fg);
	color: var(--bg);
}

.ghost-btn:focus-visible {
	outline: none;
	border-color: var(--fg);
}

.ghost-btn.small {
	font-size: 10px;
	letter-spacing: 0.24em;
	text-indent: 0.24em;
	padding: 7px 16px;
	border-color: var(--muted);
	color: var(--fg);
}

.ghost-btn.small:hover {
	background: var(--fg);
	border-color: var(--fg);
	color: var(--bg);
}

.note {
	font-size: 11.5px;
	color: var(--muted);
	max-width: 38ch;
	text-align: center;
	line-height: 1.6;
	margin-top: 4px;
}

/* ---------- working surface: two cells divide the whole page ---------- */
#stage {
	height: 100%;
	display: grid;
	grid-template-columns: 1.35fr 1fr;
	opacity: 0;
	transition: opacity 0.8s ease 0.2s;
}

#stage.live {
	opacity: 1;
}

#outcome-pane,
#candidate-pane {
	position: relative;
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
}

/* the single divider between the two cells, running the full page height */
#candidate-pane {
	border-left: 1px solid var(--faint);
}

/* header sits at the top of each cell; fixed equal height so both labels
   sit on exactly the same line across the divider */
.pane-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	height: 72px;
	padding: 0 56px;
	flex: none;
}

.head-left {
	display: flex;
	align-items: center;
	gap: 16px;
	min-width: 0;
}

.pane-head .prompt-echo {
	color: var(--fg);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
}

/* body fills the rest of the cell and centers its content vertically */
.pane-body {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 0 56px 64px;
	overflow-y: auto;
}

#full-text {
	font-family: var(--mono);
	font-weight: 300;
	font-size: clamp(22px, 2.5vw, 38px);
	line-height: 1.5;
	letter-spacing: -0.02em;
	color: var(--fg);
	word-wrap: break-word;
}

#full-text .seed {
	color: var(--muted);
}

#full-text .tok {
	opacity: 0;
	animation: settle 0.5s ease forwards;
}

@keyframes settle {
	from {
		opacity: 0;
		filter: blur(4px);
	}
	to {
		opacity: 1;
		filter: blur(0);
	}
}

#full-text .tok.gen {
	cursor: help;
	border-bottom: 1px solid transparent;
	transition: border-color 0.2s ease;
}

#full-text .tok.gen:hover {
	border-bottom-color: var(--muted);
}

#full-text .cursor {
	display: inline-block;
	width: 0.5ch;
	opacity: 0.5;
	animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
	50% {
		opacity: 0;
	}
}

/* right: candidates, weighted by probability via opacity */
#options-list {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.option-item {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 18px;
	font-family: var(--mono);
	font-size: 26px;
	font-weight: 300;
	letter-spacing: -0.02em;
	line-height: 1.7;
	transition:
		opacity 0.55s ease,
		color 0.4s ease;
}

.option-item .word {
	font-weight: 300;
}

.option-item .option-prob {
	font-family: var(--mono);
	font-variant-numeric: tabular-nums;
	font-size: 12px;
	letter-spacing: 0.02em;
	color: var(--muted);
	opacity: 0;
	transition: opacity 0.4s ease;
	white-space: nowrap;
}

.option-item.selected {
	color: var(--fg);
	opacity: 1 !important;
}

.option-item.selected .option-prob {
	color: var(--fg);
	opacity: 1;
}

.option-item.dim {
	opacity: 0.14 !important;
}

/* ---------- tooltip: the field considered at a committed word ---------- */
#tooltip {
	position: fixed;
	z-index: 9999;
	background: rgba(10, 10, 10, 0.96);
	border: 1px solid var(--faint);
	padding: 10px 12px;
	font-family: var(--mono);
	font-size: 12px;
	line-height: 1.7;
	color: var(--fg);
	pointer-events: none;
	display: none;
	backdrop-filter: blur(4px);
}

#tooltip .tt-row {
	display: flex;
	justify-content: space-between;
	gap: 20px;
}

#tooltip .tt-row .tt-pct {
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

#tooltip .tt-row.is-chosen .tt-pct,
#tooltip .tt-row.is-chosen .tt-word {
	color: var(--fg);
}

#tooltip .tt-row:not(.is-chosen) {
	color: var(--muted);
}

.api-error {
	color: #f87171;
	font-size: 13px;
	line-height: 1.6;
	max-width: 36ch;
	white-space: pre-line;
}
