.lorem-page { max-width: 960px; margin-inline: auto; }
/* The lorem ipsum generator: one panel. Settings in a row, then what you have and what you can do with it, then the text. */
.lorem { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -18px rgba(16, 24, 40, .18); }

/* Settings */
.lorem-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; padding: 16px 20px; background: var(--paper-soft); border-bottom: 1px solid var(--line); }
.lorem-units { display: flex; gap: 2px; margin: 0; padding: 3px; border: 0; border-radius: 9px; background: #e6eaf2; min-width: 0; }
.lorem-units label { position: relative; display: block; cursor: pointer; }
.lorem-units input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.lorem-units span { display: block; border-radius: 7px; padding: 8px 14px; font-size: .84rem; font-weight: 600; color: var(--ink-soft); white-space: nowrap; transition: background-color .15s, color .15s, box-shadow .15s; }
.lorem-units label:hover span { color: var(--ink); }
.lorem-units input:checked + span { background: #fff; color: var(--accent); box-shadow: 0 1px 2px rgba(16, 24, 40, .14); }
.lorem-units input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.lorem-amount { display: flex; align-items: center; gap: 14px; flex: 1 1 260px; min-width: 0; }
#lorem-amount { box-sizing: border-box; width: 92px; height: 40px; border: 1px solid #ccd5e3; border-radius: 8px; background: #fff; color: var(--ink); padding: 6px 10px; font: 600 1rem var(--mono); text-align: center; }
#lorem-amount:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
#lorem-amount[aria-invalid="true"] { border-color: var(--error-line); background: var(--error-soft); }
#lorem-slider { --filled: 10.5%; appearance: none; flex: 1; min-width: 80px; height: 28px; margin: 0; background: transparent; cursor: pointer; }
#lorem-slider::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--filled), #d5dbe7 var(--filled)); }
#lorem-slider::-moz-range-track { height: 6px; border-radius: 3px; background: #d5dbe7; }
#lorem-slider::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
#lorem-slider::-webkit-slider-thumb { appearance: none; width: 20px; height: 20px; margin-top: -7px; border: 2px solid var(--accent); border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .25); transition: transform .12s; }
#lorem-slider::-moz-range-thumb { box-sizing: border-box; width: 20px; height: 20px; border: 2px solid var(--accent); border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .25); }
#lorem-slider:active::-webkit-slider-thumb { transform: scale(1.15); }
#lorem-slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.lorem-switch { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 40px; font-size: .84rem; font-weight: 600; color: var(--ink); cursor: pointer; white-space: nowrap; }
.lorem-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.lorem-switch-track { position: relative; flex: none; width: 38px; height: 22px; border-radius: 11px; background: #c3cbd9; transition: background-color .15s; }
.lorem-switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .3); transition: transform .15s; }
.lorem-switch input:checked + .lorem-switch-track { background: var(--accent); }
.lorem-switch input:checked + .lorem-switch-track::after { transform: translateX(16px); }
.lorem-switch input:focus-visible + .lorem-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* What you have, and what you can do with it */
.lorem-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.lorem-summary { margin: 0; font-size: .82rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.lorem-summary.is-error { color: var(--error-ink); font-weight: 600; }
.lorem-actions { display: flex; align-items: center; gap: 10px; }
.lorem-view { display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: #eef1f6; }
.lorem-view button { border: 0; border-radius: 7px; background: transparent; padding: 7px 13px; font-family: inherit; font-size: .8rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; transition: background-color .15s, color .15s, box-shadow .15s; }
.lorem-view button:hover { color: var(--ink); }
.lorem-view button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .14); }
.lorem-again { display: inline-flex; align-items: center; gap: 8px; height: 40px; border: 0; border-radius: 8px; background: transparent; padding: 0 12px; font-family: inherit; font-size: .84rem; font-weight: 600; color: var(--ink); cursor: pointer; white-space: nowrap; transition: background-color .15s, color .15s; }
.lorem-again:hover { background: #eef1f6; color: var(--accent); }
.lorem-again .site-icon { width: 17px; height: 17px; transition: transform .3s; }
.lorem-again:active .site-icon { transform: rotate(180deg); }
.lorem-copy.btn { min-height: 40px; gap: 9px; border-radius: 8px; padding: 0 18px; font-size: .88rem; transition: background-color .15s, border-color .15s, transform .08s; }
.lorem-copy.btn:active { transform: scale(.97); }
.lorem-copy-label { display: inline-block; min-width: 3.4em; text-align: left; }
.lorem-copy-icons { display: inline-grid; }
.lorem-copy-icons .site-icon { grid-area: 1 / 1; width: 17px; height: 17px; transition: opacity .15s, transform .15s; }
.lorem-copy-icons .site-icon:last-child { opacity: 0; transform: scale(.6); }
.lorem-copy[data-copied="true"] { background: #1f7a4d; border-color: #1f7a4d; }
.lorem-copy[data-copied="true"] .site-icon:first-child { opacity: 0; transform: scale(.6); }
.lorem-copy[data-copied="true"] .site-icon:last-child { opacity: 1; transform: none; }
.lorem :is(.lorem-view button, .lorem-again, .lorem-copy):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lorem :is(.lorem-view button, .lorem-again, .lorem-copy):disabled { opacity: .55; cursor: default; }

/* The text. A fixed height, so nothing under it moves as the amount changes. */
.lorem-sheet { box-sizing: border-box; height: clamp(280px, 100vh - 500px, 560px); overflow-y: auto; padding: 26px 28px 40px; color: var(--ink); font-size: 1.02rem; line-height: 1.8; overflow-wrap: anywhere; scrollbar-width: thin;
    /* The last line fades out at the bottom edge, so it is plain there is more to scroll. */
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 34px), transparent); }
.lorem-sheet:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lorem-sheet p { margin: 0 0 1.15em; }
.lorem-sheet p:last-child { margin-bottom: 0; }
.lorem-sheet.is-html { font: .86rem/1.8 var(--mono); }
.lorem-sheet.is-html p { margin-bottom: 1.15em; }
.lorem-sheet.is-html span { color: var(--accent); }
.lorem-sheet.is-new { animation: lorem-new .28s ease-out; }
@keyframes lorem-new { from { opacity: .25; transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .lorem-sheet.is-new { animation: none; } .lorem *, .lorem *::after { transition: none !important; } }

@media (max-width: 700px) {
    .lorem-controls { gap: 12px; padding: 14px; }
    .lorem-units { width: 100%; }
    .lorem-units label { flex: 1 1 auto; }
    .lorem-units span { padding: 10px 4px; font-size: .8rem; text-align: center; }
    .lorem-amount { flex-basis: 100%; }
    #lorem-amount { font-size: 16px; }
    /* Two rows: the counts beside the Text and HTML switch, then New text and Copy. */
    .lorem-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 12px 14px; gap: 12px 14px; }
    .lorem-actions { display: contents; }
    .lorem-summary { grid-area: 1 / 1; display: flex; align-items: center; min-height: 2.9em; line-height: 1.45; }
    .lorem-view { grid-area: 1 / 2; align-self: center; }
    .lorem-view button { padding: 9px 13px; }
    .lorem-again { grid-area: 2 / 1; justify-self: start; height: 44px; margin-left: -8px; }
    .lorem-copy.btn { grid-area: 2 / 2; min-height: 44px; min-width: 132px; }
    .lorem-sheet { height: clamp(260px, 100vh - 420px, 480px); padding: 22px 18px 26px; font-size: 1rem; line-height: 1.75; }
    .lorem-sheet.is-html { font-size: .8rem; }
}
/* The slider does the stepping; the number box stays clean. */
#lorem-amount { appearance: textfield; -moz-appearance: textfield; }
#lorem-amount::-webkit-outer-spin-button, #lorem-amount::-webkit-inner-spin-button { appearance: none; margin: 0; }
/* On the narrowest phones the counts beside the switch run to three lines, so three are kept for them. */
@media (max-width: 359px) { .lorem-summary { min-height: 4.35em; } }
