.text-page {
  background:
    radial-gradient(circle at 82% 8%, rgba(195, 186, 231, .34), transparent 28rem),
    radial-gradient(circle at 7% 43%, rgba(255, 201, 166, .22), transparent 25rem),
    var(--paper);
}

.back-home { justify-self: end; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 750; }
.back-home span { margin-left: 4px; color: #7d6bb3; }

.text-main { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.text-hero {
  min-height: 405px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 50px;
  align-items: center;
  padding: 62px 0 48px;
}
.text-hero h1 { margin: 24px 0 16px; font-size: clamp(46px, 6.3vw, 72px); line-height: 1.04; letter-spacing: -.065em; }
.text-hero h1 em { color: #7d6bb3; font-family: Georgia, "Songti SC", serif; font-weight: 500; }
.text-hero > div > p { max-width: 650px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.75; }
.text-privacy-card { display: flex; align-items: center; gap: 14px; padding: 20px; border: 1px solid rgba(91, 75, 139, .15); border-radius: 18px; background: rgba(241, 237, 251, .8); transform: rotate(-1.2deg); }
.text-privacy-card > span { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 14px 14px 14px 5px; background: #7d6bb3; color: #fff; font: 700 14px Georgia; transform: rotate(3deg); }
.text-privacy-card div { display: grid; gap: 4px; }
.text-privacy-card strong { font-size: 13px; }
.text-privacy-card small { color: #776b93; font-size: 10px; }

.text-workbench { margin-bottom: 90px; padding: 28px; border: 1px solid rgba(104, 96, 85, .22); border-radius: 28px; background: rgba(255, 254, 250, .92); box-shadow: 0 24px 70px rgba(59, 51, 40, .09), inset 0 1px #fff; backdrop-filter: blur(12px); }
.text-workbench-title { display: flex; align-items: end; justify-content: space-between; padding: 2px 2px 22px; border-bottom: 1px solid #e2ddd4; }
.text-workbench-title > div:first-child > span { color: #a49e95; font-size: 9px; font-weight: 850; letter-spacing: .16em; }
.text-workbench-title h2 { margin: 5px 0 0; font-size: 24px; letter-spacing: -.04em; }
.text-feature-pills { display: flex; gap: 6px; }
.text-feature-pills span { padding: 6px 9px; border-radius: 999px; background: #f0edf7; color: #756b8b; font-size: 9px; font-weight: 700; }

.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(78px, 1fr)) minmax(110px, 1.25fr); gap: 1px; margin: 20px 0 24px; border: 1px solid #e1dcd3; border-radius: 15px; overflow: hidden; background: #e1dcd3; }
.stats-grid article { min-height: 72px; display: grid; align-content: center; gap: 5px; padding: 12px; background: #f7f4ee; text-align: center; }
.stats-grid strong { font-size: 18px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stats-grid span { color: #8d877f; font-size: 9px; }
.stats-grid .reading-stat { background: #eee9f7; }
.reading-stat strong { color: #6f5ea4; font-size: 14px; }

.text-workspace-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(340px, .8fr); gap: 22px; align-items: start; }
.editor-card { min-width: 0; overflow: hidden; border: 1px solid #ded8ce; border-radius: 18px; background: #fbfaf7; }
.editor-toolbar { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px 12px 17px; border-bottom: 1px solid #e2ddd4; }
.editor-toolbar > div:first-child { display: grid; gap: 3px; }
.editor-toolbar strong { font-size: 12px; }
.editor-toolbar small { color: #9a948b; font-size: 8px; }
.editor-actions { display: flex; gap: 6px; }
.editor-actions button { height: 31px; border: 1px solid #d9d3ca; border-radius: 8px; padding: 0 10px; background: #fff; color: #6f6961; font-size: 9px; font-weight: 750; cursor: pointer; }
.editor-actions button:hover { border-color: #aaa1c2; background: #f5f1fb; color: #665790; }
#textInput { width: 100%; min-height: 580px; display: block; resize: vertical; border: 0; outline: 0; padding: 22px; background: transparent; color: #282622; font: 14px/1.85 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; tab-size: 2; }
#textInput::placeholder { color: #b2aca3; }
.editor-footer { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 16px; border-top: 1px solid #e5e0d8; background: #f5f2ec; color: #9a948b; font-size: 8px; }
.editor-footer > span:first-child { color: #6f5ea4; font-weight: 750; }

.text-tools-card { position: sticky; top: 18px; padding: 20px; border-radius: 18px; background: #242320; color: #f7f3ec; box-shadow: 0 15px 35px rgba(36, 35, 32, .12); }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid #403e3a; }
.history-row > div:first-child { display: grid; gap: 3px; }
.history-row strong { font-size: 13px; }
.history-row small { color: #858078; font-size: 8px; }
.history-row > div:last-child { display: flex; gap: 5px; }
.history-row button { border: 1px solid #4a4843; border-radius: 7px; padding: 6px 8px; background: transparent; color: #aaa59d; font-size: 8px; cursor: pointer; }
.history-row button:disabled { opacity: .35; cursor: default; }
.history-row button:hover:not(:disabled) { border-color: #81769f; color: #d6cced; }

.tool-section { padding: 17px 0; border-bottom: 1px solid #403e3a; }
.tool-section-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tool-section-heading > span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; background: #8471bb; color: #211f25; font: italic 8px Georgia; }
.tool-section-heading strong { color: #ded9d1; font-size: 10px; }
.action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.action-grid button { min-height: 35px; border: 1px solid #484641; border-radius: 8px; padding: 7px 8px; background: #2d2c29; color: #aaa59d; font-size: 9px; cursor: pointer; }
.action-grid button:hover { border-color: #8471bb; background: rgba(132, 113, 187, .12); color: #d9d0ee; }

.replace-fields { display: grid; gap: 7px; }
.replace-fields label { display: grid; grid-template-columns: 45px minmax(0, 1fr); align-items: center; gap: 7px; color: #858078; font-size: 8px; }
.replace-fields input { min-width: 0; width: 100%; height: 34px; border: 1px solid #484641; border-radius: 8px; outline: 0; padding: 0 9px; background: #2d2c29; color: #f5f1ea; font-size: 9px; }
.replace-fields input:focus { border-color: #8471bb; }
.replace-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.replace-actions label { display: inline-flex; align-items: center; gap: 6px; color: #858078; font-size: 8px; cursor: pointer; }
.replace-actions input { accent-color: #9b88d1; }
.replace-actions button { border: 0; border-radius: 8px; padding: 8px 11px; background: #8471bb; color: #fff; font-size: 9px; font-weight: 800; cursor: pointer; }
.replace-actions button:hover { background: #9783cc; }

.output-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding-top: 17px; }
.output-actions button { height: 39px; border-radius: 9px; font-size: 9px; font-weight: 850; cursor: pointer; }
.copy-text-button { border: 0; background: #9b88d1; color: #211f25; }
.download-text-button { border: 1px solid #57534e; background: transparent; color: #ddd8d0; }
.clear-text-button { grid-column: 1 / -1; height: 31px !important; border: 0; background: transparent; color: #77736c; }
.output-actions button:hover { filter: brightness(1.1); }

.text-benefits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-bottom: 100px; border: 1px solid #ded8ce; border-radius: 20px; overflow: hidden; background: #ded8ce; }
.text-benefits article { min-height: 170px; position: relative; padding: 25px; background: rgba(247, 244, 238, .9); }
.text-benefits article > span { position: absolute; right: 20px; top: 18px; color: #b2aca3; font: italic 11px Georgia; }
.text-benefits strong { display: block; margin-top: 43px; font-size: 15px; }
.text-benefits p { max-width: 270px; margin: 8px 0 0; color: #7e7870; font-size: 11px; line-height: 1.65; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 20; padding: 11px 15px; border-radius: 10px; background: #242320; color: #fff; box-shadow: 0 12px 30px rgba(0, 0, 0, .2); font-size: 11px; font-weight: 750; opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b94b3c; }

@media (max-width: 980px) {
  .text-hero { grid-template-columns: 1fr; gap: 25px; }
  .text-privacy-card { width: min(360px, 100%); }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .reading-stat { grid-column: span 2; }
  .text-workspace-grid { grid-template-columns: 1fr; }
  .text-tools-card { position: static; }
  #textInput { min-height: 440px; }
}

@media (max-width: 600px) {
  .text-main { width: calc(100% - 24px); }
  .back-home { font-size: 11px; }
  .text-hero { min-height: 0; padding: 50px 4px 43px; }
  .text-hero h1 { margin-top: 20px; font-size: 43px; }
  .text-hero > div > p { font-size: 13px; }
  .text-privacy-card { padding: 15px; transform: none; }
  .text-workbench { margin-bottom: 65px; padding: 12px; border-radius: 21px; }
  .text-workbench-title { align-items: flex-start; padding: 8px 6px 17px; }
  .text-feature-pills { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); margin: 12px 0; }
  .reading-stat { grid-column: span 2; }
  .editor-toolbar { align-items: flex-start; flex-direction: column; }
  .editor-actions { width: 100%; }
  .editor-actions button { flex: 1; padding: 0 6px; }
  #textInput { min-height: 390px; padding: 16px; font-size: 13px; }
  .editor-footer > span:last-child { display: none; }
  .text-tools-card { padding: 18px; border-radius: 15px; }
  .text-benefits { grid-template-columns: 1fr; margin-bottom: 70px; }
  .text-benefits article { min-height: 145px; }
  .text-benefits strong { margin-top: 30px; }
}
