/* Topic Templates — form + topic display.
   Inherits the forum theme's font and text colour; every border/tint is derived
   from currentColor so light and dark themes both work without extra rules. */

.tt-form, .tt-block, .tt-modal {
	--tt-accent: #0f766e;
	--tt-line: color-mix(in srgb, currentColor 16%, transparent);
	--tt-line-strong: color-mix(in srgb, currentColor 32%, transparent);
	--tt-tint: color-mix(in srgb, currentColor 5%, transparent);
	--tt-accent-tint: color-mix(in srgb, var(--tt-accent) 12%, transparent);
	--tt-danger: #c2410c;
	--tt-radius: 10px;
	--tt-tap: 44px;
	box-sizing: border-box;
}
.tt-form *, .tt-block *, .tt-modal * { box-sizing: inherit; }

/* =========================================================== FORM */
.tt-form {
	container: ttform / inline-size;
	margin: 0 0 1.25rem;
	padding: 1rem 0 0;
	border-top: 3px solid var(--tt-accent);
	font-size: 1rem;
	line-height: 1.45;
}
.tt-form__bodyhint { margin: 1rem 0 0; font-size: .9rem; opacity: .75; }
.tt-form__intro { margin: 0 0 1rem; max-width: 70ch; opacity: .85; }

.tt-form__panes { display: block; }
.tt-pane { display: flex; flex-wrap: wrap; gap: 1.1rem 1rem; align-items: flex-start; }
.tt-pane[hidden] { display: none; }

.tt-field { flex: 1 1 100%; min-width: 0; }
.tt-field[hidden] { display: none; }
@container ttform (min-width: 640px) {
	.tt-field--half { flex: 1 1 calc(50% - .5rem); max-width: calc(50% - .5rem); }
}

.tt-field__label { display: block; font-weight: 600; margin: 0 0 .4rem; }
.tt-req { color: var(--tt-danger); }
.tt-field__help { font-size: .875rem; opacity: .7; margin-top: .35rem; }
.tt-field__error { color: var(--tt-danger); font-size: .875rem; font-weight: 600; margin-top: .35rem; }
.tt-field__error:empty { display: none; }
.tt-field__heading {
	margin: .75rem 0 0; padding-bottom: .35rem;
	font-size: 1.1rem; border-bottom: 1px solid var(--tt-line);
}

/* inputs: 16px font prevents iOS zoom-on-focus */
.tt-input {
	display: block; width: 100%;
	min-height: var(--tt-tap);
	padding: .6rem .75rem;
	font: inherit; font-size: max(16px, 1rem); color: inherit;
	background: color-mix(in srgb, Canvas 92%, currentColor 0%);
	background: transparent;
	border: 1px solid var(--tt-line-strong);
	border-radius: 8px;
	appearance: none;
}
.tt-input::placeholder { color: inherit; opacity: .45; }
.tt-input:focus { outline: none; border-color: var(--tt-accent); box-shadow: 0 0 0 3px var(--tt-accent-tint); }
.tt-field.has-error .tt-input { border-color: var(--tt-danger); }
.tt-textarea { resize: vertical; min-height: 6.5rem; }
.tt-select {
	padding-right: 2.25rem;
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
	background-size: 5px 5px; background-repeat: no-repeat;
}
.tt-select option { color: initial; background: initial; }
.tt-number { position: relative; display: flex; align-items: center; }
.tt-number .tt-input { padding-right: 4.5rem; font-variant-numeric: tabular-nums; }
.tt-number__unit { position: absolute; right: .75rem; opacity: .6; pointer-events: none; }

/* choice pills (radio / checkboxes / toggle) */
.tt-choices { display: flex; flex-direction: column; gap: .4rem; }
.tt-choices--inline { flex-direction: row; flex-wrap: wrap; }
.tt-choice {
	--tt-chip: var(--tt-accent);
	display: inline-flex; align-items: center; gap: .55rem;
	min-height: var(--tt-tap);
	padding: .5rem .9rem;
	font: inherit; color: inherit; text-align: left;
	background: transparent;
	border: 1px solid var(--tt-line-strong);
	border-radius: 8px;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.tt-choices--inline .tt-choice { flex: 0 1 auto; }
.tt-choice__mark {
	flex: none; width: 1.05rem; height: 1.05rem;
	border: 2px solid var(--tt-line-strong); border-radius: 50%;
}
[role="checkbox"] > .tt-choice__mark { border-radius: 4px; }
.tt-choice:hover { border-color: var(--tt-chip); }
.tt-choice.is-on {
	border-color: var(--tt-chip);
	background: color-mix(in srgb, var(--tt-chip) 12%, transparent);
	font-weight: 600;
}
.tt-choice.is-on > .tt-choice__mark {
	border-color: var(--tt-chip);
	background: var(--tt-chip);
	box-shadow: inset 0 0 0 2px Canvas;
}
.tt-choice:focus-visible, .tt-btn:focus-visible, .tt-toothbtn:focus-visible, .tt-star:focus-visible,
.tt-icon-btn:focus-visible, .tt-uploader__add:focus-visible, .tt-steps__btn:focus-visible {
	outline: 3px solid var(--tt-accent); outline-offset: 2px;
}

/* rating */
.tt-rating-input { display: flex; align-items: center; gap: .15rem; }
.tt-star {
	width: var(--tt-tap); height: var(--tt-tap);
	font-size: 1.7rem; line-height: 1;
	color: var(--tt-line-strong); background: none; border: 0; border-radius: 8px; cursor: pointer;
}
.tt-star.is-on { color: #d97706; }
.tt-rating-input__val { margin-left: .5rem; opacity: .7; font-variant-numeric: tabular-nums; }

/* list */
.tt-listinput__items { margin: 0 0 .5rem; padding-left: 1.6rem; display: grid; gap: .4rem; }
ul.tt-listinput__items { list-style: disc; }
.tt-listinput__item { padding-left: .25rem; }
.tt-listinput__item { display: list-item; }
.tt-listinput__item > .tt-input { display: inline-block; width: calc(100% - var(--tt-tap) - .4rem); vertical-align: middle; }
.tt-listinput__item > .tt-icon-btn { vertical-align: middle; margin-left: .4rem; }

/* buttons */
.tt-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
	min-height: var(--tt-tap); padding: .55rem 1.1rem;
	font: inherit; font-weight: 600; color: inherit;
	border: 1px solid var(--tt-line-strong); border-radius: 8px;
	background: transparent; cursor: pointer;
}
.tt-btn--primary { background: var(--tt-accent); border-color: var(--tt-accent); color: #fff; }
.tt-btn--ghost:hover { background: var(--tt-tint); }
.tt-btn--small { min-height: 36px; padding: .35rem .75rem; font-size: .875rem; }
.tt-btn[hidden] { display: none; }
.tt-icon-btn {
	display: inline-flex; align-items: center; justify-content: center;
	width: var(--tt-tap); height: var(--tt-tap); flex: none;
	font: inherit; font-size: 1.1rem; color: inherit;
	background: transparent; border: 1px solid var(--tt-line); border-radius: 8px; cursor: pointer;
}
.tt-icon-btn--danger:hover { color: var(--tt-danger); border-color: var(--tt-danger); }

/* notices */
.tt-notice {
	padding: .75rem .9rem;
	border-left: 4px solid var(--tt-accent);
	background: var(--tt-accent-tint);
	border-radius: 0 8px 8px 0;
	font-size: .95rem;
}
.tt-notice--warning { border-left-color: #b45309; background: color-mix(in srgb, #b45309 12%, transparent); }
.tt-notice--success { border-left-color: #15803d; background: color-mix(in srgb, #15803d 12%, transparent); }

.tt-form__summary {
	margin: 0 0 1rem; padding: .7rem .9rem;
	border: 1px solid var(--tt-danger); border-radius: 8px;
	color: var(--tt-danger); font-weight: 600;
}
.tt-form__summary[hidden], .tt-form__draft[hidden] { display: none; }
.tt-form__draft {
	display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
	margin: 0 0 1rem; padding: .7rem .9rem;
	background: var(--tt-accent-tint); border-radius: 8px;
}
.tt-form__draft > span { flex: 1 1 14rem; }

/* ------------------------------------------------------------ teeth picker
   The one distinctive element: laid out like the dental chart a dentist
   draws by hand — two jaws, midline between quadrants. */
.tt-teethpick__tabs { margin-bottom: .6rem; }
.tt-choice--tab.is-on { background: var(--tt-accent); color: #fff; border-color: var(--tt-accent); }
.tt-teethpick__chart {
	display: grid; gap: .35rem;
	padding: .75rem .5rem;
	border: 1px solid var(--tt-line); border-radius: var(--tt-radius);
}
.tt-jaw + .tt-jaw { border-top: 2px solid var(--tt-line-strong); padding-top: .55rem; }
.tt-jaw__title { font-size: .8rem; opacity: .65; text-align: center; margin-bottom: .35rem; }
.tt-jaw__row { display: grid; grid-template-columns: 1fr; gap: .35rem; }
.tt-jaw__half { display: grid; grid-template-columns: repeat(var(--tt-n, 8), 1fr); gap: 3px; }
.tt-toothbtn {
	min-width: 0; height: var(--tt-tap);
	font: inherit; font-size: .95rem; font-weight: 600;
	font-variant-numeric: tabular-nums;
	color: inherit; background: var(--tt-tint);
	border: 1px solid var(--tt-line); border-radius: 7px;
	cursor: pointer; -webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}
.tt-toothbtn:hover { border-color: var(--tt-accent); }
.tt-toothbtn.is-on { background: var(--tt-accent); border-color: var(--tt-accent); color: #fff; }
/* phones: each jaw = right half above left half (8 teeth per line ≈ 40px each);
   wider screens: halves side by side with the midline between them */
@container ttform (max-width: 559px) {
	.tt-jaw__half + .tt-jaw__half { padding-top: .35rem; border-top: 1px dashed var(--tt-line-strong); }
}
@container ttform (min-width: 560px) {
	.tt-jaw__row { grid-template-columns: 1fr 1fr; gap: 0; }
	.tt-jaw__half:first-child { padding-right: .4rem; border-right: 2px solid var(--tt-line-strong); }
	.tt-jaw__half:last-child { padding-left: .4rem; }
}
.tt-teethpick__bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin-top: .6rem; }
.tt-teethpick__status { font-weight: 600; font-variant-numeric: tabular-nums; }
.tt-teethpick__tools { display: flex; gap: .5rem; align-items: center; flex: 1 1 16rem; justify-content: flex-end; }
.tt-teethpick__typed { max-width: 14rem; min-height: 36px; padding: .35rem .6rem; }

/* uploads */
.tt-uploader__file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tt-uploader__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
.tt-thumb, .tt-uploader__add {
	position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden;
}
.tt-thumb { border: 1px solid var(--tt-line); background: var(--tt-tint); }
.tt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tt-thumb--loading { display: flex; align-items: center; justify-content: center; font-size: .8rem; opacity: .7; }
.tt-thumb__tools {
	position: absolute; inset: auto 0 0 0;
	display: flex; justify-content: flex-end; gap: 2px; padding: 3px;
	background: linear-gradient(transparent, rgba(0,0,0,.55));
}
.tt-thumb__tools .tt-icon-btn { width: 34px; height: 34px; color: #fff; border-color: rgba(255,255,255,.5); background: rgba(0,0,0,.35); }
.tt-uploader__add {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem;
	font: inherit; font-size: .8rem; color: inherit; text-align: center; padding: .4rem;
	background: transparent; border: 2px dashed var(--tt-line-strong); cursor: pointer;
}
.tt-uploader__add:hover { border-color: var(--tt-accent); color: var(--tt-accent); }
.tt-uploader__plus { font-size: 1.7rem; line-height: 1; }
.tt-uploader__msg { color: var(--tt-danger); font-size: .875rem; margin-top: .3rem; }
.tt-uploader__msg:empty { display: none; }
.tt-ba-input { display: grid; grid-template-columns: 1fr; gap: .9rem; }
@container ttform (min-width: 640px) { .tt-ba-input { grid-template-columns: 1fr 1fr; } }
.tt-ba-input__label { font-size: .875rem; font-weight: 600; margin-bottom: .3rem; opacity: .75; }

/* steps */
.tt-steps {
	display: flex; gap: .25rem; margin: 0 0 1.1rem; padding: 0; list-style: none;
	overflow-x: auto; scrollbar-width: none;
}
.tt-steps::-webkit-scrollbar { display: none; }
.tt-steps > li { flex: 1 0 auto; }
.tt-steps > li[hidden] { display: none; }
.tt-steps__btn {
	display: flex; align-items: center; gap: .45rem; width: 100%;
	min-height: var(--tt-tap); padding: .4rem .6rem .5rem;
	font: inherit; font-size: .9rem; color: inherit; text-align: left;
	background: none; border: 0; border-bottom: 3px solid var(--tt-line);
	cursor: pointer; white-space: nowrap;
}
.tt-steps__num {
	display: inline-flex; align-items: center; justify-content: center;
	width: 1.6rem; height: 1.6rem; flex: none;
	border-radius: 50%; border: 2px solid var(--tt-line-strong);
	font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.tt-steps__btn.is-current { border-bottom-color: var(--tt-accent); font-weight: 700; }
.tt-steps__btn.is-current .tt-steps__num { background: var(--tt-accent); border-color: var(--tt-accent); color: #fff; }
.tt-steps__btn.is-done .tt-steps__num { border-color: var(--tt-accent); color: var(--tt-accent); }
.tt-steps__btn.has-error .tt-steps__num { border-color: var(--tt-danger); color: var(--tt-danger); }
/* on phones show only the number for non-current steps */
@container ttform (max-width: 559px) {
	.tt-steps__btn:not(.is-current) .tt-steps__label { display: none; }
	.tt-steps > li { flex: 0 0 auto; }
	.tt-steps > li:has(.is-current) { flex: 1 0 auto; }
}

/* footer: progress + step nav. Sticky at the bottom on phones */
.tt-form__footer {
	display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem;
	margin-top: 1.25rem; padding-top: .9rem;
	border-top: 1px solid var(--tt-line);
}
.tt-progress { display: flex; align-items: center; gap: .6rem; flex: 1 1 14rem; font-size: .85rem; }
.tt-progress[hidden] { display: none; }
.tt-progress__bar { flex: 0 0 6rem; height: 6px; border-radius: 3px; background: var(--tt-line); overflow: hidden; }
.tt-progress__bar > span { display: block; height: 100%; background: var(--tt-accent); transition: width .25s; }
.tt-progress__text { opacity: .75; font-variant-numeric: tabular-nums; }
.tt-form__nav { display: flex; align-items: center; gap: .5rem; flex: 1 1 18rem; justify-content: flex-end; }
.tt-form__steplabel { font-size: .85rem; opacity: .7; white-space: nowrap; font-variant-numeric: tabular-nums; }
@container ttform (max-width: 559px) {
	.tt-form__nav {
		position: sticky; bottom: 0; z-index: 5;
		flex: 1 1 100%;
		margin: 0 -1rem; padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom));
		background: Canvas; color: CanvasText;
		border-top: 1px solid var(--tt-line);
		box-shadow: 0 -6px 16px rgba(0,0,0,.08);
	}
	.tt-form__nav .tt-btn { flex: 1 1 0; }
	.tt-form__steplabel { order: -1; flex: 1 1 100%; text-align: center; margin-bottom: -.2rem; }
	.tt-btn--preview { flex: 1 1 100%; }
}
.tt-titlehint { font-size: .85rem; opacity: .8; margin-top: .35rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.tt-titlehint:empty { display: none; }
input.tt-title-locked { opacity: .8; cursor: not-allowed; }

/* preview modal */
.tt-modal {
	position: fixed; inset: 0; z-index: 10000;
	display: flex; align-items: flex-end; justify-content: center;
	background: rgba(0,0,0,.5);
}
.tt-modal__box {
	width: 100%; max-width: 860px; max-height: 92vh; overflow: auto;
	background: Canvas; color: CanvasText;
	border-radius: 14px 14px 0 0; padding: 0 1rem 1.25rem;
}
.tt-modal__head {
	position: sticky; top: 0; z-index: 1;
	display: flex; justify-content: space-between; align-items: center;
	padding: .75rem 0; background: Canvas; border-bottom: 1px solid var(--tt-line); margin-bottom: 1rem;
}
@media (min-width: 640px) { .tt-modal { align-items: center; } .tt-modal__box { border-radius: 14px; } }

/* =========================================================== TOPIC DISPLAY */
.tt-block {
	container: ttblock / inline-size;
	margin: 0 0 1.5rem;
	padding: 1rem 1.1rem 1.1rem;
	border: 1px solid var(--tt-line);
	border-left: 4px solid var(--tt-accent);
	border-radius: var(--tt-radius);
	line-height: 1.5;
}
.tt-block__head { margin: 0 0 .75rem; }
.tt-block__badge {
	display: inline-block; padding: .2rem .6rem;
	font-size: .85rem; font-weight: 700;
	color: var(--tt-accent); background: var(--tt-accent-tint); border-radius: 6px;
}
.tt-section + .tt-section { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--tt-line); }
.tt-section__title { margin: 0 0 .6rem; font-size: 1.05rem; }

.tt-grid { display: grid; grid-template-columns: 1fr; gap: .8rem 1.5rem; margin: 0; }
@container ttblock (min-width: 640px) { .tt-grid { grid-template-columns: 1fr 1fr; } }
.tt-item { min-width: 0; }
.tt-item--wide { grid-column: 1 / -1; }
.tt-item dt { font-size: .82rem; opacity: .65; margin: 0 0 .15rem; }
.tt-item dd { margin: 0; overflow-wrap: anywhere; }
.tt-layout-sections .tt-item dt { font-size: .9rem; font-weight: 600; opacity: .8; }

.tt-table { width: 100%; border-collapse: collapse; }
.tt-table th, .tt-table td { padding: .55rem .4rem; vertical-align: top; text-align: left; border-top: 1px solid var(--tt-line); }
.tt-table tr:first-child th, .tt-table tr:first-child td { border-top: 0; }
.tt-table th { width: 38%; font-weight: 600; opacity: .75; font-size: .92rem; }
@container ttblock (max-width: 479px) {
	.tt-table, .tt-table tbody, .tt-table tr, .tt-table th, .tt-table td { display: block; width: auto; }
	.tt-table th { border-top: 1px solid var(--tt-line); padding-bottom: 0; }
	.tt-table td { border-top: 0; padding-top: .15rem; }
}

.tt-chips { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.tt-chip {
	--tt-chip: currentColor;
	display: inline-block; padding: .12rem .55rem;
	font-size: .9rem; border-radius: 999px;
	border: 1px solid color-mix(in srgb, var(--tt-chip) 45%, transparent);
}
.tt-chip--color { color: var(--tt-chip); background: color-mix(in srgb, var(--tt-chip) 10%, transparent); font-weight: 600; }
.tt-bool--yes { color: #15803d; font-weight: 600; }
.tt-bool--no { opacity: .75; }
.tt-rating__on { color: #d97706; letter-spacing: 1px; }
.tt-rating__off { color: var(--tt-line-strong); letter-spacing: 1px; }
.tt-rating small { opacity: .65; }
.tt-list { margin: 0; padding-left: 1.35rem; }
.tt-list li + li { margin-top: .2rem; }
.tt-text { max-width: 75ch; }
.tt-locked { opacity: .65; font-size: .9rem; }

.tt-teeth { display: grid; gap: 2px; width: 100%; max-width: 34rem; margin-bottom: .3rem; }
.tt-teeth__row { display: grid; grid-template-columns: 1fr 1fr; }
.tt-teeth__row--split { border-top: 2px solid var(--tt-line-strong); padding-top: 2px; }
.tt-teeth__half { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; }
.tt-teeth__half--r { padding-right: 3px; border-right: 2px solid var(--tt-line-strong); }
.tt-teeth__half--l { padding-left: 3px; }
/* primary quadrants (5 teeth) sit next to the midline, under the matching permanent teeth */
.tt-teeth__half--r.tt-teeth__half--prim > :first-child { grid-column-start: 4; }
.tt-tooth {
	min-width: 0; height: 1.5rem;
	display: inline-flex; align-items: center; justify-content: center;
	font-size: .7rem; font-variant-numeric: tabular-nums;
	border-radius: 4px; background: var(--tt-tint); opacity: .55;
}
.tt-tooth.is-on { background: var(--tt-accent); color: #fff; opacity: 1; font-weight: 700; }
@container ttblock (max-width: 420px) { .tt-tooth { font-size: .58rem; height: 1.35rem; border-radius: 3px; } .tt-teeth__half { gap: 1px; } }
.tt-teeth__text { font-weight: 600; font-variant-numeric: tabular-nums; }

.tt-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.tt-gallery__item { display: block; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--tt-tint); }
.tt-gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tt-ba { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.tt-ba__col { margin: 0; min-width: 0; }
.tt-ba__col figcaption { font-size: .85rem; font-weight: 700; margin-bottom: .3rem; }
.tt-ba .tt-gallery { grid-template-columns: 1fr; }

/* list chips under topic titles + filter bar */
.tt-rowchips { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.tt-rowchips .tt-chip { font-size: .78rem; padding: .05rem .45rem; }
.tt-filterlink { display: inline-flex; align-items: center; gap: .3rem; }

/* lightbox */
.tt-lightbox { position: fixed; inset: 0; z-index: 10001; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.88); }
.tt-lightbox img { max-width: 96vw; max-height: 90vh; object-fit: contain; }
.tt-lightbox button { position: absolute; top: max(.75rem, env(safe-area-inset-top)); right: .75rem; width: 48px; height: 48px; font-size: 1.5rem; color: #fff; background: rgba(255,255,255,.15); border: 0; border-radius: 50%; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
	.tt-progress__bar > span { transition: none; }
}

/* =========================================================== FILTER PAGE */
.tt-browse { --tt-accent: #0f766e; --tt-line: color-mix(in srgb, currentColor 16%, transparent); --tt-line-strong: color-mix(in srgb, currentColor 32%, transparent); --tt-tint: color-mix(in srgb, currentColor 5%, transparent); --tt-tap: 44px; container: ttbrowse / inline-size; }
.tt-browse * { box-sizing: border-box; }
.tt-browse__back { margin: 0 0 .5rem; font-size: .9rem; }
.tt-browse__title { margin: 0 0 1rem; font-size: 1.5rem; }
.tt-browse__filters { border: 1px solid var(--tt-line); border-radius: 10px; padding: 0 1rem; margin-bottom: 1rem; }
.tt-browse__filters > summary { padding: .8rem 0; font-weight: 700; cursor: pointer; }
.tt-browse__form { padding-bottom: 1rem; }
.tt-browse__grid { display: grid; grid-template-columns: 1fr; gap: .9rem 1.25rem; }
@container ttbrowse (min-width: 640px) { .tt-browse__grid { grid-template-columns: 1fr 1fr; } }
@container ttbrowse (min-width: 980px) { .tt-browse__grid { grid-template-columns: 1fr 1fr 1fr; } }
.tt-browse__field { border: 0; margin: 0; padding: 0; min-width: 0; }
.tt-browse__field legend { font-weight: 600; margin-bottom: .35rem; padding: 0; }
.tt-browse__opts { display: flex; flex-wrap: wrap; gap: .35rem; }
.tt-browse__opt { position: relative; }
.tt-browse__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tt-browse__opt span { display: inline-flex; align-items: center; min-height: 40px; padding: .35rem .8rem; border: 1px solid var(--tt-line-strong); border-radius: 999px; cursor: pointer; }
.tt-browse__opt input:checked + span { background: var(--tt-accent); border-color: var(--tt-accent); color: #fff; font-weight: 600; }
.tt-browse__opt input:focus-visible + span { outline: 3px solid var(--tt-accent); outline-offset: 2px; }
.tt-browse__range { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.tt-browse .tt-input { display: block; width: 100%; min-height: var(--tt-tap); padding: .5rem .7rem; font: inherit; font-size: max(16px, 1rem); color: inherit; background: transparent; border: 1px solid var(--tt-line-strong); border-radius: 8px; }
.tt-browse .tt-btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tt-tap); padding: .55rem 1.1rem; font: inherit; font-weight: 600; color: inherit; text-decoration: none; border: 1px solid var(--tt-line-strong); border-radius: 8px; background: transparent; cursor: pointer; }
.tt-browse .tt-btn--primary { background: var(--tt-accent); border-color: var(--tt-accent); color: #fff; }
.tt-browse__actions { display: flex; gap: .5rem; margin-top: 1rem; }
.tt-browse__count { opacity: .75; margin: 0 0 .5rem; }
.tt-browse__empty { padding: 1.5rem; text-align: center; border: 1px dashed var(--tt-line-strong); border-radius: 10px; }
.tt-browse__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--tt-line); }
.tt-browse__item { padding: .8rem 0; border-bottom: 1px solid var(--tt-line); }
.tt-browse__link { font-weight: 600; font-size: 1.05rem; }
.tt-browse__meta { font-size: .85rem; opacity: .65; margin-top: .25rem; }
.tt-browse__pages { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem 0; }

/* =========================================================== HOST-THEME HARDENING
   Invision Community 5 styles every <button> (text-align:start, display, padding). These rules
   win over the theme so buttons, step navigation and the tooth chart keep their layout. */
.tt-form button, .tt-modal button, .tt-browse button {
	text-align: center; text-transform: none; letter-spacing: normal; text-shadow: none;
	box-shadow: none; margin: 0; font-family: inherit; -webkit-appearance: none; appearance: none;
}
.tt-form .tt-btn, .tt-modal .tt-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
	width: auto; min-width: 0; white-space: nowrap; line-height: 1.2; flex: 0 0 auto;
}
.tt-form .tt-btn[hidden], .tt-form [hidden] { display: none; }
.tt-form .tt-choice { text-align: left; justify-content: flex-start; line-height: 1.25; }
.tt-form .tt-star, .tt-form .tt-icon-btn, .tt-form .tt-uploader__add {
	display: inline-flex; align-items: center; justify-content: center; padding: 0; line-height: 1;
}
.tt-form .tt-uploader__add { display: flex; flex-direction: column; padding: .4rem; }
.tt-form .tt-steps__btn { display: flex; justify-content: flex-start; text-align: left; }

/* step navigation: a grid, never squeezed by the theme */
.tt-form .tt-form__nav {
	display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .5rem;
	flex: 1 1 18rem; min-width: 0;
}
.tt-form .tt-form__nav > [data-nav="back"] { grid-column: 1; }
.tt-form .tt-form__nav > .tt-form__steplabel { grid-column: 2; text-align: center; order: 0; margin: 0; }
.tt-form .tt-form__nav > [data-nav="next"] { grid-column: 3; }
@container ttform (max-width: 559px) {
	.tt-form .tt-form__nav {
		grid-template-columns: 1fr 1fr; gap: .45rem .5rem;
		position: sticky; bottom: 0; z-index: 5;
		margin: 0 -.25rem; padding: .55rem .25rem calc(.55rem + env(safe-area-inset-bottom));
		background: var(--i-box--ba-co, Canvas); color: inherit;
		border-top: 1px solid var(--tt-line);
		box-shadow: 0 -6px 16px rgba(0,0,0,.08);
	}
	.tt-form .tt-form__nav > .tt-form__steplabel { grid-column: 1 / -1; grid-row: 1; }
	.tt-form .tt-form__nav > [data-nav="back"] { grid-column: 1; grid-row: 2; }
	.tt-form .tt-form__nav > [data-nav="next"] { grid-column: 2; grid-row: 2; }
	.tt-form .tt-form__nav.is-solo > [data-nav] { grid-column: 1 / -1; }
	.tt-form .tt-form__nav .tt-btn { width: 100%; min-height: 48px; font-size: 1rem; }
	.tt-form .tt-btn--preview { width: 100%; }
}

/* tooth chart: fixed 8-column grid, numbers always centred */
.tt-form .tt-jaw__half { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; }
.tt-form .tt-jaw__half[style*="--tt-n:5"] > :first-child { grid-column-start: 4; }
.tt-form .tt-jaw__half--l[style*="--tt-n:5"] > :first-child,
.tt-form .tt-jaw__row > .tt-jaw__half:last-child[style*="--tt-n:5"] > :first-child { grid-column-start: 1; }
.tt-form .tt-toothbtn {
	display: flex; align-items: center; justify-content: center;
	width: 100%; min-width: 0; height: 44px; padding: 0;
	font-size: 15px; font-weight: 600; line-height: 1; text-align: center;
	font-variant-numeric: tabular-nums; letter-spacing: 0; white-space: nowrap; overflow: hidden;
}
.tt-form .tt-teethpick__hint { font-size: .85rem; opacity: .75; margin: 0 0 .4rem; }
.tt-form .tt-teethpick__tabs .tt-choice { flex: 1 1 0; justify-content: center; text-align: center; }
@container ttform (max-width: 559px) {
	/* right half above left half; each labelled so the order is obvious */
	.tt-form .tt-jaw__half::before {
		content: attr(data-side); grid-column: 1 / -1;
		font-size: .7rem; opacity: .6; text-align: left; margin: .1rem 0 .05rem;
	}
	.tt-form .tt-jaw__half:last-child::before { text-align: right; }
	.tt-form .tt-toothbtn { height: 42px; font-size: 14px; }
}
@container ttform (max-width: 360px) {
	.tt-form .tt-jaw__half { gap: 2px; }
	.tt-form .tt-toothbtn { font-size: 12.5px; border-radius: 6px; }
}

/* automatic post text (summary of the fields) is folded under the block on the topic page */
.tt-autobody { display: none; }

/* =========================================================== PHOTO STEPS (step-by-step instruction) */
/* author form */
.tt-psin__list { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .75rem; }
.tt-psin__step { border: 1px solid var(--tt-line); border-radius: var(--tt-radius); padding: .6rem; background: var(--tt-tint); min-width: 0; }
.tt-psin__head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 0 0 .5rem; min-height: 34px; }
.tt-psin__n { font-weight: 700; color: var(--tt-accent); }
.tt-psin__tools { display: flex; gap: .3rem; flex: 0 0 auto; }
.tt-form .tt-psin__tools .tt-icon-btn { width: 40px; height: 40px; }
.tt-psin__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; }
@container ttform (min-width: 560px) { .tt-psin__body { grid-template-columns: 220px minmax(0, 1fr); align-items: start; } }
.tt-psin__pic { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; border: 1px solid var(--tt-line); background: var(--tt-tint); }
.tt-psin__pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tt-psin__pic.tt-thumb--loading { display: flex; align-items: center; justify-content: center; font-size: .85rem; }
.tt-psin__pictools { position: absolute; inset: auto 0 0 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .3rem; padding: .35rem; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.tt-form .tt-psin__pictools .tt-btn { color: #fff; background: rgba(0,0,0,.45); border-color: rgba(255,255,255,.55); }
.tt-form .tt-psin__pic--empty { width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; }
.tt-form .tt-psin__text { width: 100%; min-height: 4.6rem; margin: 0; }
.tt-psin__bar { display: flex; flex-wrap: wrap; gap: .5rem; }
.tt-form .tt-psin__bulk { white-space: normal; text-align: left; justify-content: flex-start; flex: 0 1 auto; max-width: 100%; }

/* topic view */
.tt-psteps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
@container ttblock (max-width: 479px) { .tt-psteps { grid-template-columns: minmax(0, 1fr); } }
.tt-pstep { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--tt-line); border-radius: var(--tt-radius); overflow: hidden; background: var(--tt-tint); }
.tt-pstep__media { display: block; aspect-ratio: 4 / 3; background: color-mix(in srgb, currentColor 7%, transparent); }
.tt-pstep__media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tt-pstep__body { padding: .55rem .7rem .7rem; }
.tt-pstep__n { display: inline-block; margin: 0 0 .35rem; padding: .1rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; color: #fff; background: var(--tt-accent); }
.tt-pstep__text { line-height: 1.45; overflow-wrap: anywhere; }

/* lightbox caption (used by photo steps) */
.tt-lightbox__cap { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 1.5rem 1rem max(.9rem, env(safe-area-inset-bottom)); color: #fff; font-size: .95rem; line-height: 1.4; text-align: center; max-height: 35vh; overflow: auto; background: linear-gradient(transparent, rgba(0,0,0,.8)); }
.tt-lightbox__cap:empty { display: none; }

/* hidden file inputs: IC5 gives input[type=file] a full width — keep them out of the layout */
.tt-uploader, .tt-psin, .tt-psin__step { position: relative; }
.tt-form input.tt-uploader__file {
	position: absolute !important; left: 0 !important; top: 0 !important;
	width: 1px !important; height: 1px !important; min-width: 0 !important; max-width: 1px !important;
	padding: 0 !important; margin: 0 !important; border: 0 !important;
	opacity: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); pointer-events: none;
}

/* compact empty picture slot; readable lightbox caption */
.tt-form .tt-psin__pic--empty { aspect-ratio: auto; min-height: 88px; flex-direction: row; gap: .5rem; font-size: .9rem; }
@container ttform (min-width: 560px) { .tt-form .tt-psin__pic--empty { aspect-ratio: 4 / 3; flex-direction: column; } }
.tt-lightbox { background: rgba(0,0,0,.95); }
.tt-lightbox__cap { background: rgba(0,0,0,.82); padding-top: .8rem; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

/* =========================================================== block heading: edit per topic */
.tt-block__head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; min-width: 0; }
.tt-block__badge { max-width: 100%; overflow-wrap: anywhere; }
.tt-block__badge--muted { color: inherit; opacity: .6; font-weight: 600; font-style: italic; background: var(--tt-tint); }
.tt-block .tt-block__edit, .tt-labeledit button {
	-webkit-appearance: none; appearance: none; box-sizing: border-box; margin: 0; font: inherit; line-height: 1.2;
	text-transform: none; letter-spacing: normal; box-shadow: none; cursor: pointer; float: none; width: auto;
}
.tt-block .tt-block__edit {
	display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
	width: 36px; height: 36px; min-width: 36px; padding: 0; border-radius: 8px;
	border: 1px solid var(--tt-line); background: transparent; color: inherit; font-size: 1rem; opacity: .75;
}
.tt-block .tt-block__edit:hover, .tt-block .tt-block__edit:focus-visible { opacity: 1; border-color: var(--tt-accent); color: var(--tt-accent); }
.tt-block .tt-block__edit:focus-visible { outline: 2px solid var(--tt-accent); outline-offset: 2px; }
.tt-labeledit { display: grid; gap: .5rem; margin: 0 0 .9rem; padding: .7rem; border: 1px solid var(--tt-line); border-radius: var(--tt-radius); background: var(--tt-tint); }
.tt-labeledit__label { font-weight: 600; font-size: .9rem; }
.tt-labeledit .tt-labeledit__input {
	box-sizing: border-box; width: 100%; max-width: 100%; min-height: 44px; margin: 0; padding: .5rem .7rem;
	font: inherit; font-size: 16px; color: inherit; background: var(--i-box--ba-co, transparent); border: 1px solid var(--tt-line-strong, var(--tt-line)); border-radius: 8px;
}
.tt-labeledit .tt-labeledit__input:focus { outline: 2px solid var(--tt-accent); outline-offset: 1px; border-color: var(--tt-accent); }
.tt-labeledit__row { display: flex; flex-wrap: wrap; gap: .5rem; }
.tt-labeledit .tt-labeledit__btn {
	display: inline-flex; align-items: center; justify-content: center; flex: 1 1 8rem; min-height: 44px; padding: .5rem 1rem;
	border-radius: 8px; border: 1px solid var(--tt-line-strong, var(--tt-line)); background: var(--i-box--ba-co, transparent); color: inherit; font-weight: 600;
}
.tt-labeledit .tt-labeledit__btn--primary { background: var(--tt-accent); border-color: var(--tt-accent); color: #fff; }
.tt-labeledit .tt-labeledit__btn:disabled { opacity: .55; cursor: default; }
.tt-labeledit__more { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.tt-labeledit .tt-labeledit__link {
	display: inline-block; min-height: 36px; padding: .4rem 0; border: 0; background: none; color: var(--tt-accent);
	text-decoration: underline; text-underline-offset: 2px; text-align: left; white-space: normal; font-size: .9rem;
}
.tt-labeledit__note { font-size: .8rem; opacity: .7; }
.tt-labeledit__msg { font-size: .85rem; color: #b91c1c; }
.tt-labeledit__msg:empty { display: none; }
@media (prefers-color-scheme: dark) { .tt-labeledit__msg { color: #fca5a5; } }
.tt-block__head[hidden] { display: none !important; }
