/* HappyTheta — plain CSS (replaces Tailwind + Flowbite) */

/* ---------- reset (Tailwind preflight subset) ---------- */
*, *::before, *::after { box-sizing: border-box; border: 0 solid #e5e7eb; }
html, body { height: auto; margin: 0; padding: 0; width: 100%; }
html {
	line-height: 1.5;
	-webkit-text-size-adjust: 100%;
	font-family: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}
h1, h2, h3, p, ul, hr { margin: 0; padding: 0; }
ul { list-style: none; }
button, input { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; background: transparent; padding: 0; }
button:disabled { cursor: not-allowed; }
img, svg, canvas, object { display: block; }
a { color: inherit; text-decoration: inherit; }

/* ---------- app shell ---------- */
.app {
	min-height: 100vh;
	max-width: 100%;
	overflow-x: hidden;
	min-width: 40rem;
	background-image: linear-gradient(to bottom, #ffffff, #bfdbfe);
	padding-bottom: 2rem;
}

.navbar { background: #fff; color: #6b7280; padding: 0.625rem 1rem; width: 100%; }
.navbar-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; margin: 0 auto; }
.navbar-brand object, .navbar-brand img { max-height: 3rem; height: 3rem; width: auto; pointer-events: none; }
.navbar-brand { display: flex; align-items: center; }
.nav-hamburger {
	margin-left: 4rem; padding: 0.5rem; border-radius: 0.5rem; color: #6b7280; display: none;
}
.nav-hamburger:hover { background: #f3f4f6; }
.nav-hamburger svg { width: 1.5rem; height: 1.5rem; }
.nav-links { width: auto; }
.nav-links ul { display: flex; flex-direction: row; gap: 2rem; font-size: 0.875rem; font-weight: 500; }
.nav-links a { display: block; color: #374151; border-radius: 0.25rem; }
.nav-links a:hover { color: #1d4ed8; }

@media (max-width: 767px) {
	.nav-hamburger { display: inline-flex; }
	.nav-links { display: none; width: 100%; }
	.nav-links.open { display: block; }
	.nav-links ul { flex-direction: column; gap: 0; padding: 1rem; margin-top: 1rem; }
	.nav-links a { padding: 0.5rem 1rem 0.5rem 0.75rem; }
	.nav-links a:hover { background: #f3f4f6; color: #374151; }
}

/* ---------- home ---------- */
.card {
	background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 0.5rem;
	box-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);
	padding: 1.5rem; width: max-content; margin: 5rem auto;
}
.card h1 { font-size: 1.875rem; line-height: 2.25rem; width: max-content; }
.card p { margin: 1rem 0; }

/* ---------- figures shell ---------- */
.figures-wrap { width: 75%; margin: 0 auto; }
.btn-group { width: 100%; display: flex; flex-direction: row; justify-content: flex-end; gap: 1px; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-top-left-radius: 0.5rem; border-bottom-left-radius: 0.5rem; }
.btn-group .btn:last-child { border-top-right-radius: 0.5rem; border-bottom-right-radius: 0.5rem; }

.toggle { margin: 0.5rem; display: flex; flex-direction: row; justify-content: flex-end; align-items: center; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track {
	position: relative; width: 2.75rem; height: 1.5rem; background: #e5e7eb; border-radius: 9999px; transition: background .15s;
}
.toggle .track::after {
	content: ''; position: absolute; top: 2px; left: 2px; width: 1.25rem; height: 1.25rem; background: #fff;
	border: 1px solid #d1d5db; border-radius: 9999px; transition: transform .15s;
}
.toggle input:checked + .track { background: #2563eb; }
.toggle input:checked + .track::after { transform: translateX(100%); border-color: #fff; }
.toggle input:focus-visible + .track { box-shadow: 0 0 0 4px #bfdbfe; }
.toggle .toggle-label { margin-left: 0.75rem; font-size: 0.875rem; font-weight: 500; color: #111827; }

#capture { width: 100%; margin: 0 auto; }

/* element controls (the "Show Element Controls" toggle) */
body:not(.show-ctrl) .ctrl-only { display: none !important; }

/* ---------- buttons ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
	padding: 0.625rem 1.25rem; font-size: 0.875rem; font-weight: 500; line-height: 1.25rem;
	border-radius: 0.5rem; text-align: center; white-space: nowrap;
}
.btn svg { width: 1.5rem; height: 1.5rem; flex: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px #d1d5db; }
.btn:disabled { opacity: 0.5; }
.btn-xs { padding: 0.5rem 0.75rem; font-size: 0.75rem; }
.btn-xs svg { width: 0.75rem; height: 0.75rem; }
.btn-dark { background: #1f2937; color: #fff; }
.btn-dark:hover:not(:disabled) { background: #111827; }
.btn-alt { background: #fff; color: #111827; border: 1px solid #e5e7eb; }
.btn-alt:hover:not(:disabled) { background: #f3f4f6; color: #1d4ed8; }
.btn-light { background: #fff; color: #111827; border: 1px solid #d1d5db; }
.btn-light:hover:not(:disabled) { background: #f3f4f6; }
.btn-blue { background: #1d4ed8; color: #fff; }
.btn-blue:hover:not(:disabled) { background: #1e40af; }
.btn-red { background: #b91c1c; color: #fff; }
.btn-red:hover:not(:disabled) { background: #991b1b; }
.btn-plain-blue { background: #3b82f6; color: #fff; padding: 0.5rem 1rem; border-radius: 0.25rem; }
.btn-plain-red { background: #ef4444; color: #fff; padding: 0.5rem 1rem; border-radius: 0.25rem; }
.w-full { width: 100%; }

/* tooltips */
[data-tip] { position: relative; }
[data-tip]:hover::after {
	content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
	background: #111827; color: #fff; font-size: 0.875rem; font-weight: 500; padding: 0.5rem 0.75rem;
	border-radius: 0.5rem; white-space: nowrap; z-index: 50; pointer-events: none;
	box-shadow: 0 1px 2px rgb(0 0 0 / .05);
}

/* ---------- editable label ---------- */
.edit-label { display: flex; flex-direction: row; }
.edit-label .btn { padding: 0; margin: 0 0.75rem; }
.edit-label .btn svg { width: 0.75rem; height: 0.75rem; margin: 0.25rem; }
.edit-label .label-text { font-weight: 700; width: 100%; outline: none; }
.edit-label .label-text.not-editing { user-select: none; }
.edit-label .label-text.editing { background: #fff; }
.edit-label .label-text.vertical { writing-mode: vertical-rl; transform: rotate(180deg); width: auto; white-space: nowrap; }
.edit-label:has(.vertical) { align-items: center; }
.size-xl2 { font-size: 1.875rem; line-height: 2.25rem; }
.size-xl { font-size: 1.5rem; line-height: 2rem; }
.size-lg { font-size: 1.25rem; line-height: 1.75rem; }
.size-md { font-size: 1.125rem; line-height: 1.75rem; }
.size-sm { font-size: 1rem; line-height: 1.5rem; }
.size-xs { font-size: 0.875rem; line-height: 1.25rem; }

.panel { display: flex; flex-direction: column; background: #f3f4f6; width: 100%; border-radius: 0.75rem;
	box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1); }
.panel.center { align-items: center; }
.panel.square { border-radius: 0; }
.panel.pad { padding: 1rem; }

.stage-container { margin: 0 auto; }
canvas.ht-stage { user-select: none; touch-action: none; }

.figure-list > li { padding: 1rem 0; }
.figure-list.fbd > li { padding: 0 0 1rem; }
.label-bold { font-weight: 700; user-select: none; }

/* ---------- free body diagram ---------- */
.fbd-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
.fbd-left { padding: 0 1rem; display: flex; flex-direction: column; flex-wrap: wrap; }
.fbd-left .label-bold { margin-left: 1rem; }
.tao-chart { max-width: 32rem; padding: 0 1rem; }
.tao-chart-title { font-weight: 700; display: flex; border-radius: 0.75rem; }
.tao-empty { margin: 1rem auto; padding: 0.5rem; font-size: 1.25rem; line-height: 1.75rem; font-weight: 700; border-radius: 0.75rem; }
.tao-empty p + p { font-size: 0.875rem; line-height: 1.25rem; }
.tao-row {
	display: grid; grid-template-columns: 0.25fr 1fr 2fr 2fr 2fr 0.25fr; gap: 0.5rem;
	padding: 0.625rem; margin: 0.25rem; font-weight: 700; border-radius: 0.75rem;
}
.tao-row > div { margin: 0 auto; }
.tao-row .icon-btn { color: #fff; width: 0; overflow: visible; display: flex; align-items: center; }
.tao-row .icon-btn:first-child { margin-left: 0.5rem; }
.tao-row .icon-btn svg { width: 1.25rem; height: 1.25rem; flex: none; }
.tao-row input {
	display: block; width: 100%; margin: auto 0; font-size: 0.875rem; border-radius: 0.5rem; border: 1px solid #d1d5db;
	background: #f9fafb; color: #111827; padding: 0.625rem; font-weight: 400;
}
.hr-label { display: flex; align-items: center; justify-content: center; position: relative; width: 100%; }
.hr-label hr { width: 12rem; height: 0.25rem; margin: 1.75rem auto; background: #e5e7eb; border: 0; border-radius: 0.25rem; }
@media (min-width: 768px) { .hr-label hr { margin: 2.5rem auto; } }
.hr-label span { position: absolute; left: 50%; transform: translateX(-50%); padding: 0 0.75rem; font-weight: 500; color: #111827; background: #fff; }
.net-force {
	margin-top: 1rem; padding: 1rem; width: 100%; display: inline-flex; justify-content: center;
	font-weight: 700; font-size: 1.25rem; line-height: 1.75rem; background: #6b7280; color: #fff; border-radius: 0.75rem;
}

/* ---------- energy ---------- */
.add-row { display: flex; flex-direction: row; justify-content: space-around; padding: 1rem 0; }
.energy-title { margin-left: 1rem; font-size: 1.125rem; line-height: 1.75rem; font-weight: 700; }

/* ---------- graph maker ---------- */
.gm-hint { font-size: 0.875rem; color: #4b5563; margin: 0 0.5rem 0.5rem; }
.gm-groups { display: flex; flex-direction: column; gap: 1rem; }
.gm-group {
	display: flex; align-items: stretch; gap: 0.75rem; background: #f3f4f6; border-radius: 0.75rem; padding: 0.75rem;
	box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
}
.gm-group-side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
	padding-right: 0.75rem; border-right: 2px solid #e5e7eb; min-width: 3rem; }
.gm-group-side .edit-label { flex-direction: column; gap: 0.25rem; }
.gm-group-side .edit-label .btn { margin: 0; }
.gm-group-ctrls { display: flex; flex-direction: column; gap: 0.375rem; }
.gm-graphs { flex: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-evenly; gap: 1rem; min-width: 0; }
.qg-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 0.5rem 0.75rem 0.5rem 0.5rem; }
.qg-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-height: 2rem; padding-left: 1.75rem; }
.qg-head .edit-label .btn { margin: 0 0.5rem 0 0; }
.qg-ctrls { display: flex; gap: 1px; }
.qg-ctrls .btn { border-radius: 0; padding: 0.4rem 0.55rem; }
.qg-ctrls .btn:first-child { border-radius: 0.375rem 0 0 0.375rem; }
.qg-ctrls .btn:last-child { border-radius: 0 0.375rem 0.375rem 0; }
.qg-body { display: grid; grid-template-columns: 1.75rem auto; }
.qg-ylabel {
	writing-mode: vertical-rl; transform: rotate(180deg); align-self: stretch; display: flex; align-items: center; justify-content: center;
	font-weight: 600; font-size: 0.95rem; user-select: none; border-radius: 0.25rem;
}
.qg-ylabel:hover { background: #f3f4f6; }
.qg-stage canvas { cursor: crosshair; }
.qg-xlabel { text-align: center; font-weight: 600; font-size: 0.95rem; color: #374151; user-select: none; padding-top: 0.125rem; }
.gm-add-graph {
	width: 3rem; height: 3rem; border-radius: 9999px; border: 2px dashed #9ca3af; color: #6b7280;
	display: flex; align-items: center; justify-content: center; flex: none;
}
.gm-add-graph:hover { border-color: #1d4ed8; color: #1d4ed8; background: #eff6ff; }
.gm-add-graph svg { width: 1.5rem; height: 1.5rem; }
.gm-add-group { margin-top: 1rem; }

/* ---------- gif maker ---------- */
.gif-box { margin: 0 auto; width: 80%; display: flex; flex-direction: column; background: #f3f4f6; border-radius: 0.75rem;
	box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1); align-items: center; }
.gif-title { padding: 0.75rem; margin-left: 1rem; font-size: 1.125rem; line-height: 1.75rem; font-weight: 700; }
.gif-view { display: flex; flex-direction: row; background: #bbf7d0; padding: 0.75rem; margin: 0.75rem; min-height: 10rem; align-items: stretch; }
.main-view { min-width: 10rem; padding: 1rem; flex: 1; display: flex; align-items: center; justify-content: center; position: relative; }
.main-view img { object-fit: contain; width: 100%; height: 100%; max-height: 24rem; max-width: 100%; }
.no-image { width: 100%; height: 10rem; background: #d1d5db; display: flex; align-items: center; justify-content: center; color: #6b7280; padding: 0 1rem; }
.thumbs { display: flex; flex-direction: column; padding: 0.5rem; gap: 0.5rem; overflow-y: scroll; max-height: 26rem; }
.thumbs .thumbs-title { font-size: 0.875rem; font-weight: 600; }
.thumb { position: relative; padding: 0.5rem; background: #fef9c3; }
.thumb .pick { padding: 0.25rem 0.5rem; font-size: 0.75rem; border-radius: 0.25rem; background: #e5e7eb; cursor: pointer; }
.thumb .pick:hover { background: #d1d5db; }
.thumb .pick.selected { background: #3b82f6; color: #fff; }
.thumb .pick img { max-width: 100%; max-height: 2.5rem; object-fit: contain; }
.thumb .remove { position: absolute; top: 0; right: 0; padding: 0.25rem; }
.thumb .remove button { background: #ef4444; color: #fff; border-radius: 0.25rem; padding: 0.125rem 0.25rem; font-size: 0.75rem; }
.gif-form { width: 50%; margin: 1rem; }
.gif-form label.upload-label { display: block; padding: 0.5rem; font-size: 0.875rem; font-weight: 500; color: #111827; }
.file-input {
	display: block; width: 100%; font-size: 0.875rem; color: #fff; border: 1px solid #d1d5db; border-radius: 0.5rem;
	cursor: pointer; background: #fff;
}
.file-input::file-selector-button {
	background: #1f2937; color: #fff; border: 0; padding: 0.625rem 1rem; margin-right: 1rem; cursor: pointer;
	border-top-left-radius: 0.5rem; border-bottom-left-radius: 0.5rem; font-weight: 500;
}
.file-input::file-selector-button:hover { background: #374151; }
.helper { margin-top: 0.5rem; font-size: 0.875rem; color: #6b7280; }
.gif-form input[type=range] { width: 100%; }
.title-row { width: 100%; display: flex; flex-direction: row; }
.title-row label { padding-right: 1rem; margin: auto 0; }
.title-row input { flex-grow: 1; border: 1px solid #d1d5db; border-radius: 0.25rem; padding: 0 0.5rem; }
#gif-preview { margin: 0 auto; padding: 0.75rem 0; }
.gif-buttons { display: flex; gap: 0.5rem; }
.gif-buttons .btn { margin-top: 1rem; }

/* ---------- advanced graph maker ---------- */
.agm { width: 75%; margin: 0 auto; padding-top: 1rem; }
.agm-title { font-size: 1.875rem; line-height: 2.25rem; font-weight: 700; margin-bottom: 1rem; }
.agm-top { display: grid; grid-template-columns: minmax(0, 3fr) minmax(14rem, 1fr); gap: 1.5rem; align-items: start; }
.agm-preview { background: #f3f4f6; border-radius: 0.75rem; padding: 0.75rem; display: flex; justify-content: center;
	box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
	background-image: linear-gradient(45deg, #e5e7eb 25%, transparent 25%), linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #e5e7eb 75%), linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
	background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
.agm-canvas { touch-action: none; }
.agm-side { display: flex; flex-direction: column; gap: 0.75rem; }
.agm-hint { font-size: 0.95rem; color: #374151; }
.agm-export { display: flex; flex-direction: column; gap: 0.5rem; }
.agm-note { font-size: 0.875rem; color: #4b5563; }
.agm-status { font-size: 0.875rem; color: #047857; min-height: 1.25rem; }
.agm-settings { margin: 1.5rem 0 2rem; display: flex; flex-direction: column; gap: 0.5rem; }
.agm-sec { background: #f3f4f6; border-radius: 0.75rem; box-shadow: 0 1px 3px rgb(0 0 0 / .1); overflow: visible; }
.agm-sec > summary { cursor: pointer; list-style: none; background: #1f2937; color: #fff; padding: 0.6rem 1rem;
	border-radius: 0.75rem; font-weight: 600; font-size: 1.05rem; user-select: none; }
.agm-sec > summary::-webkit-details-marker { display: none; }
.agm-sec > summary::before { content: '▸'; display: inline-block; width: 1.1rem; transition: transform .15s; }
.agm-sec[open] > summary::before { transform: rotate(90deg); }
.agm-sec[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.agm-body { padding: 0.75rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.agm-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: flex-end; }
.agm-field { display: flex; flex-direction: column; gap: 0.25rem; }
.agm-label { font-size: 0.8rem; font-weight: 600; color: #374151; letter-spacing: 0.02em; }
.agm-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.agm-in { border: 1px solid #9ca3af; border-radius: 0.25rem; background: #fff; padding: 0.25rem 0.5rem; font-size: 0.95rem; color: #111827; }
.agm-in:focus, .agm-sel:focus { outline: 2px solid #3b82f6; outline-offset: 0; }
.agm-in.w4 { width: 4rem; } .agm-in.w5 { width: 5rem; } .agm-in.w8 { width: 8rem; } .agm-in.w10 { width: 10rem; }
.agm-in.w12 { width: 12rem; } .agm-in.w14 { width: 14rem; } .agm-in.w16 { width: 18rem; }
.agm-area { width: 22rem; font-family: ui-monospace, monospace; }
.agm-sel { border: 1px solid #9ca3af; border-radius: 0.25rem; background: #fff; padding: 0.25rem 0.4rem; font-size: 0.9rem; }
.agm-color { width: 2.4rem; height: 1.9rem; padding: 0.1rem; border: 1px solid #9ca3af; border-radius: 0.25rem; background: #fff; cursor: pointer; }
.agm-toggle { margin: 0; justify-content: flex-start; }
.agm-help { font-size: 0.85rem; color: #6b7280; }
.agm-add { gap: 0.75rem; }
.agm-menu-wrap { position: relative; }
.agm-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; background: #fff; border: 1px solid #e5e7eb; border-radius: 0.5rem;
	box-shadow: 0 10px 15px -3px rgb(0 0 0 / .15); display: flex; flex-direction: column; min-width: 13rem; padding: 0.25rem 0; }
.agm-menu[hidden] { display: none; }
.agm-menu button { text-align: left; padding: 0.45rem 1rem; font-size: 0.95rem; }
.agm-menu button:hover { background: #f3f4f6; color: #1d4ed8; }
.agm-plots { display: flex; flex-direction: column; gap: 0.75rem; }
.agm-plot { background: #fff; border: 1px solid #e5e7eb; border-radius: 0.5rem; }
.agm-plot.is-hidden .agm-plot-body { opacity: 0.5; }
.agm-plot-head { display: flex; justify-content: space-between; align-items: center; background: #e5e7eb; padding: 0.35rem 0.75rem;
	border-top-left-radius: 0.5rem; border-top-right-radius: 0.5rem; }
.agm-plot-title { font-weight: 700; }
.agm-plot-actions { display: flex; gap: 0.75rem; }
.agm-link { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.05em; color: #1d4ed8; }
.agm-link:hover { text-decoration: underline; }
.agm-plot-body { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.75rem; }
.agm-err { color: #b91c1c; font-size: 0.85rem; min-height: 0; }
.agm-err:empty { display: none; }
.agm-points { display: grid; grid-template-columns: repeat(3, max-content); gap: 0.35rem 1.25rem; }
.agm-pt { display: inline-flex; align-items: center; gap: 0.2rem; }
.agm-pw-head, .agm-pw-row { display: grid; grid-template-columns: 14rem 5rem max-content 5rem; gap: 0.4rem; align-items: center; }
.agm-pw-head span:nth-child(2) { grid-column: 2; }
.agm-vec-head { display: grid; grid-template-columns: 11rem 1.5rem 11rem; }
.agm-vec-head span:nth-child(2) { grid-column: 3; }
.agm-vecs { display: grid; grid-template-columns: repeat(2, max-content); gap: 0.35rem 2rem; }
.agm-vec { display: grid; grid-template-columns: 11rem 1.5rem 11rem; align-items: center; }
.agm-shade-grid { display: grid; grid-template-columns: repeat(3, max-content); gap: 0.4rem 1.5rem; align-items: center; }
.agm-ann-head { display: flex; gap: 14.5rem; }
.agm-chars { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.agm-char { width: 2.4rem; height: 2.4rem; border: 1px solid #d1d5db; border-radius: 0.375rem; background: #fff; font-size: 1.15rem; }
.agm-char:hover { background: #eff6ff; border-color: #3b82f6; }
@media (max-width: 1100px) { .agm-top { grid-template-columns: 1fr; } .agm, .figures-wrap { width: 92%; } }

/* ---------- save / open dialogs ---------- */
.ht-dialog {
	width: min(32rem, calc(100vw - 2rem)); padding: 1.25rem; border: 1px solid #e5e7eb; border-radius: 0.75rem;
	box-shadow: 0 20px 25px -5px rgb(0 0 0 / .15), 0 8px 10px -6px rgb(0 0 0 / .1); color: #111827;
}
.ht-dialog::backdrop { background: rgb(17 24 39 / 0.4); }
.ht-dialog h2 { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.75rem; }
.ht-field { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.875rem; font-weight: 500; }
.ht-input {
	width: 100%; font-size: 0.875rem; border-radius: 0.5rem; border: 1px solid #d1d5db;
	background: #f9fafb; color: #111827; padding: 0.5rem 0.625rem;
}
.ht-dialog-msg { min-height: 1.25rem; margin-top: 0.5rem; font-size: 0.875rem; color: #374151; }
.ht-dialog-msg.error { color: #b91c1c; }
.ht-dialog-footer { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.ht-spacer { flex: 1; }
.ht-save-list { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 0.25rem; }
.ht-save-list li { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; border-radius: 0.5rem; background: #f3f4f6; }
.ht-save-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ht-save-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-save-info small { color: #6b7280; }
.ht-save-list li.ht-save-empty { background: none; color: #6b7280; justify-content: center; }

/* ---------- FBD extras ---------- */
.fbd-axes { display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 1rem; font-size: 0.875rem; }
.fbd-axes[hidden] { display: none; }
.fbd-net-toggle { justify-content: flex-end; margin: 0.5rem 0 0; }
.fbd-axes input[type='range'] { flex: 1; }
.fbd-axes output { min-width: 3rem; font-variant-numeric: tabular-nums; }
.tao-row .placeholder { opacity: 0.6; font-style: italic; font-weight: 400; }

/* ---------- motion diagram ---------- */
.md-modes, .fbd-modes { display: flex; justify-content: center; gap: 0.25rem; margin: 0.25rem 0 0.75rem; }
.md-modes .btn, .fbd-modes .btn { padding: 0.375rem 0.75rem; }

/* ---------- grid size + origin controls ---------- */
.grid-ctrls { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1rem; margin: 0.375rem 0; font-size: 0.75rem; color: #4b5563; }
.grid-group { display: inline-flex; align-items: center; gap: 0.125rem; }
.grid-name { font-weight: 600; margin-right: 0.25rem; }
.grid-count { min-width: 1.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.grid-sep { width: 0.5rem; }
.grid-btn { width: 1.5rem; height: 1.5rem; line-height: 1; border: 1px solid #d1d5db; border-radius: 0.375rem; background: #fff; color: #374151; font-size: 0.75rem; }
.grid-btn:hover:not(:disabled) { background: #f3f4f6; color: #1d4ed8; }
.grid-btn:disabled { opacity: 0.35; }
