:root {
  color-scheme: light;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #202534;
  background: #f5f6fa;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #202534;
  --muted: #818797;
  --line: #e9ebf1;
  --purple: #6b58da;
  --purple-dark: #5846c3;
  --purple-light: #f1efff;
  --surface: #fff;
  --shadow: 0 8px 28px rgb(34 39 61 / 4%);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(ellipse at 13% 0%, rgb(227 222 255 / 32%), transparent 29rem),
    #f5f6fa;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

.app-shell { max-width: 1200px; margin: 0 auto; padding: 0 38px; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgb(226 228 237 / 80%); }
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; font-family: Manrope, sans-serif; font-size: 15px; font-weight: 800; letter-spacing: -.5px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; overflow: hidden; border-radius: 10px; background: #192b61; box-shadow: 0 4px 10px rgb(25 43 97 / 20%); }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.discord-link { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; border: 1px solid #e6e2f8; border-radius: 8px; color: #5d4ec0; background: #fff; font-size: 11px; font-weight: 700; text-decoration: none; transition: background .15s, border-color .15s; }
.discord-link svg { width: 17px; height: 17px; }
.discord-link:hover { border-color: #c9c1ef; background: #f7f5ff; }
.local-badge { display: inline-flex; align-items: center; gap: 8px; color: #72798b; font-size: 12px; font-weight: 500; }
.local-badge > span, .preview-state > span { width: 7px; height: 7px; border-radius: 50%; background: #48b58a; box-shadow: 0 0 0 3px #e4f6ed; }

.intro { padding: 44px 2px 27px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.eyebrow, .section-kicker { margin: 0 0 9px; color: var(--purple); font-size: 10px; line-height: 1.3; font-weight: 700; letter-spacing: 1.25px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-family: Manrope, sans-serif; font-size: clamp(32px, 4vw, 43px); letter-spacing: -1.9px; line-height: 1.12; font-weight: 700; }
.intro-copy { max-width: 560px; margin-bottom: 0; color: #777e8d; font-size: 14px; line-height: 1.7; }
.shortcut-note { display: flex; align-items: center; gap: 10px; margin-bottom: 3px; color: #83899a; font-size: 11px; line-height: 1.6; white-space: nowrap; }
.shortcut-note strong { color: #4a5061; font-weight: 600; }
.shortcut-icon { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #e6e2fc; border-radius: 10px; color: var(--purple); background: #fff; font-size: 18px; }
.mobile-break { display: none; }

.notice { display: flex; align-items: flex-start; gap: 11px; padding: 12px 15px; border: 1px solid #e6e2fb; border-radius: 11px; background: #f9f8ff; }
.notice-icon { flex: 0 0 17px; width: 17px; height: 17px; display: grid; place-items: center; margin-top: 1px; border-radius: 50%; color: #fff; background: #9586e9; font-family: Georgia, serif; font-size: 12px; font-style: italic; font-weight: 700; }
.notice p { margin: 0; color: #77738c; font-size: 11px; line-height: 1.65; }
.notice strong { color: #4c456f; font-weight: 700; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, .9fr); gap: 18px; margin-top: 18px; align-items: stretch; }
.card { border: 1px solid #ebedf3; border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.compose-card, .settings-card { padding: 23px 24px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-heading h2 { margin: 0; font-family: Manrope, sans-serif; font-size: 17px; font-weight: 700; letter-spacing: -.35px; }
.card-heading .section-kicker { margin-bottom: 6px; font-size: 9px; }
.soft-tag { padding: 5px 9px; border-radius: 6px; color: #818797; background: #f5f6f9; font-size: 10px; font-weight: 600; }
.settings-glyph { color: #9c91e7; font-size: 20px; line-height: 1; }

.field-label { display: flex; justify-content: space-between; gap: 10px; margin: 19px 0 7px; color: #4b5263; font-size: 11px; font-weight: 600; }
.field-label > span { color: #a0a5b1; font-size: 10px; font-weight: 400; }
.text-input { width: 100%; height: 39px; padding: 0 12px; border: 1px solid #e7e9ef; border-radius: 8px; outline: none; color: #33394a; background: #fff; font-size: 12px; transition: border-color .15s, box-shadow .15s; }
.text-input::placeholder, textarea::placeholder { color: #b0b4bf; }
.text-input:focus, .body-input:focus { border-color: #9a8ee9; box-shadow: 0 0 0 3px rgb(107 88 218 / 10%); }
.text-input:disabled { color: #a3a7b2; background: #f6f7f9; }
.google-connection { margin-top: 20px; padding: 13px 12px 10px; border: 1px solid #ececf3; border-radius: 9px; background: #fbfbfd; }
.connection-header { display: flex; align-items: center; gap: 9px; }
.connection-icon { flex: 0 0 27px; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; background: white; }
.connection-icon svg { width: 17px; height: 17px; }
.connection-copy { min-width: 0; flex: 1; display: grid; gap: 3px; }
.connection-copy strong { color: #484f60; font-size: 10px; font-weight: 700; }
.connection-copy small { color: #969ba8; font-size: 9px; line-height: 1.4; }
.connect-button { flex: 0 0 auto; min-height: 31px; padding: 0 10px; border: 1px solid #e6e2f8; border-radius: 7px; color: #5d4ec0; background: #fff; font-size: 10px; font-weight: 700; }
.connect-button[hidden] { display: none; }
.connect-button[href] { display: inline-flex; align-items: center; text-decoration: none; }
.connect-button:hover { border-color: #c9c1ef; background: #f7f5ff; }
.connect-button:disabled { opacity: .6; cursor: wait; }
.client-config { margin-top: 11px; padding-top: 9px; border-top: 1px solid #eff0f4; }
.client-config summary { color: #777d8c; font-size: 9px; font-weight: 600; cursor: pointer; }
.client-config > p { margin: 8px 0; color: #969ba8; font-size: 9px; line-height: 1.55; }
.client-config .field-label { margin-top: 9px; }
.insertion-label { margin-top: 13px; }
.document-warning { margin: 7px 0 0; color: #a6574e; font-size: 10px; line-height: 1.5; }
.document-warning[hidden] { display: none; }
.title-options { display: flex; flex-wrap: wrap; align-items: center; gap: 11px 16px; padding: 11px 1px 3px; }
.check-option { display: inline-flex; align-items: center; gap: 6px; color: #747b8b; font-size: 10px; white-space: nowrap; cursor: pointer; }
.check-option input, .mla-option > input { width: 14px; height: 14px; margin: 0; accent-color: var(--purple); cursor: pointer; }
.inline-size { display: inline-flex; align-items: center; gap: 4px; color: #9499a7; font-size: 10px; white-space: nowrap; }
.inline-size input { width: 39px; height: 25px; padding: 0 4px; border: 1px solid #e8eaf0; border-radius: 5px; color: #4d5362; background: #fff; font-size: 10px; text-align: center; }
.inline-size input:disabled { color: #a2a6b0; background: #f5f6f8; }
.body-label { margin-top: 16px; }
.body-input { display: block; width: 100%; min-height: 225px; padding: 13px 14px; resize: vertical; border: 1px solid #e7e9ef; border-radius: 8px; outline: none; color: #414858; background: #fff; font-size: 12px; line-height: 1.7; transition: border-color .15s, box-shadow .15s; }
.input-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 9px; color: #a0a5b1; font-size: 10px; }
.text-button { padding: 2px 0; border: 0; color: #777d8c; background: transparent; font-size: 10px; font-weight: 600; }
.text-button:hover { color: var(--purple); }

.mla-option { display: flex; align-items: center; gap: 10px; margin: 18px 0 2px; padding: 11px 12px; border: 1px solid #eeeafa; border-radius: 9px; background: #faf9ff; cursor: pointer; }
.mla-option > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch { position: relative; flex: 0 0 31px; width: 31px; height: 18px; border-radius: 99px; background: #d7d9e2; transition: background .2s; }
.switch::after { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgb(0 0 0 / 15%); content: ""; transition: transform .2s; }
.mla-option > input:checked + .switch { background: var(--purple); }
.mla-option > input:checked + .switch::after { transform: translateX(13px); }
.mla-option > input:focus-visible + .switch { outline: 3px solid rgb(107 88 218 / 22%); outline-offset: 2px; }
.mla-copy { display: grid; gap: 3px; }
.mla-copy strong { color: #4b5060; font-size: 10px; font-weight: 700; }
.mla-copy small { color: #9599a8; font-size: 9px; }
.settings-fields .field-label { margin-top: 15px; }
.settings-fields .spacing-label { margin-top: 14px; }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; }
.select-wrap > span { position: absolute; top: 8px; right: 12px; color: #858b99; font-size: 17px; pointer-events: none; }
.custom-spacing[hidden], #custom-spacing[hidden] { display: none; }
.custom-spacing { margin-top: 11px !important; }
#custom-spacing { margin-top: -1px; }
.indent-option { margin-top: 13px; font-size: 10px; }
.setting-divider { height: 1px; margin: 17px 0 15px; background: #eff0f4; }
.pace-heading { display: flex; align-items: center; justify-content: space-between; }
.pace-heading .field-label { margin: 0; }
.pace-note { color: #a2a6b2; font-size: 9px; }
.range-setting { margin-top: 13px; }
.range-setting > label { display: flex; align-items: center; justify-content: space-between; color: #747b8b; font-size: 10px; }
.range-setting > label strong { color: #484f60; font-size: 11px; font-weight: 700; }
.range-setting > label small { margin-left: 3px; color: #9499a6; font-size: 9px; font-weight: 500; }
input[type="range"] { display: block; width: 100%; height: 14px; margin: 6px 0 1px; accent-color: var(--purple); cursor: pointer; }
.range-limits { display: flex; justify-content: space-between; color: #adb1bc; font-size: 9px; }
.last-range { margin-top: 13px; }

.preview-card { margin-top: 18px; padding: 21px 24px 0; overflow: hidden; }
.preview-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 15px; }
.preview-heading-row .card-heading h2 { font-size: 16px; }
.preview-state { display: inline-flex; align-items: center; gap: 8px; color: #878d9b; font-size: 10px; white-space: nowrap; }
.preview-state > span { width: 6px; height: 6px; box-shadow: 0 0 0 3px #e4f6ed; }
.preview-state[data-state="running"] > span { background: #e4a948; box-shadow: 0 0 0 3px #fcf1dc; }
.preview-state[data-state="stopped"] > span { background: #d27b79; box-shadow: 0 0 0 3px #fae9e9; }
.preview-paper { min-height: 190px; max-height: 460px; overflow: auto; padding: 24px clamp(20px, 5vw, 60px); border: 1px solid #ececf2; border-radius: 9px 9px 0 0; background: #fff; box-shadow: inset 0 2px 6px rgb(35 42 65 / 2%); }
.preview-title { margin-bottom: 1em; color: #303547; font-size: 14pt; line-height: 1.4; white-space: pre-wrap; }
.preview-body { min-height: 138px; color: #424858; font-family: Georgia, serif; font-size: 12pt; line-height: 1.2; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; }
.preview-placeholder { color: #b5b8c2; font-family: "DM Sans", sans-serif; font-size: 11px; }
.typing-caret { display: inline-block; width: 1px; height: 1.1em; margin-left: 1px; background: var(--purple); vertical-align: text-bottom; animation: blink .95s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.preview-footer { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #9298a6; font-size: 10px; }
.preview-actions { display: flex; gap: 8px; }
.secondary-button { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 10px; border: 1px solid #e8eaf0; border-radius: 7px; color: #646b7a; background: white; font-size: 10px; font-weight: 600; transition: background .15s, border-color .15s; }
.secondary-button svg { width: 15px; height: 15px; }
.secondary-button:hover:not(:disabled) { border-color: #cec8f4; color: var(--purple); background: #faf9ff; }
.secondary-button:disabled { color: #b7bbc5; background: #fafbfc; }

.action-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 19px 2px 25px; }
.action-row > p { display: flex; align-items: center; gap: 8px; margin: 0; color: #858b99; font-size: 11px; }
.hint-dot { width: 6px; height: 6px; border-radius: 50%; background: #a093ea; }
.action-buttons { display: flex; gap: 9px; }
.start-button, .stop-button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-width: 145px; height: 43px; padding: 0 17px; border: 0; border-radius: 9px; font-size: 12px; font-weight: 700; transition: transform .15s, background .15s, box-shadow .15s; }
.start-button { color: #fff; background: var(--purple); box-shadow: 0 5px 12px rgb(107 88 218 / 20%); }
.start-button:hover:not(:disabled) { transform: translateY(-1px); background: var(--purple-dark); box-shadow: 0 7px 16px rgb(107 88 218 / 28%); }
.start-button:disabled { opacity: .58; }
.start-button svg { width: 17px; height: 17px; }
.stop-button { min-width: 78px; border: 1px solid #eadcdd; color: #a05055; background: #fff; }
.stop-button:hover:not(:disabled) { background: #fff5f5; }
.stop-button:disabled { display: none; }
.footer { display: flex; justify-content: space-between; padding: 16px 2px 23px; border-top: 1px solid #e7e9ef; color: #9a9eaa; font-size: 10px; }
.footer span:first-child { color: #6e7483; font-weight: 600; }
.toast { position: fixed; right: 24px; bottom: 20px; z-index: 3; padding: 11px 15px; transform: translateY(10px); border: 1px solid #e7e3fa; border-radius: 9px; color: #55489d; background: #fff; box-shadow: 0 8px 24px rgb(34 39 61 / 12%); font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { transform: translateY(0); opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgb(107 88 218 / 28%); outline-offset: 2px; }

@media (max-width: 820px) {
  .app-shell { padding: 0 24px; }
  .workspace { grid-template-columns: minmax(0, 1.1fr) minmax(285px, .9fr); gap: 13px; }
  .compose-card, .settings-card { padding: 20px 18px; }
  .title-options { gap: 10px 12px; }
  .pace-note { display: none; }
}

@media (max-width: 680px) {
  .app-shell { padding: 0 17px; }
  .topbar { height: 65px; }
  .local-badge { font-size: 10px; }
  .intro { padding: 35px 2px 22px; }
  h1 { font-size: 35px; }
  .intro-copy { max-width: 460px; font-size: 12px; }
  .shortcut-note { display: none; }
  .workspace { grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
  .compose-card, .settings-card { padding: 21px 20px; }
  .body-input { min-height: 190px; }
  .preview-card { margin-top: 14px; padding: 19px 18px 0; }
  .preview-paper { min-height: 170px; padding: 22px 18px; }
  .preview-heading-row { align-items: flex-start; }
  .preview-state { margin-top: 3px; font-size: 9px; }
  .action-row { align-items: stretch; flex-direction: column; padding: 17px 2px 20px; }
  .action-row > p { font-size: 10px; }
  .action-buttons { justify-content: flex-end; }
  .start-button { flex: 1; }
  .footer { gap: 12px; font-size: 9px; }
}

@media (max-width: 400px) {
  .app-shell { padding: 0 13px; }
  .discord-link { min-height: 33px; gap: 6px; padding: 0 9px; font-size: 10px; }
  .discord-link svg { width: 15px; height: 15px; }
  .intro { padding-top: 29px; }
  h1 { font-size: 31px; letter-spacing: -1.4px; }
  .mobile-break { display: initial; }
  .notice { padding: 11px; }
  .notice p { font-size: 10px; }
  .compose-card, .settings-card { padding: 19px 15px; }
  .title-options { gap: 9px; }
  .preview-footer { align-items: flex-start; flex-direction: column; padding: 12px 0; }
  .preview-actions { width: 100%; }
  .secondary-button { flex: 1; justify-content: center; padding: 0 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
