/* Card editor — Variant C: focus on the word and translation */
#editorModal .editor-panel {
  width: min(620px, 94vw);
  max-height: min(92vh, 820px);
  overflow: hidden;
}

#editorModal .editor-head {
  align-items: flex-start;
  padding: 18px 22px 16px;
}

#editorModal .editor-head-copy {
  min-width: 0;
}

#editorModal .editor-head h2 {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 650;
  line-height: 1.25;
}

#editorModal #editorDeckName {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--ink-subtle);
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#editorModal .editor-body {
  gap: 12px;
  padding: 18px 22px 20px;
}

#editorModal .editor-word-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: var(--bg-elev);
}

#editorModal .editor-word-card:focus-within {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--border-strong));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

#editorModal .editor-word-card label,
#editorModal .editor-word-card .label-row label {
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

#editorModal .editor-word-card textarea {
  width: 100%;
  min-height: 64px;
  padding: 0;
  overflow: hidden;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--accent);
  -webkit-text-fill-color: var(--accent);
  caret-color: var(--accent);
  font: inherit;
  font-size: 19px;
  font-weight: 520;
  line-height: 1.42;
  text-decoration-line: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  resize: none;
}

#editorModal .editor-translation textarea {
  font-size: 17px;
  font-weight: 450;
}

#editorModal .editor-cloze textarea {
  min-height: 88px;
}

#editorModal .editor-word-card textarea:focus {
  border-color: transparent;
  box-shadow: none;
}

#editorModal .ai-gen-btn {
  justify-self: start;
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
}

#editorModal .ai-gen-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#editorModal .editor-details {
  display: grid;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

#editorModal .editor-secondary-card {
  padding: 14px;
}

#editorModal .editor-secondary-card textarea {
  min-height: 64px;
  font-size: 17px;
  font-weight: 450;
}

#editorModal .editor-details .form-row {
  gap: 6px;
}

#editorModal .editor-details label {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

#editorModal .editor-details input,
#editorModal .editor-details select,
#editorModal .editor-details textarea {
  min-height: 42px;
  padding: 9px 11px;
  font-size: 15px;
  line-height: 1.4;
}

#editorModal .editor-details textarea {
  min-height: 74px;
}

#editorModal .editor-selects {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

#editorModal .editor-selects select {
  width: 100% !important;
  min-width: 0;
  max-width: 100%;
}

#editorModal .editor-actions {
  padding: 12px 22px calc(12px + env(safe-area-inset-bottom));
}

#editorModal .editor-actions .btn {
  min-height: 42px;
  padding: 9px 14px;
  font-size: 14px;
}

@media (max-width: 640px) {
  #editorModal {
    place-items: end center;
  }

  #editorModal .editor-panel {
    width: 100%;
    max-height: calc(var(--app-vh, 1vh) * 96);
    border-radius: 18px 18px 0 0;
  }

  #editorModal .editor-head {
    padding: 13px 16px 12px;
  }

  #editorModal .editor-head h2 {
    font-size: 19px;
  }

  #editorModal #editorDeckName {
    font-size: 13px;
  }

  #editorModal .editor-body {
    gap: 10px;
    padding: 12px 14px 14px;
  }

  #editorModal .editor-word-card {
    gap: 7px;
    padding: 12px;
    border-radius: 12px;
  }

  #editorModal .editor-word-card textarea {
    min-height: 58px;
    max-height: none;
    font-size: 18px;
    line-height: 1.4;
  }

  #editorModal .editor-translation textarea {
    font-size: 17px;
  }

  #editorModal .editor-details {
    gap: 10px;
    padding: 0;
  }

  #editorModal .editor-details input,
  #editorModal .editor-details select,
  #editorModal .editor-details textarea {
    font-size: 16px;
  }

  #editorModal .editor-details textarea {
    min-height: 58px;
  }

  #editorModal .ai-gen-btn {
    justify-self: stretch;
    width: 100%;
    min-height: 44px;
    padding: 9px 13px;
    text-align: center;
  }
  
  #editorModal .ai-gen-btn span {
    flex: 1;
    text-align: center;
  }

  #editorModal .editor-selects {
    gap: 10px;
  }

  #editorModal .editor-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 8px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }

  #editorModal .editor-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 10px;
    white-space: normal;
  }

  #editorModal .editor-actions [data-close] {
    display: none;
  }

  #editorModal #saveCardBtn {
    grid-column: 1;
    grid-row: 1;
  }

  #editorModal #saveAddAnotherBtn {
    grid-column: 2;
    grid-row: 1;
    font-size: 13.5px;
  }
}

@media (max-width: 370px) {
  #editorModal .editor-selects {
    grid-template-columns: 1fr;
  }

  #editorModal .editor-actions {
    grid-template-columns: 1fr;
  }

  #editorModal #saveCardBtn,
  #editorModal #saveAddAnotherBtn {
    grid-column: 1;
    grid-row: auto;
  }

  #editorModal #saveCardBtn {
    grid-row: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  #editorModal .editor-word-card {
    transition: none;
  }
}
#editorModal .editor-ai-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  justify-content: flex-start;
}

#editorModal .editor-info-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  min-width: 44px;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--accent);
  background: var(--accent-soft);
}

#editorModal .editor-info-btn svg { width: 18px; height: 18px; display: block; }

/* Info not generated yet: dimmed but still tappable. */
#editorModal .editor-info-btn.no-info {
  color: var(--ink-faint);
  background: transparent;
  opacity: .55;
  box-shadow: inset 0 0 0 1px var(--border);
}
