:root {
  --ed-bg: #061426;
  --ed-bg-mid: transparent;
  --ed-surface: transparent;
  --ed-surface-2: #061426;
  --ed-border: rgba(255, 255, 255, 0.22);
  --ed-text: #ffffff;
  --ed-muted: rgba(255, 255, 255, 0.72);
  --ed-accent: #ffffff;
  --ed-accent-bright: #ffffff;
  --ed-accent-2: #e8eef7;
  --ed-accent-soft: rgba(255, 255, 255, 0.1);
  --ed-accent-glow: rgba(255, 255, 255, 0.18);
  --ed-violet-glow: rgba(255, 255, 255, 0.1);
  --ed-radius: 12px;
  --ed-font: "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.editor-page {
  margin: 0;
  min-height: 100vh;
  font-family: var(--ed-font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ed-text);
  background: var(--ed-bg);
  position: relative;
}

body.editor-page::before {
  content: none;
}

.ed-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 64px;
  background: var(--ed-bg);
  backdrop-filter: none;
  border-bottom: 1px solid var(--ed-border);
}

.ed-header-inner {
  width: min(1280px, 100% - 32px);
  margin: 0 auto;
  min-height: 64px;
  padding: 0.35rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.25rem;
  flex-wrap: nowrap;
}

.ed-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ed-text);
  text-decoration: none;
  flex-shrink: 0;
}

.ed-brand:hover {
  text-decoration: none;
}

.ed-logo-mark {
  width: 10px;
  height: 28px;
  border-radius: 3px;
  background: var(--ed-accent);
  box-shadow: none;
}

.ed-brand-text {
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ed-text);
}

.ed-nav-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.ed-nav {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 0.2rem 0.35rem;
  flex-wrap: wrap;
  max-width: min(820px, 100%);
  margin-inline: auto;
}

.ed-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ed-text);
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: none;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.ed-nav-ico {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.85;
}

.ed-nav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.42);
  text-decoration: none;
  box-shadow: none;
}

.ed-nav a.is-active {
  color: #061426;
  background: #ffffff;
  border-color: #ffffff;
  text-decoration: none;
  box-shadow: none;
}

.ed-login {
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: var(--ed-text);
  text-decoration: none;
  flex-shrink: 0;
  transition: border-color 0.2s, background 0.2s;
}

.ed-login:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.42);
  text-decoration: none;
}

.ed-login:focus-visible,
.ed-nav a:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.75);
  outline-offset: 2px;
}

.ed-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
}

.ed-panel {
  background: var(--ed-surface);
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius);
  padding: 1.1rem 1.25rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.ed-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.ed-row:last-of-type {
  margin-bottom: 0;
}

.ed-label {
  flex: 0 0 auto;
  width: 3.25rem;
  padding-top: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ed-muted);
}

.ed-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
}

.ed-tags--type .ed-tag {
  border-radius: 999px;
  font-size: 0.76rem;
  padding: 0.38rem 0.75rem;
  line-height: 1.4;
  white-space: normal;
  text-align: center;
}

.ed-tag {
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.82rem;
  border: 1px solid var(--ed-border);
  background: var(--ed-bg-mid);
  color: var(--ed-muted);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.ed-tag:hover {
  border-color: #ffffff;
  background: var(--ed-accent-soft);
  color: var(--ed-text);
}

.ed-tag.is-on {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.12);
  color: var(--ed-accent-bright);
  font-weight: 600;
}

.ed-mode-row {
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--ed-border);
}

.ed-modes {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ed-mode {
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  border: 1px solid var(--ed-border);
  background: var(--ed-bg-mid);
  cursor: pointer;
  font-family: inherit;
  color: var(--ed-muted);
}

.ed-mode.is-on {
  border-color: rgba(59, 130, 246, 0.5);
  background: var(--ed-accent-soft);
  color: var(--ed-accent-bright);
  font-weight: 600;
}

.ed-pro {
  margin-left: 0.35rem;
  padding: 0.1rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: #f0d060;
  background: #fbbf24;
  border: 1px solid rgba(240, 200, 80, 0.35);
  border-radius: 4px;
  vertical-align: middle;
}

.ed-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ed-reset {
  background: none;
  border: none;
  color: var(--ed-muted);
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ed-reset:hover {
  color: var(--ed-accent-bright);
}

.ed-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.35rem;
  border: 1px solid #ffffff;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--ed-bg);
  background: #ffffff;
  cursor: pointer;
  box-shadow: none;
}

.ed-primary:hover {
  background: var(--ed-accent-2);
  border-color: rgba(59, 130, 246, 0.45);
  filter: none;
  box-shadow: none;
}

.ed-primary:active {
  transform: scale(0.98);
}

.ed-primary-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0.85rem;
}

.ed-primary--stop {
  background: #ef4444;
  border-color: #ef4444;
}

.ed-primary--stop:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.ed-primary--stop .ed-primary-ico {
  font-size: 0.72rem;
}

.ed-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  min-height: 420px;
}

@media (max-width: 900px) {
  .ed-split {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .ed-mode-row {
    flex-direction: column;
    align-items: stretch;
  }

  .ed-actions {
    justify-content: flex-end;
  }
}

.ed-box {
  display: flex;
  flex-direction: column;
  background: var(--ed-surface);
  border: 1px solid var(--ed-border);
  border-radius: var(--ed-radius);
  overflow: hidden;
  min-height: 360px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.ed-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  background: var(--ed-surface);
  border-bottom: 1px solid var(--ed-border);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ed-muted);
}

.ed-box-tools {
  display: flex;
  gap: 0.5rem;
}

.ed-icon-btn {
  padding: 0.25rem 0.45rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--ed-muted);
  font-family: inherit;
}

.ed-icon-btn:hover {
  background: var(--ed-accent-soft);
  color: var(--ed-accent-bright);
}

.ed-box-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.ed-box-body--out {
  min-height: 280px;
}

.ed-textarea {
  flex: 1;
  width: 100%;
  min-height: 280px;
  padding: 1rem;
  padding-bottom: 0.5rem;
  border: none;
  resize: vertical;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ed-text);
  background: var(--ed-bg-mid);
}

.ed-textarea::placeholder {
  color: rgba(255, 255, 255, 0.62);
}

.ed-textarea:focus {
  outline: none;
}

.ed-output {
  flex: 1;
  min-height: 0;
  padding: 1rem;
  overflow: auto;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ed-muted);
  background: transparent;
}

.ed-output:not(.ed-output--loading) {
  color: var(--ed-text);
}

.ed-output--loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ed-muted);
}

.ed-output--streaming {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  color: var(--ed-text);
  min-height: 280px;
}

.ed-stream-body {
  flex: 1;
  min-height: 0;
  padding: 1rem;
  overflow: auto;
}

.ed-output--veiled .ed-result-para {
  opacity: 0.62;
  filter: blur(1px);
  transition: opacity 0.5s ease, filter 0.5s ease;
}

.ed-output--revealed .ed-result-para {
  opacity: 1;
  filter: none;
}

.ed-result-para {
  margin: 0 0 1rem;
  line-height: 1.75;
  text-align: justify;
}

.ed-result-para:last-child {
  margin-bottom: 0;
}

.ed-changed {
  font-weight: 800;
  color: #8fd3ff;
}

.ed-veil-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: opacity 0.55s ease, visibility 0.55s ease;
  pointer-events: none;
}

.ed-output--revealed .ed-veil-overlay {
  opacity: 0;
  visibility: hidden;
}

.ed-veil-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.ed-veil-inner .ed-loading-text {
  margin: 0;
}

.ed-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 280px;
  width: 100%;
}

.ed-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(59, 130, 246, 0.18);
  border-top-color: var(--ed-accent);
  border-radius: 50%;
  animation: ed-spin 0.85s linear infinite;
}

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

.ed-loading-text {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.62);
  letter-spacing: 0.04em;
}

.ed-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.ed-box-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.4rem 0.75rem 0.5rem;
  border-top: 1px solid var(--ed-border);
  background: var(--ed-bg);
  flex-shrink: 0;
}

.ed-count-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ed-muted);
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.08);
}

.ed-banner {
  margin-top: 1rem;
  padding: 0.65rem 1rem;
  font-size: 0.82rem;
  color: var(--ed-muted);
  background: rgba(59, 130, 246, 0.06);
  border: 1px dashed rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  text-align: center;
}

.ed-banner strong {
  color: var(--ed-accent-bright);
}

.ed-float {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
}

.ed-float-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.65rem 0.45rem 0.65rem 0.7rem;
  background: #061426;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-right: none;
  border-radius: 14px 0 0 14px;
  box-shadow: none;
}

.ed-float-btn {
  min-width: 3.1rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ffffff;
  cursor: pointer;
  font-family: inherit;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ed-float-btn:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: #061426;
  box-shadow: none;
}

.ed-float-btn:active {
  transform: scale(0.98);
}

#toast[hidden] {
  display: none !important;
}

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.65rem 1.1rem;
  background: var(--ed-surface-2);
  color: var(--ed-text);
  border: 1px solid var(--ed-border);
  border-radius: 8px;
  font-size: 0.88rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  z-index: 200;
  max-width: 90%;
  text-align: center;
}

.ed-logo-img {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.ed-auth-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.ed-register {
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: #ffffff;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.ed-register:hover {
  color: #061426;
  background: #ffffff;
  border-color: #ffffff;
  text-decoration: none;
}
.ed-mode-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ed-model-select {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.ed-model-label {
  width: auto;
  padding-top: 0;
  white-space: nowrap;
}

.ed-custom-select {
  position: relative;
  width: 460px;
  max-width: 100%;
}

.ed-custom-select-btn {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: #061426;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

.ed-custom-select-btn:hover,
.ed-custom-select-btn:focus {
  border-color: #ffffff;
  outline: none;
}

.ed-select-arrow {
  flex-shrink: 0;
  opacity: 0.85;
}

.ed-custom-select-menu {
  display: none;
  position: absolute;
  top: 50px;
  left: 0;
  width: 560px;
  max-height: 360px;
  overflow-y: auto;
  background: #ffffff;
  color: #061426;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  padding: 8px 0;
}

.ed-custom-select.is-open .ed-custom-select-menu {
  display: block;
}

.ed-select-tip {
  padding: 10px 18px;
  color: #ff7a00;
  font-size: 0.86rem;
  font-weight: 700;
}

.ed-custom-select-menu button {
  width: 100%;
  border: none;
  background: transparent;
  padding: 11px 18px;
  text-align: left;
  font-family: inherit;
  font-size: 0.9rem;
  color: #061426;
  cursor: pointer;
}

.ed-custom-select-menu button:hover,
.ed-custom-select-menu button.is-active {
  background: #f1f5f9;
  color: #2563eb;
  font-weight: 700;
}

@media (max-width: 720px) {
  .ed-model-select {
    flex-direction: column;
    align-items: flex-start;
  }

  .ed-custom-select,
  .ed-custom-select-menu {
    width: 100%;
  }
}