.end-page { --end-ink: #20271b; background: #f5f6f1; color: var(--ink); }
.end-page[data-theme="dark"] { --end-ink: #edf5e5; background: #11140f; color: #edf5e5; }
.end-tools, .end-lab { width: calc(100% - 64px); max-width: 1280px; margin-inline: auto; }
.end-tools { display: flex; align-items: center; gap: 20px; min-height: 70px; border-bottom: 1px solid var(--line); }
.end-logo { display: inline-flex; align-items: center; min-height: 44px; font: 750 34px/1 var(--sans); letter-spacing: -2.5px; text-decoration: none; }
.end-logo > span { color: #83a933; }
.end-tools > span { color: var(--muted); font: 10px var(--mono); letter-spacing: 1px; }
.end-return { display: flex; align-items: center; min-height: 44px; margin-left: auto; font-size: 12px; text-decoration: none; }
.end-directions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 17px 0 12px; }
.end-directions > button { display: flex; align-items: center; gap: 12px; min-height: 55px; padding: 10px 17px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--end-ink); font-size: 14px; text-align: left; }
.end-directions small { color: var(--muted); font: 10px var(--mono); }
.end-directions > [aria-pressed="true"] { background: var(--end-ink); border-color: var(--end-ink); color: var(--paper); }
.end-directions > [aria-pressed="true"] small { color: #a3c46b; }
.end-page[data-theme="dark"] .end-directions > [aria-pressed="true"] small { color: #4b642e; }
.end-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.end-controls > p { margin: 0 auto 0 0; padding-right: 15px; color: var(--muted); font-size: 11px; }
.end-control-group { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; }
.end-control-group button { min-height: 44px; padding: 0 12px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 10px; }
.end-control-group [aria-pressed="true"] { background: var(--paper); box-shadow: 0 1px 3px #17191715; color: var(--end-ink); }
.end-theme { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 8px; background: transparent; font-size: 23px; }
.end-mat { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #e9ece3; }
.end-page[data-theme="dark"] .end-mat { background: #0a0e07; }
.end-viewport { width: 100%; margin-inline: auto; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); container: ending / inline-size; }
.end-viewport[data-size="phone"] { max-width: 390px; }
.end-context { display: flex; align-items: center; gap: 12px; height: 34px; padding: 0 25px; color: var(--muted); font: 8px var(--mono); letter-spacing: .5px; }
.end-context > i { flex: 1; border-bottom: 1px solid var(--line); }
.end-footer { position: relative; color: var(--end-ink); }
.end-bottom { display: flex; align-items: center; gap: 22px; min-height: 67px; margin: 0 26px; border-top: 1px solid var(--line); font: 11px var(--mono); }
.end-bottom > span { margin-right: auto; color: var(--muted); font-size: 10px; }
.end-bottom > a { display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; }
.end-bottom svg, .end-signature-top svg { width: 16px; height: 16px; flex-shrink: 0; }
.end-bottom > a > span { font-size: 19px; }
.end-plain { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding: 20px 26px 28px; font-family: "Times New Roman", serif; }
.end-plain > a { font-size: 48px; font-weight: 700; text-decoration: none; }
.end-plain > span { font-size: 20px; }
.end-footer[data-mode="bare"] .end-bottom { font-family: var(--bare-font, Georgia); }
.end-footer[data-mode="bare"] .end-bottom > a { text-decoration: underline; text-underline-offset: 3px; }
.end-signature-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 26px 0; font: 10px var(--mono); }
.end-signature-top > span { color: var(--muted); letter-spacing: 1px; }
.end-signature-top > a { display: flex; align-items: center; gap: 9px; min-height: 44px; text-decoration: none; }
.end-ink { display: block; width: calc(100% - 42px); height: clamp(175px, 27cqw, 310px); margin: -20px auto 0; padding: 0; border: 1px solid transparent; background: transparent; cursor: grab; touch-action: none; }
.end-ink[data-dragging="true"] { cursor: grabbing; }
.end-ink > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.end-ink g { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ink-shadow { stroke: #29351c; stroke-opacity: calc(.07 + var(--ink-lift,0)*.06); stroke-width: 15; }
.ink-body { stroke: var(--end-ink); stroke-width: 14; }
.ink-highlight { stroke: var(--paper); stroke-opacity: .1; stroke-width: 1.5; }
.ink-dot { fill: var(--lime); stroke: #99bd50; stroke-width: 1; }
.ink-tail { fill: none; stroke: var(--end-ink); stroke-width: 1; opacity: .2; }
.end-signature[data-ink="true"] .ink-dot { fill: #a78ee2; stroke: #8267b8; }
.end-signature[data-mode="showoff"] .ink-body { stroke-width: 18; }
.end-signature[data-mode="showoff"] .ink-shadow { stroke-width: 20; }
.end-light:not([data-mode="bare"]) { background: #182012; color: #eff6e4; border-radius: 0 0 3px 3px; }
.end-light:not([data-mode="bare"]) .end-bottom { border-color: #ffffff26; }
.end-light:not([data-mode="bare"]) .end-bottom > span { color: #a8b59b; }
.end-light-room { position: relative; isolation: isolate; height: 270px; overflow: hidden; }
.light-pool { position: absolute; z-index: -1; inset: -70% -10% -40%; background: radial-gradient(ellipse at var(--light-x, 72%) 42%, #d6fa704a, #b9dd5522 26%, transparent 57%); }
.light-words { position: absolute; left: 38px; bottom: 32px; font: 550 clamp(75px, 13cqw, 166px)/1 var(--sans); letter-spacing: -.07em; text-shadow: 0 1px 0 #ffffff33; }
.light-words > span { color: var(--lime); }
.light-switch { position: absolute; right: 4%; top: -23px; width: 200px; height: 270px; padding: 0; border: 1px solid transparent; background: transparent; cursor: grab; touch-action: none; }
.light-switch[data-dragging="true"] { cursor: grabbing; }
.light-switch > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.light-pendant { transform: rotate(var(--swing, 0rad)); transform-origin: 100px 0; }
.light-cable { fill: none; stroke: #93a47a; stroke-width: 2; }
.end-light-room[data-lit="false"] .light-pool { opacity: 0; }
.end-light-room[data-lit="false"] .light-bulb { fill: #58644c; }
.end-light-room[data-lit="false"] .light-words { color: #9eae8d; text-shadow: none; }
.end-light-room[data-lit="false"] .light-words > span { color: #6f8155; }
.end-light[data-mode="dressed"] .light-switch { cursor: pointer; }
.end-turn { position: relative; display: block; width: 100%; height: 275px; padding: 0; border: 1px solid transparent; border-bottom: 1px solid var(--line); background: var(--paper); cursor: grab; touch-action: none; overflow: hidden; }
.end-turn[data-dragging="true"] { cursor: grabbing; }
.end-turn > svg { display: block; width: 100%; height: 100%; }
.turn-under { fill: var(--lime); }
.turn-paper { fill: var(--paper); }
.turn-title, .turn-again { fill: var(--end-ink); font: 550 clamp(56px, 12.5cqw, 158px)/1 var(--sans); letter-spacing: -.065em; }
.turn-title > tspan { fill: #83a933; }
.turn-again { fill: #20271b; font-size: clamp(48px, 10.6cqw, 135px); }
.turn-shadow { fill: #20271b; opacity: .12; }
.turn-crease { fill: none; stroke: #6f873945; stroke-width: 1; }
.turn-grip { position: absolute; left: var(--grip-x, calc(100% - 70px)); top: var(--grip-y, calc(100% - 55px)); display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #6e88394d; border-radius: 50%; background: #e5fbb9; color: #344722; transform: translate(-50%, -50%); pointer-events: none; }
.turn-grip > svg { width: 18px; height: 18px; }
.end-turn[aria-pressed="true"] .turn-grip { opacity: 0; }
.end-footer[data-mode="dressed"] .end-turn { cursor: pointer; }
.end-page .end-lab { padding-bottom: 28px; }
.theme-changing *, .theme-changing *::before, .theme-changing *::after { transition: none !important; }
.end-footer[data-instant="true"] * { transition: none !important; }
@media (prefers-reduced-motion: no-preference) {
  .end-directions > button, .end-bottom a { transition: color 150ms ease-out, background-color 150ms ease-out; }
  .light-pool, .light-words, .light-words > span { transition: opacity 180ms ease-out, color 180ms ease-out; }
  .end-control-group button { transition: background-color 150ms ease-out, color 150ms ease-out; }
  .end-theme:enabled:active, .end-directions > button:enabled:active { scale: .96; transition: scale 150ms ease-out; }
}
@media (hover: hover) and (pointer: fine) {
  .end-directions > button:not([aria-pressed="true"]):hover { background: var(--paper); }
  .end-bottom a:hover, .end-signature-top > a:hover { color: #688c2e; }
  .end-page[data-theme="dark"] .end-bottom a:hover, .end-light:not([data-mode="bare"]) .end-bottom a:hover { color: var(--lime); }
}
@container ending (max-width: 600px) {
  .end-bottom { gap: 14px; margin-inline: 18px; font-size: 10px; min-height: 64px; }
  .end-bottom > span { font-size: 8px; }
  .end-bottom > a { gap: 5px; }
  .end-signature-top { padding-inline: 18px; }
  .end-ink { width: calc(100% - 18px); height: clamp(110px, 32cqw, 185px); margin-top: -10px; }
  .end-light-room { height: 225px; }
  .light-words { left: 20px; bottom: 44px; font-size: clamp(49px, 14cqw, 80px); }
  .light-switch { width: 116px; height: 210px; right: 0; top: -26px; }
  .end-turn { height: 170px; }
  .turn-title { font-size: 17cqw; }
  .turn-again { font-size: 15cqw; }
  .end-plain { padding-inline: 18px; }
}
@media (max-width: 850px) {
  .end-tools, .end-lab { width: calc(100% - 28px); }
  .end-tools { min-height: 60px; gap: 15px; }
  .end-directions > button { font-size: 12px; padding-inline: 11px; gap: 8px; }
  .end-controls > p { flex-basis: 100%; padding: 0 0 4px; }
  .end-control-group button { padding-inline: 10px; }
  .end-mat { padding: 6px; }
}
@media (max-width: 420px) {
  .end-tools > span { font-size: 8px; }
  .end-return { font-size: 10px; }
  .end-directions { gap: 4px; }
  .end-directions > button { flex-direction: column; align-items: start; font-size: 11px; padding: 8px 10px; gap: 5px; }
  .end-control-group button { padding-inline: 7px; font-size: 9px; }
  .end-context { padding-inline: 18px; }
}
