/* Shared styles for the text and developer tools */
.tet-tool.tx { max-width: 1040px; }
.tet-tool .tx-area, .tet-tool .tx-out { width: 100%; min-height: 260px; padding: 16px; font: inherit; font-size: 16px; line-height: 1.6; color: var(--c-ink); background: var(--c-white); border: 1px solid var(--c-line); border-radius: 14px; resize: vertical; outline: none; transition: border-color .15s, box-shadow .15s; }
.tet-tool .tx-area:focus { border-color: var(--c-accent); box-shadow: 0 0 0 4px rgba(31, 94, 75, .15); }
.tet-tool .tx-mono { font-family: ui-monospace, "JetBrains Mono", "Geist Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.55; tab-size: 2; }
.tx-out { background: #FBFAF7; white-space: pre-wrap; word-break: break-word; overflow: auto; max-height: 560px; }
.tx-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.tx-bar .tx-spacer { flex: 1; }
.tx-bar label { font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
.tx-bar select { min-height: 36px !important; width: auto !important; padding: 4px 10px !important; font-size: 14px !important; }
.tx-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tx-label { font-size: 14px; font-weight: 600; color: var(--c-ink); margin: 0 0 6px; display: block; }
.tx-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 14px 0; }
.tx-stat { background: var(--c-white); border: 1px solid var(--c-line); border-radius: 12px; padding: 12px 14px; }
.tx-stat b { display: block; font-size: 26px; line-height: 1.1; color: var(--c-ink); font-variant-numeric: tabular-nums; }
.tx-stat span { font-size: 13px; }
.tx-msg { font-size: 14px; font-weight: 600; margin: 6px 0; min-height: 22px; }
.tx-msg.is-ok { color: var(--c-accent); }
.tx-msg.is-bad { color: var(--c-danger); font-weight: 700; }
.tx-panel { background: var(--c-white); border: 1px solid var(--c-line); border-radius: 14px; padding: 16px 18px; margin-top: 14px; }
.tx-panel h3 { font-size: 16px; margin-bottom: 10px; }

/* Word counter */
.tx-limits { display: grid; gap: 10px; }
.tx-limit { display: grid; grid-template-columns: 170px 1fr 90px; gap: 12px; align-items: center; font-size: 14px; }
.tx-meter { height: 8px; border-radius: 999px; background: var(--c-sand); overflow: hidden; }
.tx-meter i { display: block; height: 100%; border-radius: 999px; background: var(--c-accent); transition: width .2s; }
.tx-limit.is-over .tx-meter i { background: var(--c-danger); }
.tx-limit.is-over em { color: var(--c-danger); }
.tx-limit em { font-style: normal; text-align: right; font-variant-numeric: tabular-nums; }
.tx-kw { width: 100%; border-collapse: collapse; font-size: 14px; }
.tx-kw td { padding: 6px 4px; border-bottom: 1px solid var(--c-line); }
.tx-kw td:last-child, .tx-kw td:nth-child(2) { text-align: right; font-variant-numeric: tabular-nums; }

/* Case converter */
.tx-cases { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tx-cases .tet-btn.is-on { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }

/* JSON highlighting */
.tx-j-key { color: #1F5E4B; font-weight: 600; }
.tx-j-str { color: #9E3029; }
.tx-j-num { color: #1D4ED8; }
.tx-j-bool { color: #B45309; font-weight: 600; }
.tx-j-null { color: #6B7280; font-style: italic; }

/* CSV table preview */
.tx-table-wrap { overflow: auto; max-height: 360px; border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-white); }
.tx-table { border-collapse: collapse; font-size: 13px; width: 100%; }
.tx-table th, .tx-table td { padding: 6px 10px; border-bottom: 1px solid var(--c-line); text-align: left; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.tx-table th { position: sticky; top: 0; background: var(--c-sage); color: var(--c-ink); font-weight: 700; }

/* Regex */
.tx-regex { display: flex; align-items: stretch; border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-white); overflow: hidden; }
.tx-regex:focus-within { border-color: var(--c-accent); box-shadow: 0 0 0 4px rgba(31, 94, 75, .15); }
.tx-regex span { display: flex; align-items: center; padding: 0 10px; font-size: 18px; color: var(--c-text); background: var(--c-sand); font-family: ui-monospace, Menlo, Consolas, monospace; }
.tx-regex input { flex: 1; border: 0 !important; box-shadow: none !important; border-radius: 0 !important; min-height: 48px !important; font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace !important; font-size: 16px !important; }
.tx-flags { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0; font-size: 14px; }
.tx-flags label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.tx-flags input { accent-color: var(--c-accent); width: 16px; height: 16px; }
.tx-flags code { background: var(--c-sand); padding: 1px 6px; border-radius: 4px; }
.tx-hl mark { background: rgba(242, 179, 61, .45); color: inherit; border-radius: 3px; padding: 0 1px; box-shadow: 0 0 0 1px rgba(180, 120, 20, .35); }
.tx-hl mark.alt { background: rgba(31, 94, 75, .2); box-shadow: 0 0 0 1px rgba(31, 94, 75, .35); }
.tx-matches { list-style: none; margin: 0; padding: 0; font-size: 14px; max-height: 300px; overflow: auto; }
.tx-matches li { padding: 8px 0; border-bottom: 1px solid var(--c-line); }
.tx-matches code { background: var(--c-sand); padding: 1px 6px; border-radius: 4px; font-size: 13px; word-break: break-all; }
.tx-matches .tx-g { display: block; margin-top: 4px; font-size: 13px; color: var(--c-text); }
.tx-chips { display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 760px) {
	.tx-two { grid-template-columns: 1fr; }
	.tx-limit { grid-template-columns: 1fr 70px; }
	.tx-limit .tx-meter { grid-column: 1 / -1; grid-row: 2; }
	.tet-tool .tx-area, .tet-tool .tx-out { min-height: 200px; }
}

/* Two-way switch */
.tx-switch { display: grid; grid-template-columns: 1fr 1fr; max-width: 420px; background: var(--c-sand); border: 1px solid var(--c-line); border-radius: 999px; padding: 4px; margin-bottom: 4px; }
.tx-switch button { border: 0; background: none; border-radius: 999px; min-height: 40px; font: inherit; font-size: 14px; font-weight: 600; color: var(--c-text); cursor: pointer; }
.tx-switch button.is-on { background: var(--c-white); color: var(--c-ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.tx-cheat { margin-top: 14px; font-size: 14px; }
.tx-cheat summary { cursor: pointer; font-weight: 600; color: var(--c-accent); }
.tx-cheat table { border-collapse: collapse; margin-top: 8px; width: 100%; }
.tx-cheat td { padding: 4px 8px; border-bottom: 1px solid var(--c-line); vertical-align: top; }
.tx-cheat td:first-child { font-family: ui-monospace, Menlo, Consolas, monospace; white-space: nowrap; color: var(--c-ink); }

.tx-bar input[type="checkbox"], .tet-tool .tx-flags input { accent-color: var(--c-accent); width: 16px; height: 16px; }
.tx-cases .tet-btn.is-on:hover { background: var(--c-hover); color: #fff; }

/* Focus reading tool */
.fr .fr-area { min-height: 170px; }
.fr-count { margin: 0; }
.fr-controls { display: grid; gap: 14px; }
.fr-row { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-end; }
.fr-ctl { flex: 1 1 240px; }
.fr-seg { max-width: none; }
.fr-picks .fr-pick { flex: 1 1 140px; display: block; }
.fr-picks select { width: 100%; min-height: 42px; }
.fr-tick { margin: 0; font-size: 15px; }
.fr-actions { margin-top: 16px; }
.fr-view-wrap { position: relative; border: 1px solid var(--c-line); border-radius: 16px; background: #fff; color: var(--c-ink); }
.fr-view { max-width: 720px; margin: 0 auto; padding: 28px 24px; outline: none; overflow-wrap: break-word; }
.fr-view p { margin: 0 0 1em; }
.fr-view p:last-child { margin-bottom: 0; }
.fr-view b { font-weight: 700; }
.fr-view .fr-empty { opacity: .65; font-size: 16px; }
.fr-bg-cream { background: #FAF5E9; }
.fr-bg-blue { background: #E8F0F7; }
.fr-bg-dark { background: #1A1D1C; color: #EDEDE8; border-color: #1A1D1C; }
.fr-fade .fr-view { color: rgba(26, 29, 28, .68); }
.fr-fade .fr-view b { color: #1A1D1C; }
.fr-bg-dark.fr-fade .fr-view { color: rgba(237, 237, 232, .7); }
.fr-bg-dark.fr-fade .fr-view b { color: #EDEDE8; }
.fr-exit { display: none !important; }
.fr-view-wrap.is-full { position: fixed; inset: 0; z-index: 99999; border-radius: 0; border: 0; overflow-y: auto; }
.fr-view-wrap.is-full .fr-view { padding: 64px 24px 80px; }
.fr-view-wrap.is-full .fr-exit { display: inline-flex !important; position: fixed; top: 14px; right: 14px; z-index: 2; }
html.fr-lock, html.fr-lock body { overflow: hidden; }
@media (max-width: 560px) { .fr-view { padding: 20px 16px; } }
@media print {
	body * { visibility: hidden !important; }
	.fr-view-wrap, .fr-view-wrap * { visibility: visible !important; }
	.fr-view-wrap { position: absolute; left: 0; top: 0; width: 100%; border: 0; background: #fff !important; }
	.fr-exit { display: none !important; }
}

/* ---------- Line height calculator ---------- */
.lh .cx-help { font-size: 13px; opacity: .85; line-height: 1.45; display: block; }
.lh .lh-tabs { max-width: 360px; margin: 0 0 14px; }
.lh .lh-controls { margin-top: 0; }
.lh-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 18px; }
.lh-field { min-width: 0; }
.lh-field select, .lh-field input[type="number"], .lh-field input[type="text"] { min-height: 42px !important; }
.lh-field .tet-inline select { flex: 0 0 auto; width: auto; }
.lh-field input[type="range"] { width: 100%; margin: 10px 0 0; accent-color: var(--c-accent); }
.lh-hint { margin-top: 4px; }
.lh-custom { margin-top: 8px; }
.lh-more { margin-top: 14px; border-top: 1px solid var(--c-line); padding-top: 10px; }
.lh-more summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--c-accent); margin-bottom: 10px; }
.lh-seg { max-width: none; margin: 0; }
.lh-seg button { font-size: 13px; padding: 0 6px; min-height: 36px; }
.lh-results { margin-top: 14px; }
.lh-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0 0 10px; }
.lh-stats .tx-stat b { font-size: 22px; }
.lh-stats .tx-stat span { display: block; line-height: 1.35; margin-top: 2px; }
.lh-meta { grid-column: 1 / -1; margin: 0; }
.lh-rec { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; background: var(--c-sage); border-radius: 14px; padding: 14px 16px; }
.lh-rec > div { flex: 1 1 260px; }
.lh-rec-label { display: block; font-size: 13px; font-weight: 600; color: var(--c-hover); }
.lh-rec strong { display: block; font-size: 22px; color: var(--c-ink); font-variant-numeric: tabular-nums; white-space: pre; }
.lh-rec .tet-btn[disabled] { opacity: .5; cursor: default; }
.lh-prev-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin: 22px 0 4px; }
.lh-prev-head h3 { margin: 0; }
.lh-prev-bar { margin: 6px 0 10px; gap: 4px 16px; }
.lh-tick { margin: 0; font-size: 14px; }
.lh-prev-wrap { border: 1px solid var(--c-line); border-radius: 16px; background: #fff; color: var(--c-ink); padding: 24px; overflow: hidden; }
.lh-prev-wrap.is-dark { background: #1A1D1C; color: #EDEDE8; border-color: #1A1D1C; }
.lh-prev { outline: none; overflow-wrap: break-word; }
.lh-prev:focus { box-shadow: 0 0 0 3px rgba(31, 94, 75, .25); border-radius: 4px; }
.lh-prev p { margin: 0 0 var(--lh-pgap, 1em); }
.lh-prev p:last-child { margin-bottom: 0; }
.lh-prev-wrap.is-overlay .lh-prev { background-image: repeating-linear-gradient(to bottom, rgba(31, 94, 75, .10) 0, rgba(31, 94, 75, .10) var(--lh-box), transparent var(--lh-box), transparent calc(var(--lh-box) * 2)); box-shadow: inset 0 0 0 1px rgba(31, 94, 75, .25); }
.lh-prev-wrap.is-dark.is-overlay .lh-prev { background-image: repeating-linear-gradient(to bottom, rgba(242, 179, 61, .16) 0, rgba(242, 179, 61, .16) var(--lh-box), transparent var(--lh-box), transparent calc(var(--lh-box) * 2)); }
.lh-prev-note { margin: 6px 0 0; min-height: 1px; }
.lh-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lh-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; line-height: 1.5; }
.lh-check i { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; margin-top: 2px; background: var(--c-accent); position: relative; }
.lh-check i::after { content: ""; position: absolute; left: 6px; top: 3px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.lh-check.is-warn i { background: var(--c-wattle); }
.lh-check.is-warn i::after, .lh-check.is-bad i::after { content: "!"; left: 0; top: 0; width: 100%; height: 100%; border: 0; transform: none; color: #fff; font: 700 12px/18px system-ui, sans-serif; text-align: center; }
.lh-check.is-warn i::after { color: #1A1D1C; }
.lh-check.is-bad i { background: var(--c-danger); }
.lh-check strong { color: var(--c-ink); }
.lh-code-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.lh-code-head h3 { margin: 0 !important; }
.lh-code-seg { width: auto; min-width: 280px; }
.lh-sel-wrap { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.lh-sel-wrap .tx-label { margin: 0; }
.lh-sel-wrap .lh-sel { max-width: 220px; min-height: 38px !important; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px !important; }
.tet-tool .lh-code { min-height: 0; max-height: 420px; margin: 0; white-space: pre; overflow: auto; }
.lh-scale-intro { margin: 0 0 12px; }
.lh .lh-tab > .lh-controls > .lh-field { max-width: 360px; margin-top: 10px; }
.lh-scale { display: grid; gap: 0; border: 1px solid var(--c-line); border-radius: 16px; background: #fff; overflow: hidden; }
.lh-step { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--c-line); align-items: start; }
.lh-step:last-child { border-bottom: 0; }
.lh-step-meta { display: flex; flex-direction: column; font-size: 12.5px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.lh-step-meta strong { font-size: 14px; color: var(--c-accent); text-transform: uppercase; letter-spacing: .04em; }
.lh-step-sample { color: var(--c-ink); overflow-wrap: break-word; min-width: 0; }
.lh .tet-tool-gap { height: 0; }
@media (max-width: 760px) { .lh-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
	.lh-prev-wrap { padding: 16px; }
	.lh-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.lh-stats .tx-stat:nth-child(5) { grid-column: 1 / -1; }
	.lh-step { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 14px 16px; }
	.lh-step-meta { flex-direction: row; flex-wrap: wrap; gap: 2px 10px; }
	.lh-code-seg { min-width: 0; width: 100%; }
}
