/* HH Recorder — front end
   Stage is dark on purpose: a bright UI leaks light into whatever the user
   is capturing, and a field-recorder look makes the transport controls read
   instantly. Everything the user reads later (library, account) is on paper. */

.hhrec {
	--hh-ink: #16181d;
	--hh-panel: #1e2129;
	--hh-panel-2: #252932;
	--hh-line: #2c313b;
	--hh-paper: #f7f6f3;
	--hh-paper-line: #e4e1da;
	--hh-sage: #2f6f62;
	--hh-sage-lift: #3d8574;
	--hh-signal: #e5484d;
	--hh-amber: #e0a73d;
	--hh-muted: #8a919a;
	--hh-muted-dark: #66707a;

	--hh-display: "Space Grotesk", "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
	--hh-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--hh-mono: "JetBrains Mono", "SF Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;

	--hh-r: 10px;
	--hh-r-lg: 16px;

	font-family: var(--hh-body);
	color: var(--hh-ink);
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

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

.hhrec :focus-visible {
	outline: 2px solid var(--hh-sage-lift);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ------------------------------------------------------------------ atoms */

.hhrec-eyebrow {
	font-family: var(--hh-mono);
	font-size: 11px;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--hh-muted);
	margin: 0 0 8px;
}

.hhrec-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .01em;
	margin: 0 0 6px;
}
.hhrec-label--sub { margin-top: 16px; }

.hhrec-hint {
	font-size: 12.5px;
	color: var(--hh-muted-dark);
	margin: 8px 0 0;
}

.hhrec-input {
	width: 100%;
	font: inherit;
	font-size: 14px;
	padding: 10px 12px;
	border-radius: var(--hh-r);
	border: 1px solid var(--hh-paper-line);
	background: #fff;
	color: var(--hh-ink);
}
.hhrec-input:focus { border-color: var(--hh-sage); outline: none; box-shadow: 0 0 0 3px rgba(47,111,98,.14); }

.hhrec-check {
	display: flex;
	align-items: center;
	gap: 9px;
	font-size: 13.5px;
	margin-top: 10px;
	cursor: pointer;
}
.hhrec-check input { accent-color: var(--hh-sage); width: 16px; height: 16px; }

.hhrec-range { width: 100%; accent-color: var(--hh-sage); margin-top: 4px; }

.hhrec-btn {
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .01em;
	padding: 11px 18px;
	border-radius: var(--hh-r);
	border: 1px solid transparent;
	cursor: pointer;
	background: #fff;
	color: var(--hh-ink);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: background .15s ease, border-color .15s ease, transform .08s ease;
}
.hhrec-btn:active { transform: translateY(1px); }
.hhrec-btn[disabled] { opacity: .45; cursor: not-allowed; }

.hhrec-btn--primary { background: var(--hh-sage); color: #fff; }
.hhrec-btn--primary:hover { background: var(--hh-sage-lift); }
.hhrec-btn--ghost { background: transparent; border-color: var(--hh-line); color: #d6dae0; }
.hhrec-btn--ghost:hover { background: rgba(255,255,255,.06); }
.hhrec-btn--quiet { background: transparent; color: var(--hh-muted); border-color: transparent; }
.hhrec-btn--quiet:hover { color: var(--hh-ink); }
.hhrec-btn--block { width: 100%; margin-top: 6px; }

.hhrec-btn--rec { background: var(--hh-signal); color: #fff; padding-left: 22px; padding-right: 22px; }
.hhrec-btn--rec:hover { background: #ef5b60; }
.hhrec-btn--stop { background: #fff; color: var(--hh-ink); }

.hhrec-link {
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	font-size: 13.5px;
	color: var(--hh-sage);
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.hhrec-notice,
.hhrec-alert {
	border-radius: var(--hh-r);
	padding: 11px 14px;
	font-size: 13.5px;
	margin: 0 0 16px;
	background: rgba(47,111,98,.1);
	border: 1px solid rgba(47,111,98,.25);
}
.hhrec-alert[data-tone="error"] { background: rgba(229,72,77,.09); border-color: rgba(229,72,77,.3); }
.hhrec-alert[data-tone="warn"] { background: rgba(224,167,61,.12); border-color: rgba(224,167,61,.35); }

.hhrec-progress {
	margin-top: 16px;
	position: relative;
	height: 6px;
	border-radius: 99px;
	background: rgba(255,255,255,.12);
	overflow: hidden;
}
.hhrec-progress i {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	background: var(--hh-sage-lift);
	transition: width .2s ease;
}
.hhrec-progress span {
	position: absolute;
	top: 12px;
	left: 0;
	font-family: var(--hh-mono);
	font-size: 11.5px;
	color: var(--hh-muted);
}

/* ----------------------------------------------------------------- studio */

.hhrec-studio {
	background: var(--hh-ink);
	border-radius: var(--hh-r-lg);
	padding: 20px;
	color: #e8eaed;
	position: relative;
}

.hhrec-studio__grid {
	display: grid;
	grid-template-columns: 320px minmax(0, 1fr);
	gap: 20px;
	align-items: start;
}

.hhrec-rail {
	background: var(--hh-panel);
	border: 1px solid var(--hh-line);
	border-radius: var(--hh-r-lg);
	padding: 20px;
	max-height: 78vh;
	overflow-y: auto;
}
.hhrec-rail .hhrec-label { color: #e8eaed; }
.hhrec-rail .hhrec-input {
	background: var(--hh-panel-2);
	border-color: var(--hh-line);
	color: #e8eaed;
}
.hhrec-rail .hhrec-hint { color: var(--hh-muted); }
.hhrec-rail__head { margin-bottom: 20px; }
.hhrec-rail__title {
	font-family: var(--hh-display);
	font-size: 20px;
	font-weight: 600;
	letter-spacing: -.015em;
	margin: 0;
	color: #fff;
}
.hhrec-field + .hhrec-field { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--hh-line); }

.hhrec-seg {
	display: flex;
	gap: 4px;
	background: var(--hh-panel-2);
	padding: 4px;
	border-radius: var(--hh-r);
	border: 1px solid var(--hh-line);
}
.hhrec-seg__btn {
	flex: 1;
	font: inherit;
	font-size: 12.5px;
	font-weight: 550;
	padding: 8px 6px;
	border: 0;
	border-radius: 7px;
	background: transparent;
	color: var(--hh-muted);
	cursor: pointer;
	white-space: nowrap;
}
.hhrec-seg__btn.is-on { background: var(--hh-sage); color: #fff; }
.hhrec-seg--tight .hhrec-seg__btn { padding: 7px 4px; }

.hhrec-bg { display: flex; flex-wrap: wrap; gap: 6px; }
.hhrec-bg__chip {
	font: inherit;
	font-size: 12px;
	padding: 7px 11px;
	border-radius: 99px;
	border: 1px solid var(--hh-line);
	background: var(--hh-panel-2);
	color: var(--hh-muted);
	cursor: pointer;
}
.hhrec-bg__chip.is-on { border-color: var(--hh-sage); color: #fff; background: rgba(47,111,98,.28); }
.hhrec-bg__upload { display: inline-flex; align-items: center; }

.hhrec-presets { display: grid; gap: 8px; }
.hhrec-preset {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	text-align: left;
	font: inherit;
	padding: 11px 13px;
	border-radius: var(--hh-r);
	border: 1px solid var(--hh-line);
	background: var(--hh-panel-2);
	color: #e8eaed;
	cursor: pointer;
}
.hhrec-preset.is-on { border-color: var(--hh-sage); background: rgba(47,111,98,.2); }
.hhrec-preset b { font-size: 13.5px; font-weight: 600; display: block; }
.hhrec-preset span {
	font-family: var(--hh-mono);
	font-size: 11px;
	color: var(--hh-muted);
	white-space: nowrap;
}

.hhrec-budget {
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid var(--hh-line);
	font-size: 12.5px;
	color: var(--hh-muted);
}
.hhrec-budget__row { display: flex; justify-content: space-between; margin-bottom: 7px; }
.hhrec-budget__row strong { color: #e8eaed; font-family: var(--hh-mono); font-size: 12px; }
.hhrec-budget__row--sub { margin: 7px 0 0; font-family: var(--hh-mono); font-size: 11px; }
.hhrec-meter { height: 4px; border-radius: 99px; background: var(--hh-line); overflow: hidden; }
.hhrec-meter i { display: block; height: 100%; background: var(--hh-sage-lift); transition: width .3s ease; }
.hhrec-meter i[data-over="1"] { background: var(--hh-amber); }

/* stage */

.hhrec-stage { min-width: 0; }
.hhrec-stage__frame {
	position: relative;
	aspect-ratio: 16 / 9;
	background: #0d0f13;
	border: 1px solid var(--hh-line);
	border-radius: var(--hh-r-lg);
	overflow: hidden;
}
.hhrec-stage__video { width: 100%; height: 100%; object-fit: contain; display: block; background: #0d0f13; }
.hhrec-stage__empty {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 32px;
}
.hhrec-stage__emptytext { max-width: 42ch; color: var(--hh-muted); font-size: 14px; margin: 0; }

/* the draggable camera bubble */
.hhrec-bubble {
	position: absolute;
	left: 4%;
	bottom: 6%;
	width: 18%;
	aspect-ratio: 1;
	cursor: grab;
	touch-action: none;
	border: 2px solid rgba(255,255,255,.85);
	box-shadow: 0 10px 30px rgba(0,0,0,.45);
	overflow: hidden;
	background: #0d0f13;
}
.hhrec-bubble[data-shape="circle"] { border-radius: 50%; }
.hhrec-bubble[data-shape="square"] { border-radius: 14px; }
.hhrec-bubble[data-shape="wide"] { border-radius: 14px; aspect-ratio: 16 / 9; }
.hhrec-bubble.is-dragging { cursor: grabbing; border-color: var(--hh-sage-lift); }
.hhrec-bubble video,
.hhrec-bubble canvas {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transform: scaleX(-1);
}
.hhrec-bubble canvas { position: absolute; inset: 0; }
.hhrec-bubble__grab {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	box-shadow: inset 0 0 0 0 rgba(47,111,98,0);
	transition: box-shadow .15s ease;
}
.hhrec-bubble:hover .hhrec-bubble__grab { box-shadow: inset 0 0 0 3px rgba(47,111,98,.6); }

.hhrec-countdown {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	background: rgba(13,15,19,.72);
	backdrop-filter: blur(2px);
}
.hhrec-countdown span {
	font-family: var(--hh-mono);
	font-size: clamp(56px, 12vw, 120px);
	font-weight: 700;
	color: #fff;
	font-variant-numeric: tabular-nums;
}

.hhrec-textarea { resize: vertical; min-height: 84px; line-height: 1.5; }

.hhrec-keys {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 6px 12px;
	margin: 0;
	font-size: 12.5px;
	color: var(--hh-muted);
}
.hhrec-keys dt {
	font-family: var(--hh-mono);
	font-size: 11px;
	background: var(--hh-panel-2);
	border: 1px solid var(--hh-line);
	border-radius: 5px;
	padding: 2px 7px;
	text-align: center;
}
.hhrec-keys dd { margin: 0; align-self: center; }

/* drawing */
.hhrec-stage__frame.is-drawing { cursor: crosshair; }

.hhrec-tools {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	align-items: center;
	margin-top: 10px;
	padding: 8px 12px;
	background: var(--hh-panel);
	border: 1px solid var(--hh-line);
	border-radius: var(--hh-r);
}
.hhrec-tools__group { display: flex; gap: 4px; align-items: center; }
.hhrec-tool {
	font: inherit;
	font-size: 12px;
	font-weight: 550;
	padding: 6px 11px;
	border-radius: 7px;
	border: 1px solid transparent;
	background: transparent;
	color: var(--hh-muted);
	cursor: pointer;
}
.hhrec-tool:hover { background: var(--hh-panel-2); color: #e8eaed; }
.hhrec-tool.is-on { background: var(--hh-sage); color: #fff; }
.hhrec-tool--check { display: inline-flex; align-items: center; gap: 6px; }
.hhrec-tool--check input { accent-color: var(--hh-sage); }

.hhrec-swatch {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 2px solid transparent;
	background: var(--c);
	cursor: pointer;
	padding: 0;
}
.hhrec-swatch.is-on { border-color: #fff; box-shadow: 0 0 0 2px var(--hh-panel), 0 0 0 3px var(--c); }

/* teleprompter — sits over the stage but never enters the frame */
.hhrec-prompter {
	position: absolute;
	left: 8%;
	right: 8%;
	top: 8%;
	height: 34%;
	overflow: hidden;
	background: rgba(13,15,19,.72);
	border: 1px solid rgba(255,255,255,.14);
	border-radius: 12px;
	padding: 16px 22px;
	pointer-events: none;
}
.hhrec-prompter__text {
	font-size: clamp(16px, 2.1vw, 26px);
	line-height: 1.5;
	color: #fff;
	white-space: pre-wrap;
	will-change: transform;
}

.hhrec-caption {
	position: absolute;
	left: 10%;
	right: 10%;
	bottom: 5%;
	margin: 0;
	text-align: center;
	font-size: clamp(13px, 1.5vw, 18px);
	color: #fff;
	background: rgba(13,15,19,.7);
	border-radius: 8px;
	padding: 7px 14px;
	pointer-events: none;
}

.hhrec-chapters {
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
	display: grid;
	gap: 6px;
}
.hhrec-chapters li {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--hh-panel);
	border: 1px solid var(--hh-line);
	border-radius: 8px;
	padding: 7px 12px;
}
.hhrec-chapters code {
	font-family: var(--hh-mono);
	font-size: 11.5px;
	color: var(--hh-muted);
	flex: none;
}
.hhrec-chapters input {
	flex: 1;
	background: transparent;
	border: 0;
	color: #e8eaed;
	font: inherit;
	font-size: 13px;
	padding: 2px 0;
}
.hhrec-chapters input:focus { outline: none; border-bottom: 1px solid var(--hh-sage-lift); }

/* transport dock — the signature element */
.hhrec-dock {
	margin-top: 14px;
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 20px;
	background: var(--hh-panel);
	border: 1px solid var(--hh-line);
	border-radius: var(--hh-r-lg);
	padding: 14px 18px;
}
.hhrec-dock__tc { display: flex; align-items: center; gap: 12px; }
.hhrec-rec {
	width: 11px;
	height: 11px;
	border-radius: 50%;
	background: var(--hh-line);
	flex: none;
}
.hhrec-studio[data-state="recording"] .hhrec-rec { background: var(--hh-signal); animation: hhrec-pulse 1.4s ease-in-out infinite; }
.hhrec-studio[data-state="paused"] .hhrec-rec { background: var(--hh-amber); }
@keyframes hhrec-pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
	.hhrec-studio[data-state="recording"] .hhrec-rec { animation: none; }
	.hhrec-btn, .hhrec-meter i, .hhrec-progress i { transition: none; }
}

.hhrec-tc {
	font-family: var(--hh-mono);
	font-size: 30px;
	font-weight: 600;
	letter-spacing: -.03em;
	font-variant-numeric: tabular-nums;
	color: #fff;
	line-height: 1;
}
.hhrec-dock__cap {
	font-family: var(--hh-mono);
	font-size: 11px;
	color: var(--hh-muted);
	letter-spacing: .04em;
}
.hhrec-vu { min-width: 0; height: 34px; }
.hhrec-vu canvas { width: 100%; height: 100%; display: block; }
.hhrec-dock__controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.hhrec-status {
	margin: 12px 2px 0;
	font-size: 13px;
	color: var(--hh-muted);
	min-height: 20px;
}
.hhrec-status[data-tone="error"] { color: #ff9a9d; }
.hhrec-status[data-tone="ok"] { color: #7fd1bd; }

/* finished panel */
.hhrec-done {
	position: absolute;
	inset: 0;
	background: rgba(13,15,19,.9);
	backdrop-filter: blur(3px);
	display: grid;
	place-items: center;
	padding: 24px;
	border-radius: var(--hh-r-lg);
	z-index: 5;
}
.hhrec-done__card {
	background: var(--hh-panel);
	border: 1px solid var(--hh-line);
	border-radius: var(--hh-r-lg);
	padding: 28px;
	max-width: 480px;
	width: 100%;
}
.hhrec-done__title {
	font-family: var(--hh-display);
	font-size: 22px;
	font-weight: 600;
	letter-spacing: -.015em;
	margin: 0 0 6px;
	color: #fff;
}
.hhrec-done__meta { font-family: var(--hh-mono); font-size: 12px; color: var(--hh-muted); margin: 0 0 14px; }
.hhrec-done__note { font-size: 13.5px; color: #b9c0c8; margin: 0 0 20px; }
.hhrec-done__note code {
	font-family: var(--hh-mono);
	font-size: 12px;
	background: var(--hh-panel-2);
	padding: 2px 6px;
	border-radius: 5px;
}
.hhrec-done__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.hhrec-gate {
	position: absolute;
	inset: 0;
	z-index: 8;
	background: rgba(13,15,19,.94);
	border-radius: var(--hh-r-lg);
	display: grid;
	place-items: center;
	text-align: center;
	padding: 32px;
}
.hhrec-gate__msg { max-width: 44ch; color: #e8eaed; margin: 0 0 18px; }

/* -------------------------------------------------------------- dashboard */

.hhrec-dash { background: var(--hh-paper); border-radius: var(--hh-r-lg); padding: 26px; }
.hhrec-dash__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.hhrec-dash__title,
.hhrec-auth__title {
	font-family: var(--hh-display);
	font-size: 26px;
	font-weight: 600;
	letter-spacing: -.02em;
	margin: 0;
}
.hhrec-dash__who { font-family: var(--hh-mono); font-size: 12px; color: var(--hh-muted-dark); text-align: right; }

.hhrec-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 22px 0; }
.hhrec-card {
	background: #fff;
	border: 1px solid var(--hh-paper-line);
	border-radius: var(--hh-r);
	padding: 14px 16px;
}
.hhrec-card b {
	display: block;
	font-family: var(--hh-mono);
	font-size: 19px;
	letter-spacing: -.02em;
	margin-bottom: 2px;
}
.hhrec-card span { font-size: 12px; color: var(--hh-muted-dark); }

.hhrec-dash__bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.hhrec-input--search { flex: 1; min-width: 200px; }

.hhrec-table { border: 1px solid var(--hh-paper-line); border-radius: var(--hh-r); background: #fff; overflow: hidden; }
.hhrec-row {
	display: grid;
	grid-template-columns: minmax(0,1fr) auto;
	gap: 14px;
	align-items: center;
	padding: 14px 16px;
	border-bottom: 1px solid var(--hh-paper-line);
}
.hhrec-row:last-child { border-bottom: 0; }
.hhrec-row__name { font-weight: 600; font-size: 14.5px; margin: 0 0 3px; word-break: break-word; }
.hhrec-row__meta { font-family: var(--hh-mono); font-size: 11.5px; color: var(--hh-muted-dark); margin: 0; }
.hhrec-row__actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.hhrec-row__actions .hhrec-btn { padding: 7px 12px; font-size: 12.5px; border-color: var(--hh-paper-line); }
.hhrec-row__actions .hhrec-btn--ghost { color: var(--hh-ink); }

.hhrec-tag {
	display: inline-block;
	font-family: var(--hh-mono);
	font-size: 10.5px;
	letter-spacing: .06em;
	text-transform: uppercase;
	padding: 3px 7px;
	border-radius: 5px;
	background: rgba(22,24,29,.06);
	color: var(--hh-muted-dark);
	margin-left: 8px;
	vertical-align: 2px;
}
.hhrec-tag--sealed { background: rgba(22,24,29,.08); }
.hhrec-tag--ready { background: rgba(47,111,98,.14); color: var(--hh-sage); }

.hhrec-empty { padding: 34px 20px; text-align: center; color: var(--hh-muted-dark); margin: 0; font-size: 14px; }
.hhrec-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; font-family: var(--hh-mono); font-size: 12px; }

.hhrec-modal { position: fixed; inset: 0; background: rgba(22,24,29,.55); display: grid; place-items: center; padding: 20px; z-index: 9999; }
.hhrec-modal__box { background: #fff; border-radius: var(--hh-r-lg); padding: 26px; max-width: 440px; width: 100%; }
.hhrec-modal__box h3 { font-family: var(--hh-display); font-size: 19px; margin: 0 0 8px; font-weight: 600; }
.hhrec-modal__body { font-size: 14px; color: var(--hh-muted-dark); margin: 0 0 18px; }
.hhrec-modal__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hhrec-modal__actions .hhrec-btn { border-color: var(--hh-paper-line); }
.hhrec-modal .hhrec-progress { background: var(--hh-paper-line); }
.hhrec-modal .hhrec-progress span { color: var(--hh-muted-dark); }

/* ---------------------------------------------------------------- account */

.hhrec-auth { max-width: 420px; margin: 0 auto; }
.hhrec-auth__card,
.hhrec-auth__signedin {
	background: #fff;
	border: 1px solid var(--hh-paper-line);
	border-radius: var(--hh-r-lg);
	padding: 28px;
}
.hhrec-auth__lede { font-size: 14px; color: var(--hh-muted-dark); margin: 6px 0 20px; }
.hhrec-auth__links { display: flex; gap: 16px; margin-top: 18px; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------- responsive */

@media (max-width: 900px) {
	.hhrec-studio__grid { grid-template-columns: 1fr; }
	.hhrec-rail { max-height: none; }
	.hhrec-dock { grid-template-columns: 1fr; gap: 12px; }
	.hhrec-dock__controls { justify-content: stretch; }
	.hhrec-dock__controls .hhrec-btn { flex: 1; }
	.hhrec-vu { height: 26px; }
}
@media (max-width: 560px) {
	.hhrec-studio, .hhrec-dash { padding: 14px; }
	.hhrec-tc { font-size: 24px; }
	.hhrec-row { grid-template-columns: 1fr; }
	.hhrec-row__actions { justify-content: flex-start; }
}
