/* Offline styles for text editor (no CDN required) */
*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.te-body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(to bottom right, #eff6ff, #e0e7ff);
  color: #1e293b;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.te-body.te-theme-dark {
  background: linear-gradient(to bottom right, #0f172a, #1e293b);
  color: #e2e8f0;
}
body.te-theme-dark .te-top,
body.te-theme-dark .te-editor-shell,
body.te-theme-dark .te-card-white,
body.te-theme-dark .te-step,
body.te-theme-dark .te-faq details,
body.te-theme-dark .te-footer-mini,
body.te-theme-dark .te-footer {
  background: #111827;
  color: #e2e8f0;
  border-color: #334155;
}
body.te-theme-dark .te-toolbar,
body.te-theme-dark .te-editor-footer,
body.te-theme-dark .te-md-preview {
  background: #0b1220;
  border-color: #334155;
}
body.te-theme-dark .te-textarea,
body.te-theme-dark .te-tool-btn {
  background: #0b1220;
  color: #e2e8f0;
  border-color: #334155;
}
body.te-theme-dark .te-nav-link,
body.te-theme-dark .te-back,
body.te-theme-dark .te-lead,
body.te-theme-dark .te-sub-gray,
body.te-theme-dark .te-card-soft p,
body.te-theme-dark .te-card-white p,
body.te-theme-dark .te-step p {
  color: #cbd5e1;
}
body.te-theme-dark .te-h1,
body.te-theme-dark .te-title-xl,
body.te-theme-dark .te-h2,
body.te-theme-dark .te-brand,
body.te-theme-dark .te-card-soft h3,
body.te-theme-dark .te-card-white h3,
body.te-theme-dark .te-step h3 {
  color: #f8fafc;
}

.te-u-hidden { display: none !important; }

.te-top {
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid #f1f5f9;
}
.te-wrap {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 640px) {
  .te-wrap { padding: 0 1.5rem; }
}
.te-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 3.5rem;
}
@media (min-width: 640px) {
  .te-bar { min-height: 4rem; }
}
.te-brand {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.02em;
  text-decoration: none;
}
@media (min-width: 640px) {
  .te-brand { font-size: 1.25rem; }
}
/* Tabs below header; horizontally scrollable on mobile */
.te-tabs-row {
  border-top: 1px solid #f1f5f9;
  padding: 0.35rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pinch-zoom;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.te-tabs-row::-webkit-scrollbar {
  display: none;
}
.te-tabs-row .te-nav-desk {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: max-content;
  min-width: 100%;
  margin: 0 auto;
  padding: 0.05rem 1rem 0.15rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-sizing: border-box;
}
@media (min-width: 640px) {
  .te-tabs-row .te-nav-desk {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}
.te-nav-link {
  flex-shrink: 0;
  scroll-snap-align: center;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: #475569;
  text-decoration: none;
}
.te-nav-link:hover {
  color: #4f46e5;
  background: #f8fafc;
}
.te-nav-link--active {
  color: #4f46e5;
  background: #eef2ff;
}

.te-main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 2rem 1rem;
}
.te-main--wide {
  max-width: 72rem;
}
@media (min-width: 640px) {
  .te-main { padding-left: 1.5rem; padding-right: 1.5rem; }
}
h1.te-h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
}
@media (min-width: 640px) {
  h1.te-h1 { font-size: 1.875rem; }
}
.te-lead {
  margin: 0.5rem 0 0;
  color: #475569;
  font-size: 0.875rem;
}
.te-back {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
}
.te-back a { color: #4f46e5; }
.te-back a:hover { text-decoration: underline; }

.te-section {
  max-width: 72rem;
  margin: 0 auto;
  padding: 3rem 1rem;
}
@media (min-width: 640px) {
  .te-section { padding-left: 1.5rem; padding-right: 1.5rem; }
}
.te-section--narrow {
  max-width: 48rem;
  margin: 0 auto;
  padding: 2.5rem 1rem;
}
.te-section--hero {
  max-width: 64rem;
  margin: 0 auto;
  padding: 2rem 1rem 1.5rem;
  text-align: center;
}
@media (min-width: 640px) {
  .te-section--hero { padding-left: 1.5rem; padding-right: 1.5rem; }
}
.te-title-xl {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}
@media (min-width: 640px) {
  .te-title-xl { font-size: 1.875rem; }
}
.te-sub-gray {
  margin: 0.5rem auto 0;
  max-width: 42rem;
  color: #475569;
  font-size: 0.875rem;
}
@media (min-width: 640px) {
  .te-sub-gray { font-size: 1rem; }
}
.te-hero-box { max-width: 64rem; margin: 0 auto; padding: 0 1rem 2.5rem; }
.te-hero-box--editor { position: relative; }
.te-editor-stage {
  position: relative;
  margin-top: 1.5rem;
}
@media (min-width: 640px) {
  .te-hero-box { padding-left: 1.5rem; padding-right: 1.5rem; }
}

.te-h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
}
.te-h2-sub {
  text-align: center;
  color: #475569;
  font-size: 0.875rem;
  margin: 0.25rem auto 2rem;
  max-width: 36rem;
}

.te-grid-4 {
  display: grid;
  gap: 1rem;
}
@media (min-width: 640px) {
  .te-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .te-grid-4 { grid-template-columns: repeat(4, 1fr); }
}
.te-card-soft {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 0.75rem;
  padding: 1.25rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  text-align: center;
}
.te-card-soft h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}
.te-card-soft p {
  margin: 0;
  font-size: 0.875rem;
  color: #475569;
}
.te-emoji {
  font-size: 1.5rem;
  margin: 0 auto 0.5rem;
  width: fit-content;
}

.te-section-border { border-top: 1px solid rgba(226, 232, 240, 0.8); }
.te-grid-3 {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}
@media (min-width: 768px) {
  .te-grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.te-card-white {
  border-radius: 0.75rem;
  background: #fff;
  padding: 1.25rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  text-align: center;
}
.te-card-white h3 {
  margin: 0;
  font-weight: 600;
  color: #4338ca;
  font-size: 1rem;
}
.te-card-white p {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: #475569;
}

.te-steps {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}
@media (min-width: 640px) {
  .te-steps { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .te-steps { grid-template-columns: repeat(4, 1fr); }
}
.te-step {
  position: relative;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 3.2rem 1.25rem 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  text-align: center;
}
.te-step-num {
  position: absolute;
  top: 0.65rem;
  left: 50%;
  transform: translateX(-50%);
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: #4f46e5;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.te-step h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}
.te-step p {
  margin: 0;
  font-size: 0.875rem;
  color: #475569;
}

.te-faq {
  margin-top: 1.5rem;
}
.te-faq details {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  padding: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}
.te-faq summary {
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.te-faq summary::-webkit-details-marker { display: none; }
.te-faq details p {
  margin: 0.5rem 0 0;
  color: #475569;
  line-height: 1.55;
}

.te-cta {
  padding: 3rem 1rem;
  text-align: center;
  background: linear-gradient(to right, #7c83ff, #a78bfa);
}
.te-cta h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}
.te-cta p {
  margin: 0.5rem auto 0;
  max-width: 28rem;
  font-size: 0.875rem;
  color: #e0e7ff;
}
.te-cta .te-btn-primary {
  margin-top: 1.5rem;
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1.5rem;
  border-radius: 0.5rem;
  background: #fff;
  color: #4338ca;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.te-cta .te-btn-primary:hover { background: #eef2ff; }

/* Keep CTA directly attached to footer on text editor pages */
.te-body .site-footer {
  margin-top: 0;
}

.te-footer {
  background: #1e293b;
  color: #cbd5e1;
}
.te-footer-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2.5rem 1rem;
}
@media (min-width: 640px) {
  .te-footer-inner { padding-left: 1.5rem; padding-right: 1.5rem; }
}
.te-footer-grid {
  display: grid;
  gap: 2rem;
  font-size: 0.875rem;
}
@media (min-width: 640px) {
  .te-footer-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .te-footer-grid { grid-template-columns: repeat(4, 1fr); }
}
.te-footer-col--wide {
  grid-column: span 2;
}
@media (max-width: 639px) {
  .te-footer-col--wide { grid-column: span 1; }
}
.te-footer h4 {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
}
.te-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.te-footer li { margin-bottom: 0.5rem; }
.te-footer a {
  color: inherit;
  text-decoration: none;
}
.te-footer a:hover { color: #fff; }
.te-footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.te-footer-copy {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
}

.te-footer-mini {
  background: #1e293b;
  color: #cbd5e1;
  margin-top: 3rem;
}
.te-footer-mini .te-wrap {
  padding-top: 2rem;
  padding-bottom: 2rem;
}
.te-footer-mini-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.875rem;
}
.te-footer-mini-row a {
  color: inherit;
  text-decoration: none;
}
.te-footer-mini-row a:hover { color: #fff; }
.te-footer-mini-row .te-push-end { margin-left: auto; }
.te-footer-mini p {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
}

/* Editor card */
.te-editor-shell {
  margin-top: 0;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 10px 40px -10px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}
.te-editor-shell.te-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 999;
  margin: 0;
  border-radius: 0;
  border: 0;
}
.te-editor-shell.te-fullscreen #editor,
.te-editor-shell.te-fullscreen .ck-content,
.te-editor-shell.te-fullscreen .ck.ck-editor__main > .ck-editor__editable {
  min-height: calc(100vh - 170px);
}
.te-editor-loading {
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08);
  padding: 4rem 1rem;
  text-align: center;
  color: #64748b;
}
.te-editor-loading--overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  box-shadow: none;
  border-radius: 0.75rem;
}
body.te-theme-dark .te-editor-loading--overlay {
  background: #0f172a;
  border-color: #334155;
  color: #94a3b8;
}
.te-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.te-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.te-tool-btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 0.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #334155;
  cursor: pointer;
}
@media (min-width: 640px) {
  .te-tool-btn { font-size: 0.875rem; }
}
.te-tool-btn:hover { background: #f1f5f9; }
.te-tool-btn--danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
  margin-left: auto;
}
.te-tool-btn--danger:hover { background: #fee2e2; }
.te-tool-btn--primary {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #3730a3;
}
.te-settings-panel {
  border-top: 1px dashed #cbd5e1;
  background: #f8fafc;
  padding: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  font-size: 0.8125rem;
}
.te-settings-panel label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.te-settings-panel input[type="range"] {
  width: 130px;
}
.te-settings-panel select,
.te-settings-panel input[type="number"] {
  min-width: 68px;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  padding: 0.2rem 0.35rem;
  background: #fff;
}
body.te-theme-dark .te-settings-panel {
  background: #0b1220;
  border-color: #334155;
}
body.te-theme-dark .te-settings-panel select,
body.te-theme-dark .te-settings-panel input[type="number"] {
  background: #111827;
  color: #e2e8f0;
  border-color: #334155;
}
.te-editor-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  font-size: 0.75rem;
  color: #64748b;
}
.te-editor-footer span:last-child { color: #94a3b8; }
.te-editor-meta {
  display: inline-flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.te-textarea {
  width: 100%;
  min-height: 560px;
  padding: 1rem;
  border: 0;
  resize: vertical;
  font-size: 0.875rem;
  line-height: 1.625;
  color: #1e293b;
  font-family: inherit;
  outline: none;
}
.te-textarea:focus { box-shadow: inset 0 0 0 2px rgba(79, 70, 229, 0.15); }
.te-textarea--mono {
  font-family: ui-monospace, Consolas, "Cascadia Code", monospace;
  tab-size: 2;
  background: rgba(248, 250, 252, 0.8);
}
#editor.te-ck-mount {
  border-top: 1px solid #f1f5f9;
}
.ck-content { min-height: 560px; }
.ck.ck-editor__main > .ck-editor__editable { min-height: 560px; }

/* Markdown split layout */
.te-md-grid {
  display: grid;
  min-height: 560px;
  border-top: 1px solid #e2e8f0;
}
.te-md-grid > * { border-bottom: 1px solid #e2e8f0; }
@media (min-width: 768px) {
  .te-md-grid {
    grid-template-columns: 1fr 1fr;
  }
  .te-md-grid > * {
    border-bottom: none;
  }
  .te-md-grid > *:first-child {
    border-right: 1px solid #e2e8f0;
  }
}
.te-md-preview {
  padding: 1rem;
  font-size: 0.875rem;
  line-height: 1.625;
  background: rgba(248, 250, 252, 0.9);
  overflow: auto;
  min-height: 200px;
}
@media (min-width: 768px) {
  .te-md-preview { min-height: 560px; }
}
.te-textarea--md-top {
  min-height: 370px;
}
@media (min-width: 768px) {
  .te-textarea--md-top { min-height: 560px; }
}

.md-preview h1 { font-size: 1.5rem; font-weight: 700; margin: 0.75rem 0 0.5rem; }
.md-preview h2 { font-size: 1.25rem; font-weight: 700; margin: 0.75rem 0 0.5rem; }
.md-preview h3 { font-size: 1.1rem; font-weight: 600; margin: 0.5rem 0; }
.md-preview pre { background: #1e293b; color: #e2e8f0; padding: 1rem; border-radius: 0.5rem; overflow-x: auto; font-size: 0.85rem; }
.md-preview code { background: #e2e8f0; padding: 0.1em 0.35em; border-radius: 0.25rem; font-size: 0.9em; }
.md-preview pre code { background: none; padding: 0; color: inherit; }
.md-preview ul { list-style: disc; padding-left: 1.25rem; }
.md-preview a { color: #4f46e5; text-decoration: underline; }

.te-msg-error { color: #dc2626; margin: 0; }

/* Toast — te-shared.js */
.te-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  font-size: 0.875rem;
  font-weight: 500;
  transition: opacity 0.2s;
  background: #111827;
  color: #fff;
}
.te-toast--error {
  background: #dc2626;
  color: #fff;
}
