.glass-card { backdrop-filter: blur(16px); background: rgba(255,255,255,0.96); border-color: rgba(148,163,184,0.5); }
.dark .glass-card { background: linear-gradient(135deg, rgba(30,41,59,0.82), rgba(30,41,59,0.68)); border-color: rgba(255,255,255,0.1); }
.editor-shadow { box-shadow: 0 20px 70px rgba(15,23,42,0.18); }
.dark .editor-shadow { box-shadow: 0 20px 70px rgba(0,0,0,0.35); }
.preview-area mjx-container { font-size: 1.05rem; }
.latex-page { background: #f8fafc; color: #0f172a; }
.dark .latex-page { background: linear-gradient(135deg, #0b1020, #0f172a, #0b1020); color: #e2e8f0; }
.latex-page {
  --calcbe-kind-app: "App";
  --calcbe-kind-app-bg: rgba(245, 158, 11, 0.16);
  --calcbe-kind-app-border: rgba(245, 158, 11, 0.45);
  --calcbe-kind-app-fg: #0f172a;
}
html:lang(ja) .latex-page { --calcbe-kind-app: "アプリ"; }
html:lang(es) .latex-page { --calcbe-kind-app: "Herramienta"; }
html:lang(zh-cn) .latex-page { --calcbe-kind-app: "工具"; }
html:lang(pt-br) .latex-page { --calcbe-kind-app: "Ferramenta"; }
html:lang(id) .latex-page { --calcbe-kind-app: "Alat"; }
html:lang(fr) .latex-page { --calcbe-kind-app: "Outil"; }
html:lang(hi-in) .latex-page { --calcbe-kind-app: "उपकरण"; }
html:lang(ar) .latex-page { --calcbe-kind-app: "أداة"; }
.dark .latex-page {
  --calcbe-kind-app-bg: rgba(245, 158, 11, 0.24);
  --calcbe-kind-app-border: rgba(245, 158, 11, 0.6);
  --calcbe-kind-app-fg: #e2e8f0;
}
.latex-page header {
  margin: 0 auto 0.75rem;
}
.latex-page header::before,
.latex-page header::after {
  display: none;
}
.latex-page header h1 {
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.latex-page header h1::before {
  content: var(--calcbe-kind-app);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-inline-end: 0.7rem;
  padding: 0 0.72em;
  height: 1.58em;
  border-radius: 10px;
  border: 1px solid var(--calcbe-kind-app-border);
  background: var(--calcbe-kind-app-bg);
  color: var(--calcbe-kind-app-fg);
  font-size: 0.6em;
  font-weight: 800;
  letter-spacing: 0.02em;
  vertical-align: 0.16em;
}
.latex-page header .lead,
.latex-page header p.text-base,
.latex-page header p.text-sm {
  max-width: 62rem;
}
.latex-page header .page-tools-row {
  margin-top: 1rem;
  padding-top: 0.35rem;
}
.latex-page header .page-tools-row .lang-switch summary {
  min-height: 42px;
  padding: 0.55rem 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 999px;
  background: #ffffff;
  color: #0f172a;
}
.dark .latex-page header .page-tools-row .lang-switch summary {
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.78);
  color: #e2e8f0;
}
.latex-page header .page-tools-row .lang-switch[open] {
  padding: 0.35rem 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 1.1rem;
  background: #ffffff;
}
.dark .latex-page header .page-tools-row .lang-switch[open] {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.88);
}
.latex-page header .page-tools-row .lang-switch[open] a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
}
.light .latex-page .bg-slate-900\/80,
.light .latex-page .bg-slate-900\/70,
.light .latex-page .bg-slate-900\/60 { background-color: #e5e7eb !important; }
.light .latex-page .bg-slate-950 { background-color: #f9fafb !important; }
.light .latex-page .border-white\/10 { border-color: rgba(148,163,184,0.6) !important; }
.light .latex-page textarea { background: #f9fafb; color: #0f172a; }
.light .latex-page .text-white,
.light .latex-page .text-slate-100,
.light .latex-page .text-slate-200,
.light .latex-page .text-slate-300 { color: #0f172a !important; }
.latex-page .bg-indigo-500,
.latex-page .bg-indigo-500:hover,
.latex-page .bg-indigo-500 *,
.latex-page .bg-indigo-500:hover * { color: #ffffff !important; }
.light .latex-page .bg-indigo-500,
.light .latex-page .bg-indigo-500:hover,
.light .latex-page .bg-indigo-500 span { color: #ffffff !important; }
.light .latex-page .text-slate-400 { color: #334155 !important; }
.light .latex-page .text-indigo-200 { color: #3730a3 !important; }
.light .latex-page .text-indigo-300 { color: #3730a3 !important; }
.light .latex-page .lead { color: #334155 !important; }
.light .latex-page .bg-slate-800,
.light .latex-page .bg-slate-900 { background-color: #e5e7eb !important; color: #0f172a !important; }
.light .latex-page .bg-slate-900\/80 button,
.light .latex-page .bg-slate-900\/70 button { color: inherit; }
.no-scrollbar { scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.preview-card.is-sticky,
.preview-card {
  position: static;
  top: auto;
  z-index: auto;
}
.page-tools-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.page-tools-row .lang-switch {
  margin: 0;
}
.latex-page header nav a {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding-inline: 0.2rem;
}
.primary-actions,
.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.primary-actions > *,
.preview-actions > * {
  flex-shrink: 0;
}
#theme-toggle-host {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}
.latex-page ol.mt-3.grid.gap-2.sm\:grid-cols-3 {
  list-style-position: inside;
  padding-left: 0;
  padding-inline-start: 1rem;
}
.latex-page ol.mt-3.grid.gap-2.sm\:grid-cols-3 > li {
  padding-inline-start: 0.2rem;
}
.latex-page .theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  min-width: 42px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #ffffff;
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
.latex-page .theme-toggle-label {
  white-space: nowrap;
  font-size: 0.75rem;
}
.latex-page .theme-toggle[data-theme-mode="auto"] {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(148, 163, 184, 0.4);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
.dark .latex-page .theme-toggle {
  background: rgba(15, 23, 42, 0.78);
  color: #f8fafc;
  border-color: rgba(148, 163, 184, 0.3);
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.latex-page .theme-toggle:hover {
  transform: translateY(-1px);
}
.latex-page .feedback-host {
  position: relative;
  overflow: visible;
}
.latex-page .feedback-host::after {
  content: attr(data-feedback);
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 50%;
  transform: translate(-50%, -3px);
  min-width: max-content;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: #065f46;
  color: #ffffff;
  font-size: 0.75rem;
  line-height: 1.2;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 20;
}
.latex-page .feedback-host.is-feedback-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
.latex-page .feedback-host[data-feedback-tone="error"]::after {
  background: #b45309;
}
.latex-input-area {
  min-height: 7.5rem;
  height: auto;
  line-height: 1.55;
  resize: vertical;
}
#latex-help {
  margin-top: 0.35rem;
  line-height: 1.5;
}
#live-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 6.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
#live-status[data-status="ready"],
#live-status[data-status="rendered"] {
  background: rgba(5, 150, 105, 0.22) !important;
  color: #ecfdf5 !important;
  border-color: rgba(52, 211, 153, 0.55) !important;
}
#live-status[data-status="rendering"],
#live-status[data-status="loading"] {
  background: rgba(37, 99, 235, 0.24) !important;
  color: #eff6ff !important;
  border-color: rgba(96, 165, 250, 0.56) !important;
}
#live-status[data-status="error"] {
  background: rgba(180, 83, 9, 0.28) !important;
  color: #fffbeb !important;
  border-color: rgba(251, 191, 36, 0.58) !important;
}
.light #live-status[data-status="ready"],
.light #live-status[data-status="rendered"] {
  background: #065f46 !important;
  color: #ffffff !important;
  border-color: #047857 !important;
}
.light #live-status[data-status="rendering"],
.light #live-status[data-status="loading"] {
  background: #1d4ed8 !important;
  color: #ffffff !important;
  border-color: #1e40af !important;
}
.light #live-status[data-status="error"] {
  background: #b45309 !important;
  color: #ffffff !important;
  border-color: #92400e !important;
}
@media (min-width: 1024px) {
  .latex-page .grid.lg\:grid-cols-2 {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
@media (max-width: 640px) {
  .page-tools-row {
    align-items: stretch;
  }
  .primary-actions,
  .preview-actions {
    gap: 0.4rem;
  }
  #theme-toggle-host {
    width: 100%;
    justify-content: flex-end;
  }
}
.export-settings-panel {
  display: block;
}
.export-default-note {
  line-height: 1.45;
}
.export-note.is-active {
  color: #f8fafc !important;
  background: rgba(37, 99, 235, 0.16);
  border: 1px solid rgba(96, 165, 250, 0.38);
  border-radius: 0.85rem;
  padding: 0.5rem 0.65rem;
}
.light .export-note.is-active {
  color: #1e3a8a !important;
  background: rgba(191, 219, 254, 0.8);
  border-color: rgba(96, 165, 250, 0.58);
}
.light .export-settings-panel {
  background: rgba(255,255,255,0.78) !important;
}
.latex-page footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
}
.latex-page footer .footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding-block: 0.25rem;
}
html[dir="rtl"] .latex-page .primary-actions,
html[dir="rtl"] .latex-page .preview-actions {
  justify-content: flex-start;
}
html[dir="rtl"] .latex-page [data-header-bar="1"] {
  row-gap: 0.45rem;
}
