/**
 * Shell, layout, and the pieces every screen shares.
 *
 * @package FirstHand
 */

.fh__root {
	position: relative;
	height: 100%;
	min-height: 520px;
	background: var(--fh-bg);
	color: var(--fh-ink);
	font-family: var(--fh-font);
	font-size: 14px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
	overflow: hidden;
}

.fh__root--standalone {
	position: fixed;
	inset: 0;
	height: 100%;
}

.fh__root *,
.fh__root *::before,
.fh__root *::after {
	box-sizing: border-box;
}

/*
 * `hidden` must actually hide.
 *
 * The browser's own [hidden] rule is display:none, but any author rule that
 * sets display beats it — so a panel styled `display: grid` stayed on screen no
 * matter what its hidden property said. That is how the map settings panel
 * became permanently open, the panel's reopen tab showed while the panel was
 * open, and the workspace kept taking up layout on Discover.
 *
 * One authoritative rule, so toggling `.hidden` is always enough.
 */
.fh__root [hidden] {
	display: none !important;
}

.fh__root button {
	font: inherit;
	color: inherit;
	cursor: pointer;
}

.fh__root a {
	color: var(--fh-known);
}

.fh__root :focus-visible {
	outline: 2px solid var(--fh-accent);
	outline-offset: 2px;
}

/* Boot ---------------------------------------------------------------- */

.fh__boot {
	position: absolute;
	inset: 0;
	display: grid;
	place-content: center;
	gap: 8px;
	text-align: center;
	background: var(--fh-bg);
	z-index: 60;
}

.fh__root[data-view] .fh__boot {
	display: none;
}

.fh__boot-mark {
	font-size: 22px;
	font-weight: 700;
	letter-spacing: -0.02em;
}

.fh__boot-note,
.fh__noscript {
	color: var(--fh-ink-3);
}

/* The map bed: the persistent home of the one map ---------------------- */

.fh__map-bed {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.fh__root[data-view='workspace'] .fh__map-bed {
	position: static;
}

/* Top bar ------------------------------------------------------------- */

.fh__top {
	position: relative;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 14px;
	height: var(--fh-top);
	padding: 0 14px;
	background: var(--fh-bg-2);
	border-bottom: 1px solid var(--fh-line);
}

.fh__brand {
	background: none;
	border: 0;
	padding: 0;
	font-weight: 700;
	font-size: 15px;
	letter-spacing: -0.01em;
}

.fh__switcher {
	display: flex;
	align-items: center;
	gap: 7px;
	max-width: 46vw;
	padding: 6px 10px;
	background: var(--fh-bg-3);
	border: 1px solid var(--fh-line);
	border-radius: var(--fh-radius);
}

.fh__switcher-title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 600;
}

.fh__switcher-caret {
	color: var(--fh-ink-3);
	font-size: 11px;
}

.fh__switcher-menu {
	position: absolute;
	top: calc(var(--fh-top) - 4px);
	left: 120px;
	width: 330px;
	max-height: 60vh;
	overflow-y: auto;
	padding: 8px;
	background: var(--fh-bg-2);
	border: 1px solid var(--fh-line-2);
	border-radius: var(--fh-radius-lg);
	box-shadow: var(--fh-shadow);
	z-index: 40;
}

.fh__switcher-list {
	display: flex;
	flex-direction: column;
}

.fh__switcher-item,
.fh__switcher-new {
	display: flex;
	flex-direction: column;
	gap: 2px;
	width: 100%;
	padding: 9px 10px;
	text-align: left;
	background: none;
	border: 0;
	border-radius: var(--fh-radius);
}

.fh__switcher-item:hover,
.fh__switcher-new:hover {
	background: var(--fh-bg-3);
}

.fh__switcher-name {
	font-weight: 500;
}

.fh__switcher-meta {
	font-size: 12px;
	color: var(--fh-ink-3);
}

.fh__switcher-new {
	margin-top: 6px;
	border-top: 1px solid var(--fh-line);
	color: var(--fh-accent);
	border-radius: 0 0 var(--fh-radius) var(--fh-radius);
}

.fh__top-actions {
	display: flex;
	gap: 8px;
	margin-left: auto;
	position: relative;
}

/* Share: a small popover under the button, not a browser prompt. */
.fh__share {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 90;
	width: 360px;
	max-width: calc(100vw - 24px);
	padding: 12px;
	background: var(--fh-bg-2);
	border: 1px solid var(--fh-line);
	border-radius: var(--fh-radius-lg);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
	display: grid;
	gap: 8px;
	font-size: 12px;
	color: var(--fh-ink-2);
}

.fh__share-title {
	margin: 0;
	font-size: 10.5px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--fh-ink-3);
}

.fh__share-row {
	display: flex;
	gap: 6px;
}

.fh__share-link {
	flex: 1;
	min-width: 0;
	padding: 5px 8px;
	background: var(--fh-bg-3);
	border: 1px solid var(--fh-line-2);
	border-radius: var(--fh-radius);
	color: var(--fh-ink);
	font: inherit;
	font-size: 11.5px;
}

.fh__feedback-text {
	width: 100%;
	resize: vertical;
	min-height: 72px;
	line-height: 1.4;
}

.fh__share-social {
	flex-wrap: wrap;
}

.fh__share-social a.fh__btn {
	text-decoration: none;
}

.fh__share-card {
	display: grid;
	gap: 8px;
}

.fh__share-card-img {
	width: 100%;
	max-height: 300px;
	object-fit: contain;
	background: #000;
	border-radius: var(--fh-radius);
}

.fh__share-opt {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}

.fh__share-note {
	margin: 0;
	font-size: 11px;
}

/* Buttons ------------------------------------------------------------- */

.fh__btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 12px;
	background: var(--fh-bg-3);
	color: var(--fh-ink);
	border: 1px solid var(--fh-line-2);
	border-radius: var(--fh-radius);
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
}

.fh__btn:hover {
	border-color: var(--fh-ink-3);
}

.fh__btn--primary {
	background: var(--fh-accent);
	border-color: var(--fh-accent);
	color: #12140f;
	font-weight: 600;
}

.fh__btn--sm {
	padding: 5px 12px;
	font-size: 12px;
}

.fh__btn--ghost {
	background: transparent;
}

.fh__btn[disabled] {
	opacity: 0.5;
	cursor: default;
}

.fh__icon {
	width: 28px;
	height: 28px;
	display: grid;
	place-items: center;
	background: none;
	border: 0;
	border-radius: var(--fh-radius);
	color: var(--fh-ink-3);
}

.fh__icon:hover {
	background: var(--fh-bg-3);
	color: var(--fh-ink);
}

.fh__chip {
	padding: 4px 10px;
	background: var(--fh-bg-3);
	border: 1px solid var(--fh-line);
	border-radius: 999px;
	font-size: 12px;
	color: var(--fh-ink-2);
}

.fh__chip:hover {
	border-color: var(--fh-accent);
	color: var(--fh-ink);
}

.fh__muted {
	color: var(--fh-ink-3);
}

.fh__error {
	color: var(--fh-alert);
}

/* Stage --------------------------------------------------------------- */

.fh__workspace {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	z-index: 10;
}

.fh__stage {
	display: flex;
	flex: 1;
	min-height: 0;
}

.fh__stage-main {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
}

/*
 * The wrap must be a flex container in its own right.
 *
 * The slot's only child is the map, which is absolutely positioned and so
 * contributes no height. Without `display: flex` here the slot collapsed to
 * zero and the map canvas rendered 0px tall — a black rectangle with a
 * perfectly healthy Mapbox instance inside it.
 */
.fh__map-wrap {
	position: relative;
	display: flex;
	flex: 1;
	min-height: 0;
}

.fh__map-slot {
	position: relative;
	flex: 1;
	min-width: 0;
	min-height: 0;
}

/* Discover ------------------------------------------------------------ */

/*
 * Discover sits over the globe. The scrim has to make text legible without
 * burying the map — it was opaque from 44% down, which greyed the globe out and
 * left a dead band under the content. Now it darkens only behind the words and
 * lets the map show through beside and below them.
 */
.fh__discover {
	position: relative;
	z-index: 10;
	height: 100%;
	overflow-y: auto;
	padding: 0 0 40px;
	background:
		linear-gradient(180deg, rgba(var(--fh-scrim), 0.72) 0%, rgba(var(--fh-scrim), 0.45) 46%, rgba(var(--fh-scrim), 0.72) 100%),
		radial-gradient(120% 90% at 0% 30%, rgba(var(--fh-scrim), 0.92) 0%, rgba(var(--fh-scrim), 0) 60%);
}

.fh__discover-intro {
	max-width: 620px;
	margin: 0;
	padding: 74px 28px 34px;
}

.fh__discover-title {
	margin: 0 0 8px;
	font-size: clamp(28px, 4.4vw, 42px);
	font-weight: 700;
	letter-spacing: -0.028em;
	text-wrap: balance;
}

.fh__discover-sub {
	margin: 0 0 20px;
	color: var(--fh-ink-2);
	font-size: 16px;
	max-width: 46ch;
}

.fh__discover-form {
	display: flex;
	gap: 8px;
}

.fh__discover-input {
	flex: 1;
	padding: 10px 12px;
	background: var(--fh-bg-2);
	color: var(--fh-ink);
	border: 1px solid var(--fh-line-2);
	border-radius: var(--fh-radius);
	font: inherit;
}

.fh__discover-note {
	min-height: 20px;
	margin: 10px 0 0;
	color: var(--fh-ink-3);
	font-size: 13px;
}

.fh__cards-title {
	margin: 8px 0 12px;
	padding: 0 28px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--fh-ink-3);
}

.fh__cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 10px;
	padding: 0 28px;
}

.fh__card {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 14px;
	text-align: left;
	background: var(--fh-bg-2);
	border: 1px solid var(--fh-line);
	border-radius: var(--fh-radius-lg);
}

.fh__card:hover {
	border-color: var(--fh-accent);
}

.fh__card-title {
	font-weight: 600;
	line-height: 1.3;
}

.fh__card-meta,
.fh__card-counts {
	font-size: 12px;
	color: var(--fh-ink-3);
}

/* Story mode: the map is the stage; this is the caption and the picture. */
.fh__story {
	position: absolute;
	inset: 0;
	z-index: 95;
	pointer-events: none;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}

.fh__story > * {
	pointer-events: auto;
}

.fh__story-top {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 12px 16px 0;
	padding: 8px 12px;
	background: var(--fh-glass);
	border: 1px solid var(--fh-line);
	border-radius: var(--fh-radius-lg);
	align-self: flex-start;
}

.fh__story-title {
	font-weight: 600;
	color: var(--fh-ink);
}

.fh__story-n {
	font-family: var(--fh-mono);
	font-size: 11px;
	color: var(--fh-ink-3);
}

.fh__story-pic {
	align-self: flex-end;
	width: min(38vw, 460px);
	margin: 0 16px;
	padding: 6px;
	background: var(--fh-glass);
	border: 1px solid var(--fh-line);
	border-radius: var(--fh-radius-lg);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
	animation: fh-story-in 0.6s ease;
}

.fh__story-pic img {
	width: 100%;
	max-height: 40vh;
	object-fit: cover;
	border-radius: var(--fh-radius);
	background: #000;
}

.fh__story-pic.is-still-motion {
	overflow: hidden;
}

.fh__story-pic.is-still-motion img,
.fh__story-pic.is-still-motion video {
	will-change: transform;
	animation-duration: 12s;
	animation-timing-function: ease-in-out;
	animation-fill-mode: both;
}

.fh__story-pic.is-motion-left img,
.fh__story-pic.is-motion-left video { animation-name: fh-story-pan-left; }
.fh__story-pic.is-motion-right img,
.fh__story-pic.is-motion-right video { animation-name: fh-story-pan-right; }

@keyframes fh-story-pan-left {
	from { transform: scale(1.015) translate3d(0.8%, 0.3%, 0); }
	to { transform: scale(1.09) translate3d(-1.8%, -0.7%, 0); }
}

@keyframes fh-story-pan-right {
	from { transform: scale(1.025) translate3d(-1.2%, -0.5%, 0); }
	to { transform: scale(1.085) translate3d(1.6%, 0.6%, 0); }
}

.fh__story-media,
.fh__story-pic iframe,
.fh__story-pic video {
	display: block;
	width: 100%;
	height: min(48vh, 470px);
	border: 0;
	background: #000;
	object-fit: contain;
}

.fh__story-pic-title {
	display: block;
	padding: 6px 4px 2px;
	font-size: 12px;
	color: var(--fh-ink-2);
}

.fh__story-bar {
	margin: 12px 16px 16px;
	padding: 12px 16px;
	background: var(--fh-glass);
	border: 1px solid var(--fh-line);
	border-radius: var(--fh-radius-lg);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.fh__story-kind {
	font-size: 10.5px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--fh-accent);
}

.fh__story-text {
	margin: 4px 0 10px;
	max-width: 70ch;
	font-size: clamp(16px, 1.6vw, 22px);
	line-height: 1.4;
	color: var(--fh-ink);
	text-wrap: balance;
}

.fh__story-acts {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.fh__story-mood,
.fh__story-voice-select {
	min-height: 30px;
	padding: 4px 28px 4px 9px;
	border: 1px solid var(--fh-line);
	border-radius: var(--fh-radius);
	background: var(--fh-bg-2);
	color: var(--fh-ink);
	font: inherit;
	font-size: 12px;
}

.fh__story-volume {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 30px;
	padding: 3px 8px;
	border: 1px solid var(--fh-line);
	border-radius: var(--fh-radius);
	background: var(--fh-bg-2);
	color: var(--fh-ink-2);
	font-size: 11px;
}

.fh__story-volume-range {
	width: 96px;
	accent-color: var(--fh-accent);
}

.fh__story-volume-value {
	min-width: 30px;
	color: var(--fh-ink);
	font-variant-numeric: tabular-nums;
}

@keyframes fh-story-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.fh__story-pic,
	.fh__story-pic.is-still-motion img,
	.fh__story-pic.is-still-motion video { animation: none; transform: none; }
}

/* GPT61 — cinematic Story dialog over the live map. */
.fh__story {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	padding: clamp(12px, 3vw, 40px);
	background: rgba(5, 8, 12, 0.34);
	backdrop-filter: blur(1.5px);
	pointer-events: auto;
}

.fh__story-modal {
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
	width: min(900px, 92vw);
	max-height: min(820px, 88vh);
	overflow: hidden;
	background: color-mix(in srgb, var(--fh-bg) 92%, transparent);
	border: 1px solid var(--fh-line);
	border-radius: 18px;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.fh__story-top {
	align-self: auto;
	margin: 0;
	padding: 11px 14px;
	border: 0;
	border-bottom: 1px solid var(--fh-line);
	border-radius: 0;
	background: transparent;
}

.fh__story-top [data-fh-story-close] { margin-left: auto; }

.fh__story-pic {
	align-self: stretch;
	justify-self: stretch;
	width: auto;
	min-height: 180px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: #07090c;
}

.fh__story-pic img {
	display: block;
	width: 100%;
	height: min(48vh, 470px);
	max-height: none;
	object-fit: contain;
	border-radius: 0;
}

.fh__story-pic-title { padding: 7px 12px; }

.fh__story-bar {
	margin: 0;
	padding: 14px 16px 16px;
	border: 0;
	border-top: 1px solid var(--fh-line);
	border-radius: 0;
	box-shadow: none;
	background: transparent;
}

.fh__story-text { max-width: none; }
.fh__story-track { max-width: 190px; }

.fh__story-editor {
	margin-top: 10px;
	padding-top: 9px;
	border-top: 1px solid var(--fh-line);
}

.fh__story-editor summary { cursor: pointer; color: var(--fh-ink-2); font-size: 12px; }
.fh__story-editor-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 9px; }
.fh__story-visual-evidence { max-width: 310px; }
.fh__story-visual-at { width: 76px; }
.fh__story-at-label { display: inline-flex; align-items: center; gap: 5px; color: var(--fh-ink-2); font-size: 11px; }

/* GPT66 — Story is a dock beside the moving map, not a modal over it. */
.fh__story {
	inset: 0;
	display: block;
	padding: 0;
	background: transparent;
	backdrop-filter: none;
	pointer-events: none;
}

.fh__story-modal {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(500px, 42vw);
	max-height: none;
	border-radius: 0;
	border-width: 0 0 0 1px;
	pointer-events: auto;
	transition: transform 220ms ease, width 220ms ease, opacity 180ms ease;
	grid-template-rows: auto auto minmax(0, 1fr);
}

.fh__story-pic {
	align-self: start;
	min-height: 0;
}

.fh__story-bar {
	min-height: 0;
	overflow-y: auto;
	align-self: stretch;
}

.fh__story-pic img,
.fh__story-media,
.fh__story-pic iframe,
.fh__story-pic video { height: min(42vh, 430px); }

.fh__story-edge {
	position: absolute;
	right: 0;
	top: 42%;
	display: none;
	padding: 12px 7px;
	border: 1px solid var(--fh-line);
	border-right: 0;
	border-radius: 9px 0 0 9px;
	background: var(--fh-accent);
	color: #171a20;
	font: 700 12px/1.1 inherit;
	writing-mode: vertical-rl;
	cursor: pointer;
	pointer-events: auto;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}

.fh__story-open-full { display: none; }

.fh__story.is-compact .fh__story-modal {
	top: auto;
	right: 12px;
	bottom: 92px;
	width: min(440px, 38vw);
	height: auto;
	max-height: 42vh;
	border: 1px solid var(--fh-line);
	border-radius: 14px;
}

.fh__story.is-compact .fh__story-pic,
.fh__story.is-compact .fh__story-editor { display: none; }
.fh__story.is-compact .fh__story-open-full { display: inline-flex; }
.fh__story.is-compact .fh__story-text { font-size: 15px; line-height: 1.35; }
.fh__story.is-compact .fh__story-top { padding-block: 7px; }
.fh__story.is-compact .fh__story-bar { padding: 9px 11px 11px; }

.fh__story.is-hidden .fh__story-modal {
	transform: translateX(105%);
	opacity: 0;
	visibility: hidden;
}
.fh__story.is-hidden .fh__story-edge { display: block; }

@media (max-width: 760px) {
	.fh__story-modal {
		width: 100%;
		max-height: 100%;
	}
	.fh__story.is-compact .fh__story-modal {
		right: 8px;
		bottom: 70px;
		width: calc(100% - 16px);
		max-height: 48vh;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fh__story-modal { transition: none; }
}

@media (max-width: 680px) {
	.fh__story { padding: 8px; }
	.fh__story-modal { width: 100%; max-height: 94vh; }
	.fh__story-pic img { height: 34vh; }
	.fh__story-top { flex-wrap: wrap; }
}

/* Busy ---------------------------------------------------------------- */

.fh__busy {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 2px;
	background: linear-gradient(90deg, transparent, var(--fh-accent), transparent);
	background-size: 40% 100%;
	background-repeat: no-repeat;
	animation: fh-sweep 1.1s linear infinite;
	z-index: 80;
}

@keyframes fh-sweep {
	from { background-position: -40% 0; }
	to   { background-position: 140% 0; }
}

@media (prefers-reduced-motion: reduce) {
	.fh__busy { animation: none; background-position: 30% 0; }
	.fh__root * { transition: none !important; }
}

/* Phone --------------------------------------------------------------- */

@media (max-width: 820px) {
	.fh__switcher-menu { left: 8px; right: 8px; width: auto; }
	.fh__discover-intro { padding: 48px 18px 26px; }
	.fh__cards, .fh__cards-title { padding-inline: 18px; }
}

/* A control that takes something away. Quiet until armed. */
.fh__btn--danger:hover,
.fh__btn--danger.is-armed {
	border-color: var(--fh-alert);
	color: var(--fh-alert);
}

.fh__btn--danger.is-armed {
	background: rgba(194, 69, 45, 0.12);
}

/* Draft / published ---------------------------------------------------- */

.fh__draft,
.fh__card-draft {
	display: inline-block;
	margin-left: 8px;
	padding: 1px 7px;
	font-family: var(--fh-mono);
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--fh-accent);
	border: 1px solid var(--fh-accent);
	border-radius: 999px;
	vertical-align: middle;
}

.fh__card-draft {
	margin-left: 0;
	justify-self: start;
}

.fh__share-state {
	justify-content: space-between;
	align-items: center;
	padding-top: 8px;
	border-top: 1px solid var(--fh-line);
}

/* Jump to Moment ------------------------------------------------------- */

.fh__picker {
	position: absolute;
	top: 64px;
	left: 50%;
	transform: translateX(-50%);
	width: min(560px, calc(100vw - 32px));
	z-index: 96;
	background: var(--fh-glass);
	border: 1px solid var(--fh-line-2, var(--fh-line));
	border-radius: var(--fh-radius-lg);
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(8px);
	overflow: hidden;
}

.fh__picker-input {
	width: 100%;
	box-sizing: border-box;
	padding: 12px 14px;
	font: inherit;
	font-size: 15px;
	color: var(--fh-ink);
	background: transparent;
	border: 0;
	border-bottom: 1px solid var(--fh-line);
	outline: none;
}

.fh__picker-list {
	max-height: 50vh;
	overflow: auto;
	padding: 6px;
}

.fh__picker-item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 8px 10px;
	border: 0;
	border-radius: 8px;
	background: none;
	color: var(--fh-ink);
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.fh__picker-item:hover,
.fh__picker-item:focus {
	background: var(--fh-bg-2, rgba(127, 127, 127, 0.15));
	outline: none;
}

.fh__picker-label {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* The master clock ---------------------------------------------------- */

.fh__clock {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 2px 10px;
	background: var(--fh-bg-3);
	border: 1px solid var(--fh-line);
	border-radius: var(--fh-radius);
}

.fh__clock-face {
	display: grid;
	line-height: 1.1;
}

.fh__clock-digits,
.fh__clock-input {
	padding: 0;
	border: 0;
	background: none;
	color: var(--fh-accent);
	font-family: var(--fh-mono);
	font-size: 17px;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.02em;
	cursor: text;
	text-align: left;
}

.fh__clock-input {
	width: 15ch;
	color: var(--fh-ink);
	border-bottom: 1px solid var(--fh-accent);
	outline: none;
}

.fh__clock-under {
	display: flex;
	gap: 8px;
	align-items: baseline;
}

.fh__clock-date,
.fh__clock-rel {
	font-family: var(--fh-mono);
	font-size: 10.5px;
	color: var(--fh-ink-3);
}

.fh__clock-rel {
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	color: var(--fh-ink-2);
}

.fh__clock-rel:hover {
	color: var(--fh-accent);
}

.fh__clock-controls {
	display: inline-flex;
	align-items: center;
	gap: 2px;
}

.fh__clock-btn {
	min-width: 26px;
	height: 26px;
	padding: 0 6px;
	border: 1px solid transparent;
	border-radius: 6px;
	background: none;
	color: var(--fh-ink-2);
	font-family: var(--fh-mono);
	font-size: 12px;
	cursor: pointer;
}

.fh__clock-btn:hover {
	background: var(--fh-bg-2);
	color: var(--fh-ink);
}

.fh__clock-play {
	color: var(--fh-accent);
	font-size: 13px;
}

.fh__clock-play.is-playing {
	background: var(--fh-accent);
	color: #14181f;
}

.fh__clock-speed {
	margin-left: 4px;
	padding: 3px 4px;
	font: inherit;
	font-size: 11px;
	font-family: var(--fh-mono);
	color: var(--fh-ink-2);
	background: var(--fh-bg);
	border: 1px solid var(--fh-line);
	border-radius: 6px;
}

@media (max-width: 900px) {
	.fh__clock-controls .fh__clock-speed,
	.fh__clock-date {
		display: none;
	}
}

/* The stack ------------------------------------------------------------ */

.fh__stack {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	z-index: 60;
	display: flex;
	flex-direction: column;
	background: var(--fh-glass);
	border-top: 1px solid var(--fh-line-2, var(--fh-line));
	backdrop-filter: blur(8px);
	box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
}

.fh__stack-panes {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 10px 12px 6px;
	flex: 1 1 auto;
	overflow: auto;
	min-height: 0;
}

.fh__stack-pane {
	flex: 1 1 300px;
	min-width: 260px;
	max-width: 560px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 6px;
	background: var(--fh-bg);
	border: 1px solid var(--fh-line);
	border-radius: var(--fh-radius);
}

.fh__stack-pane.is-detached {
	border-color: var(--fh-accent);
}

.fh__stack-pane.is-outside .fh__stack-media {
	opacity: 0.35;
}

.fh__stack-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
}

.fh__stack-name {
	font-size: 12px;
	font-weight: 600;
	color: var(--fh-ink);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fh__stack-acts {
	display: inline-flex;
	gap: 2px;
	flex: 0 0 auto;
}

.fh__stack-media {
	position: relative;
	flex: 0 0 auto;
	width: 100%;
	min-height: 120px;
	background: #000;
	border-radius: 6px;
	overflow: hidden;
	aspect-ratio: 16 / 9;
}

.fh__stack-media iframe,
.fh__stack-media video,
.fh__stack-media img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: contain;
	border: 0;
}

.fh__stack-status {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	color: var(--fh-ink-3);
}

.fh__stack-detached {
	color: var(--fh-accent);
}

.fh__stack-align {
	display: grid;
	gap: 6px;
	padding: 8px;
	border: 1px solid var(--fh-accent);
	border-radius: 6px;
}

.fh__stack-lineup {
	flex: 1 1 100%;
	display: grid;
	gap: 6px;
	justify-items: start;
}

.fh__stack-lineup-rows {
	display: grid;
	gap: 4px;
}

.fh__stack-lineup-row {
	display: grid;
	grid-template-columns: minmax(120px, 200px) minmax(200px, 1fr);
	gap: 8px;
	align-items: center;
	font-size: 12px;
}

.fh__stack-lineup-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--fh-ink-2);
}

.fh__stack-foot {
	flex: 0 0 auto;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 18px;
	padding: 6px 12px 10px;
	border-top: 1px solid var(--fh-line);
}

.fh__stack-master {
	display: inline-flex;
	align-items: baseline;
	gap: 8px;
}

.fh__stack-k {
	font-family: var(--fh-mono);
	font-size: 10.5px;
	letter-spacing: 0.08em;
	color: var(--fh-ink-3);
}

.fh__stack-time {
	font-family: var(--fh-mono);
	font-size: 16px;
	color: var(--fh-accent);
	font-variant-numeric: tabular-nums;
}

.fh__stack-rel {
	font-family: var(--fh-mono);
	font-size: 11px;
	color: var(--fh-ink-2);
}

.fh__stack-transport {
	display: inline-flex;
	gap: 4px;
	flex-wrap: wrap;
}

.fh__stack-scrub {
	flex: 1 1 100%;
	display: flex;
	align-items: center;
	gap: 10px;
}

.fh__stack-range {
	flex: 1 1 auto;
	min-width: 160px;
	accent-color: var(--fh-accent);
	margin: 0;
}

.fh__stack-window {
	font-family: var(--fh-mono);
	font-size: 11px;
	color: var(--fh-ink-3);
	white-space: nowrap;
}

.fh__stack-preview {
	color: var(--fh-accent);
}

.fh__stack-history {
	margin: 0;
	padding: 4px 0 0 18px;
	font-size: 11px;
	color: var(--fh-ink-2);
	display: grid;
	gap: 2px;
}

.fh__stack-history-step {
	display: flex;
	align-items: center;
	gap: 6px;
}

.fh__stack-history-step.is-current {
	color: var(--fh-ink);
	font-weight: 600;
}

.fh__stack-anchors {
	flex: 1 1 100%;
	font-size: 12px;
}

.fh__stack-anchor-list {
	list-style: none;
	margin: 4px 0 0;
	padding: 0;
	display: grid;
	gap: 2px;
}

.fh__stack-anchor {
	display: flex;
	align-items: center;
	gap: 8px;
}

.fh__stack-anchor-go {
	flex: 1 1 auto;
	min-width: 0;
	padding: 2px 0;
	border: 0;
	background: none;
	color: var(--fh-ink);
	font: inherit;
	text-align: left;
	cursor: pointer;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fh__stack-anchor.is-proposed strong {
	font-style: italic;
	color: var(--fh-ink-2);
}

/* Selected · N ---------------------------------------------------------- */

.fh__multibar {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin: 0;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 0;
	width: auto;
	max-width: 100%;
}

.fh__multibar-count {
	font-size: 11px;
	font-weight: 600;
	color: var(--fh-ink-2);
	margin: 0 2px 0 4px;
	white-space: nowrap;
}

/* Isolate, and the rest of the set ---------------------------------------- */

.fh__tile.is-dimmed,
.fh__lane.is-dimmed {
	opacity: 0.25;
}

.fh__cam.is-dimmed {
	opacity: 0.18;
}

.fh__tile.is-inset,
.fh__lane.is-inset {
	outline: 2px solid var(--fh-accent);
	outline-offset: -2px;
	background: color-mix(in srgb, var(--fh-accent) 10%, transparent);
}

.fh__cam.is-inset {
	box-shadow: 0 0 0 3px var(--fh-accent), 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* GPT comparison-player diagnostics ---------------------------------- */
.fh__stack-provider {
	flex: 0 0 auto;
	padding: 1px 5px;
	border: 1px solid var(--fh-line);
	border-radius: 999px;
	font-family: var(--fh-mono);
	font-size: 11px;
	letter-spacing: 0.02em;
	color: var(--fh-ink-2);
	white-space: nowrap;
}

.fh__stack-provider.is-error {
	border-color: currentColor;
	font-weight: 600;
}

.fh__stack-frame--portrait {
	object-fit: contain;
}

.fh__stack-acts .is-active {
	border-color: var(--fh-accent);
	color: var(--fh-accent);
}

/* GPT7 dedicated Compare document ------------------------------------ */
.fh__root[data-view='compare'] {
	background: var(--fh-bg);
}

.fh__compare-page {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: var(--fh-bg);
}

.fh__compare-page-head {
	flex: 0 0 54px;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0 14px;
	border-bottom: 1px solid var(--fh-line);
	background: var(--fh-bg-2);
}

.fh__compare-page-brand {
	font-weight: 700;
	white-space: nowrap;
}

.fh__compare-page-title {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 14px;
}

.fh__compare-page-count {
	margin-left: auto;
	font-family: var(--fh-mono);
	font-size: 11px;
	color: var(--fh-ink-3);
	white-space: nowrap;
}

.fh__compare-page-main {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
}

.fh__root[data-view='compare'] .fh__stack {
	background: var(--fh-bg);
	backdrop-filter: none;
	box-shadow: none;
	border-top: 0;
}

.fh__root[data-view='compare'] .fh__stack-panes {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
	align-content: start;
	align-items: start;
	gap: 12px;
	padding: 12px;
}

.fh__root[data-view='compare'] .fh__stack-pane {
	width: 100%;
	min-width: 0;
	max-width: none;
	padding: 8px;
}

.fh__root[data-view='compare'] .fh__stack-media {
	min-height: 220px;
	max-height: 52vh;
}

.fh__root[data-view='compare'] .fh__stack-foot {
	padding: 8px 12px 12px;
	background: var(--fh-bg-2);
}

.fh__compare-page-error {
	max-width: 520px;
	margin: 12vh auto 0;
	padding: 24px;
	text-align: center;
	border: 1px solid var(--fh-line);
	border-radius: var(--fh-radius);
	background: var(--fh-bg-2);
}

@media (max-width: 900px) {
	.fh__compare-page-head { gap: 8px; padding: 0 8px; }
	.fh__compare-page-brand { display: none; }
	.fh__root[data-view='compare'] .fh__stack-panes { grid-template-columns: 1fr; }
	.fh__root[data-view='compare'] .fh__stack-media { min-height: 180px; max-height: 42vh; }
}

/* GPT12 — edge workspaces can collapse for a map-first view. */
.fh__stage {
	position: relative;
}

.fh__lower-dock {
	position: relative;
	flex: 0 0 auto;
	min-height: 0;
}

.fh__lower-dock-tab {
	position: absolute;
	left: 12px;
	top: -28px;
	z-index: 24;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 28px;
	padding: 0 10px;
	border: 1px solid var(--fh-line-2);
	border-bottom: 0;
	border-radius: 7px 7px 0 0;
	background: var(--fh-bg-2);
	color: var(--fh-ink-2);
	box-shadow: 0 -3px 12px rgba(0,0,0,.08);
	font: inherit;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	cursor: pointer;
}

.fh__lower-dock-tab:hover {
	color: var(--fh-ink);
	border-color: var(--fh-accent);
}

.fh__lower-dock-tab .fh__icon {
	width: 14px;
	height: 14px;
}

.fh__lower-dock.is-collapsed {
	height: 0;
	min-height: 0;
	border: 0;
	background: transparent;
	overflow: visible;
}

.fh__lower-dock.is-collapsed > .fh__time,
.fh__lower-dock.is-collapsed > .fh__strip {
	display: none;
}

.fh__lower-dock.is-collapsed .fh__lower-dock-tab {
	top: -28px;
	border-bottom: 1px solid var(--fh-line-2);
	border-radius: 7px 7px 0 0;
	box-shadow: 0 -3px 12px rgba(0,0,0,.08);
}

.fh__edge-label {
	white-space: nowrap;
}


/* GPT40 — lower workbench reads Evidence first, Timeline second. */
.fh__lower-dock:not(.is-collapsed) {
	display: flex;
	flex-direction: column;
}

/* GPT50: switcher actions can be links as well as buttons. */
a.fh__switcher-new {
	text-decoration: none;
	cursor: pointer;
}


/* 1.24.4 — what a Story scene rests on, shown under the narration. */
.fh__story-basis {
	margin: 6px 0 0;
	font-size: 12px;
	line-height: 1.4;
	opacity: 0.78;
}
.fh__story-ai-note {
	margin: 8px 0 0;
	font-size: 12px;
	line-height: 1.4;
	opacity: 0.7;
}

/* One rule for every FirstHand stylesheet: people who ask for less motion get none. */
@media (prefers-reduced-motion: reduce) {
	.fh__root *,
	.fh__root *::before,
	.fh__root *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}


/* 1.24.5 — editing a scene's words and directing the writer. */
.fh__story-editor-block { display: grid; gap: 6px; margin: 8px 0 12px; }
.fh__story-editor-label { display: block; font-size: 12px; opacity: 0.8; }
.fh__story-text-edit,
.fh__story-guidance { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; font-size: 14px; line-height: 1.4; }
.fh__story-editor-block .fh__btn { justify-self: start; }


/* 1.24.6 — the invitation to play an Event's Story. */
.fh__story-invite {
	position: fixed;
	left: 50%;
	/* Clear of the timeline and evidence strip, in the middle of the map. */
	top: 50%;
	transform: translate(-50%, -50%);
	z-index: 70;
	width: min( 440px, calc( 100vw - 32px ) );
	box-sizing: border-box;
	padding: 20px 22px 16px;
	border-radius: 14px;
	background: var(--fh-bg-2, #161a20);
	color: var(--fh-ink, #e9edf3);
	border: 1px solid var(--fh-line-2, #333b47);
	box-shadow: 0 18px 50px rgba(0,0,0,0.45);
	animation: fh-story-invite-in 260ms ease-out both;
}
@keyframes fh-story-invite-in {
	from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)); }
	to   { opacity: 1; transform: translate(-50%, -50%); }
}
.fh__story-invite-kicker { margin: 0 0 4px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; }
.fh__story-invite-title  { margin: 0 28px 6px 0; font-size: 20px; line-height: 1.25; font-weight: 600; }
.fh__story-invite-meta   { margin: 0 0 14px; font-size: 13px; opacity: 0.8; }
.fh__story-invite-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fh__story-invite-play   { font-size: 15px; padding: 10px 18px; }
.fh__story-invite-note   { margin: 12px 0 0; font-size: 12px; line-height: 1.4; opacity: 0.65; }
.fh__story-invite-close  {
	position: absolute; top: 8px; right: 10px;
	width: 32px; height: 32px;
	border: 0; border-radius: 8px;
	background: transparent; color: inherit;
	font-size: 22px; line-height: 1; cursor: pointer; opacity: 0.7;
}
.fh__story-invite-close:hover { opacity: 1; }
