.converter-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  --converter-pane-height: clamp(320px, 45vh, 520px);
  width: 100%;
  min-width: 0;
}

@media (max-width: 960px) {
  .converter-shell {
    grid-template-columns: 1fr;
  }
}

.converter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  max-width: 100%;
  min-width: 0;
}

.converter-panel h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.converter-panel p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.converter-input {
  width: 100%;
  height: var(--converter-pane-height);
  min-height: 320px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  font-family: var(--font-mono);
  background: #fff;
  color: var(--ink);
  resize: vertical;
}

.converter-input:focus {
  outline: none;
  border-color: rgba(231, 111, 81, 0.6);
  box-shadow: 0 0 0 3px rgba(231, 111, 81, 0.12);
}

.converter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin: 14px 0 0;
}

.converter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.converter-toggle input {
  width: 16px;
  height: 16px;
}

.converter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  align-items: center;
}

.output-preview {
  width: 100%;
  height: var(--converter-pane-height);
  min-height: 320px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font-family: Calibri, "Times New Roman", serif;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  overflow: auto;
}

.output-preview:focus {
  border-color: rgba(231, 111, 81, 0.6);
  box-shadow: 0 0 0 3px rgba(231, 111, 81, 0.12);
}

.converter-status {
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
  margin-top: 10px;
}

.converter-status.ok {
  color: rgba(22, 163, 74, 0.95);
}

.converter-status.err {
  color: rgba(239, 68, 68, 0.95);
}

.converter-help {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(231, 111, 81, 0.35);
  background: rgba(231, 111, 81, 0.10);
  color: #7a2c1f;
  font-size: 13px;
  line-height: 1.55;
}

.converter-help a {
  color: inherit;
  text-decoration: underline;
}

.converter-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}

.share-block {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.share-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-3);
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.7);
  color: var(--accent-3);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.share-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.share-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(231, 111, 81, 0.4);
  color: var(--accent);
}

.share-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(231, 111, 81, 0.12);
  border-color: rgba(231, 111, 81, 0.6);
}

.share-status {
  min-height: 16px;
  font-size: 12px;
  color: var(--muted);
}

.share-status.ok {
  color: rgba(22, 163, 74, 0.95);
}

.share-status.err {
  color: rgba(239, 68, 68, 0.95);
}

.converter-content {
  display: grid;
  gap: 18px;
  width: 100%;
  min-width: 0;
}

.converter-content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  min-width: 0;
}

@media (max-width: 960px) {
  .converter-content-grid {
    grid-template-columns: 1fr;
  }
}

.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow-wrap: anywhere;
}

.content-card-wide {
  grid-column: 1 / -1;
}

.content-card h3 {
  margin: 0 0 10px;
  font-size: 20px;
}

.content-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.content-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.content-card pre {
  margin: 0;
  padding: 14px 16px;
  background: rgba(38, 70, 83, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(38, 70, 83, 0.18);
  overflow: auto;
  font-size: 13px;
  max-width: 100%;
}

.content-card code {
  font-family: var(--font-mono);
  font-size: 0.95em;
  word-break: break-word;
}

.faq-list {
  display: grid;
  gap: 10px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.6);
}

.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
}

.faq-item p {
  margin: 10px 0 0;
  color: var(--muted);
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 720px) {
  .link-grid {
    grid-template-columns: 1fr;
  }
}

.link-card {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.6);
  color: var(--accent-3);
  font-weight: 600;
}

.link-card:hover {
  color: var(--accent);
  border-color: rgba(231, 111, 81, 0.4);
}

.math-token {
  cursor: pointer;
  display: inline-block;
  padding: 0 2px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.math-token:hover {
  background: rgba(231, 111, 81, 0.2);
}

.math-token[contenteditable="false"] {
  user-select: all;
}

.math-token.bold {
  font-weight: 700;
}

.math-fail {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.12);
  color: rgba(239, 68, 68, 0.95);
  font-family: var(--font-mono);
  font-size: 12px;
}

html.processing-lock,
html.processing-lock body {
  overflow: hidden;
}

.processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(38, 70, 83, 0.22);
  backdrop-filter: blur(4px);
}

.processing-overlay[hidden] {
  display: none;
}

.processing-card {
  width: min(520px, 100%);
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  outline: none;
}

.processing-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.processing-spinner {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 3px solid rgba(231, 111, 81, 0.25);
  border-top-color: rgba(231, 111, 81, 0.95);
  animation: processing-spin 0.85s linear infinite;
  flex: 0 0 auto;
}

.processing-title {
  font-weight: 700;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
}

.processing-desc {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

@keyframes processing-spin {
  to {
    transform: rotate(360deg);
  }
}

.notice-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(38, 70, 83, 0.28);
  backdrop-filter: blur(4px);
}

.notice-overlay[hidden] {
  display: none;
}

.notice-card {
  width: min(640px, 100%);
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  outline: none;
}

.notice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.notice-title {
  font-weight: 800;
  color: var(--ink);
  font-size: 15px;
}

.notice-close {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  color: var(--accent-3);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.notice-close:hover {
  border-color: rgba(231, 111, 81, 0.4);
  color: var(--accent);
}

.notice-body {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.notice-body p {
  margin: 10px 0;
}

.notice-note {
  color: var(--muted);
  font-size: 12px;
  margin-top: 12px;
}
